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

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

Issue 1315563003: GrPathRangeBatch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix init order warning Created 5 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/GrReorderCommandBuilder.h ('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 "GrDrawTarget.h" 12 #include "GrDrawTarget.h"
13 #include "GrStrokeInfo.h" 13 #include "GrStrokeInfo.h"
14 14
15 class GrTextStrike; 15 class GrTextStrike;
16 class GrPath; 16 class GrPath;
17 class GrPathRange; 17 class GrPathRange;
18 class GrPathRangeDraw;
18 class SkSurfaceProps; 19 class SkSurfaceProps;
19 20
20 /* 21 /*
21 * This class implements text rendering using stencil and cover path rendering 22 * This class implements text rendering using stencil and cover path rendering
22 * (by the means of GrDrawTarget::drawPath). 23 * (by the means of GrDrawTarget::drawPath).
23 * This class exposes the functionality through GrTextContext interface. 24 * This class exposes the functionality through GrTextContext interface.
24 */ 25 */
25 class GrStencilAndCoverTextContext : public GrTextContext { 26 class GrStencilAndCoverTextContext : public GrTextContext {
26 public: 27 public:
27 static GrStencilAndCoverTextContext* Create(GrContext*, const SkSurfaceProps &); 28 static GrStencilAndCoverTextContext* Create(GrContext*, const SkSurfaceProps &);
28 29
29 virtual ~GrStencilAndCoverTextContext(); 30 virtual ~GrStencilAndCoverTextContext();
30 31
31 private: 32 private:
32 static const int kGlyphBufferSize = 1024;
33
34 enum RenderMode { 33 enum RenderMode {
35 /** 34 /**
36 * This is the render mode used by drawText(), which is mainly used by 35 * This is the render mode used by drawText(), which is mainly used by
37 * the Skia unit tests. It tries match the other text backends exactly, 36 * the Skia unit tests. It tries match the other text backends exactly,
38 * with the exception of not implementing LCD text, and doing anti- 37 * with the exception of not implementing LCD text, and doing anti-
39 * aliasing with the built-in MSAA. 38 * aliasing with the built-in MSAA.
40 */ 39 */
41 kMaxAccuracy_RenderMode, 40 kMaxAccuracy_RenderMode,
42 41
43 /** 42 /**
44 * This is the render mode used by drawPosText(). It ignores hinting and 43 * This is the render mode used by drawPosText(). It ignores hinting and
45 * LCD text, even if the client provided positions for hinted glyphs, 44 * LCD text, even if the client provided positions for hinted glyphs,
46 * and renders from a canonically-sized, generic set of paths for the 45 * and renders from a canonically-sized, generic set of paths for the
47 * given typeface. In the future we should work out a system for the 46 * given typeface. In the future we should work out a system for the
48 * client to know it should not provide hinted glyph positions. This 47 * client to know it should not provide hinted glyph positions. This
49 * render mode also tries to use GPU stroking for fake bold, even when 48 * render mode also tries to use GPU stroking for fake bold, even when
50 * SK_USE_FREETYPE_EMBOLDEN is set. 49 * SK_USE_FREETYPE_EMBOLDEN is set.
51 */ 50 */
52 kMaxPerformance_RenderMode, 51 kMaxPerformance_RenderMode,
53 }; 52 };
54 53
55 SkScalar fTextRatio; 54 SkScalar fTextRatio;
56 float fTextInverseRatio; 55 float fTextInverseRatio;
57 SkGlyphCache* fGlyphCache; 56 SkGlyphCache* fGlyphCache;
57
58 GrPathRange* fGlyphs; 58 GrPathRange* fGlyphs;
59 GrPathRangeDraw* fDraw;
59 GrStrokeInfo fStroke; 60 GrStrokeInfo fStroke;
60 uint16_t fGlyphIndices[kGlyphBuff erSize]; 61 SkSTArray<32, uint16_t, true> fFallbackIndices;
61 SkPoint fGlyphPositions[kGlyphBu fferSize]; 62 SkSTArray<32, SkPoint, true> fFallbackPositions;
62 int fQueuedGlyphCount; 63
63 int fFallbackGlyphsIdx;
64 SkMatrix fContextInitialMatrix; 64 SkMatrix fContextInitialMatrix;
65 SkMatrix fViewMatrix; 65 SkMatrix fViewMatrix;
66 SkMatrix fLocalMatrix; 66 SkMatrix fLocalMatrix;
67 bool fUsingDeviceSpaceGlyphs; 67 bool fUsingDeviceSpaceGlyphs;
68 SkAutoTUnref<GrRenderTarget> fRenderTarget; 68 SkAutoTUnref<GrRenderTarget> fRenderTarget;
69 GrClip fClip; 69 GrClip fClip;
70 SkIRect fClipRect; 70 SkIRect fClipRect;
71 SkIRect fRegionClipBounds; 71 SkIRect fRegionClipBounds;
72 GrPaint fPaint; 72 GrPaint fPaint;
73 SkPaint fSkPaint; 73 SkPaint fSkPaint;
(...skipping 11 matching lines...) Expand all
85 const GrClip&, const GrPaint&, const SkPaint&, 85 const GrClip&, const GrPaint&, const SkPaint&,
86 const SkMatrix& viewMatrix, 86 const SkMatrix& viewMatrix,
87 const char text[], size_t byteLength, 87 const char text[], size_t byteLength,
88 const SkScalar pos[], int scalarsPerPosition, 88 const SkScalar pos[], int scalarsPerPosition,
89 const SkPoint& offset, const SkIRect& regionClipBounds) o verride; 89 const SkPoint& offset, const SkIRect& regionClipBounds) o verride;
90 90
91 void init(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPaint&, 91 void init(GrRenderTarget*, const GrClip&, const GrPaint&, const SkPaint&,
92 size_t textByteLength, RenderMode, const SkMatrix& viewMatrix, 92 size_t textByteLength, RenderMode, const SkMatrix& viewMatrix,
93 const SkIRect& regionClipBounds); 93 const SkIRect& regionClipBounds);
94 bool mapToFallbackContext(SkMatrix* inverse); 94 bool mapToFallbackContext(SkMatrix* inverse);
95 void appendGlyph(GrDrawContext* dc, const SkGlyph&, const SkPoint&); 95 void appendGlyph(const SkGlyph&, const SkPoint&);
96 void flush(GrDrawContext* dc); 96 void flush(GrDrawContext* dc);
97 void finish(GrDrawContext* dc); 97 void finish(GrDrawContext* dc);
98 98
99 typedef GrTextContext INHERITED;
99 }; 100 };
100 101
101 #endif 102 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrReorderCommandBuilder.h ('k') | src/gpu/GrStencilAndCoverTextContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698