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 |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 void drawTextBlob(GrContext*, GrDrawContext*, const GrClip&, const SkPaint&, | 45 void drawTextBlob(GrContext*, GrDrawContext*, const GrClip&, const SkPaint&, |
46 const SkMatrix& viewMatrix, const SkSurfaceProps&, const S
kTextBlob*, | 46 const SkMatrix& viewMatrix, const SkSurfaceProps&, const S
kTextBlob*, |
47 SkScalar x, SkScalar y, | 47 SkScalar x, SkScalar y, |
48 SkDrawFilter*, const SkIRect& clipBounds); | 48 SkDrawFilter*, const SkIRect& clipBounds); |
49 | 49 |
50 private: | 50 private: |
51 GrAtlasTextContext(); | 51 GrAtlasTextContext(); |
52 | 52 |
53 // sets up the descriptor on the blob and returns a detached cache. Client
must attach | 53 // sets up the descriptor on the blob and returns a detached cache. Client
must attach |
54 inline static GrColor ComputeCanonicalColor(const SkPaint&, bool lcd); | 54 inline static GrColor ComputeCanonicalColor(const SkPaint&, bool lcd); |
| 55 // Determines if we need to use FakeGamma: |
| 56 inline static SkPaint::FakeGamma ComputeFakeGamma(GrDrawContext*, const GrPa
int&); |
55 static void RegenerateTextBlob(GrAtlasTextBlob* bmp, | 57 static void RegenerateTextBlob(GrAtlasTextBlob* bmp, |
56 GrBatchFontCache*, | 58 GrBatchFontCache*, |
57 const GrShaderCaps&, | 59 const GrShaderCaps&, |
58 const SkPaint& skPaint, GrColor, | 60 const SkPaint& skPaint, GrColor, SkPaint::Fak
eGamma, |
59 const SkMatrix& viewMatrix, | 61 const SkMatrix& viewMatrix, |
60 const SkSurfaceProps&, | 62 const SkSurfaceProps&, |
61 const SkTextBlob* blob, SkScalar x, SkScalar
y, | 63 const SkTextBlob* blob, SkScalar x, SkScalar
y, |
62 SkDrawFilter* drawFilter); | 64 SkDrawFilter* drawFilter); |
63 inline static bool HasLCD(const SkTextBlob*); | 65 inline static bool HasLCD(const SkTextBlob*); |
64 | 66 |
65 static inline GrAtlasTextBlob* CreateDrawTextBlob(GrTextBlobCache*, | 67 static inline GrAtlasTextBlob* CreateDrawTextBlob(GrTextBlobCache*, |
66 GrBatchFontCache*, const G
rShaderCaps&, | 68 GrBatchFontCache*, const G
rShaderCaps&, |
67 const GrPaint&, | 69 const GrPaint&, |
68 const SkPaint&, const SkMa
trix& viewMatrix, | 70 const SkPaint&, SkPaint::F
akeGamma, |
| 71 const SkMatrix& viewMatrix
, |
69 const SkSurfaceProps&, | 72 const SkSurfaceProps&, |
70 const char text[], size_t
byteLength, | 73 const char text[], size_t
byteLength, |
71 SkScalar x, SkScalar y); | 74 SkScalar x, SkScalar y); |
72 static inline GrAtlasTextBlob* CreateDrawPosTextBlob(GrTextBlobCache*, GrBat
chFontCache*, | 75 static inline GrAtlasTextBlob* CreateDrawPosTextBlob(GrTextBlobCache*, GrBat
chFontCache*, |
73 const GrShaderCaps&, | 76 const GrShaderCaps&, |
74 const GrPaint&, | 77 const GrPaint&, |
75 const SkPaint&, const S
kMatrix& viewMatrix, | 78 const SkPaint&, SkPaint
::FakeGamma, |
| 79 const SkMatrix& viewMat
rix, |
76 const SkSurfaceProps&, | 80 const SkSurfaceProps&, |
77 const char text[], size
_t byteLength, | 81 const char text[], size
_t byteLength, |
78 const SkScalar pos[], | 82 const SkScalar pos[], |
79 int scalarsPerPosition, | 83 int scalarsPerPosition, |
80 const SkPoint& offset); | 84 const SkPoint& offset); |
81 const GrDistanceFieldAdjustTable* dfAdjustTable() const { return fDistanceAd
justTable; } | 85 const GrDistanceFieldAdjustTable* dfAdjustTable() const { return fDistanceAd
justTable; } |
82 | 86 |
83 SkAutoTUnref<const GrDistanceFieldAdjustTable> fDistanceAdjustTable; | 87 SkAutoTUnref<const GrDistanceFieldAdjustTable> fDistanceAdjustTable; |
84 | 88 |
85 #ifdef GR_TEST_UTILS | 89 #ifdef GR_TEST_UTILS |
| 90 static const SkPaint::FakeGamma kTextBlobBatchFakeGamma = SkPaint::FakeGamma
::On; |
86 DRAW_BATCH_TEST_FRIEND(TextBlobBatch); | 91 DRAW_BATCH_TEST_FRIEND(TextBlobBatch); |
87 #endif | 92 #endif |
88 }; | 93 }; |
89 | 94 |
90 #endif | 95 #endif |
OLD | NEW |