diff options
Diffstat (limited to 'src/gpu/text/GrAtlasTextBlob.h')
-rw-r--r-- | src/gpu/text/GrAtlasTextBlob.h | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/src/gpu/text/GrAtlasTextBlob.h b/src/gpu/text/GrAtlasTextBlob.h index 4351aae748..68cba3d506 100644 --- a/src/gpu/text/GrAtlasTextBlob.h +++ b/src/gpu/text/GrAtlasTextBlob.h @@ -18,6 +18,7 @@ #include "SkTInternalLList.h" struct GrDistanceFieldAdjustTable; +class GrMemoryPool; class GrTextContext; class SkDrawFilter; class SkTextBlob; @@ -45,16 +46,7 @@ class GrAtlasTextBlob : public SkNVRefCnt<GrAtlasTextBlob> { public: SK_DECLARE_INTERNAL_LLIST_INTERFACE(GrAtlasTextBlob); - GrAtlasTextBlob() - : fMaxMinScale(-SK_ScalarMax) - , fMinMaxScale(SK_ScalarMax) - , fTextType(0) {} - - ~GrAtlasTextBlob() { - for (int i = 0; i < fRunCount; i++) { - fRuns[i].~Run(); - } - } + static GrAtlasTextBlob* Create(GrMemoryPool* pool, int glyphCount, int runCount); struct Key { Key() { @@ -75,6 +67,20 @@ public: } }; + void setupKey(const GrAtlasTextBlob::Key& key, + const SkMaskFilter::BlurRec& blurRec, + const SkPaint& paint) { + fKey = key; + if (key.fHasBlur) { + fBlurRec = blurRec; + } + if (key.fStyle != SkPaint::kFill_Style) { + fStrokeInfo.fFrameWidth = paint.getStrokeWidth(); + fStrokeInfo.fMiterLimit = paint.getStrokeMiter(); + fStrokeInfo.fJoin = paint.getStrokeJoin(); + } + } + static const Key& GetKey(const GrAtlasTextBlob& blob) { return blob.fKey; } @@ -198,6 +204,7 @@ public: static const size_t kColorTextVASize = sizeof(SkPoint) + sizeof(SkIPoint16); static const size_t kGrayTextVASize = sizeof(SkPoint) + sizeof(GrColor) + sizeof(SkIPoint16); static const size_t kLCDTextVASize = kGrayTextVASize; + static const size_t kMaxVASize = kGrayTextVASize; static const int kVerticesPerGlyph = 4; static void AssertEqual(const GrAtlasTextBlob&, const GrAtlasTextBlob&); @@ -220,7 +227,20 @@ public: const GrDistanceFieldAdjustTable* distanceAdjustTable, GrBatchFontCache* cache); + const Key& key() const { return fKey; } + + ~GrAtlasTextBlob() { + for (int i = 0; i < fRunCount; i++) { + fRuns[i].~Run(); + } + } + private: + GrAtlasTextBlob() + : fMaxMinScale(-SK_ScalarMax) + , fMinMaxScale(SK_ScalarMax) + , fTextType(0) {} + void appendLargeGlyph(GrGlyph* glyph, GrFontScaler* scaler, const SkGlyph& skGlyph, SkScalar x, SkScalar y, SkScalar scale, bool applyVM); @@ -456,7 +476,6 @@ private: uint8_t fTextType; friend class GrAtlasTextBatch; // We might be able to get rid of this friending - friend class GrTextBlobCache; // Needs to access the key }; #endif |