Chromium Code Reviews| Index: src/gpu/GrTextContext.h |
| diff --git a/src/gpu/GrTextContext.h b/src/gpu/GrTextContext.h |
| index d333c631413f751d3b89378f921b4dee815e9994..da585eb69507e52ca4cbf79df5a51d8ebf4b6079 100644 |
| --- a/src/gpu/GrTextContext.h |
| +++ b/src/gpu/GrTextContext.h |
| @@ -19,6 +19,7 @@ class GrClip; |
| class GrContext; |
| class GrDrawTarget; |
| class GrFontScaler; |
| +class SkGpuDevice; |
| /* |
| * This class wraps the state for a single text render |
| @@ -27,18 +28,22 @@ class GrTextContext { |
| public: |
| virtual ~GrTextContext(); |
| - bool drawText(GrRenderTarget* rt, const GrClip&, const GrPaint&, const SkPaint&, |
| + void drawText(GrRenderTarget* rt, const GrClip&, const GrPaint&, const SkPaint&, |
| const SkMatrix& viewMatrix, const char text[], size_t byteLength, SkScalar x, |
| - SkScalar y); |
| - bool drawPosText(GrRenderTarget* rt, const GrClip&, const GrPaint&, const SkPaint&, |
| + SkScalar y, const SkIRect& clipBounds); |
| + void drawPosText(GrRenderTarget* rt, const GrClip&, const GrPaint&, const SkPaint&, |
| const SkMatrix& viewMatrix, |
| const char text[], size_t byteLength, |
| const SkScalar pos[], int scalarsPerPosition, |
| - const SkPoint& offset); |
| + const SkPoint& offset, const SkIRect& clipBounds); |
| protected: |
| GrTextContext* fFallbackTextContext; |
| GrContext* fContext; |
| + // TODO we probably don't really need to store a back pointer to the owning SkGpuDevice, except |
| + // we need to be able to call drawPath on it in the event no other text context can draw the |
| + // text. We might be able to move this logic to context though. |
|
robertphillips
2015/03/18 19:52:13
// Note: this is unreffed ?
|
| + SkGpuDevice* fGpuDevice; |
| SkDeviceProperties fDeviceProperties; |
| SkAutoTUnref<GrRenderTarget> fRenderTarget; |
| @@ -48,7 +53,7 @@ protected: |
| GrPaint fPaint; |
| SkPaint fSkPaint; |
| - GrTextContext(GrContext*, const SkDeviceProperties&); |
| + GrTextContext(GrContext*, SkGpuDevice*, const SkDeviceProperties&); |
| virtual bool canDraw(const SkPaint& paint, const SkMatrix& viewMatrix) = 0; |
| @@ -61,6 +66,14 @@ protected: |
| const SkScalar pos[], int scalarsPerPosition, |
| const SkPoint& offset) = 0; |
|
robertphillips
2015/03/18 19:52:13
skPaint -> origPaint ?
|
| + void drawTextAsPath(const SkPaint& skPaint, const SkMatrix& viewMatrix, |
| + const char text[], size_t byteLength, SkScalar x, SkScalar y, |
| + const SkIRect& clipBounds); |
| + void drawPosTextAsPath(const SkPaint& origPaint, const SkMatrix& viewMatrix, |
| + const char text[], size_t byteLength, |
| + const SkScalar pos[], int scalarsPerPosition, |
| + const SkPoint& offset, const SkIRect& clipBounds); |
| + |
| void init(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPaint&); |
| void finish() { fDrawTarget = NULL; } |
| @@ -68,6 +81,9 @@ protected: |
| // sets extent in stopVector and returns glyph count |
| static int MeasureText(SkGlyphCache* cache, SkDrawCacheProc glyphCacheProc, |
| const char text[], size_t byteLength, SkVector* stopVector); |
| + |
| + friend class GrDistanceFieldTextContext; |
| + friend class GrStencilAndCoverTextContext; |
| }; |
| #endif |