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

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

Issue 141863005: Add standalone drawText for GrTextContext. (Closed) Base URL: https://skia.googlesource.com/skia.git@issue2018-factory
Patch Set: Some clean-up work. Created 6 years, 11 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
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 drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top, 20 void drawText(const char text[], size_t byteLength, SkScalar x, SkScalar y) SK_OVERRIDE;
bsalomon 2014/01/27 21:51:25 virtual? (and several more)
jvanverth1 2014/01/28 18:05:33 Done.
21 GrFontScaler*) SK_OVERRIDE;
22
23 void drawText(const char text[], size_t byteLength,
24 SkScalar x, SkScalar y, SkGlyphCache*, GrFontScaler*);
25 void drawPosText(const char text[], size_t byteLength, 21 void drawPosText(const char text[], size_t byteLength,
26 const SkScalar pos[], SkScalar constY, 22 const SkScalar pos[], SkScalar constY,
27 int scalarsPerPosition, 23 int scalarsPerPosition) SK_OVERRIDE;
28 SkGlyphCache* cache, GrFontScaler* fontScaler);
29
30 const SkPaint& getSkPaint() { return fSkPaint; }
31 24
32 private: 25 private:
33 GrDistanceFieldTextContext(GrContext*, const GrPaint&, const SkPaint&); 26 GrDistanceFieldTextContext(SkGpuDevice*, const GrPaint&, const SkPaint&);
34 virtual ~GrDistanceFieldTextContext(); 27 virtual ~GrDistanceFieldTextContext();
35 friend class GrTTextContextManager<GrDistanceFieldTextContext>; 28 friend class GrTTextContextManager<GrDistanceFieldTextContext>;
36 29
37 GrTextStrike* fStrike; 30 GrTextStrike* fStrike;
38 SkScalar fTextRatio; 31 SkScalar fTextRatio;
39 32
33 void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top, GrFontSca ler*);
40 void flushGlyphs(); // automatically called by destructor 34 void flushGlyphs(); // automatically called by destructor
41 35
42 enum { 36 enum {
43 kMinRequestedGlyphs = 1, 37 kMinRequestedGlyphs = 1,
44 kDefaultRequestedGlyphs = 64, 38 kDefaultRequestedGlyphs = 64,
45 kMinRequestedVerts = kMinRequestedGlyphs * 4, 39 kMinRequestedVerts = kMinRequestedGlyphs * 4,
46 kDefaultRequestedVerts = kDefaultRequestedGlyphs * 4, 40 kDefaultRequestedVerts = kDefaultRequestedGlyphs * 4,
47 }; 41 };
48 42
49 SkPoint* fVertices; 43 SkPoint* fVertices;
50 int32_t fMaxVertices; 44 int32_t fMaxVertices;
51 GrTexture* fCurrTexture; 45 GrTexture* fCurrTexture;
52 int fCurrVertex; 46 int fCurrVertex;
53 }; 47 };
54 48
55 #endif 49 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698