Flutter Engine
The Flutter Engine
Classes | Functions
SkTextBlobTrace Namespace Reference

Classes

class  Capture
 
struct  Record
 

Functions

std::vector< SkTextBlobTrace::RecordCreateBlobTrace (SkStream *stream, sk_sp< SkFontMgr > lastResortMgr)
 
void DumpTrace (const std::vector< SkTextBlobTrace::Record > &)
 

Function Documentation

◆ CreateBlobTrace()

std::vector< SkTextBlobTrace::Record > SkTextBlobTrace::CreateBlobTrace ( SkStream stream,
sk_sp< SkFontMgr lastResortMgr 
)

Definition at line 25 of file SkTextBlobTrace.cpp.

26 {
27 std::vector<SkTextBlobTrace::Record> trace;
28
29 uint32_t typefaceCount;
30 if (!stream->readU32(&typefaceCount)) {
31 return trace;
32 }
33
34 std::vector<sk_sp<SkTypeface>> typefaceArray;
35 for (uint32_t i = 0; i < typefaceCount; i++) {
36 typefaceArray.push_back(SkTypeface::MakeDeserialize(stream, lastResortMgr));
37 }
38
39 uint32_t restOfFile;
40 if (!stream->readU32(&restOfFile)) {
41 return trace;
42 }
44 SkReadBuffer readBuffer{data->data(), data->size()};
45 readBuffer.setTypefaceArray(typefaceArray.data(), typefaceArray.size());
46
47 while (!readBuffer.eof()) {
49 record.origUniqueID = readBuffer.readUInt();
50 record.paint = readBuffer.readPaint();
51 readBuffer.readPoint(&record.offset);
52 record.blob = SkTextBlobPriv::MakeFromBuffer(readBuffer);
53 trace.push_back(std::move(record));
54 }
55 return trace;
56}
static sk_sp< SkData > MakeFromStream(SkStream *, size_t size)
Definition: SkData.cpp:208
static sk_sp< SkTextBlob > MakeFromBuffer(SkReadBuffer &)
Definition: SkTextBlob.cpp:705
static sk_sp< SkTypeface > MakeDeserialize(SkStream *, sk_sp< SkFontMgr > lastResortMgr)
Definition: SkTypeface.cpp:241
sk_sp< SkTextBlob > blob
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

◆ DumpTrace()

void SkTextBlobTrace::DumpTrace ( const std::vector< SkTextBlobTrace::Record > &  trace)

Definition at line 58 of file SkTextBlobTrace.cpp.

58 {
59 for (const SkTextBlobTrace::Record& record : trace) {
60 const SkTextBlob* blob = record.blob.get();
61 const SkPaint& p = record.paint;
62 bool weirdPaint = p.getStyle() != SkPaint::kFill_Style
63 || p.getMaskFilter() != nullptr
64 || p.getPathEffect() != nullptr;
65
66 SkDebugf("Blob %u ( %g %g ) %d\n ",
67 blob->uniqueID(), record.offset.x(), record.offset.y(), weirdPaint);
68 SkTextBlobRunIterator iter(blob);
69 int runNumber = 0;
70 while (!iter.done()) {
71 SkDebugf("Run %d\n ", runNumber);
72 SkFont font = iter.font();
73 SkDebugf("Font %u %g %g %g %d %d %d\n ",
74 font.getTypeface()->uniqueID(),
75 font.getSize(),
76 font.getScaleX(),
77 font.getSkewX(),
79 (int)font.getEdging(),
80 (int)font.getHinting());
81 uint32_t glyphCount = iter.glyphCount();
82 const uint16_t* glyphs = iter.glyphs();
83 for (uint32_t i = 0; i < glyphCount; i++) {
84 SkDebugf("%02X ", glyphs[i]);
85 }
86 SkDebugf("\n");
87 runNumber += 1;
88 iter.next();
89 }
90 }
91}
uint16_t glyphs[5]
Definition: FontMgrTest.cpp:46
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
static uint8_t Flags(const SkFont &font)
Definition: SkFontPriv.h:90
Definition: SkFont.h:35
@ kFill_Style
set to fill geometry
Definition: SkPaint.h:193
uint32_t uniqueID() const
Definition: SkTextBlob.h:59
font
Font Metadata and Metrics.