Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
SkTextBlobTrace::Capture Class Reference

#include <SkTextBlobTrace.h>

Public Member Functions

 Capture ()
 
 ~Capture ()
 
void capture (const sktext::GlyphRunList &, const SkPaint &)
 
void dump (SkWStream *dst=nullptr) const
 

Detailed Description

Definition at line 39 of file SkTextBlobTrace.h.

Constructor & Destructor Documentation

◆ Capture()

SkTextBlobTrace::Capture::Capture ( )

Definition at line 93 of file SkTextBlobTrace.cpp.

93 : fTypefaceSet(new SkRefCntSet), fWriteBuffer({}) {
94 fWriteBuffer.setTypefaceRecorder(fTypefaceSet);
95}
void setTypefaceRecorder(sk_sp< SkRefCntSet >)

◆ ~Capture()

SkTextBlobTrace::Capture::~Capture ( )
default

Member Function Documentation

◆ capture()

void SkTextBlobTrace::Capture::capture ( const sktext::GlyphRunList glyphRunList,
const SkPaint paint 
)

Definition at line 99 of file SkTextBlobTrace.cpp.

100 {
101 const SkTextBlob* blob = glyphRunList.blob();
102 if (blob != nullptr) {
103 fWriteBuffer.writeUInt(blob->uniqueID());
104 fWriteBuffer.writePaint(paint);
105 fWriteBuffer.writePoint(glyphRunList.origin());
106 SkTextBlobPriv::Flatten(*blob, fWriteBuffer);
107 fBlobCount++;
108 }
109}
void writePoint(const SkPoint &point) override
void writePaint(const SkPaint &paint) override
void writeUInt(uint32_t value) override
static void Flatten(const SkTextBlob &, SkWriteBuffer &)
Definition: SkTextBlob.cpp:663
uint32_t uniqueID() const
Definition: SkTextBlob.h:59
const SkTextBlob * blob() const
Definition: GlyphRun.h:117
SkPoint origin() const
Definition: GlyphRun.h:114
const Paint & paint
Definition: color_source.cc:38

◆ dump()

void SkTextBlobTrace::Capture::dump ( SkWStream dst = nullptr) const

Definition at line 111 of file SkTextBlobTrace.cpp.

111 {
112 SkTLazy<SkFILEWStream> fileStream;
113 if (!dst) {
114 uint32_t id = SkChecksum::Mix(reinterpret_cast<uintptr_t>(this));
115 SkString f = SkStringPrintf("diff-canvas-%08x-%04zu.trace", id, fBlobCount);
116 dst = fileStream.init(f.c_str());
117 if (!fileStream->isValid()) {
118 SkDebugf("Error opening '%s'.\n", f.c_str());
119 return;
120 }
121 SkDebugf("Saving trace to '%s'.\n", f.c_str());
122 }
123 SkASSERT(dst);
124 int count = fTypefaceSet->count();
125 dst->write32(count);
126 SkPtrSet::Iter iter(*fTypefaceSet);
127 while (void* ptr = iter.next()) {
129 }
130 dst->write32(fWriteBuffer.bytesWritten());
131 fWriteBuffer.writeToStream(dst);
132}
int count
Definition: FontMgrTest.cpp:50
#define SkASSERT(cond)
Definition: SkAssert.h:116
void SK_SPI SkDebugf(const char format[],...) SK_PRINTF_LIKE(1
SK_API SkString SkStringPrintf(const char *format,...) SK_PRINTF_LIKE(1
Creates a new string and writes into it using a printf()-style format.
size_t bytesWritten() const
bool writeToStream(SkWStream *) const
int count() const
Definition: SkPtrRecorder.h:45
T * init(Args &&... args)
Definition: SkTLazy.h:45
bool isValid() const
Definition: SkTLazy.h:77
static uint32_t Mix(uint32_t hash)
Definition: SkChecksum.h:30
dst
Definition: cp.py:12

The documentation for this class was generated from the following files: