| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 Google Inc. | 2 * Copyright 2010 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 GrTextContext_DEFINED | 8 #ifndef GrTextContext_DEFINED |
| 9 #define GrTextContext_DEFINED | 9 #define GrTextContext_DEFINED |
| 10 | 10 |
| 11 #include "GrClip.h" | 11 #include "GrClip.h" |
| 12 #include "GrGlyph.h" | 12 #include "GrGlyph.h" |
| 13 #include "GrPaint.h" | 13 #include "GrPaint.h" |
| 14 #include "SkDeviceProperties.h" | 14 #include "SkDeviceProperties.h" |
| 15 #include "SkPostConfig.h" | 15 #include "SkPostConfig.h" |
| 16 | 16 |
| 17 class GrClip; | 17 class GrClip; |
| 18 class GrContext; | 18 class GrContext; |
| 19 class GrDrawContext; | 19 class GrDrawContext; |
| 20 class GrFontScaler; | 20 class GrFontScaler; |
| 21 class SkDrawFilter; | 21 class SkDrawFilter; |
| 22 class SkGpuDevice; | |
| 23 class SkTextBlob; | 22 class SkTextBlob; |
| 24 | 23 |
| 25 /* | 24 /* |
| 26 * This class wraps the state for a single text render | 25 * This class wraps the state for a single text render |
| 27 */ | 26 */ |
| 28 class GrTextContext { | 27 class GrTextContext { |
| 29 public: | 28 public: |
| 30 virtual ~GrTextContext(); | 29 virtual ~GrTextContext(); |
| 31 | 30 |
| 32 void drawText(GrRenderTarget* rt, const GrClip&, const GrPaint&, const SkPa
int&, | 31 void drawText(GrRenderTarget* rt, const GrClip&, const GrPaint&, const SkPa
int&, |
| 33 const SkMatrix& viewMatrix, const char text[], size_t byteLeng
th, SkScalar x, | 32 const SkMatrix& viewMatrix, const char text[], size_t byteLeng
th, SkScalar x, |
| 34 SkScalar y, const SkIRect& clipBounds); | 33 SkScalar y, const SkIRect& clipBounds); |
| 35 void drawPosText(GrRenderTarget* rt, const GrClip&, const GrPaint&, const Sk
Paint&, | 34 void drawPosText(GrRenderTarget* rt, const GrClip&, const GrPaint&, const Sk
Paint&, |
| 36 const SkMatrix& viewMatrix, | 35 const SkMatrix& viewMatrix, |
| 37 const char text[], size_t byteLength, | 36 const char text[], size_t byteLength, |
| 38 const SkScalar pos[], int scalarsPerPosition, | 37 const SkScalar pos[], int scalarsPerPosition, |
| 39 const SkPoint& offset, const SkIRect& clipBounds); | 38 const SkPoint& offset, const SkIRect& clipBounds); |
| 40 virtual void drawTextBlob(SkGpuDevice*, GrRenderTarget*, const GrClip&, cons
t SkPaint&, | 39 virtual void drawTextBlob(GrRenderTarget*, const GrClip&, const SkPaint&, |
| 41 const SkMatrix& viewMatrix, const SkTextBlob*, | 40 const SkMatrix& viewMatrix, const SkTextBlob*, |
| 42 SkScalar x, SkScalar y, | 41 SkScalar x, SkScalar y, |
| 43 SkDrawFilter*, const SkIRect& clipBounds); | 42 SkDrawFilter*, const SkIRect& clipBounds); |
| 44 | 43 |
| 44 static bool ShouldDisableLCD(const SkPaint& paint); |
| 45 |
| 45 protected: | 46 protected: |
| 46 GrTextContext* fFallbackTextContext; | 47 GrTextContext* fFallbackTextContext; |
| 47 GrContext* fContext; | 48 GrContext* fContext; |
| 48 SkDeviceProperties fDeviceProperties; | 49 SkDeviceProperties fDeviceProperties; |
| 49 | 50 |
| 50 SkAutoTUnref<GrRenderTarget> fRenderTarget; | 51 SkAutoTUnref<GrRenderTarget> fRenderTarget; |
| 51 GrClip fClip; | 52 GrClip fClip; |
| 52 SkIRect fClipRect; | 53 SkIRect fClipRect; |
| 53 SkIRect fRegionClipBounds; | 54 SkIRect fRegionClipBounds; |
| 54 GrPaint fPaint; | 55 GrPaint fPaint; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 80 const SkScalar pos[], int scalarsPerPosition, | 81 const SkScalar pos[], int scalarsPerPosition, |
| 81 const SkPoint& offset, const SkIRect& clipBounds); | 82 const SkPoint& offset, const SkIRect& clipBounds); |
| 82 | 83 |
| 83 void init(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPaint&, | 84 void init(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPaint&, |
| 84 const SkIRect& regionClipBounds); | 85 const SkIRect& regionClipBounds); |
| 85 | 86 |
| 86 static GrFontScaler* GetGrFontScaler(SkGlyphCache* cache); | 87 static GrFontScaler* GetGrFontScaler(SkGlyphCache* cache); |
| 87 // sets extent in stopVector and returns glyph count | 88 // sets extent in stopVector and returns glyph count |
| 88 static int MeasureText(SkGlyphCache* cache, SkDrawCacheProc glyphCacheProc, | 89 static int MeasureText(SkGlyphCache* cache, SkDrawCacheProc glyphCacheProc, |
| 89 const char text[], size_t byteLength, SkVector* stopV
ector); | 90 const char text[], size_t byteLength, SkVector* stopV
ector); |
| 91 static uint32_t FilterTextFlags(const SkDeviceProperties& devProps, const Sk
Paint& paint); |
| 90 | 92 |
| 91 friend class BitmapTextBatch; | 93 friend class BitmapTextBatch; |
| 92 }; | 94 }; |
| 93 | 95 |
| 94 #endif | 96 #endif |
| OLD | NEW |