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

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: rebase 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
« src/gpu/GrStrokeInfo.h ('K') | « 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 b6dbbd6e0ed19f877ca6c3c5b391e7334fe0923d..3365901b655d9e7a9f4c6d2765c6b51e1ea8b1ea 100644
--- a/src/gpu/effects/GrDashingEffect.cpp
+++ b/src/gpu/effects/GrDashingEffect.cpp
@@ -41,18 +41,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;
}
@@ -703,7 +703,8 @@ bool GrDashingEffect::DrawDashLine(GrGpu* gpu, GrDrawTarget* target,
GrPipelineBuilder* pipelineBuilder, GrColor color,
const SkMatrix& viewMatrix, const SkPoint pts[2],
bool useAA, const GrStrokeInfo& strokeInfo) {
- const SkPathEffect::DashInfo& info = strokeInfo.getDashInfo();
+ const SkScalar* intervals = strokeInfo.getDashIntervals();
+ SkScalar phase = strokeInfo.getDashPhase();
SkPaint::Cap cap = strokeInfo.getStrokeRec().getCap();
@@ -711,7 +712,7 @@ bool GrDashingEffect::DrawDashLine(GrGpu* gpu, GrDrawTarget* target,
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) {
@@ -730,7 +731,7 @@ bool GrDashingEffect::DrawDashLine(GrGpu* gpu, GrDrawTarget* target,
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) {
@@ -746,9 +747,9 @@ bool GrDashingEffect::DrawDashLine(GrGpu* gpu, GrDrawTarget* target,
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];
SkAutoTUnref<GrBatch> batch(DashBatch::Create(geometry, cap, aaMode, fullDash));
target->drawBatch(pipelineBuilder, batch);
« src/gpu/GrStrokeInfo.h ('K') | « src/gpu/GrStrokeInfo.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698