| OLD | NEW |
| 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 Loading... |
| 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 return; | 1329 pathPtr = tmpPath.get(); |
| 1330 if (pathPtr->isEmpty()) { |
| 1331 return; |
| 1332 } |
| 1333 strokeInfoPtr = &dashlessStrokeInfo; |
| 1330 } | 1334 } |
| 1331 pathPtr = tmpPath.get(); | |
| 1332 if (pathPtr->isEmpty()) { | |
| 1333 return; | |
| 1334 } | |
| 1335 strokeInfoPtr = &dashlessStrokeInfo; | |
| 1336 pr = this->getPathRenderer(target, pipelineBuilder, viewMatrix, *pathPtr
, *strokeInfoPtr, | 1335 pr = this->getPathRenderer(target, pipelineBuilder, viewMatrix, *pathPtr
, *strokeInfoPtr, |
| 1337 false, type); | 1336 false, type); |
| 1338 } | 1337 } |
| 1339 | 1338 |
| 1340 if (NULL == pr) { | 1339 if (NULL == pr) { |
| 1341 if (!GrPathRenderer::IsStrokeHairlineOrEquivalent(*strokeInfoPtr, viewMa
trix, NULL)) { | 1340 if (!GrPathRenderer::IsStrokeHairlineOrEquivalent(*strokeInfoPtr, viewMa
trix, NULL)) { |
| 1342 // It didn't work above, so try again with stroke converted to a fil
l. | 1341 // It didn't work above, so try again with stroke converted to a fil
l. |
| 1343 if (!tmpPath.isValid()) { | 1342 if (!tmpPath.isValid()) { |
| 1344 tmpPath.init(); | 1343 tmpPath.init(); |
| 1345 } | 1344 } |
| 1346 SkStrokeRec* strokeRec = dashlessStrokeInfo.getStrokeRecPtr(); | 1345 SkStrokeRec* strokeRec = dashlessStrokeInfo.getStrokeRecPtr(); |
| 1347 strokeRec->setResScale(SkScalarAbs(viewMatrix.getMaxScale())); | 1346 strokeRec->setResScale(SkScalarAbs(viewMatrix.getMaxScale())); |
| 1348 if (!strokeRec->applyToPath(tmpPath.get(), *pathPtr)) { | 1347 if (strokeRec->applyToPath(tmpPath.get(), *pathPtr)) { |
| 1349 return; | 1348 pathPtr = tmpPath.get(); |
| 1349 if (pathPtr->isEmpty()) { |
| 1350 return; |
| 1351 } |
| 1352 strokeRec->setFillStyle(); |
| 1353 strokeInfoPtr = &dashlessStrokeInfo; |
| 1350 } | 1354 } |
| 1351 pathPtr = tmpPath.get(); | |
| 1352 if (pathPtr->isEmpty()) { | |
| 1353 return; | |
| 1354 } | |
| 1355 strokeRec->setFillStyle(); | |
| 1356 strokeInfoPtr = &dashlessStrokeInfo; | |
| 1357 } | 1355 } |
| 1358 | 1356 |
| 1359 // This time, allow SW renderer | 1357 // This time, allow SW renderer |
| 1360 pr = this->getPathRenderer(target, pipelineBuilder, viewMatrix, *pathPtr
, *strokeInfoPtr, | 1358 pr = this->getPathRenderer(target, pipelineBuilder, viewMatrix, *pathPtr
, *strokeInfoPtr, |
| 1361 true, type); | 1359 true, type); |
| 1362 } | 1360 } |
| 1363 | 1361 |
| 1364 if (NULL == pr) { | 1362 if (NULL == pr) { |
| 1365 #ifdef SK_DEBUG | 1363 #ifdef SK_DEBUG |
| 1366 SkDebugf("Unable to find path renderer compatible with path.\n"); | 1364 SkDebugf("Unable to find path renderer compatible with path.\n"); |
| (...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1901 fDrawBuffer->addGpuTraceMarker(marker); | 1899 fDrawBuffer->addGpuTraceMarker(marker); |
| 1902 } | 1900 } |
| 1903 } | 1901 } |
| 1904 | 1902 |
| 1905 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { | 1903 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { |
| 1906 fGpu->removeGpuTraceMarker(marker); | 1904 fGpu->removeGpuTraceMarker(marker); |
| 1907 if (fDrawBuffer) { | 1905 if (fDrawBuffer) { |
| 1908 fDrawBuffer->removeGpuTraceMarker(marker); | 1906 fDrawBuffer->removeGpuTraceMarker(marker); |
| 1909 } | 1907 } |
| 1910 } | 1908 } |
| OLD | NEW |