| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2014 Google Inc. | 2 * Copyright 2014 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef GrStencilAndCoverTextContext_DEFINED | 8 #ifndef GrStencilAndCoverTextContext_DEFINED |
| 9 #define GrStencilAndCoverTextContext_DEFINED | 9 #define GrStencilAndCoverTextContext_DEFINED |
| 10 | 10 |
| 11 #include "GrTextContext.h" | 11 #include "GrTextContext.h" |
| 12 #include "GrDrawTarget.h" | 12 #include "GrDrawTarget.h" |
| 13 #include "GrStrokeInfo.h" | 13 #include "GrStrokeInfo.h" |
| 14 #include "SkTHash.h" | 14 #include "SkTHash.h" |
| 15 #include "SkTInternalLList.h" | 15 #include "SkTInternalLList.h" |
| 16 #include "SkTLList.h" | 16 #include "SkTLList.h" |
| 17 #include "batches/GrDrawPathBatch.h" |
| 17 | 18 |
| 18 class GrTextStrike; | 19 class GrTextStrike; |
| 19 class GrPath; | 20 class GrPath; |
| 20 class SkSurfaceProps; | 21 class SkSurfaceProps; |
| 21 class GrPathRangeDraw; | |
| 22 | 22 |
| 23 /* | 23 /* |
| 24 * This class implements text rendering using stencil and cover path rendering | 24 * This class implements text rendering using stencil and cover path rendering |
| 25 * (by the means of GrDrawTarget::drawPath). | 25 * (by the means of GrDrawTarget::drawPath). |
| 26 * This class exposes the functionality through GrTextContext interface. | 26 * This class exposes the functionality through GrTextContext interface. |
| 27 */ | 27 */ |
| 28 class GrStencilAndCoverTextContext : public GrTextContext { | 28 class GrStencilAndCoverTextContext : public GrTextContext { |
| 29 public: | 29 public: |
| 30 static GrStencilAndCoverTextContext* Create(GrContext*, const SkSurfaceProps
&); | 30 static GrStencilAndCoverTextContext* Create(GrContext*, const SkSurfaceProps
&); |
| 31 | 31 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 68 |
| 69 void draw(GrContext*, GrDrawContext*, GrPipelineBuilder*, GrColor, const
SkMatrix&, | 69 void draw(GrContext*, GrDrawContext*, GrPipelineBuilder*, GrColor, const
SkMatrix&, |
| 70 SkScalar x, SkScalar y, const SkIRect& clipBounds, | 70 SkScalar x, SkScalar y, const SkIRect& clipBounds, |
| 71 GrTextContext* fallbackTextContext, const SkPaint& originalSkP
aint) const; | 71 GrTextContext* fallbackTextContext, const SkPaint& originalSkP
aint) const; |
| 72 | 72 |
| 73 void releaseGlyphCache() const; | 73 void releaseGlyphCache() const; |
| 74 | 74 |
| 75 size_t computeSizeInCache() const; | 75 size_t computeSizeInCache() const; |
| 76 | 76 |
| 77 private: | 77 private: |
| 78 typedef GrDrawPathRangeBatch::InstanceData InstanceData; |
| 79 |
| 78 SkGlyphCache* getGlyphCache() const; | 80 SkGlyphCache* getGlyphCache() const; |
| 79 GrPathRange* createGlyphs(GrContext*) const; | 81 GrPathRange* createGlyphs(GrContext*) const; |
| 80 void appendGlyph(const SkGlyph&, const SkPoint&, FallbackBlobBuilder*); | 82 void appendGlyph(const SkGlyph&, const SkPoint&, FallbackBlobBuilder*); |
| 81 | 83 |
| 82 GrStrokeInfo fStroke; | 84 GrStrokeInfo fStroke; |
| 83 SkPaint fFont; | 85 SkPaint fFont; |
| 84 SkScalar fTextRatio; | 86 SkScalar fTextRatio; |
| 85 float fTextInverseRatio; | 87 float fTextInverseRatio; |
| 86 bool fUsingRawGlyphPaths; | 88 bool fUsingRawGlyphPaths; |
| 87 GrUniqueKey fGlyphPathsKey; | 89 GrUniqueKey fGlyphPathsKey; |
| 88 int fTotalGlyphCount; | 90 int fTotalGlyphCount; |
| 89 SkAutoTUnref<GrPathRangeDraw> fDraw; | 91 SkAutoTUnref<InstanceData> fInstanceData; |
| 92 int fFallbackGlyphCount; |
| 90 SkAutoTUnref<const SkTextBlob> fFallbackTextBlob; | 93 SkAutoTUnref<const SkTextBlob> fFallbackTextBlob; |
| 91 mutable SkGlyphCache* fDetachedGlyphCache; | 94 mutable SkGlyphCache* fDetachedGlyphCache; |
| 92 mutable uint32_t fLastDrawnGlyphsID; | 95 mutable uint32_t fLastDrawnGlyphsID; |
| 93 mutable SkMatrix fLocalMatrixTemplate; | |
| 94 }; | 96 }; |
| 95 | 97 |
| 96 // Text blobs/caches. | 98 // Text blobs/caches. |
| 97 | 99 |
| 98 class TextBlob : public SkTLList<TextRun, 1> { | 100 class TextBlob : public SkTLList<TextRun, 1> { |
| 99 public: | 101 public: |
| 100 typedef SkTArray<uint32_t, true> Key; | 102 typedef SkTArray<uint32_t, true> Key; |
| 101 | 103 |
| 102 static const Key& GetKey(const TextBlob* blob) { return blob->key(); } | 104 static const Key& GetKey(const TextBlob* blob) { return blob->key(); } |
| 103 | 105 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 134 | 136 |
| 135 SkTHashMap<uint32_t, TextBlob*> fBlobIdCache; | 137 SkTHashMap<uint32_t, TextBlob*> fBlobIdCache; |
| 136 SkTHashTable<TextBlob*, const TextBlob::Key&, TextBlob> fBlobKeyCache; | 138 SkTHashTable<TextBlob*, const TextBlob::Key&, TextBlob> fBlobKeyCache; |
| 137 SkTInternalLList<TextBlob> fLRUList; | 139 SkTInternalLList<TextBlob> fLRUList; |
| 138 size_t fCacheSize; | 140 size_t fCacheSize; |
| 139 | 141 |
| 140 typedef GrTextContext INHERITED; | 142 typedef GrTextContext INHERITED; |
| 141 }; | 143 }; |
| 142 | 144 |
| 143 #endif | 145 #endif |
| OLD | NEW |