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

Unified Diff: src/gpu/batches/GrAADistanceFieldPathRenderer.cpp

Issue 1957363002: Replace GrStrokeInfo with GrStyle. (Closed) Base URL: https://chromium.googlesource.com/skia.git@resscale
Patch Set: Fix issue where hairlines were going to MSAAPathRenderer Created 4 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 side-by-side diff with in-line comments
Download patch
Index: src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
diff --git a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
index f891b8d1f592495a2358c746e36a983d042c0f43..ba52bf921372f33140ba11589936ce67afb0affb 100644
--- a/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
+++ b/src/gpu/batches/GrAADistanceFieldPathRenderer.cpp
@@ -81,13 +81,14 @@ GrAADistanceFieldPathRenderer::~GrAADistanceFieldPathRenderer() {
////////////////////////////////////////////////////////////////////////////////
bool GrAADistanceFieldPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const {
-
+ // We don't currently apply the dash or factor it into the DF key. (skbug.com/5082)
+ if (args.fStyle->pathEffect()) {
+ return false;
+ }
// TODO: Support inverse fill
if (!args.fShaderCaps->shaderDerivativeSupport() || !args.fAntiAlias ||
- SkStrokeRec::kHairline_Style == args.fStroke->getStyle() ||
- args.fPath->isInverseFillType() || args.fPath->isVolatile() ||
- // We don't currently apply the dash or factor it into the DF key. (skbug.com/5082)
- args.fStroke->isDashed()) {
+ args.fStyle->isSimpleHairline() || args.fPath->isInverseFillType() ||
+ args.fPath->isVolatile()) {
return false;
}
@@ -100,16 +101,23 @@ bool GrAADistanceFieldPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) c
// scaled to have bounds within 2.0f*kLargeMIP by 2.0f*kLargeMIP
// the goal is to accelerate rendering of lots of small paths that may be scaling
SkScalar maxScale = args.fViewMatrix->getMaxScale();
+#if 0 // This is more accurate but changes some GMs. TODO: Standalone change to enable this.
+ SkRect bounds;
+ args.fStyle->adjustBounds(&bounds, args.fPath->getBounds());
+ SkScalar maxDim = SkMaxScalar(bounds.width(), bounds.height());
+#else
const SkRect& bounds = args.fPath->getBounds();
SkScalar maxDim = SkMaxScalar(bounds.width(), bounds.height());
+ const SkStrokeRec& stroke = args.fStyle->strokeRec();
// Approximate stroked size by adding the maximum of the stroke width or 2x the miter limit
- if (!args.fStroke->isFillStyle()) {
- SkScalar extraWidth = args.fStroke->getWidth();
- if (SkPaint::kMiter_Join == args.fStroke->getJoin()) {
- extraWidth = SkTMax(extraWidth, 2.0f*args.fStroke->getMiter());
+ if (!stroke.isFillStyle()) {
+ SkScalar extraWidth = stroke.getWidth();
+ if (SkPaint::kMiter_Join == stroke.getJoin()) {
+ extraWidth = SkTMax(extraWidth, 2.0f*stroke.getMiter());
}
maxDim += extraWidth;
}
+#endif
return maxDim <= kMediumMIP && maxDim * maxScale <= 2.0f*kLargeMIP;
}
@@ -552,11 +560,12 @@ bool GrAADistanceFieldPathRenderer::onDrawPath(const DrawPathArgs& args) {
}
}
- AADistanceFieldPathBatch::Geometry geometry(*args.fStroke);
- if (SkStrokeRec::kFill_Style == args.fStroke->getStyle()) {
+ // It's ok to ignore style's path effect because canDrawPath filtered out path effects.
+ AADistanceFieldPathBatch::Geometry geometry(args.fStyle->strokeRec());
+ if (args.fStyle->isSimpleFill()) {
geometry.fPath = *args.fPath;
} else {
- args.fStroke->applyToPath(&geometry.fPath, *args.fPath);
+ args.fStyle->strokeRec().applyToPath(&geometry.fPath, *args.fPath);
}
geometry.fColor = args.fColor;
geometry.fAntiAlias = args.fAntiAlias;

Powered by Google App Engine
This is Rietveld 408576698