| 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 "SkSurfaceProps.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 SkTextBlob; | 22 class SkTextBlob; |
| 23 | 23 |
| 24 /* | 24 /* |
| (...skipping 14 matching lines...) Expand all Loading... |
| 39 virtual void drawTextBlob(GrRenderTarget*, const GrClip&, const SkPaint&, | 39 virtual void drawTextBlob(GrRenderTarget*, const GrClip&, const SkPaint&, |
| 40 const SkMatrix& viewMatrix, const SkTextBlob*, | 40 const SkMatrix& viewMatrix, const SkTextBlob*, |
| 41 SkScalar x, SkScalar y, | 41 SkScalar x, SkScalar y, |
| 42 SkDrawFilter*, const SkIRect& clipBounds); | 42 SkDrawFilter*, const SkIRect& clipBounds); |
| 43 | 43 |
| 44 static bool ShouldDisableLCD(const SkPaint& paint); | 44 static bool ShouldDisableLCD(const SkPaint& paint); |
| 45 | 45 |
| 46 protected: | 46 protected: |
| 47 GrTextContext* fFallbackTextContext; | 47 GrTextContext* fFallbackTextContext; |
| 48 GrContext* fContext; | 48 GrContext* fContext; |
| 49 SkDeviceProperties fDeviceProperties; | 49 SkSurfaceProps fSurfaceProps; |
| 50 | 50 |
| 51 GrDrawContext* fDrawContext; // owning drawContext | 51 GrDrawContext* fDrawContext; // owning drawContext |
| 52 SkAutoTUnref<GrRenderTarget> fRenderTarget; | 52 SkAutoTUnref<GrRenderTarget> fRenderTarget; |
| 53 GrClip fClip; | 53 GrClip fClip; |
| 54 SkIRect fClipRect; | 54 SkIRect fClipRect; |
| 55 SkIRect fRegionClipBounds; | 55 SkIRect fRegionClipBounds; |
| 56 GrPaint fPaint; | 56 GrPaint fPaint; |
| 57 SkPaint fSkPaint; | 57 SkPaint fSkPaint; |
| 58 | 58 |
| 59 GrTextContext(GrContext*, GrDrawContext*, const SkDeviceProperties&); | 59 GrTextContext(GrContext*, GrDrawContext*, const SkSurfaceProps&); |
| 60 | 60 |
| 61 virtual bool canDraw(const GrRenderTarget*, const GrClip&, const GrPaint&, | 61 virtual bool canDraw(const GrRenderTarget*, const GrClip&, const GrPaint&, |
| 62 const SkPaint&, const SkMatrix& viewMatrix) = 0; | 62 const SkPaint&, const SkMatrix& viewMatrix) = 0; |
| 63 | 63 |
| 64 virtual void onDrawText(GrRenderTarget*, const GrClip&, | 64 virtual void onDrawText(GrRenderTarget*, const GrClip&, |
| 65 const GrPaint&, const SkPaint&, | 65 const GrPaint&, const SkPaint&, |
| 66 const SkMatrix& viewMatrix, const char text[], size_
t byteLength, | 66 const SkMatrix& viewMatrix, const char text[], size_
t byteLength, |
| 67 SkScalar x, SkScalar y, const SkIRect& clipBounds) =
0; | 67 SkScalar x, SkScalar y, const SkIRect& clipBounds) =
0; |
| 68 virtual void onDrawPosText(GrRenderTarget*, const GrClip&, | 68 virtual void onDrawPosText(GrRenderTarget*, const GrClip&, |
| 69 const GrPaint&, const SkPaint&, | 69 const GrPaint&, const SkPaint&, |
| (...skipping 12 matching lines...) Expand all Loading... |
| 82 const SkScalar pos[], int scalarsPerPosition, | 82 const SkScalar pos[], int scalarsPerPosition, |
| 83 const SkPoint& offset, const SkIRect& clipBounds); | 83 const SkPoint& offset, const SkIRect& clipBounds); |
| 84 | 84 |
| 85 void init(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPaint&, | 85 void init(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPaint&, |
| 86 const SkIRect& regionClipBounds); | 86 const SkIRect& regionClipBounds); |
| 87 | 87 |
| 88 static GrFontScaler* GetGrFontScaler(SkGlyphCache* cache); | 88 static GrFontScaler* GetGrFontScaler(SkGlyphCache* cache); |
| 89 // sets extent in stopVector and returns glyph count | 89 // sets extent in stopVector and returns glyph count |
| 90 static int MeasureText(SkGlyphCache* cache, SkDrawCacheProc glyphCacheProc, | 90 static int MeasureText(SkGlyphCache* cache, SkDrawCacheProc glyphCacheProc, |
| 91 const char text[], size_t byteLength, SkVector* stopV
ector); | 91 const char text[], size_t byteLength, SkVector* stopV
ector); |
| 92 static uint32_t FilterTextFlags(const SkDeviceProperties& devProps, const Sk
Paint& paint); | 92 static uint32_t FilterTextFlags(const SkSurfaceProps& surfaceProps, const Sk
Paint& paint); |
| 93 | 93 |
| 94 friend class BitmapTextBatch; | 94 friend class BitmapTextBatch; |
| 95 }; | 95 }; |
| 96 | 96 |
| 97 #endif | 97 #endif |
| OLD | NEW |