Index: src/gpu/effects/GrDashingEffect.cpp |
diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp |
index 8a38ebe5733e4a69362b07f5397330fa63b9af19..f1e8016eb9c81890f2dec4ea19e06a25301c3ae1 100644 |
--- a/src/gpu/effects/GrDashingEffect.cpp |
+++ b/src/gpu/effects/GrDashingEffect.cpp |
@@ -16,7 +16,7 @@ |
#include "GrDefaultGeoProcFactory.h" |
#include "GrInvariantOutput.h" |
#include "GrProcessor.h" |
-#include "GrStyle.h" |
+#include "GrStrokeInfo.h" |
#include "SkGr.h" |
#include "batches/GrVertexBatch.h" |
#include "glsl/GrGLSLFragmentShaderBuilder.h" |
@@ -29,7 +29,7 @@ |
/////////////////////////////////////////////////////////////////////////////// |
// Returns whether or not the gpu can fast path the dash line effect. |
-bool GrDashingEffect::CanDrawDashLine(const SkPoint pts[2], const GrStyle& style, |
+bool GrDashingEffect::CanDrawDashLine(const SkPoint pts[2], const GrStrokeInfo& strokeInfo, |
const SkMatrix& viewMatrix) { |
// Pts must be either horizontal or vertical in src space |
if (pts[0].fX != pts[1].fX && pts[0].fY != pts[1].fY) { |
@@ -42,16 +42,16 @@ |
return false; |
} |
- if (!style.isDashed() || 2 != style.dashIntervalCnt()) { |
+ if (!strokeInfo.isDashed() || 2 != strokeInfo.getDashCount()) { |
return false; |
} |
- const SkScalar* intervals = style.dashIntervals(); |
+ const SkScalar* intervals = strokeInfo.getDashIntervals(); |
if (0 == intervals[0] && 0 == intervals[1]) { |
return false; |
} |
- SkPaint::Cap cap = style.strokeRec().getCap(); |
+ SkPaint::Cap cap = strokeInfo.getCap(); |
// Current we do don't handle Round or Square cap dashes |
if (SkPaint::kRound_Cap == cap && intervals[0] != 0.f) { |
return false; |
@@ -690,15 +690,14 @@ |
}; |
static GrDrawBatch* create_batch(GrColor color, const SkMatrix& viewMatrix, const SkPoint pts[2], |
- bool useAA, const GrStyle& style, bool msaaRT) { |
- SkASSERT(GrDashingEffect::CanDrawDashLine(pts, style, viewMatrix)); |
- const SkScalar* intervals = style.dashIntervals(); |
- SkScalar phase = style.dashPhase(); |
- |
- SkPaint::Cap cap = style.strokeRec().getCap(); |
+ bool useAA, const GrStrokeInfo& strokeInfo, bool msaaRT) { |
+ const SkScalar* intervals = strokeInfo.getDashIntervals(); |
+ SkScalar phase = strokeInfo.getDashPhase(); |
+ |
+ SkPaint::Cap cap = strokeInfo.getCap(); |
DashBatch::Geometry geometry; |
- geometry.fSrcStrokeWidth = style.strokeRec().getWidth(); |
+ geometry.fSrcStrokeWidth = strokeInfo.getWidth(); |
// the phase should be normalized to be [0, sum of all intervals) |
SkASSERT(phase >= 0 && phase < intervals[0] + intervals[1]); |
@@ -748,8 +747,8 @@ |
const SkPoint pts[2], |
bool useAA, |
bool msaaIsEnabled, |
- const GrStyle& style) { |
- return create_batch(color, viewMatrix, pts, useAA, style, msaaIsEnabled); |
+ const GrStrokeInfo& strokeInfo) { |
+ return create_batch(color, viewMatrix, pts, useAA, strokeInfo, msaaIsEnabled); |
} |
////////////////////////////////////////////////////////////////////////////// |
@@ -1290,11 +1289,17 @@ |
p.setStyle(SkPaint::kStroke_Style); |
p.setStrokeWidth(SkIntToScalar(1)); |
p.setStrokeCap(cap); |
- p.setPathEffect(GrTest::TestDashPathEffect::Make(intervals, 2, phase)); |
- |
- GrStyle style(p); |
- |
- return create_batch(color, viewMatrix, pts, useAA, style, msaaRT); |
+ |
+ GrStrokeInfo strokeInfo(p); |
+ |
+ SkPathEffect::DashInfo info; |
+ info.fIntervals = intervals; |
+ info.fCount = 2; |
+ info.fPhase = phase; |
+ SkDEBUGCODE(bool success = ) strokeInfo.setDashInfo(info); |
+ SkASSERT(success); |
+ |
+ return create_batch(color, viewMatrix, pts, useAA, strokeInfo, msaaRT); |
} |
#endif |