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

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

Issue 1784493004: Reject dashes from GrAADFR (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: Move check earlier Created 4 years, 9 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 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 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 SkDebugf("Cached paths: %d, freed paths: %d\n", g_NumCachedPaths, g_NumFreed Paths); 79 SkDebugf("Cached paths: %d, freed paths: %d\n", g_NumCachedPaths, g_NumFreed Paths);
80 #endif 80 #endif
81 } 81 }
82 82
83 //////////////////////////////////////////////////////////////////////////////// 83 ////////////////////////////////////////////////////////////////////////////////
84 bool GrAADistanceFieldPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) c onst { 84 bool GrAADistanceFieldPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) c onst {
85 85
86 // TODO: Support inverse fill 86 // TODO: Support inverse fill
87 if (!args.fShaderCaps->shaderDerivativeSupport() || !args.fAntiAlias || 87 if (!args.fShaderCaps->shaderDerivativeSupport() || !args.fAntiAlias ||
88 SkStrokeRec::kHairline_Style == args.fStroke->getStyle() || 88 SkStrokeRec::kHairline_Style == args.fStroke->getStyle() ||
89 args.fPath->isInverseFillType() || args.fPath->isVolatile()) { 89 args.fPath->isInverseFillType() || args.fPath->isVolatile() ||
90 // We don't currently apply the dash or factor it into the DF key. (skbu g.com/5082)
91 args.fStroke->isDashed()) {
90 return false; 92 return false;
91 } 93 }
92 94
93 // currently don't support perspective 95 // currently don't support perspective
94 if (args.fViewMatrix->hasPerspective()) { 96 if (args.fViewMatrix->hasPerspective()) {
95 return false; 97 return false;
96 } 98 }
97 99
98 // only support paths with bounds within kMediumMIP by kMediumMIP, 100 // only support paths with bounds within kMediumMIP by kMediumMIP,
99 // scaled to have bounds within 2.0f*kLargeMIP by 2.0f*kLargeMIP 101 // scaled to have bounds within 2.0f*kLargeMIP by 2.0f*kLargeMIP
100 // the goal is to accelerate rendering of lots of small paths that may be sc aling 102 // the goal is to accelerate rendering of lots of small paths that may be sc aling
101 SkScalar maxScale = args.fViewMatrix->getMaxScale(); 103 SkScalar maxScale = args.fViewMatrix->getMaxScale();
102 const SkRect& bounds = args.fPath->getBounds(); 104 const SkRect& bounds = args.fPath->getBounds();
103 SkScalar maxDim = SkMaxScalar(bounds.width(), bounds.height()); 105 SkScalar maxDim = SkMaxScalar(bounds.width(), bounds.height());
104 // Approximate stroked size by adding the maximum of the stroke width or 2x the miter limit 106 // Approximate stroked size by adding the maximum of the stroke width or 2x the miter limit
105 if (!args.fStroke->isFillStyle()) { 107 if (!args.fStroke->isFillStyle()) {
106 SkScalar extraWidth = args.fStroke->getWidth(); 108 SkScalar extraWidth = args.fStroke->getWidth();
107 if (SkPaint::kMiter_Join == args.fStroke->getJoin()) { 109 if (SkPaint::kMiter_Join == args.fStroke->getJoin()) {
108 extraWidth = SkTMax(extraWidth, 2.0f*args.fStroke->getMiter()); 110 extraWidth = SkTMax(extraWidth, 2.0f*args.fStroke->getMiter());
109 } 111 }
110 maxDim += extraWidth; 112 maxDim += extraWidth;
111 } 113 }
112 114
113 return maxDim <= kMediumMIP && maxDim * maxScale <= 2.0f*kLargeMIP; 115 return maxDim <= kMediumMIP && maxDim * maxScale <= 2.0f*kLargeMIP;
114 } 116 }
115 117
116 //////////////////////////////////////////////////////////////////////////////// 118 ////////////////////////////////////////////////////////////////////////////////
117 119
118 // padding around path bounds to allow for antialiased pixels 120 // padding around path bounds to allow for antialiased pixels
119 static const SkScalar kAntiAliasPad = 1.0f; 121 static const SkScalar kAntiAliasPad = 1.0f;
120 122
121 class AADistanceFieldPathBatch : public GrVertexBatch { 123 class AADistanceFieldPathBatch : public GrVertexBatch {
122 public: 124 public:
(...skipping 522 matching lines...) Expand 10 before | Expand all | Expand 10 after
645 geometry.fAntiAlias = random->nextBool(); 647 geometry.fAntiAlias = random->nextBool();
646 geometry.fGenID = random->nextU(); 648 geometry.fGenID = random->nextU();
647 649
648 return AADistanceFieldPathBatch::Create(geometry, viewMatrix, 650 return AADistanceFieldPathBatch::Create(geometry, viewMatrix,
649 gTestStruct.fAtlas, 651 gTestStruct.fAtlas,
650 &gTestStruct.fPathCache, 652 &gTestStruct.fPathCache,
651 &gTestStruct.fPathList); 653 &gTestStruct.fPathList);
652 } 654 }
653 655
654 #endif 656 #endif
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