Index: src/gpu/batches/GrDefaultPathRenderer.cpp |
diff --git a/src/gpu/batches/GrDefaultPathRenderer.cpp b/src/gpu/batches/GrDefaultPathRenderer.cpp |
index 9994b26a1ad590d4f6a6455ed99bcdbe4b776d01..1de0bf771e2066f6c46237239a8db909d4dfe6d6 100644 |
--- a/src/gpu/batches/GrDefaultPathRenderer.cpp |
+++ b/src/gpu/batches/GrDefaultPathRenderer.cpp |
@@ -422,20 +422,21 @@ |
GrColor color, |
const SkMatrix& viewMatrix, |
const SkPath& path, |
- const GrStyle& origStyle, |
+ const GrStrokeInfo& origStroke, |
bool stencilOnly) { |
- const GrStyle* style = &origStyle; |
+ SkTCopyOnFirstWrite<GrStrokeInfo> stroke(origStroke); |
SkScalar hairlineCoverage; |
uint8_t newCoverage = 0xff; |
- bool isHairline = false; |
- if (IsStrokeHairlineOrEquivalent(*style, viewMatrix, &hairlineCoverage)) { |
+ if (IsStrokeHairlineOrEquivalent(*stroke, viewMatrix, &hairlineCoverage)) { |
newCoverage = SkScalarRoundToInt(hairlineCoverage * 0xff); |
- style = &GrStyle::SimpleHairline(); |
- isHairline = true; |
- } else { |
- SkASSERT(style->isSimpleFill()); |
- } |
+ |
+ if (!stroke->isHairlineStyle()) { |
+ stroke.writable()->setHairlineStyle(); |
+ } |
+ } |
+ |
+ const bool isHairline = stroke->isHairlineStyle(); |
// Save the current xp on the draw state so we can reset it if needed |
const GrXPFactory* xpFactory = pipelineBuilder->getXPFactory(); |
@@ -459,7 +460,7 @@ |
lastPassIsBounds = false; |
drawFace[0] = GrPipelineBuilder::kBoth_DrawFace; |
} else { |
- if (single_pass_path(path, style->strokeRec())) { |
+ if (single_pass_path(path, *stroke)) { |
passCount = 1; |
if (stencilOnly) { |
passes[0] = &gDirectToStencil; |
@@ -595,11 +596,10 @@ |
} |
bool GrDefaultPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) const { |
- // this class can draw any path with any simple fill style but doesn't do any anti-aliasing. |
- return !args.fAntiAlias && |
- (args.fStyle->isSimpleFill() || IsStrokeHairlineOrEquivalent(*args.fStyle, |
- *args.fViewMatrix, |
- nullptr)); |
+ // this class can draw any path with any fill but doesn't do any anti-aliasing. |
+ return !args.fAntiAlias && (args.fStroke->isFillStyle() || |
+ IsStrokeHairlineOrEquivalent(*args.fStroke, *args.fViewMatrix, |
+ nullptr)); |
} |
bool GrDefaultPathRenderer::onDrawPath(const DrawPathArgs& args) { |
@@ -609,7 +609,7 @@ |
args.fColor, |
*args.fViewMatrix, |
*args.fPath, |
- *args.fStyle, |
+ *args.fStroke, |
false); |
} |
@@ -618,7 +618,7 @@ |
SkASSERT(SkPath::kInverseEvenOdd_FillType != args.fPath->getFillType()); |
SkASSERT(SkPath::kInverseWinding_FillType != args.fPath->getFillType()); |
this->internalDrawPath(args.fTarget, args.fPipelineBuilder, GrColor_WHITE, *args.fViewMatrix, |
- *args.fPath, GrStyle::SimpleFill(), true); |
+ *args.fPath, GrStrokeInfo::FillInfo(), true); |
} |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
@@ -631,7 +631,7 @@ |
// For now just hairlines because the other types of draws require two batches. |
// TODO we should figure out a way to combine the stencil and cover steps into one batch |
- GrStyle style(SkStrokeRec::kHairline_InitStyle); |
+ GrStrokeInfo stroke(SkStrokeRec::kHairline_InitStyle); |
SkPath path = GrTest::TestPath(random); |
// Compute srcSpaceTol |