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

Side by Side Diff: src/gpu/GrAADistanceFieldPathRenderer.cpp

Issue 1275083002: Don't pass pipeline to GrBatch::generateGeometry() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 4 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/GrAAConvexPathRenderer.cpp ('k') | src/gpu/GrAAHairLinePathRenderer.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 /* 2 /*
3 * Copyright 2014 Google Inc. 3 * Copyright 2014 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "GrAADistanceFieldPathRenderer.h" 9 #include "GrAADistanceFieldPathRenderer.h"
10 10
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 fBatch.fCoverageIgnored = !init.readsCoverage(); 160 fBatch.fCoverageIgnored = !init.readsCoverage();
161 } 161 }
162 162
163 struct FlushInfo { 163 struct FlushInfo {
164 SkAutoTUnref<const GrVertexBuffer> fVertexBuffer; 164 SkAutoTUnref<const GrVertexBuffer> fVertexBuffer;
165 SkAutoTUnref<const GrIndexBuffer> fIndexBuffer; 165 SkAutoTUnref<const GrIndexBuffer> fIndexBuffer;
166 int fVertexOffset; 166 int fVertexOffset;
167 int fInstancesToFlush; 167 int fInstancesToFlush;
168 }; 168 };
169 169
170 void generateGeometry(GrBatchTarget* batchTarget, const GrPipeline* pipeline ) override { 170 void generateGeometry(GrBatchTarget* batchTarget) override {
171 int instanceCount = fGeoData.count(); 171 int instanceCount = fGeoData.count();
172 172
173 SkMatrix invert; 173 SkMatrix invert;
174 if (this->usesLocalCoords() && !this->viewMatrix().invert(&invert)) { 174 if (this->usesLocalCoords() && !this->viewMatrix().invert(&invert)) {
175 SkDebugf("Could not invert viewmatrix\n"); 175 SkDebugf("Could not invert viewmatrix\n");
176 return; 176 return;
177 } 177 }
178 178
179 uint32_t flags = 0; 179 uint32_t flags = 0;
180 flags |= this->viewMatrix().isSimilarity() ? kSimilarity_DistanceFieldEf fectFlag : 0; 180 flags |= this->viewMatrix().isSimilarity() ? kSimilarity_DistanceFieldEf fectFlag : 0;
181 181
182 GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kBil erp_FilterMode); 182 GrTextureParams params(SkShader::kRepeat_TileMode, GrTextureParams::kBil erp_FilterMode);
183 183
184 // Setup GrGeometryProcessor 184 // Setup GrGeometryProcessor
185 GrBatchAtlas* atlas = fAtlas; 185 GrBatchAtlas* atlas = fAtlas;
186 SkAutoTUnref<GrGeometryProcessor> dfProcessor( 186 SkAutoTUnref<GrGeometryProcessor> dfProcessor(
187 GrDistanceFieldPathGeoProc::Create(this->color(), 187 GrDistanceFieldPathGeoProc::Create(this->color(),
188 this->viewMatrix(), 188 this->viewMatrix(),
189 atlas->getTexture(), 189 atlas->getTexture(),
190 params, 190 params,
191 flags, 191 flags,
192 this->usesLocalCoords())); 192 this->usesLocalCoords()));
193 193
194 batchTarget->initDraw(dfProcessor, pipeline); 194 batchTarget->initDraw(dfProcessor, this->pipeline());
195 195
196 FlushInfo flushInfo; 196 FlushInfo flushInfo;
197 197
198 // allocate vertices 198 // allocate vertices
199 size_t vertexStride = dfProcessor->getVertexStride(); 199 size_t vertexStride = dfProcessor->getVertexStride();
200 SkASSERT(vertexStride == 2 * sizeof(SkPoint)); 200 SkASSERT(vertexStride == 2 * sizeof(SkPoint));
201 201
202 const GrVertexBuffer* vertexBuffer; 202 const GrVertexBuffer* vertexBuffer;
203 void* vertices = batchTarget->makeVertSpace(vertexStride, 203 void* vertices = batchTarget->makeVertSpace(vertexStride,
204 kVerticesPerQuad * instanceC ount, 204 kVerticesPerQuad * instanceC ount,
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
237 // Remove the stale cache entry 237 // Remove the stale cache entry
238 if (args.fPathData) { 238 if (args.fPathData) {
239 fPathCache->remove(args.fPathData->fKey); 239 fPathCache->remove(args.fPathData->fKey);
240 fPathList->remove(args.fPathData); 240 fPathList->remove(args.fPathData);
241 SkDELETE(args.fPathData); 241 SkDELETE(args.fPathData);
242 } 242 }
243 SkScalar scale = desiredDimension/maxDim; 243 SkScalar scale = desiredDimension/maxDim;
244 args.fPathData = SkNEW(PathData); 244 args.fPathData = SkNEW(PathData);
245 if (!this->addPathToAtlas(batchTarget, 245 if (!this->addPathToAtlas(batchTarget,
246 dfProcessor, 246 dfProcessor,
247 pipeline, 247 this->pipeline(),
248 &flushInfo, 248 &flushInfo,
249 atlas, 249 atlas,
250 args.fPathData, 250 args.fPathData,
251 args.fPath, 251 args.fPath,
252 args.fStroke, 252 args.fStroke,
253 args.fAntiAlias, 253 args.fAntiAlias,
254 desiredDimension, 254 desiredDimension,
255 scale)) { 255 scale)) {
256 SkDebugf("Can't rasterize path\n"); 256 SkDebugf("Can't rasterize path\n");
257 return; 257 return;
258 } 258 }
259 } 259 }
260 260
261 atlas->setLastUseToken(args.fPathData->fID, batchTarget->currentToke n()); 261 atlas->setLastUseToken(args.fPathData->fID, batchTarget->currentToke n());
262 262
263 // Now set vertices 263 // Now set vertices
264 intptr_t offset = reinterpret_cast<intptr_t>(vertices); 264 intptr_t offset = reinterpret_cast<intptr_t>(vertices);
265 offset += i * kVerticesPerQuad * vertexStride; 265 offset += i * kVerticesPerQuad * vertexStride;
266 SkPoint* positions = reinterpret_cast<SkPoint*>(offset); 266 SkPoint* positions = reinterpret_cast<SkPoint*>(offset);
267 this->writePathVertices(batchTarget, 267 this->writePathVertices(batchTarget,
268 atlas, 268 atlas,
269 pipeline, 269 this->pipeline(),
270 dfProcessor, 270 dfProcessor,
271 positions, 271 positions,
272 vertexStride, 272 vertexStride,
273 this->viewMatrix(), 273 this->viewMatrix(),
274 args.fPath, 274 args.fPath,
275 args.fPathData); 275 args.fPathData);
276 flushInfo.fInstancesToFlush++; 276 flushInfo.fInstancesToFlush++;
277 } 277 }
278 278
279 this->flush(batchTarget, &flushInfo); 279 this->flush(batchTarget, &flushInfo);
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
625 geometry.fPath = GrTest::TestPath(random); 625 geometry.fPath = GrTest::TestPath(random);
626 geometry.fAntiAlias = random->nextBool(); 626 geometry.fAntiAlias = random->nextBool();
627 627
628 return AADistanceFieldPathBatch::Create(geometry, color, viewMatrix, 628 return AADistanceFieldPathBatch::Create(geometry, color, viewMatrix,
629 gTestStruct.fAtlas, 629 gTestStruct.fAtlas,
630 &gTestStruct.fPathCache, 630 &gTestStruct.fPathCache,
631 &gTestStruct.fPathList); 631 &gTestStruct.fPathList);
632 } 632 }
633 633
634 #endif 634 #endif
OLDNEW
« no previous file with comments | « src/gpu/GrAAConvexPathRenderer.cpp ('k') | src/gpu/GrAAHairLinePathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698