OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2014 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 8 #ifndef GrStencilAndCoverTextContext_DEFINED |
| 9 #define GrStencilAndCoverTextContext_DEFINED |
| 10 |
| 11 #include "GrTextContext.h" |
| 12 #include "GrDrawState.h" |
| 13 #include "SkStrokeRec.h" |
| 14 |
| 15 class GrTextStrike; |
| 16 class GrPath; |
| 17 |
| 18 /* |
| 19 * This class implements text rendering using stencil and cover path rendering |
| 20 * (by the means of GrDrawTarget::drawPath). |
| 21 * This class exposes the functionality through GrTextContext interface. |
| 22 */ |
| 23 class GrStencilAndCoverTextContext : public GrTextContext { |
| 24 public: |
| 25 GrStencilAndCoverTextContext(GrContext*, const SkDeviceProperties&); |
| 26 virtual ~GrStencilAndCoverTextContext(); |
| 27 |
| 28 virtual void drawText(const GrPaint&, const SkPaint&, const char text[], |
| 29 size_t byteLength, |
| 30 SkScalar x, SkScalar y) SK_OVERRIDE; |
| 31 virtual void drawPosText(const GrPaint&, const SkPaint&, |
| 32 const char text[], size_t byteLength, |
| 33 const SkScalar pos[], SkScalar constY, |
| 34 int scalarsPerPosition) SK_OVERRIDE; |
| 35 |
| 36 virtual bool canDraw(const SkPaint& paint) SK_OVERRIDE; |
| 37 |
| 38 private: |
| 39 void init(const GrPaint&, const SkPaint&, size_t textByteLength); |
| 40 void appendGlyph(GrGlyph::PackedID, const SkPoint&, |
| 41 GrTextStrike*, GrFontScaler*); |
| 42 void finish(); |
| 43 |
| 44 GrDrawState::AutoRestoreEffects fStateRestore; |
| 45 SkScalar fTextRatio; |
| 46 SkStrokeRec fStroke; |
| 47 SkPaint::Style fStyle; |
| 48 SkTDArray<const GrPath*> fPaths; |
| 49 SkTDArray<SkMatrix> fTransforms; |
| 50 SkPath fTmpPath; |
| 51 }; |
| 52 |
| 53 #endif |
OLD | NEW |