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 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 Loading... |
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 } |
OLD | NEW |