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

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: rebase 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
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 };
115
107 struct Clear : public ::SkNoncopyable { 116 struct Clear : public ::SkNoncopyable {
108 Clear() : fRenderTarget(NULL) {} 117 Clear() : fRenderTarget(NULL) {}
109 ~Clear() { SkSafeUnref(fRenderTarget); } 118 ~Clear() { SkSafeUnref(fRenderTarget); }
110 119
111 SkIRect fRect; 120 SkIRect fRect;
112 GrColor fColor; 121 GrColor fColor;
113 GrRenderTarget* fRenderTarget; 122 GrRenderTarget* fRenderTarget;
114 }; 123 };
115 124
116 struct CopySurface : public ::SkNoncopyable { 125 struct CopySurface : public ::SkNoncopyable {
117 SkAutoTUnref<GrSurface> fDst; 126 SkAutoTUnref<GrSurface> fDst;
118 SkAutoTUnref<GrSurface> fSrc; 127 SkAutoTUnref<GrSurface> fSrc;
119 SkIRect fSrcRect; 128 SkIRect fSrcRect;
120 SkIPoint fDstPoint; 129 SkIPoint fDstPoint;
121 }; 130 };
122 131
123 // overrides from GrDrawTarget 132 // overrides from GrDrawTarget
124 virtual void onDraw(const DrawInfo&) SK_OVERRIDE; 133 virtual void onDraw(const DrawInfo&) SK_OVERRIDE;
125 virtual void onDrawRect(const SkRect& rect, 134 virtual void onDrawRect(const SkRect& rect,
126 const SkMatrix* matrix, 135 const SkMatrix* matrix,
127 const SkRect* localRect, 136 const SkRect* localRect,
128 const SkMatrix* localMatrix) SK_OVERRIDE; 137 const SkMatrix* localMatrix) SK_OVERRIDE;
129 virtual void onStencilPath(const GrPath*, const SkStrokeRec& stroke, SkPath: :FillType) SK_OVERRIDE; 138 virtual void onStencilPath(const GrPath*, const SkStrokeRec& stroke, SkPath: :FillType) SK_OVERRIDE;
139 virtual void onFillPath(const GrPath*, const SkStrokeRec& stroke, SkPath::Fi llType) SK_OVERRIDE;
130 virtual bool onReserveVertexSpace(size_t vertexSize, 140 virtual bool onReserveVertexSpace(size_t vertexSize,
131 int vertexCount, 141 int vertexCount,
132 void** vertices) SK_OVERRIDE; 142 void** vertices) SK_OVERRIDE;
133 virtual bool onReserveIndexSpace(int indexCount, 143 virtual bool onReserveIndexSpace(int indexCount,
134 void** indices) SK_OVERRIDE; 144 void** indices) SK_OVERRIDE;
135 virtual void releaseReservedVertexSpace() SK_OVERRIDE; 145 virtual void releaseReservedVertexSpace() SK_OVERRIDE;
136 virtual void releaseReservedIndexSpace() SK_OVERRIDE; 146 virtual void releaseReservedIndexSpace() SK_OVERRIDE;
137 virtual void onSetVertexSourceToArray(const void* vertexArray, 147 virtual void onSetVertexSourceToArray(const void* vertexArray,
138 int vertexCount) SK_OVERRIDE; 148 int vertexCount) SK_OVERRIDE;
139 virtual void onSetIndexSourceToArray(const void* indexArray, 149 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 172 // we lazily record state and clip changes in order to skip clips and states that have no
163 // effect. 173 // effect.
164 bool needsNewState() const; 174 bool needsNewState() const;
165 bool needsNewClip() const; 175 bool needsNewClip() const;
166 176
167 // these functions record a command 177 // these functions record a command
168 void recordState(); 178 void recordState();
169 void recordClip(); 179 void recordClip();
170 DrawRecord* recordDraw(const DrawInfo&); 180 DrawRecord* recordDraw(const DrawInfo&);
171 StencilPath* recordStencilPath(); 181 StencilPath* recordStencilPath();
182 FillPath* recordFillPath();
172 Clear* recordClear(); 183 Clear* recordClear();
173 CopySurface* recordCopySurface(); 184 CopySurface* recordCopySurface();
174 185
175 // TODO: Use a single allocator for commands and records 186 // TODO: Use a single allocator for commands and records
176 enum { 187 enum {
177 kCmdPreallocCnt = 32, 188 kCmdPreallocCnt = 32,
178 kDrawPreallocCnt = 8, 189 kDrawPreallocCnt = 8,
179 kStencilPathPreallocCnt = 8, 190 kStencilPathPreallocCnt = 8,
191 kFillPathPreallocCnt = 8,
180 kStatePreallocCnt = 8, 192 kStatePreallocCnt = 8,
181 kClipPreallocCnt = 8, 193 kClipPreallocCnt = 8,
182 kClearPreallocCnt = 4, 194 kClearPreallocCnt = 4,
183 kGeoPoolStatePreAllocCnt = 4, 195 kGeoPoolStatePreAllocCnt = 4,
184 kCopySurfacePreallocCnt = 4, 196 kCopySurfacePreallocCnt = 4,
185 }; 197 };
186 198
187 SkSTArray<kCmdPreallocCnt, uint8_t, true> fCmds; 199 SkSTArray<kCmdPreallocCnt, uint8_t, true> fCmds;
188 GrSTAllocator<kDrawPreallocCnt, DrawRecord> fDraws; 200 GrSTAllocator<kDrawPreallocCnt, DrawRecord> fDraws;
189 GrSTAllocator<kStatePreallocCnt, StencilPath> fStencilP aths; 201 GrSTAllocator<kStatePreallocCnt, StencilPath> fStencilP aths;
202 GrSTAllocator<kStatePreallocCnt, FillPath> fFillPath s;
190 GrSTAllocator<kStatePreallocCnt, GrDrawState::DeferredState> fStates; 203 GrSTAllocator<kStatePreallocCnt, GrDrawState::DeferredState> fStates;
191 GrSTAllocator<kClearPreallocCnt, Clear> fClears; 204 GrSTAllocator<kClearPreallocCnt, Clear> fClears;
192 GrSTAllocator<kCopySurfacePreallocCnt, CopySurface> fCopySurf aces; 205 GrSTAllocator<kCopySurfacePreallocCnt, CopySurface> fCopySurf aces;
193 GrSTAllocator<kClipPreallocCnt, SkClipStack> fClips; 206 GrSTAllocator<kClipPreallocCnt, SkClipStack> fClips;
194 GrSTAllocator<kClipPreallocCnt, SkIPoint> fClipOrig ins; 207 GrSTAllocator<kClipPreallocCnt, SkIPoint> fClipOrig ins;
195 208
196 GrDrawTarget* fDstGpu; 209 GrDrawTarget* fDstGpu;
197 210
198 bool fClipSet; 211 bool fClipSet;
199 212
(...skipping 24 matching lines...) Expand all
224 237
225 virtual bool isIssued(uint32_t drawID) { return drawID != fDrawID; } 238 virtual bool isIssued(uint32_t drawID) { return drawID != fDrawID; }
226 239
227 bool fFlushing; 240 bool fFlushing;
228 uint32_t fDrawID; 241 uint32_t fDrawID;
229 242
230 typedef GrDrawTarget INHERITED; 243 typedef GrDrawTarget INHERITED;
231 }; 244 };
232 245
233 #endif 246 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698