Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(463)

Side by Side Diff: include/gpu/GrDistanceFieldTextContext.h

Issue 135683006: Add fallback code for TextContexts that don't support all features (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix nits Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/gpu/GrBitmapTextContext.h ('k') | include/gpu/GrTextContext.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 GrDistanceFieldTextContext_DEFINED 8 #ifndef GrDistanceFieldTextContext_DEFINED
9 #define GrDistanceFieldTextContext_DEFINED 9 #define GrDistanceFieldTextContext_DEFINED
10 10
11 #include "GrTextContext.h" 11 #include "GrTextContext.h"
12 12
13 class GrTextStrike; 13 class GrTextStrike;
14 14
15 /* 15 /*
16 * This class implements GrTextContext using distance field fonts 16 * This class implements GrTextContext using distance field fonts
17 */ 17 */
18 class GrDistanceFieldTextContext : public GrTextContext { 18 class GrDistanceFieldTextContext : public GrTextContext {
19 public: 19 public:
20 virtual void drawText(const char text[], size_t byteLength, SkScalar x, SkSc alar y) SK_OVERRIDE; 20 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, 21 virtual void drawPosText(const char text[], size_t byteLength,
22 const SkScalar pos[], SkScalar constY, 22 const SkScalar pos[], SkScalar constY,
23 int scalarsPerPosition) SK_OVERRIDE; 23 int scalarsPerPosition) SK_OVERRIDE;
24
25 static bool CanDraw(const SkPaint& paint, const SkMatrix& ctm);
24 26
25 private: 27 private:
26 GrDistanceFieldTextContext(GrContext*, const GrPaint&, const SkPaint&, 28 GrDistanceFieldTextContext(GrContext*, const GrPaint&, const SkPaint&,
27 const SkDeviceProperties&); 29 const SkDeviceProperties&);
28 virtual ~GrDistanceFieldTextContext(); 30 virtual ~GrDistanceFieldTextContext();
29 friend class GrTTextContextManager<GrDistanceFieldTextContext>; 31 friend class GrTTextContextManager<GrDistanceFieldTextContext>;
30 32
31 GrTextStrike* fStrike; 33 GrTextStrike* fStrike;
32 SkScalar fTextRatio; 34 SkScalar fTextRatio;
33 35
34 void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top, GrFontSca ler*); 36 void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top, GrFontSca ler*);
35 void flushGlyphs(); // automatically called by destructor 37 void flushGlyphs(); // automatically called by destructor
36 38
37 enum { 39 enum {
38 kMinRequestedGlyphs = 1, 40 kMinRequestedGlyphs = 1,
39 kDefaultRequestedGlyphs = 64, 41 kDefaultRequestedGlyphs = 64,
40 kMinRequestedVerts = kMinRequestedGlyphs * 4, 42 kMinRequestedVerts = kMinRequestedGlyphs * 4,
41 kDefaultRequestedVerts = kDefaultRequestedGlyphs * 4, 43 kDefaultRequestedVerts = kDefaultRequestedGlyphs * 4,
42 }; 44 };
43 45
44 SkPoint* fVertices; 46 SkPoint* fVertices;
45 int32_t fMaxVertices; 47 int32_t fMaxVertices;
46 GrTexture* fCurrTexture; 48 GrTexture* fCurrTexture;
47 int fCurrVertex; 49 int fCurrVertex;
48 }; 50 };
49 51
50 #endif 52 #endif
OLDNEW
« no previous file with comments | « include/gpu/GrBitmapTextContext.h ('k') | include/gpu/GrTextContext.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698