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

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

Issue 563283004: Use per-typeface sets of glyphs for nvpr text (Closed) Base URL: https://skia.googlesource.com/skia.git@upload_glyphmemorypath
Patch Set: Touch up fake bold stroking Created 6 years, 3 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/GrPathRendering.cpp ('k') | src/gpu/GrStencilAndCoverTextContext.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 2014 Google Inc. 2 * Copyright 2014 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 GrStencilAndCoverTextContext_DEFINED 8 #ifndef GrStencilAndCoverTextContext_DEFINED
9 #define GrStencilAndCoverTextContext_DEFINED 9 #define GrStencilAndCoverTextContext_DEFINED
10 10
11 #include "GrTextContext.h" 11 #include "GrTextContext.h"
12 #include "GrDrawState.h" 12 #include "GrDrawState.h"
13 #include "GrDrawTarget.h" 13 #include "GrDrawTarget.h"
14 #include "SkStrokeRec.h" 14 #include "SkStrokeRec.h"
15 15
16 class GrTextStrike; 16 class GrTextStrike;
17 class GrPath; 17 class GrPath;
18 class GrPathRange;
18 19
19 /* 20 /*
20 * This class implements text rendering using stencil and cover path rendering 21 * This class implements text rendering using stencil and cover path rendering
21 * (by the means of GrDrawTarget::drawPath). 22 * (by the means of GrDrawTarget::drawPath).
22 * This class exposes the functionality through GrTextContext interface. 23 * This class exposes the functionality through GrTextContext interface.
23 */ 24 */
24 class GrStencilAndCoverTextContext : public GrTextContext { 25 class GrStencilAndCoverTextContext : public GrTextContext {
25 public: 26 public:
26 GrStencilAndCoverTextContext(GrContext*, const SkDeviceProperties&); 27 GrStencilAndCoverTextContext(GrContext*, const SkDeviceProperties&);
27 virtual ~GrStencilAndCoverTextContext(); 28 virtual ~GrStencilAndCoverTextContext();
28 29
29 virtual void drawText(const GrPaint&, const SkPaint&, const char text[], 30 virtual void drawText(const GrPaint&, const SkPaint&, const char text[],
30 size_t byteLength, 31 size_t byteLength,
31 SkScalar x, SkScalar y) SK_OVERRIDE; 32 SkScalar x, SkScalar y) SK_OVERRIDE;
32 virtual void drawPosText(const GrPaint&, const SkPaint&, 33 virtual void drawPosText(const GrPaint&, const SkPaint&,
33 const char text[], size_t byteLength, 34 const char text[], size_t byteLength,
34 const SkScalar pos[], SkScalar constY, 35 const SkScalar pos[], SkScalar constY,
35 int scalarsPerPosition) SK_OVERRIDE; 36 int scalarsPerPosition) SK_OVERRIDE;
36 37
37 virtual bool canDraw(const SkPaint& paint) SK_OVERRIDE; 38 virtual bool canDraw(const SkPaint& paint) SK_OVERRIDE;
38 39
39 private: 40 private:
40 class GlyphPathRange;
41 static const int kGlyphBufferSize = 1024; 41 static const int kGlyphBufferSize = 1024;
42 42
43 enum DeviceSpaceGlyphsBehavior { 43 enum RenderMode {
bsalomon 2014/09/17 20:57:29 Maybe some comment here on the nature of the short
Chris Dalton 2014/09/17 22:22:56 Done.
44 kUseIfNeeded_DeviceSpaceGlyphsBehavior, 44 kMaxAccuracy_RenderMode,
45 kDoNotUse_DeviceSpaceGlyphsBehavior, 45 kMaxPerformance_RenderMode,
46 }; 46 };
47 void init(const GrPaint&, const SkPaint&, size_t textByteLength, 47 void init(const GrPaint&, const SkPaint&, size_t textByteLength,
48 DeviceSpaceGlyphsBehavior, SkScalar textTranslateY = 0); 48 RenderMode, SkScalar textTranslateY = 0);
49 void initGlyphs(SkGlyphCache* cache); 49 void initGlyphs(SkGlyphCache* cache);
50 void appendGlyph(uint16_t glyphID, float x); 50 void appendGlyph(uint16_t glyphID, float x);
51 void appendGlyph(uint16_t glyphID, float x, float y); 51 void appendGlyph(uint16_t glyphID, float x, float y);
52 void flush(); 52 void flush();
53 void finish(); 53 void finish();
54 54
55 GrDrawState::AutoRestoreEffects fStateRestore; 55 GrDrawState::AutoRestoreEffects fStateRestore;
56 SkScalar fTextRatio; 56 SkScalar fTextRatio;
57 float fTextInverseRatio; 57 float fTextInverseRatio;
58 SkStrokeRec fStroke;
59 SkGlyphCache* fGlyphCache; 58 SkGlyphCache* fGlyphCache;
60 GlyphPathRange* fGlyphs; 59 GrPathRange* fGlyphs;
61 uint32_t fIndexBuffer[kGlyphBufferSize]; 60 uint32_t fIndexBuffer[kGlyphBufferSize];
62 float fTransformBuffer[2 * kGlyphBufferSize]; 61 float fTransformBuffer[2 * kGlyphBufferSize];
63 GrDrawTarget::PathTransformType fTransformType; 62 GrDrawTarget::PathTransformType fTransformType;
64 int fPendingGlyphCount; 63 int fPendingGlyphCount;
65 SkMatrix fContextInitialMatrix; 64 SkMatrix fContextInitialMatrix;
66 bool fNeedsDeviceSpaceGlyphs; 65 bool fNeedsDeviceSpaceGlyphs;
67 }; 66 };
68 67
69 #endif 68 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrPathRendering.cpp ('k') | src/gpu/GrStencilAndCoverTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698