Debian Codegraph @

tools/text/SkTextBlobTrace.h

raw
1 // Copyright 2019 Google LLC.
2 // Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
3 #ifndef SkTextBlobTrace_DEFINED
4 #define SkTextBlobTrace_DEFINED
5
6 #include "include/core/SkPaint.h"
7 #include "include/core/SkPoint.h"
8 #include "include/core/SkRefCnt.h"
9 #include "include/core/SkTextBlob.h"
10 #include "include/core/SkTypes.h"
11 #include "src/core/SkWriteBuffer.h"
12
13 #include <cstddef>
14 #include <cstdint>
15 #include <vector>
16
17 class SkFontMgr;
18 class SkRefCntSet;
19 class SkStream;
20 class SkWStream;
21 namespace sktext {
22 class GlyphRunList;
23 }
24
25 namespace SkTextBlobTrace {
26
27 struct Record {
28 uint32_t origUniqueID;
29 SkPaint paint;
30 SkPoint offset;
31 sk_sp<SkTextBlob> blob;
32 };
33
34 std::vector<SkTextBlobTrace::Record> CreateBlobTrace(SkStream* stream,
35 sk_sp<SkFontMgr> lastResortMgr);
36
37 void DumpTrace(const std::vector<SkTextBlobTrace::Record>&);
38
39 class Capture {
40 public:
41 Capture();
42 ~Capture();
43 void capture(const sktext::GlyphRunList&, const SkPaint&);
44 // If `dst` is nullptr, write to a file.
45 void dump(SkWStream* dst = nullptr) const;
46
47 private:
48 size_t fBlobCount = 0;
49 sk_sp<SkRefCntSet> fTypefaceSet;
50 SkBinaryWriteBuffer fWriteBuffer;
51
52 Capture(const Capture&) = delete;
53 Capture& operator=(const Capture&) = delete;
54 };
55
56 } // namespace SkTextBlobTrace
57 #endif // SkTextBlobTrace_DEFINED