8#ifndef SkTextBlobPriv_DEFINED
9#define SkTextBlobPriv_DEFINED
64SkDEBUGCODE(
static const unsigned kRunRecordMagic = 0xb10bcafe;)
66class SkTextBlob::RunRecord {
73 SkASSERT(
static_cast<unsigned>(
pos) <= Flags::kPositioning_Mask);
78 *this->textSizePtr() = textSize;
82 uint32_t glyphCount()
const {
94 GlyphPositioning positioning()
const {
95 return static_cast<GlyphPositioning
>(
fFlags & kPositioning_Mask);
98 uint16_t* glyphBuffer()
const {
101 return reinterpret_cast<uint16_t*
>(
const_cast<RunRecord*
>(
this) + 1);
107 return reinterpret_cast<SkScalar*
>(
reinterpret_cast<uint8_t*
>(this->glyphBuffer()) +
113 SkASSERT(this->positioning() == (GlyphPositioning)2);
114 return reinterpret_cast<SkPoint*
>(this->posBuffer());
119 SkASSERT(this->positioning() == (GlyphPositioning)3);
120 return reinterpret_cast<SkRSXform*
>(this->posBuffer());
123 uint32_t textSize()
const {
return isExtended() ? *this->textSizePtr() : 0; }
125 uint32_t* clusterBuffer()
const {
127 return isExtended() ? 1 + this->textSizePtr() : nullptr;
130 char* textBuffer()
const {
132 ?
reinterpret_cast<char*
>(this->clusterBuffer() +
fCount)
138 static size_t StorageSize(uint32_t glyphCount, uint32_t textSize,
142 static const RunRecord* First(
const SkTextBlob* blob);
144 static const RunRecord* Next(
const RunRecord*
run);
146 void validate(
const uint8_t* storageTop)
const;
152 kPositioning_Mask = 0x03,
154 kExtended_Flag = 0x08,
157 static const RunRecord* NextUnchecked(
const RunRecord*
run);
159 static size_t PosCount(uint32_t glyphCount,
163 uint32_t* textSizePtr()
const;
165 void grow(uint32_t
count);
167 bool isExtended()
const {
168 return fFlags & kExtended_Flag;
203 return fCurrentRun->glyphCount();
207 return fCurrentRun->glyphBuffer();
211 return fCurrentRun->posBuffer();
215 return fCurrentRun->pointBuffer();
219 return fCurrentRun->xformBuffer();
223 return fCurrentRun->offset();
227 return fCurrentRun->font();
229 GlyphPositioning positioning()
const;
230 unsigned scalarsPerGlyph()
const;
233 return fCurrentRun->clusterBuffer();
237 return fCurrentRun->textSize();
241 return fCurrentRun->textBuffer();
247 const SkTextBlob::RunRecord* fCurrentRun;
static void done(const char *config, const char *src, const char *srcOptions, const char *name)
static float next(float f)
static constexpr bool SkIsAlignPtr(T x)
static constexpr T SkAlign4(T x)
static bool isLCD(const SkScalerContextRec &rec)
@ kHorizontal_Positioning
SkDEBUGCODE(SK_SPI) SkThreadID SkGetThreadID()
static constexpr bool SkToBool(const T &x)
static void Flatten(const SkTextBlob &, SkWriteBuffer &)
static sk_sp< SkTextBlob > MakeFromBuffer(SkReadBuffer &)
static bool HasRSXForm(const SkTextBlob &blob)
uint32_t * clusters() const
const SkPoint * points() const
const SkPoint & offset() const
const SkRSXform * xforms() const
const SkScalar * pos() const
const uint16_t * glyphs() const
uint32_t glyphCount() const
uint32_t textSize() const
const SkFont & font() const
font
Font Metadata and Metrics.