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

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

Issue 1096513002: Pass dashing information to path rasterizers. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix 100-col issue Created 5 years, 8 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
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 1426 matching lines...) Expand 10 before | Expand all | Expand 10 after
1437 bool useCoverageAA = useAA && 1437 bool useCoverageAA = useAA &&
1438 !pipelineBuilder->getRenderTarget()->isMultisampled(); 1438 !pipelineBuilder->getRenderTarget()->isMultisampled();
1439 1439
1440 1440
1441 GrPathRendererChain::DrawType type = 1441 GrPathRendererChain::DrawType type =
1442 useCoverageAA ? GrPathRendererChain::kColorAntiAlias_DrawType : 1442 useCoverageAA ? GrPathRendererChain::kColorAntiAlias_DrawType :
1443 GrPathRendererChain::kColor_DrawType; 1443 GrPathRendererChain::kColor_DrawType;
1444 1444
1445 const SkPath* pathPtr = &path; 1445 const SkPath* pathPtr = &path;
1446 SkTLazy<SkPath> tmpPath; 1446 SkTLazy<SkPath> tmpPath;
1447 SkTCopyOnFirstWrite<SkStrokeRec> stroke(strokeInfo.getStrokeRec()); 1447 GrStrokeInfo stroke(strokeInfo);
1448 1448
1449 // Try a 1st time without stroking the path and without allowing the SW rend erer 1449 // Try a 1st time without stroking the path and without allowing the SW rend erer
1450 GrPathRenderer* pr = this->getPathRenderer(target, pipelineBuilder, viewMatr ix, *pathPtr, 1450 GrPathRenderer* pr = this->getPathRenderer(target, pipelineBuilder, viewMatr ix, *pathPtr,
1451 *stroke, false, type); 1451 stroke, false, type);
1452 1452
1453 if (NULL == pr) { 1453 if (NULL == pr) {
1454 if (!GrPathRenderer::IsStrokeHairlineOrEquivalent(*stroke, viewMatrix, N ULL)) { 1454 if (!GrPathRenderer::IsStrokeHairlineOrEquivalent(stroke.getStrokeRec(), viewMatrix,
1455 NULL)) {
1455 // It didn't work the 1st time, so try again with the stroked path 1456 // It didn't work the 1st time, so try again with the stroked path
1456 stroke.writable()->setResScale(SkScalarAbs(viewMatrix.getMaxScale()) ); 1457 stroke.getStrokeRecPtr()->setResScale(SkScalarAbs(viewMatrix.getMaxS cale()));
1457 if (stroke->applyToPath(tmpPath.init(), *pathPtr)) { 1458 if (stroke.getStrokeRec().applyToPath(tmpPath.init(), *pathPtr)) {
bsalomon 2015/04/16 17:53:38 need to apply path effect here, right?
1458 pathPtr = tmpPath.get(); 1459 pathPtr = tmpPath.get();
1459 stroke.writable()->setFillStyle(); 1460 stroke.getStrokeRecPtr()->setFillStyle();
bsalomon 2015/04/16 17:52:18 Seems like this should also remove the path effect
1460 if (pathPtr->isEmpty()) { 1461 if (pathPtr->isEmpty()) {
1461 return; 1462 return;
1462 } 1463 }
1463 } 1464 }
1464 } 1465 }
1465 1466
1466 // This time, allow SW renderer 1467 // This time, allow SW renderer
1467 pr = this->getPathRenderer(target, pipelineBuilder, viewMatrix, *pathPtr , *stroke, true, 1468 pr = this->getPathRenderer(target, pipelineBuilder, viewMatrix, *pathPtr , stroke, true,
1468 type); 1469 type);
1469 } 1470 }
1470 1471
1471 if (NULL == pr) { 1472 if (NULL == pr) {
1472 #ifdef SK_DEBUG 1473 #ifdef SK_DEBUG
1473 SkDebugf("Unable to find path renderer compatible with path.\n"); 1474 SkDebugf("Unable to find path renderer compatible with path.\n");
1474 #endif 1475 #endif
1475 return; 1476 return;
1476 } 1477 }
1477 1478
1478 pr->drawPath(target, pipelineBuilder, color, viewMatrix, *pathPtr, *stroke, useCoverageAA); 1479 pr->drawPath(target, pipelineBuilder, color, viewMatrix, *pathPtr, stroke, u seCoverageAA);
1479 } 1480 }
1480 1481
1481 //////////////////////////////////////////////////////////////////////////////// 1482 ////////////////////////////////////////////////////////////////////////////////
1482 1483
1483 void GrContext::flush(int flagsBitfield) { 1484 void GrContext::flush(int flagsBitfield) {
1484 if (NULL == fDrawBuffer) { 1485 if (NULL == fDrawBuffer) {
1485 return; 1486 return;
1486 } 1487 }
1487 1488
1488 if (kDiscard_FlushBit & flagsBitfield) { 1489 if (kDiscard_FlushBit & flagsBitfield) {
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after
1865 /* 1866 /*
1866 * This method finds a path renderer that can draw the specified path on 1867 * This method finds a path renderer that can draw the specified path on
1867 * the provided target. 1868 * the provided target.
1868 * Due to its expense, the software path renderer has split out so it can 1869 * Due to its expense, the software path renderer has split out so it can
1869 * can be individually allowed/disallowed via the "allowSW" boolean. 1870 * can be individually allowed/disallowed via the "allowSW" boolean.
1870 */ 1871 */
1871 GrPathRenderer* GrContext::getPathRenderer(const GrDrawTarget* target, 1872 GrPathRenderer* GrContext::getPathRenderer(const GrDrawTarget* target,
1872 const GrPipelineBuilder* pipelineBuil der, 1873 const GrPipelineBuilder* pipelineBuil der,
1873 const SkMatrix& viewMatrix, 1874 const SkMatrix& viewMatrix,
1874 const SkPath& path, 1875 const SkPath& path,
1875 const SkStrokeRec& stroke, 1876 const GrStrokeInfo& stroke,
1876 bool allowSW, 1877 bool allowSW,
1877 GrPathRendererChain::DrawType drawTyp e, 1878 GrPathRendererChain::DrawType drawTyp e,
1878 GrPathRendererChain::StencilSupport* stencilSupport) { 1879 GrPathRendererChain::StencilSupport* stencilSupport) {
1879 1880
1880 if (NULL == fPathRendererChain) { 1881 if (NULL == fPathRendererChain) {
1881 fPathRendererChain = SkNEW_ARGS(GrPathRendererChain, (this)); 1882 fPathRendererChain = SkNEW_ARGS(GrPathRendererChain, (this));
1882 } 1883 }
1883 1884
1884 GrPathRenderer* pr = fPathRendererChain->getPathRenderer(target, 1885 GrPathRenderer* pr = fPathRendererChain->getPathRenderer(target,
1885 pipelineBuilder, 1886 pipelineBuilder,
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
2030 } 2031 }
2031 } 2032 }
2032 2033
2033 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) { 2034 void GrContext::removeGpuTraceMarker(const GrGpuTraceMarker* marker) {
2034 fGpu->removeGpuTraceMarker(marker); 2035 fGpu->removeGpuTraceMarker(marker);
2035 if (fDrawBuffer) { 2036 if (fDrawBuffer) {
2036 fDrawBuffer->removeGpuTraceMarker(marker); 2037 fDrawBuffer->removeGpuTraceMarker(marker);
2037 } 2038 }
2038 } 2039 }
2039 2040
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698