| 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: | 55 // Determines if we need to use fake gamma (and contrast boost): |
| 56 inline static SkPaint::FakeGamma ComputeFakeGamma(GrDrawContext*, const GrPa
int&); | 56 inline static uint32_t ComputeScalerContextFlags(GrDrawContext*, const GrPai
nt&); |
| 57 static void RegenerateTextBlob(GrAtlasTextBlob* bmp, | 57 static void RegenerateTextBlob(GrAtlasTextBlob* bmp, |
| 58 GrBatchFontCache*, | 58 GrBatchFontCache*, |
| 59 const GrShaderCaps&, | 59 const GrShaderCaps&, |
| 60 const SkPaint& skPaint, GrColor, SkPaint::Fak
eGamma, | 60 const SkPaint& skPaint, GrColor, |
| 61 uint32_t scalerContextFlags, |
| 61 const SkMatrix& viewMatrix, | 62 const SkMatrix& viewMatrix, |
| 62 const SkSurfaceProps&, | 63 const SkSurfaceProps&, |
| 63 const SkTextBlob* blob, SkScalar x, SkScalar
y, | 64 const SkTextBlob* blob, SkScalar x, SkScalar
y, |
| 64 SkDrawFilter* drawFilter); | 65 SkDrawFilter* drawFilter); |
| 65 inline static bool HasLCD(const SkTextBlob*); | 66 inline static bool HasLCD(const SkTextBlob*); |
| 66 | 67 |
| 67 static inline GrAtlasTextBlob* CreateDrawTextBlob(GrTextBlobCache*, | 68 static inline GrAtlasTextBlob* CreateDrawTextBlob(GrTextBlobCache*, |
| 68 GrBatchFontCache*, const G
rShaderCaps&, | 69 GrBatchFontCache*, const G
rShaderCaps&, |
| 69 const GrPaint&, | 70 const GrPaint&, |
| 70 const SkPaint&, SkPaint::F
akeGamma, | 71 const SkPaint&, |
| 72 uint32_t scalerContextFlag
s, |
| 71 const SkMatrix& viewMatrix
, | 73 const SkMatrix& viewMatrix
, |
| 72 const SkSurfaceProps&, | 74 const SkSurfaceProps&, |
| 73 const char text[], size_t
byteLength, | 75 const char text[], size_t
byteLength, |
| 74 SkScalar x, SkScalar y); | 76 SkScalar x, SkScalar y); |
| 75 static inline GrAtlasTextBlob* CreateDrawPosTextBlob(GrTextBlobCache*, GrBat
chFontCache*, | 77 static inline GrAtlasTextBlob* CreateDrawPosTextBlob(GrTextBlobCache*, GrBat
chFontCache*, |
| 76 const GrShaderCaps&, | 78 const GrShaderCaps&, |
| 77 const GrPaint&, | 79 const GrPaint&, |
| 78 const SkPaint&, SkPaint
::FakeGamma, | 80 const SkPaint&, |
| 81 uint32_t scalerContextF
lags, |
| 79 const SkMatrix& viewMat
rix, | 82 const SkMatrix& viewMat
rix, |
| 80 const SkSurfaceProps&, | 83 const SkSurfaceProps&, |
| 81 const char text[], size
_t byteLength, | 84 const char text[], size
_t byteLength, |
| 82 const SkScalar pos[], | 85 const SkScalar pos[], |
| 83 int scalarsPerPosition, | 86 int scalarsPerPosition, |
| 84 const SkPoint& offset); | 87 const SkPoint& offset); |
| 85 const GrDistanceFieldAdjustTable* dfAdjustTable() const { return fDistanceAd
justTable; } | 88 const GrDistanceFieldAdjustTable* dfAdjustTable() const { return fDistanceAd
justTable; } |
| 86 | 89 |
| 87 SkAutoTUnref<const GrDistanceFieldAdjustTable> fDistanceAdjustTable; | 90 SkAutoTUnref<const GrDistanceFieldAdjustTable> fDistanceAdjustTable; |
| 88 | 91 |
| 89 #ifdef GR_TEST_UTILS | 92 #ifdef GR_TEST_UTILS |
| 90 static const SkPaint::FakeGamma kTextBlobBatchFakeGamma = SkPaint::FakeGamma
::On; | 93 static const uint32_t kTextBlobBatchScalerContextFlags = |
| 94 SkPaint::kFakeGammaAndBoostContrast_ScalerContextFlags; |
| 91 DRAW_BATCH_TEST_FRIEND(TextBlobBatch); | 95 DRAW_BATCH_TEST_FRIEND(TextBlobBatch); |
| 92 #endif | 96 #endif |
| 93 }; | 97 }; |
| 94 | 98 |
| 95 #endif | 99 #endif |
| OLD | NEW |