| OLD | NEW |
| (Empty) |
| 1 /* | |
| 2 * Copyright 2010 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 GrTextContext_DEFINED | |
| 9 #define GrTextContext_DEFINED | |
| 10 | |
| 11 #include "GrClip.h" | |
| 12 #include "GrGlyph.h" | |
| 13 #include "GrPaint.h" | |
| 14 #include "SkSurfaceProps.h" | |
| 15 #include "SkPostConfig.h" | |
| 16 | |
| 17 class GrClip; | |
| 18 class GrContext; | |
| 19 class GrDrawContext; | |
| 20 class GrFontScaler; | |
| 21 class SkDrawFilter; | |
| 22 class SkTextBlob; | |
| 23 | |
| 24 /* | |
| 25 * This class wraps the state for a single text render | |
| 26 */ | |
| 27 class GrTextContext { | |
| 28 public: | |
| 29 virtual ~GrTextContext(); | |
| 30 | |
| 31 void drawText(GrDrawContext* dc, | |
| 32 const GrClip&, const GrPaint&, const SkPaint&, | |
| 33 const SkMatrix& viewMatrix, const char text[], size_t byteLeng
th, SkScalar x, | |
| 34 SkScalar y, const SkIRect& clipBounds); | |
| 35 void drawPosText(GrDrawContext* dc, | |
| 36 const GrClip&, const GrPaint&, const SkPaint&, | |
| 37 const SkMatrix& viewMatrix, | |
| 38 const char text[], size_t byteLength, | |
| 39 const SkScalar pos[], int scalarsPerPosition, | |
| 40 const SkPoint& offset, const SkIRect& clipBounds); | |
| 41 virtual void drawTextBlob(GrDrawContext* dc, const GrClip&, const SkPaint&, | |
| 42 const SkMatrix& viewMatrix, const SkTextBlob*, | |
| 43 SkScalar x, SkScalar y, | |
| 44 SkDrawFilter*, const SkIRect& clipBounds); | |
| 45 | |
| 46 static bool ShouldDisableLCD(const SkPaint& paint); | |
| 47 | |
| 48 protected: | |
| 49 GrTextContext* fFallbackTextContext; | |
| 50 GrContext* fContext; | |
| 51 SkSurfaceProps fSurfaceProps; | |
| 52 | |
| 53 GrTextContext(GrContext*, const SkSurfaceProps&); | |
| 54 | |
| 55 virtual bool canDraw(const SkPaint&, const SkMatrix& viewMatrix) = 0; | |
| 56 | |
| 57 virtual void onDrawText(GrDrawContext*, const GrClip&, | |
| 58 const GrPaint&, const SkPaint&, | |
| 59 const SkMatrix& viewMatrix, const char text[], size_
t byteLength, | |
| 60 SkScalar x, SkScalar y, const SkIRect& clipBounds) =
0; | |
| 61 virtual void onDrawPosText(GrDrawContext*, const GrClip&, | |
| 62 const GrPaint&, const SkPaint&, | |
| 63 const SkMatrix& viewMatrix, | |
| 64 const char text[], size_t byteLength, | |
| 65 const SkScalar pos[], int scalarsPerPosition, | |
| 66 const SkPoint& offset, const SkIRect& clipBounds)
= 0; | |
| 67 | |
| 68 static GrFontScaler* GetGrFontScaler(SkGlyphCache* cache); | |
| 69 static uint32_t FilterTextFlags(const SkSurfaceProps& surfaceProps, const Sk
Paint& paint); | |
| 70 | |
| 71 friend class GrAtlasTextBatch; | |
| 72 friend class GrAtlasTextBlob; // for FilterTextFlags | |
| 73 friend class GrTextUtils; // for some static functions | |
| 74 }; | |
| 75 | |
| 76 #endif | |
| OLD | NEW |