| 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 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 SkSurfaceProps fSurfaceProps; | 49 SkSurfaceProps fSurfaceProps; |
| 50 | 50 |
| 51 GrDrawContext* fDrawContext; // owning drawContext | 51 GrDrawContext* fDrawContext; // owning drawContext |
| 52 SkAutoTUnref<GrRenderTarget> fRenderTarget; | |
| 53 GrClip fClip; | |
| 54 SkIRect fClipRect; | |
| 55 SkIRect fRegionClipBounds; | |
| 56 GrPaint fPaint; | |
| 57 SkPaint fSkPaint; | |
| 58 | 52 |
| 59 GrTextContext(GrContext*, GrDrawContext*, const SkSurfaceProps&); | 53 GrTextContext(GrContext*, GrDrawContext*, const SkSurfaceProps&); |
| 60 | 54 |
| 61 virtual bool canDraw(const GrRenderTarget*, const GrClip&, const GrPaint&, | 55 virtual bool canDraw(const GrRenderTarget*, const GrClip&, const GrPaint&, |
| 62 const SkPaint&, const SkMatrix& viewMatrix) = 0; | 56 const SkPaint&, const SkMatrix& viewMatrix) = 0; |
| 63 | 57 |
| 64 virtual void onDrawText(GrRenderTarget*, const GrClip&, | 58 virtual void onDrawText(GrRenderTarget*, const GrClip&, |
| 65 const GrPaint&, const SkPaint&, | 59 const GrPaint&, const SkPaint&, |
| 66 const SkMatrix& viewMatrix, const char text[], size_
t byteLength, | 60 const SkMatrix& viewMatrix, const char text[], size_
t byteLength, |
| 67 SkScalar x, SkScalar y, const SkIRect& clipBounds) =
0; | 61 SkScalar x, SkScalar y, const SkIRect& clipBounds) =
0; |
| 68 virtual void onDrawPosText(GrRenderTarget*, const GrClip&, | 62 virtual void onDrawPosText(GrRenderTarget*, const GrClip&, |
| 69 const GrPaint&, const SkPaint&, | 63 const GrPaint&, const SkPaint&, |
| 70 const SkMatrix& viewMatrix, | 64 const SkMatrix& viewMatrix, |
| 71 const char text[], size_t byteLength, | 65 const char text[], size_t byteLength, |
| 72 const SkScalar pos[], int scalarsPerPosition, | 66 const SkScalar pos[], int scalarsPerPosition, |
| 73 const SkPoint& offset, const SkIRect& clipBounds)
= 0; | 67 const SkPoint& offset, const SkIRect& clipBounds)
= 0; |
| 74 | 68 |
| 75 void drawTextAsPath(GrRenderTarget*, const GrClip& clip, | 69 void drawTextAsPath(GrRenderTarget*, const GrClip& clip, |
| 76 const SkPaint& origPaint, const SkMatrix& viewMatrix, | 70 const SkPaint& origPaint, const SkMatrix& viewMatrix, |
| 77 const char text[], size_t byteLength, SkScalar x, SkScal
ar y, | 71 const char text[], size_t byteLength, SkScalar x, SkScal
ar y, |
| 78 const SkIRect& clipBounds); | 72 const SkIRect& clipBounds); |
| 79 void drawPosTextAsPath(GrRenderTarget*, const GrClip& clip, | 73 void drawPosTextAsPath(GrRenderTarget*, const GrClip& clip, |
| 80 const SkPaint& origPaint, const SkMatrix& viewMatrix, | 74 const SkPaint& origPaint, const SkMatrix& viewMatrix, |
| 81 const char text[], size_t byteLength, | 75 const char text[], size_t byteLength, |
| 82 const SkScalar pos[], int scalarsPerPosition, | 76 const SkScalar pos[], int scalarsPerPosition, |
| 83 const SkPoint& offset, const SkIRect& clipBounds); | 77 const SkPoint& offset, const SkIRect& clipBounds); |
| 84 | 78 |
| 85 void init(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPaint&, | |
| 86 const SkIRect& regionClipBounds); | |
| 87 | |
| 88 static GrFontScaler* GetGrFontScaler(SkGlyphCache* cache); | 79 static GrFontScaler* GetGrFontScaler(SkGlyphCache* cache); |
| 89 // sets extent in stopVector and returns glyph count | 80 // sets extent in stopVector and returns glyph count |
| 90 static int MeasureText(SkGlyphCache* cache, SkDrawCacheProc glyphCacheProc, | 81 static int MeasureText(SkGlyphCache* cache, SkDrawCacheProc glyphCacheProc, |
| 91 const char text[], size_t byteLength, SkVector* stopV
ector); | 82 const char text[], size_t byteLength, SkVector* stopV
ector); |
| 92 static uint32_t FilterTextFlags(const SkSurfaceProps& surfaceProps, const Sk
Paint& paint); | 83 static uint32_t FilterTextFlags(const SkSurfaceProps& surfaceProps, const Sk
Paint& paint); |
| 93 | 84 |
| 94 friend class BitmapTextBatch; | 85 friend class BitmapTextBatch; |
| 95 }; | 86 }; |
| 96 | 87 |
| 97 #endif | 88 #endif |
| OLD | NEW |