diff options
author | 2015-04-21 07:35:10 -0700 | |
---|---|---|
committer | 2015-04-21 07:35:10 -0700 | |
commit | fcfb9fc4bde43fd375ce8e0d6583282dad4a1226 (patch) | |
tree | e1b75203ee14ff7441187f6c922c6e8286675a3e /src/gpu/GrAtlasTextContext.h | |
parent | c8e934007a48465e584cdeed9ef02077d3cd5451 (diff) |
A small patch to enable distance field text in textblobs
BUG=skia:
Review URL: https://codereview.chromium.org/1098653005
Diffstat (limited to 'src/gpu/GrAtlasTextContext.h')
-rw-r--r-- | src/gpu/GrAtlasTextContext.h | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/src/gpu/GrAtlasTextContext.h b/src/gpu/GrAtlasTextContext.h index cf2ba6bcc2..ec39ef5023 100644 --- a/src/gpu/GrAtlasTextContext.h +++ b/src/gpu/GrAtlasTextContext.h @@ -210,6 +210,14 @@ private: StrokeInfo fStrokeInfo; GrMemoryPool* fPool; + enum TextType { + kHasDistanceField_TextType = 0x1, + kHasBitmap_TextType = 0x2, + }; + uint8_t fTextType; + + BitmapTextBlob() : fTextType(0) {} + // all glyph / vertex offsets are into these pools. unsigned char* fVertices; GrGlyph::PackedID* fGlyphIDs; @@ -255,6 +263,11 @@ private: void operator delete(void* target, void* placement) { ::operator delete(target, placement); } + + bool hasDistanceField() const { return SkToBool(fTextType & kHasDistanceField_TextType); } + bool hasBitmap() const { return SkToBool(fTextType & kHasBitmap_TextType); } + void setHasDistanceField() { fTextType |= kHasDistanceField_TextType; } + void setHasBitmap() { fTextType |= kHasBitmap_TextType; } }; typedef BitmapTextBlob::Run Run; @@ -293,7 +306,8 @@ private: const GrPaint&, const GrClip&); // A helper for drawing BitmapText in a run of distance fields - inline void fallbackDrawPosText(BitmapTextBlob*, GrRenderTarget*, const GrClip&, + inline void fallbackDrawPosText(BitmapTextBlob*, int runIndex, + GrRenderTarget*, const GrClip&, const GrPaint&, const SkPaint&, const SkMatrix& viewMatrix, const SkTDArray<char>& fallbackTxt, @@ -339,7 +353,8 @@ private: void regenerateTextBlob(BitmapTextBlob* bmp, const SkPaint& skPaint, GrColor, const SkMatrix& viewMatrix, const SkTextBlob* blob, SkScalar x, SkScalar y, - SkDrawFilter* drawFilter, const SkIRect& clipRect); + SkDrawFilter* drawFilter, const SkIRect& clipRect, GrRenderTarget*, + const GrClip&, const GrPaint&); inline static bool HasLCD(const SkTextBlob*); inline void initDistanceFieldPaint(SkPaint*, SkScalar* textRatio, const SkMatrix&); |