| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 GrContext* fContext; | 46 GrContext* fContext; |
| 47 // TODO we probably don't really need to store a back pointer to the owning
SkGpuDevice, except | 47 // TODO we probably don't really need to store a back pointer to the owning
SkGpuDevice, except |
| 48 // we need to be able to call drawPath on it in the event no other text cont
ext can draw the | 48 // we need to be able to call drawPath on it in the event no other text cont
ext can draw the |
| 49 // text. We might be able to move this logic to context though. This is un
reffed because | 49 // text. We might be able to move this logic to context though. This is un
reffed because |
| 50 // GrTextContext is completely owned by SkGpuDevice | 50 // GrTextContext is completely owned by SkGpuDevice |
| 51 SkGpuDevice* fGpuDevice; | 51 SkGpuDevice* fGpuDevice; |
| 52 SkDeviceProperties fDeviceProperties; | 52 SkDeviceProperties fDeviceProperties; |
| 53 | 53 |
| 54 SkAutoTUnref<GrRenderTarget> fRenderTarget; | 54 SkAutoTUnref<GrRenderTarget> fRenderTarget; |
| 55 GrClip fClip; | 55 GrClip fClip; |
| 56 GrDrawTarget* fDrawTarget; | |
| 57 SkIRect fClipRect; | 56 SkIRect fClipRect; |
| 58 SkIRect fRegionClipBounds; | 57 SkIRect fRegionClipBounds; |
| 59 GrPaint fPaint; | 58 GrPaint fPaint; |
| 60 SkPaint fSkPaint; | 59 SkPaint fSkPaint; |
| 61 | 60 |
| 62 GrTextContext(GrContext*, SkGpuDevice*, const SkDeviceProperties&); | 61 GrTextContext(GrContext*, SkGpuDevice*, const SkDeviceProperties&); |
| 63 | 62 |
| 64 virtual bool canDraw(const GrRenderTarget*, const GrClip&, const GrPaint&, | 63 virtual bool canDraw(const GrRenderTarget*, const GrClip&, const GrPaint&, |
| 65 const SkPaint&, const SkMatrix& viewMatrix) = 0; | 64 const SkPaint&, const SkMatrix& viewMatrix) = 0; |
| 66 | 65 |
| 67 virtual void onDrawText(GrRenderTarget*, const GrClip&, const GrPaint&, cons
t SkPaint&, | 66 virtual void onDrawText(GrRenderTarget*, const GrClip&, const GrPaint&, cons
t SkPaint&, |
| 68 const SkMatrix& viewMatrix, const char text[], size_
t byteLength, | 67 const SkMatrix& viewMatrix, const char text[], size_
t byteLength, |
| 69 SkScalar x, SkScalar y, const SkIRect& clipBounds) =
0; | 68 SkScalar x, SkScalar y, const SkIRect& clipBounds) =
0; |
| 70 virtual void onDrawPosText(GrRenderTarget*, const GrClip&, const GrPaint&, c
onst SkPaint&, | 69 virtual void onDrawPosText(GrRenderTarget*, const GrClip&, const GrPaint&, c
onst SkPaint&, |
| 71 const SkMatrix& viewMatrix, | 70 const SkMatrix& viewMatrix, |
| 72 const char text[], size_t byteLength, | 71 const char text[], size_t byteLength, |
| 73 const SkScalar pos[], int scalarsPerPosition, | 72 const SkScalar pos[], int scalarsPerPosition, |
| 74 const SkPoint& offset, const SkIRect& clipBounds)
= 0; | 73 const SkPoint& offset, const SkIRect& clipBounds)
= 0; |
| 75 | 74 |
| 76 void drawTextAsPath(const SkPaint& origPaint, const SkMatrix& viewMatrix, | 75 void drawTextAsPath(const SkPaint& origPaint, const SkMatrix& viewMatrix, |
| 77 const char text[], size_t byteLength, SkScalar x, SkScal
ar y, | 76 const char text[], size_t byteLength, SkScalar x, SkScal
ar y, |
| 78 const SkIRect& clipBounds); | 77 const SkIRect& clipBounds); |
| 79 void drawPosTextAsPath(const SkPaint& origPaint, const SkMatrix& viewMatrix, | 78 void drawPosTextAsPath(const SkPaint& origPaint, const SkMatrix& viewMatrix, |
| 80 const char text[], size_t byteLength, | 79 const char text[], size_t byteLength, |
| 81 const SkScalar pos[], int scalarsPerPosition, | 80 const SkScalar pos[], int scalarsPerPosition, |
| 82 const SkPoint& offset, const SkIRect& clipBounds); | 81 const SkPoint& offset, const SkIRect& clipBounds); |
| 83 | 82 |
| 84 void init(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPaint&, | 83 void init(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPaint&, |
| 85 const SkIRect& regionClipBounds); | 84 const SkIRect& regionClipBounds); |
| 86 void finish() { fDrawTarget = NULL; } | |
| 87 | 85 |
| 88 static GrFontScaler* GetGrFontScaler(SkGlyphCache* cache); | 86 static GrFontScaler* GetGrFontScaler(SkGlyphCache* cache); |
| 89 // sets extent in stopVector and returns glyph count | 87 // sets extent in stopVector and returns glyph count |
| 90 static int MeasureText(SkGlyphCache* cache, SkDrawCacheProc glyphCacheProc, | 88 static int MeasureText(SkGlyphCache* cache, SkDrawCacheProc glyphCacheProc, |
| 91 const char text[], size_t byteLength, SkVector* stopV
ector); | 89 const char text[], size_t byteLength, SkVector* stopV
ector); |
| 92 | 90 |
| 93 friend class BitmapTextBatch; | 91 friend class BitmapTextBatch; |
| 94 }; | 92 }; |
| 95 | 93 |
| 96 #endif | 94 #endif |
| OLD | NEW |