8 #ifndef SkTextBlob_DEFINED
9 #define SkTextBlob_DEFINED
11 #include "../private/SkTemplates.h"
32 uint32_t
uniqueID()
const {
return fUniqueID; }
48 static const SkTextBlob* CreateFromBuffer(SkReadBuffer& buffer) {
49 return MakeFromBuffer(buffer).release();
52 enum GlyphPositioning {
53 kDefault_Positioning = 0,
54 kHorizontal_Positioning = 1,
68 void operator delete(
void* p) {
sk_free(p); }
69 void*
operator new(size_t) {
70 SkFAIL(
"All blobs are created by placement new.");
73 void*
operator new(size_t,
void* p) {
return p; }
75 static unsigned ScalarsPerGlyph(GlyphPositioning pos);
78 friend class SkTextBlobRunIterator;
82 const uint32_t fUniqueID;
84 SkDEBUGCODE(
size_t fStorageSize;)
135 const RunBuffer& allocRun(
const SkPaint& font,
int count, SkScalar x, SkScalar y,
136 const SkRect* bounds = NULL);
152 const SkRect* bounds = NULL);
170 void reserve(
size_t size);
171 void allocInternal(
const SkPaint& font, SkTextBlob::GlyphPositioning positioning,
173 bool mergeRun(
const SkPaint& font, SkTextBlob::GlyphPositioning positioning,
175 void updateDeferredBounds();
177 static SkRect ConservativeRunBounds(
const SkTextBlob::RunRecord&);
178 static SkRect TightRunBounds(
const SkTextBlob::RunRecord&);
180 SkAutoTMalloc<uint8_t> fStorage;
186 bool fDeferredBounds;
192 #endif // SkTextBlob_DEFINED
T *SK_WARN_UNUSED_RESULT release()
Return the bare pointer, and set the internal object pointer to nullptr.
Definition: SkRefCnt.h:363
SK_API void * sk_malloc_throw(size_t size)
Same as sk_malloc(), but hard coded to pass SK_MALLOC_THROW as the flag.
SkTextBlob combines multiple text runs into an immutable, ref-counted structure.
Definition: SkTextBlob.h:22
uint16_t SkGlyphID
16 bit unsigned integer to hold a glyph index
Definition: SkTypes.h:359
Definition: SkPoint.h:156
const SkRect & bounds() const
Returns a conservative blob bounding box.
Definition: SkTextBlob.h:27
Definition: SkRefCnt.h:135
The SkPaint class holds the style and color information about how to draw geometries, text and bitmaps.
Definition: SkPaint.h:46
Glyph and position buffers associated with a run.
Definition: SkTextBlob.h:117
SK_API void sk_free(void *)
Free memory returned by sk_malloc().
Shared pointer class to wrap classes that support a ref()/unref() interface.
Definition: SkRefCnt.h:258
Helper class for constructing SkTextBlobs.
Definition: SkTextBlob.h:96
Definition: SkWriteBuffer.h:26
uint32_t uniqueID() const
Return a non-zero, unique value representing the text blob.
Definition: SkTextBlob.h:32
Definition: SkRefCnt.h:221