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

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

Issue 1967513002: Revert of Replace GrStrokeInfo with GrStyle. (Closed) Base URL: https://chromium.googlesource.com/skia.git@resscale
Patch Set: 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
« no previous file with comments | « src/gpu/effects/GrDashingEffect.h ('k') | src/gpu/gl/GrGLPath.h » ('j') | 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 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
« no previous file with comments | « src/gpu/effects/GrDashingEffect.h ('k') | src/gpu/gl/GrGLPath.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698