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

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

Issue 22686002: Implement path cover with nv_path_rendering (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: fix a comment Created 7 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « src/gpu/GrGpu.cpp ('k') | src/gpu/GrInOrderDrawBuffer.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 2011 Google Inc. 2 * Copyright 2011 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 GrInOrderDrawBuffer_DEFINED 8 #ifndef GrInOrderDrawBuffer_DEFINED
9 #define GrInOrderDrawBuffer_DEFINED 9 #define GrInOrderDrawBuffer_DEFINED
10 10
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 virtual void clipWillBeSet(const GrClipData* newClip) SK_OVERRIDE; 80 virtual void clipWillBeSet(const GrClipData* newClip) SK_OVERRIDE;
81 81
82 private: 82 private:
83 enum Cmd { 83 enum Cmd {
84 kDraw_Cmd = 1, 84 kDraw_Cmd = 1,
85 kStencilPath_Cmd = 2, 85 kStencilPath_Cmd = 2,
86 kSetState_Cmd = 3, 86 kSetState_Cmd = 3,
87 kSetClip_Cmd = 4, 87 kSetClip_Cmd = 4,
88 kClear_Cmd = 5, 88 kClear_Cmd = 5,
89 kCopySurface_Cmd = 6, 89 kCopySurface_Cmd = 6,
90 kFillPath_Cmd = 7,
90 }; 91 };
91 92
92 class DrawRecord : public DrawInfo { 93 class DrawRecord : public DrawInfo {
93 public: 94 public:
94 DrawRecord(const DrawInfo& info) : DrawInfo(info) {} 95 DrawRecord(const DrawInfo& info) : DrawInfo(info) {}
95 const GrVertexBuffer* fVertexBuffer; 96 const GrVertexBuffer* fVertexBuffer;
96 const GrIndexBuffer* fIndexBuffer; 97 const GrIndexBuffer* fIndexBuffer;
97 }; 98 };
98 99
99 struct StencilPath : public ::SkNoncopyable { 100 struct StencilPath : public ::SkNoncopyable {
100 StencilPath(); 101 StencilPath();
101 102
102 SkAutoTUnref<const GrPath> fPath; 103 SkAutoTUnref<const GrPath> fPath;
103 SkStrokeRec fStroke; 104 SkStrokeRec fStroke;
104 SkPath::FillType fFill; 105 SkPath::FillType fFill;
105 }; 106 };
106 107
108 struct FillPath : public ::SkNoncopyable {
109 FillPath();
110
111 SkAutoTUnref<const GrPath> fPath;
112 SkStrokeRec fStroke;
113 SkPath::FillType fFill;
114 GrDeviceCoordTexture fDstCopy;
115 };
116
107 struct Clear : public ::SkNoncopyable { 117 struct Clear : public ::SkNoncopyable {
108 Clear() : fRenderTarget(NULL) {} 118 Clear() : fRenderTarget(NULL) {}
109 ~Clear() { SkSafeUnref(fRenderTarget); } 119 ~Clear() { SkSafeUnref(fRenderTarget); }
110 120
111 SkIRect fRect; 121 SkIRect fRect;
112 GrColor fColor; 122 GrColor fColor;
113 GrRenderTarget* fRenderTarget; 123 GrRenderTarget* fRenderTarget;
114 }; 124 };
115 125
116 struct CopySurface : public ::SkNoncopyable { 126 struct CopySurface : public ::SkNoncopyable {
117 SkAutoTUnref<GrSurface> fDst; 127 SkAutoTUnref<GrSurface> fDst;
118 SkAutoTUnref<GrSurface> fSrc; 128 SkAutoTUnref<GrSurface> fSrc;
119 SkIRect fSrcRect; 129 SkIRect fSrcRect;
120 SkIPoint fDstPoint; 130 SkIPoint fDstPoint;
121 }; 131 };
122 132
123 // overrides from GrDrawTarget 133 // overrides from GrDrawTarget
124 virtual void onDraw(const DrawInfo&) SK_OVERRIDE; 134 virtual void onDraw(const DrawInfo&) SK_OVERRIDE;
125 virtual void onDrawRect(const SkRect& rect, 135 virtual void onDrawRect(const SkRect& rect,
126 const SkMatrix* matrix, 136 const SkMatrix* matrix,
127 const SkRect* localRect, 137 const SkRect* localRect,
128 const SkMatrix* localMatrix) SK_OVERRIDE; 138 const SkMatrix* localMatrix) SK_OVERRIDE;
129 virtual void onStencilPath(const GrPath*, const SkStrokeRec& stroke, SkPath: :FillType) SK_OVERRIDE; 139 virtual void onStencilPath(const GrPath*, const SkStrokeRec& stroke, SkPath: :FillType) SK_OVERRIDE;
140 virtual void onFillPath(const GrPath*, const SkStrokeRec& stroke, SkPath::Fi llType,
141 const GrDeviceCoordTexture* dstCopy) SK_OVERRIDE;
130 virtual bool onReserveVertexSpace(size_t vertexSize, 142 virtual bool onReserveVertexSpace(size_t vertexSize,
131 int vertexCount, 143 int vertexCount,
132 void** vertices) SK_OVERRIDE; 144 void** vertices) SK_OVERRIDE;
133 virtual bool onReserveIndexSpace(int indexCount, 145 virtual bool onReserveIndexSpace(int indexCount,
134 void** indices) SK_OVERRIDE; 146 void** indices) SK_OVERRIDE;
135 virtual void releaseReservedVertexSpace() SK_OVERRIDE; 147 virtual void releaseReservedVertexSpace() SK_OVERRIDE;
136 virtual void releaseReservedIndexSpace() SK_OVERRIDE; 148 virtual void releaseReservedIndexSpace() SK_OVERRIDE;
137 virtual void onSetVertexSourceToArray(const void* vertexArray, 149 virtual void onSetVertexSourceToArray(const void* vertexArray,
138 int vertexCount) SK_OVERRIDE; 150 int vertexCount) SK_OVERRIDE;
139 virtual void onSetIndexSourceToArray(const void* indexArray, 151 virtual void onSetIndexSourceToArray(const void* indexArray,
(...skipping 22 matching lines...) Expand all
162 // we lazily record state and clip changes in order to skip clips and states that have no 174 // we lazily record state and clip changes in order to skip clips and states that have no
163 // effect. 175 // effect.
164 bool needsNewState() const; 176 bool needsNewState() const;
165 bool needsNewClip() const; 177 bool needsNewClip() const;
166 178
167 // these functions record a command 179 // these functions record a command
168 void recordState(); 180 void recordState();
169 void recordClip(); 181 void recordClip();
170 DrawRecord* recordDraw(const DrawInfo&); 182 DrawRecord* recordDraw(const DrawInfo&);
171 StencilPath* recordStencilPath(); 183 StencilPath* recordStencilPath();
184 FillPath* recordFillPath();
172 Clear* recordClear(); 185 Clear* recordClear();
173 CopySurface* recordCopySurface(); 186 CopySurface* recordCopySurface();
174 187
175 // TODO: Use a single allocator for commands and records 188 // TODO: Use a single allocator for commands and records
176 enum { 189 enum {
177 kCmdPreallocCnt = 32, 190 kCmdPreallocCnt = 32,
178 kDrawPreallocCnt = 8, 191 kDrawPreallocCnt = 8,
179 kStencilPathPreallocCnt = 8, 192 kStencilPathPreallocCnt = 8,
193 kFillPathPreallocCnt = 8,
180 kStatePreallocCnt = 8, 194 kStatePreallocCnt = 8,
181 kClipPreallocCnt = 8, 195 kClipPreallocCnt = 8,
182 kClearPreallocCnt = 4, 196 kClearPreallocCnt = 4,
183 kGeoPoolStatePreAllocCnt = 4, 197 kGeoPoolStatePreAllocCnt = 4,
184 kCopySurfacePreallocCnt = 4, 198 kCopySurfacePreallocCnt = 4,
185 }; 199 };
186 200
187 SkSTArray<kCmdPreallocCnt, uint8_t, true> fCmds; 201 SkSTArray<kCmdPreallocCnt, uint8_t, true> fCmds;
188 GrSTAllocator<kDrawPreallocCnt, DrawRecord> fDraws; 202 GrSTAllocator<kDrawPreallocCnt, DrawRecord> fDraws;
189 GrSTAllocator<kStatePreallocCnt, StencilPath> fStencilP aths; 203 GrSTAllocator<kStatePreallocCnt, StencilPath> fStencilP aths;
204 GrSTAllocator<kStatePreallocCnt, FillPath> fFillPath s;
190 GrSTAllocator<kStatePreallocCnt, GrDrawState::DeferredState> fStates; 205 GrSTAllocator<kStatePreallocCnt, GrDrawState::DeferredState> fStates;
191 GrSTAllocator<kClearPreallocCnt, Clear> fClears; 206 GrSTAllocator<kClearPreallocCnt, Clear> fClears;
192 GrSTAllocator<kCopySurfacePreallocCnt, CopySurface> fCopySurf aces; 207 GrSTAllocator<kCopySurfacePreallocCnt, CopySurface> fCopySurf aces;
193 GrSTAllocator<kClipPreallocCnt, SkClipStack> fClips; 208 GrSTAllocator<kClipPreallocCnt, SkClipStack> fClips;
194 GrSTAllocator<kClipPreallocCnt, SkIPoint> fClipOrig ins; 209 GrSTAllocator<kClipPreallocCnt, SkIPoint> fClipOrig ins;
195 210
196 GrDrawTarget* fDstGpu; 211 GrDrawTarget* fDstGpu;
197 212
198 bool fClipSet; 213 bool fClipSet;
199 214
(...skipping 24 matching lines...) Expand all
224 239
225 virtual bool isIssued(uint32_t drawID) { return drawID != fDrawID; } 240 virtual bool isIssued(uint32_t drawID) { return drawID != fDrawID; }
226 241
227 bool fFlushing; 242 bool fFlushing;
228 uint32_t fDrawID; 243 uint32_t fDrawID;
229 244
230 typedef GrDrawTarget INHERITED; 245 typedef GrDrawTarget INHERITED;
231 }; 246 };
232 247
233 #endif 248 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrGpu.cpp ('k') | src/gpu/GrInOrderDrawBuffer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698