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

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

Issue 150743002: Replace factory generation of TextContexts with persistent objects. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: And an if statement 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 | « src/gpu/GrBitmapTextContext.cpp ('k') | src/gpu/GrDistanceFieldTextContext.cpp » ('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 GrDistanceFieldTextContext(GrContext*, const SkDeviceProperties&);
21 virtual void drawPosText(const char text[], size_t byteLength, 21 virtual ~GrDistanceFieldTextContext();
22
23 virtual void drawText(const GrPaint&, const SkPaint&, const char text[], siz e_t byteLength,
24 SkScalar x, SkScalar y) SK_OVERRIDE;
25 virtual void drawPosText(const GrPaint&, const SkPaint&,
26 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
25 static bool CanDraw(const SkPaint& paint, const SkMatrix& ctm); 30 virtual bool canDraw(const SkPaint& paint) SK_OVERRIDE;
26 31
27 private: 32 private:
28 GrDistanceFieldTextContext(GrContext*, const GrPaint&, const SkPaint&,
29 const SkDeviceProperties&);
30 virtual ~GrDistanceFieldTextContext();
31 friend class GrTTextContextManager<GrDistanceFieldTextContext>;
32
33 GrTextStrike* fStrike; 33 GrTextStrike* fStrike;
34 SkScalar fTextRatio; 34 SkScalar fTextRatio;
35 35
36 void init(const GrPaint&, const SkPaint&);
36 void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top, GrFontSca ler*); 37 void drawPackedGlyph(GrGlyph::PackedID, GrFixed left, GrFixed top, GrFontSca ler*);
37 void flushGlyphs(); // automatically called by destructor 38 void flushGlyphs(); // automatically called by destructor
39 void finish();
38 40
39 enum { 41 enum {
40 kMinRequestedGlyphs = 1, 42 kMinRequestedGlyphs = 1,
41 kDefaultRequestedGlyphs = 64, 43 kDefaultRequestedGlyphs = 64,
42 kMinRequestedVerts = kMinRequestedGlyphs * 4, 44 kMinRequestedVerts = kMinRequestedGlyphs * 4,
43 kDefaultRequestedVerts = kDefaultRequestedGlyphs * 4, 45 kDefaultRequestedVerts = kDefaultRequestedGlyphs * 4,
44 }; 46 };
45 47
46 SkPoint* fVertices; 48 SkPoint* fVertices;
47 int32_t fMaxVertices; 49 int32_t fMaxVertices;
48 GrTexture* fCurrTexture; 50 GrTexture* fCurrTexture;
49 int fCurrVertex; 51 int fCurrVertex;
50 }; 52 };
51 53
52 #endif 54 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrBitmapTextContext.cpp ('k') | src/gpu/GrDistanceFieldTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698