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

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

Issue 144283002: Add factory class for generating various flavors of GrTextContext. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Add placement delete for ManagedTextContext 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
« 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 GrDistanceFieldTextContext(GrContext*, const GrPaint&, const SkPaint&);
21 virtual ~GrDistanceFieldTextContext();
22
23 virtual void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top, 20 virtual void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top,
24 GrFontScaler*) SK_OVERRIDE; 21 GrFontScaler*) SK_OVERRIDE;
25 22
26 void drawText(const char text[], size_t byteLength, 23 void drawText(const char text[], size_t byteLength,
27 SkScalar x, SkScalar y, SkGlyphCache*, GrFontScaler*); 24 SkScalar x, SkScalar y, SkGlyphCache*, GrFontScaler*);
28 void drawPosText(const char text[], size_t byteLength, 25 void drawPosText(const char text[], size_t byteLength,
29 const SkScalar pos[], SkScalar constY, 26 const SkScalar pos[], SkScalar constY,
30 int scalarsPerPosition, 27 int scalarsPerPosition,
31 SkGlyphCache* cache, GrFontScaler* fontScaler); 28 SkGlyphCache* cache, GrFontScaler* fontScaler);
32 29
33 const SkPaint& getSkPaint() { return fSkPaint; } 30 const SkPaint& getSkPaint() { return fSkPaint; }
34 31
35 private: 32 private:
33 GrDistanceFieldTextContext(GrContext*, const GrPaint&, const SkPaint&);
34 virtual ~GrDistanceFieldTextContext();
35 friend class GrTTextContextManager<GrDistanceFieldTextContext>;
36
36 GrTextStrike* fStrike; 37 GrTextStrike* fStrike;
37 SkScalar fTextRatio; 38 SkScalar fTextRatio;
38 39
39 void flushGlyphs(); // automatically called by destructor 40 void flushGlyphs(); // automatically called by destructor
40 41
41 enum { 42 enum {
42 kMinRequestedGlyphs = 1, 43 kMinRequestedGlyphs = 1,
43 kDefaultRequestedGlyphs = 64, 44 kDefaultRequestedGlyphs = 64,
44 kMinRequestedVerts = kMinRequestedGlyphs * 4, 45 kMinRequestedVerts = kMinRequestedGlyphs * 4,
45 kDefaultRequestedVerts = kDefaultRequestedGlyphs * 4, 46 kDefaultRequestedVerts = kDefaultRequestedGlyphs * 4,
46 }; 47 };
47 48
48 SkPaint fSkPaint;
49 SkPoint* fVertices; 49 SkPoint* fVertices;
50 int32_t fMaxVertices; 50 int32_t fMaxVertices;
51 GrTexture* fCurrTexture; 51 GrTexture* fCurrTexture;
52 int fCurrVertex; 52 int fCurrVertex;
53 }; 53 };
54 54
55 #endif 55 #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