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

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

Issue 1119393002: Don't attempt to draw path if dashing or stroking fails (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix fill paths Created 5 years, 7 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 | « no previous file | no next file » | 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 2011 Google Inc. 3 * Copyright 2011 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 "GrContext.h" 9 #include "GrContext.h"
10 10
(...skipping 1307 matching lines...) Expand 10 before | Expand all | Expand 10 after
1318 SkTLazy<SkPath> tmpPath; 1318 SkTLazy<SkPath> tmpPath;
1319 const GrStrokeInfo* strokeInfoPtr = &strokeInfo; 1319 const GrStrokeInfo* strokeInfoPtr = &strokeInfo;
1320 1320
1321 // Try a 1st time without stroking the path and without allowing the SW rend erer 1321 // Try a 1st time without stroking the path and without allowing the SW rend erer
1322 GrPathRenderer* pr = this->getPathRenderer(target, pipelineBuilder, viewMatr ix, *pathPtr, 1322 GrPathRenderer* pr = this->getPathRenderer(target, pipelineBuilder, viewMatr ix, *pathPtr,
1323 *strokeInfoPtr, false, type); 1323 *strokeInfoPtr, false, type);
1324 1324
1325 GrStrokeInfo dashlessStrokeInfo(strokeInfo, false); 1325 GrStrokeInfo dashlessStrokeInfo(strokeInfo, false);
1326 if (NULL == pr && strokeInfo.isDashed()) { 1326 if (NULL == pr && strokeInfo.isDashed()) {
1327 // It didn't work above, so try again with dashed stroke converted to a dashless stroke. 1327 // It didn't work above, so try again with dashed stroke converted to a dashless stroke.
1328 if (strokeInfo.applyDash(tmpPath.init(), &dashlessStrokeInfo, *pathPtr)) { 1328 if (!strokeInfo.applyDash(tmpPath.init(), &dashlessStrokeInfo, *pathPtr) ) {
1329 pathPtr = tmpPath.get(); 1329 return;
1330 if (pathPtr->isEmpty()) {
1331 return;
1332 }
1333 strokeInfoPtr = &dashlessStrokeInfo;
1334 } 1330 }
1331 pathPtr = tmpPath.get();
1332 if (pathPtr->isEmpty()) {
1333 return;
1334 }
1335 strokeInfoPtr = &dashlessStrokeInfo;
1335 pr = this->getPathRenderer(target, pipelineBuilder, viewMatrix, *pathPtr , *strokeInfoPtr, 1336 pr = this->getPathRenderer(target, pipelineBuilder, viewMatrix, *pathPtr , *strokeInfoPtr,
1336 false, type); 1337 false, type);
1337 } 1338 }
1338 1339
1339 if (NULL == pr) { 1340 if (NULL == pr) {
1340 if (!GrPathRenderer::IsStrokeHairlineOrEquivalent(*strokeInfoPtr, viewMa trix, NULL)) { 1341 if (!GrPathRenderer::IsStrokeHairlineOrEquivalent(*strokeInfoPtr, viewMa trix, NULL) &&
1342 !strokeInfoPtr->isFillStyle()) {
1341 // It didn't work above, so try again with stroke converted to a fil l. 1343 // It didn't work above, so try again with stroke converted to a fil l.
1342 if (!tmpPath.isValid()) { 1344 if (!tmpPath.isValid()) {
1343 tmpPath.init(); 1345 tmpPath.init();
1344 } 1346 }
1345 SkStrokeRec* strokeRec = dashlessStrokeInfo.getStrokeRecPtr(); 1347 SkStrokeRec* strokeRec = dashlessStrokeInfo.getStrokeRecPtr();
1346 strokeRec->setResScale(SkScalarAbs(viewMatrix.getMaxScale())); 1348 strokeRec->setResScale(SkScalarAbs(viewMatrix.getMaxScale()));
1347 if (strokeRec->applyToPath(tmpPath.get(), *pathPtr)) { 1349 if (!strokeRec->applyToPath(tmpPath.get(), *pathPtr)) {
1348 pathPtr = tmpPath.get(); 1350 return;
1349 if (pathPtr->isEmpty()) {
1350 return;
1351 }
1352 strokeRec->setFillStyle();
1353 strokeInfoPtr = &dashlessStrokeInfo;
1354 } 1351 }
1352 pathPtr = tmpPath.get();
1353 if (pathPtr->isEmpty()) {
1354 return;
1355 }
1356 strokeRec->setFillStyle();
1357 strokeInfoPtr = &dashlessStrokeInfo;
1355 } 1358 }
1356 1359
1357 // This time, allow SW renderer 1360 // This time, allow SW renderer
1358 pr = this->getPathRenderer(target, pipelineBuilder, viewMatrix, *pathPtr , *strokeInfoPtr, 1361 pr = this->getPathRenderer(target, pipelineBuilder, viewMatrix, *pathPtr , *strokeInfoPtr,
1359 true, type); 1362 true, type);
1360 } 1363 }
1361 1364
1362 if (NULL == pr) { 1365 if (NULL == pr) {
1363 #ifdef SK_DEBUG 1366 #ifdef SK_DEBUG
1364 SkDebugf("Unable to find path renderer compatible with path.\n"); 1367 SkDebugf("Unable to find path renderer compatible with path.\n");
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after
1899 fDrawBuffer->addGpuTraceMarker(marker); 1902 fDrawBuffer->addGpuTraceMarker(marker);
1900 } 1903 }
1901 } 1904 }
1902 1905
1903 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { 1906 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) {
1904 fGpu->removeGpuTraceMarker(marker); 1907 fGpu->removeGpuTraceMarker(marker);
1905 if (fDrawBuffer) { 1908 if (fDrawBuffer) {
1906 fDrawBuffer->removeGpuTraceMarker(marker); 1909 fDrawBuffer->removeGpuTraceMarker(marker);
1907 } 1910 }
1908 } 1911 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698