Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 GrBitmapTextContext_DEFINED | 8 #ifndef GrBitmapTextContext_DEFINED |
| 9 #define GrBitmapTextContext_DEFINED | 9 #define GrBitmapTextContext_DEFINED |
| 10 | 10 |
| 11 #include "GrTextContext.h" | 11 #include "GrTextContext.h" |
| 12 | 12 |
| 13 #include "SkDraw.h" | |
| 14 | |
| 13 class GrTextStrike; | 15 class GrTextStrike; |
| 14 | 16 |
| 15 /* | 17 /* |
| 16 * This class implements GrTextContext using standard bitmap fonts | 18 * This class implements GrTextContext using standard bitmap fonts |
| 17 */ | 19 */ |
| 18 class GrBitmapTextContext : public GrTextContext { | 20 class GrBitmapTextContext : public GrTextContext { |
| 19 public: | 21 public: |
| 22 GrBitmapTextContext(GrContext*, const GrPaint&, const SkPaint&, const SkDevi ceProperties&); | |
| 23 virtual ~GrBitmapTextContext(); | |
| 24 | |
| 20 virtual void drawText(const char text[], size_t byteLength, SkScalar x, SkSc alar y) SK_OVERRIDE; | 25 virtual void drawText(const char text[], size_t byteLength, SkScalar x, SkSc alar y) SK_OVERRIDE; |
| 21 virtual void drawPosText(const char text[], size_t byteLength, | 26 virtual void drawPosText(const char text[], size_t byteLength, |
| 22 const SkScalar pos[], SkScalar constY, | 27 const SkScalar pos[], SkScalar constY, |
| 23 int scalarsPerPosition) SK_OVERRIDE; | 28 int scalarsPerPosition) SK_OVERRIDE; |
| 24 | 29 |
| 30 static bool CanDraw(const SkPaint& paint, const SkMatrix& ctm) { | |
| 31 return !SkDraw::ShouldDrawTextAsPaths(paint, ctm); | |
|
reed1
2014/01/29 17:18:56
If we move this impl into the .cpp, can we not add
jvanverth1
2014/01/29 19:25:59
Done.
| |
| 32 } | |
| 33 | |
| 25 private: | 34 private: |
| 26 GrBitmapTextContext(GrContext*, const GrPaint&, const SkPaint&, const SkDevi ceProperties&); | |
| 27 virtual ~GrBitmapTextContext(); | |
| 28 friend class GrTTextContextManager<GrBitmapTextContext>; | |
| 29 | |
| 30 GrTextStrike* fStrike; | 35 GrTextStrike* fStrike; |
| 31 | 36 |
| 32 void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top, GrFontSca ler*); | 37 void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top, GrFontSca ler*); |
| 33 void flushGlyphs(); // automatically called by destructor | 38 void flushGlyphs(); // automatically called by destructor |
| 34 | 39 |
| 35 enum { | 40 enum { |
| 36 kMinRequestedGlyphs = 1, | 41 kMinRequestedGlyphs = 1, |
| 37 kDefaultRequestedGlyphs = 64, | 42 kDefaultRequestedGlyphs = 64, |
| 38 kMinRequestedVerts = kMinRequestedGlyphs * 4, | 43 kMinRequestedVerts = kMinRequestedGlyphs * 4, |
| 39 kDefaultRequestedVerts = kDefaultRequestedGlyphs * 4, | 44 kDefaultRequestedVerts = kDefaultRequestedGlyphs * 4, |
| 40 }; | 45 }; |
| 41 | 46 |
| 42 SkPoint* fVertices; | 47 SkPoint* fVertices; |
| 43 int32_t fMaxVertices; | 48 int32_t fMaxVertices; |
| 44 GrTexture* fCurrTexture; | 49 GrTexture* fCurrTexture; |
| 45 int fCurrVertex; | 50 int fCurrVertex; |
| 46 }; | 51 }; |
| 47 | 52 |
| 48 #endif | 53 #endif |
| OLD | NEW |