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

Unified Diff: src/gpu/effects/GrDashingEffect.cpp

Issue 1110093002: Avoid using SkPathEffect::DashInfo in GrStrokeInfo (Closed) Base URL: https://skia.googlesource.com/skia.git@dashing-nvpr
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/GrStrokeInfo.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrDashingEffect.cpp
diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp
index 3f0df6737796a42a0ccbba098e23855843908d50..a36d1d86660e0c6e064935bc1f3a4a63340c151f 100644
--- a/src/gpu/effects/GrDashingEffect.cpp
+++ b/src/gpu/effects/GrDashingEffect.cpp
@@ -43,18 +43,18 @@ bool GrDashingEffect::CanDrawDashLine(const SkPoint pts[2], const GrStrokeInfo&
return false;
}
- if (!strokeInfo.isDashed() || 2 != strokeInfo.dashCount()) {
+ if (!strokeInfo.isDashed() || 2 != strokeInfo.getDashCount()) {
return false;
}
- const SkPathEffect::DashInfo& info = strokeInfo.getDashInfo();
- if (0 == info.fIntervals[0] && 0 == info.fIntervals[1]) {
+ const SkScalar* intervals = strokeInfo.getDashIntervals();
+ if (0 == intervals[0] && 0 == intervals[1]) {
return false;
}
SkPaint::Cap cap = strokeInfo.getStrokeRec().getCap();
// Current we do don't handle Round or Square cap dashes
- if (SkPaint::kRound_Cap == cap && info.fIntervals[0] != 0.f) {
+ if (SkPaint::kRound_Cap == cap && intervals[0] != 0.f) {
return false;
}
@@ -711,7 +711,8 @@ private:
static GrBatch* create_batch(GrColor color, const SkMatrix& viewMatrix, const SkPoint pts[2],
bool useAA, const GrStrokeInfo& strokeInfo, bool msaaRT) {
- const SkPathEffect::DashInfo& info = strokeInfo.getDashInfo();
+ const SkScalar* intervals = strokeInfo.getDashIntervals();
+ SkScalar phase = strokeInfo.getDashPhase();
SkPaint::Cap cap = strokeInfo.getStrokeRec().getCap();
@@ -719,7 +720,7 @@ static GrBatch* create_batch(GrColor color, const SkMatrix& viewMatrix, const Sk
geometry.fSrcStrokeWidth = strokeInfo.getStrokeRec().getWidth();
// the phase should be normalized to be [0, sum of all intervals)
- SkASSERT(info.fPhase >= 0 && info.fPhase < info.fIntervals[0] + info.fIntervals[1]);
+ SkASSERT(phase >= 0 && phase < intervals[0] + intervals[1]);
// Rotate the src pts so they are aligned horizontally with pts[0].fX < pts[1].fX
if (pts[0].fY != pts[1].fY || pts[0].fX > pts[1].fX) {
@@ -738,7 +739,7 @@ static GrBatch* create_batch(GrColor color, const SkMatrix& viewMatrix, const Sk
calc_dash_scaling(&geometry.fParallelScale, &geometry.fPerpendicularScale, viewMatrix,
geometry.fPtsRot);
- SkScalar offInterval = info.fIntervals[1] * geometry.fParallelScale;
+ SkScalar offInterval = intervals[1] * geometry.fParallelScale;
SkScalar strokeWidth = geometry.fSrcStrokeWidth * geometry.fPerpendicularScale;
if (SkPaint::kSquare_Cap == cap && 0 != geometry.fSrcStrokeWidth) {
@@ -754,9 +755,9 @@ static GrBatch* create_batch(GrColor color, const SkMatrix& viewMatrix, const Sk
geometry.fColor = color;
geometry.fViewMatrix = viewMatrix;
- geometry.fPhase = info.fPhase;
- geometry.fIntervals[0] = info.fIntervals[0];
- geometry.fIntervals[1] = info.fIntervals[1];
+ geometry.fPhase = phase;
+ geometry.fIntervals[0] = intervals[0];
+ geometry.fIntervals[1] = intervals[1];
return DashBatch::Create(geometry, cap, aaMode, fullDash);
}
« no previous file with comments | « src/gpu/GrStrokeInfo.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698