| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 GrAtlasTextContext_DEFINED | 8 #ifndef GrAtlasTextContext_DEFINED |
| 9 #define GrAtlasTextContext_DEFINED | 9 #define GrAtlasTextContext_DEFINED |
| 10 | 10 |
| 11 #include "GrTextContext.h" | 11 #include "GrTextContext.h" |
| 12 | 12 |
| 13 #include "GrAtlasTextBlob.h" | 13 #include "GrAtlasTextBlob.h" |
| 14 #include "GrGeometryProcessor.h" | 14 #include "GrGeometryProcessor.h" |
| 15 #include "SkTextBlob.h" | 15 #include "SkTextBlob.h" |
| 16 | 16 |
| 17 #ifdef GR_TEST_UTILS | 17 #ifdef GR_TEST_UTILS |
| 18 #include "GrBatchTest.h" | 18 #include "GrBatchTest.h" |
| 19 #endif | 19 #endif |
| 20 | 20 |
| 21 class GrDrawContext; | 21 class GrDrawContext; |
| 22 class GrDrawTarget; | 22 class GrDrawTarget; |
| 23 class GrPipelineBuilder; | 23 class GrPipelineBuilder; |
| 24 class GrTextBlobCache; | 24 class GrTextBlobCache; |
| 25 class SkGlyph; |
| 25 | 26 |
| 26 /* | 27 /* |
| 27 * This class implements GrTextContext using standard bitmap fonts, and can also
process textblobs. | 28 * This class implements GrTextContext using standard bitmap fonts, and can also
process textblobs. |
| 28 * TODO replace GrBitmapTextContext | 29 * TODO replace GrBitmapTextContext |
| 29 */ | 30 */ |
| 30 class GrAtlasTextContext : public GrTextContext { | 31 class GrAtlasTextContext : public GrTextContext { |
| 31 public: | 32 public: |
| 32 static GrAtlasTextContext* Create(GrContext*, GrDrawContext*, const SkSurfac
eProps&); | 33 static GrAtlasTextContext* Create(GrContext*, GrDrawContext*, const SkSurfac
eProps&); |
| 33 | 34 |
| 34 private: | 35 private: |
| (...skipping 15 matching lines...) Expand all Loading... |
| 50 const SkMatrix& viewMatrix, const SkTextBlob*, SkScalar x,
SkScalar y, | 51 const SkMatrix& viewMatrix, const SkTextBlob*, SkScalar x,
SkScalar y, |
| 51 SkDrawFilter*, const SkIRect& clipBounds) override; | 52 SkDrawFilter*, const SkIRect& clipBounds) override; |
| 52 | 53 |
| 53 typedef GrAtlasTextBlob::Run Run; | 54 typedef GrAtlasTextBlob::Run Run; |
| 54 typedef Run::SubRunInfo PerSubRunInfo; | 55 typedef Run::SubRunInfo PerSubRunInfo; |
| 55 | 56 |
| 56 inline bool canDrawAsDistanceFields(const SkPaint&, const SkMatrix& viewMatr
ix); | 57 inline bool canDrawAsDistanceFields(const SkPaint&, const SkMatrix& viewMatr
ix); |
| 57 GrAtlasTextBlob* setupDFBlob(int glyphCount, const SkPaint& origPaint, | 58 GrAtlasTextBlob* setupDFBlob(int glyphCount, const SkPaint& origPaint, |
| 58 const SkMatrix& viewMatrix, SkGlyphCache** cache
, | 59 const SkMatrix& viewMatrix, SkGlyphCache** cache
, |
| 59 SkPaint* dfPaint, SkScalar* textRatio); | 60 SkPaint* dfPaint, SkScalar* textRatio); |
| 60 void bmpAppendGlyph(GrAtlasTextBlob*, int runIndex, GrGlyph::PackedID, int l
eft, int top, | 61 void bmpAppendGlyph(GrAtlasTextBlob*, int runIndex, const SkGlyph&, int left
, int top, |
| 61 GrColor color, GrFontScaler*, const SkIRect& clipRect); | 62 GrColor color, GrFontScaler*, const SkIRect& clipRect); |
| 62 bool dfAppendGlyph(GrAtlasTextBlob*, int runIndex, GrGlyph::PackedID, SkScal
ar sx, SkScalar sy, | 63 bool dfAppendGlyph(GrAtlasTextBlob*, int runIndex, const SkGlyph&, SkScalar
sx, SkScalar sy, |
| 63 GrColor color, GrFontScaler*, const SkIRect& clipRect, Sk
Scalar textRatio, | 64 GrColor color, GrFontScaler*, const SkIRect& clipRect, Sk
Scalar textRatio, |
| 64 const SkMatrix& viewMatrix); | 65 const SkMatrix& viewMatrix); |
| 65 inline void appendGlyphPath(GrAtlasTextBlob* blob, GrGlyph* glyph, | 66 inline void appendGlyphPath(GrAtlasTextBlob*, GrGlyph*, GrFontScaler*, const
SkGlyph&, |
| 66 GrFontScaler* scaler, SkScalar x, SkScalar y); | 67 SkScalar x, SkScalar y); |
| 67 inline void appendGlyphCommon(GrAtlasTextBlob*, Run*, Run::SubRunInfo*, | 68 inline void appendGlyphCommon(GrAtlasTextBlob*, Run*, Run::SubRunInfo*, |
| 68 const SkRect& positions, GrColor color, | 69 const SkRect& positions, GrColor color, |
| 69 size_t vertexStride, bool useVertexColor, | 70 size_t vertexStride, bool useVertexColor, |
| 70 GrGlyph*); | 71 GrGlyph*); |
| 71 | 72 |
| 72 inline void flushRunAsPaths(GrRenderTarget*, | 73 inline void flushRunAsPaths(GrRenderTarget*, |
| 73 const SkTextBlob::RunIterator&, const GrClip& cl
ip, | 74 const SkTextBlob::RunIterator&, const GrClip& cl
ip, |
| 74 const SkPaint&, SkDrawFilter*, | 75 const SkPaint&, SkDrawFilter*, |
| 75 const SkMatrix& viewMatrix, const SkIRect& clipB
ounds, SkScalar x, | 76 const SkMatrix& viewMatrix, const SkIRect& clipB
ounds, SkScalar x, |
| 76 SkScalar y); | 77 SkScalar y); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 friend class TextBatch; | 186 friend class TextBatch; |
| 186 | 187 |
| 187 #ifdef GR_TEST_UTILS | 188 #ifdef GR_TEST_UTILS |
| 188 BATCH_TEST_FRIEND(TextBlobBatch); | 189 BATCH_TEST_FRIEND(TextBlobBatch); |
| 189 #endif | 190 #endif |
| 190 | 191 |
| 191 typedef GrTextContext INHERITED; | 192 typedef GrTextContext INHERITED; |
| 192 }; | 193 }; |
| 193 | 194 |
| 194 #endif | 195 #endif |
| OLD | NEW |