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

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

Issue 732693002: Drawstate on stack (Closed) Base URL: https://skia.googlesource.com/skia.git@real_def_gp
Patch Set: tiny fix Created 6 years, 1 month 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/GrGpuGL.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 af96ef63185acb9ee23426458f3bc8ee6f13abfb..71d92cbb843e22455ad9ba41806c49cfba56e211 100644
--- a/src/gpu/effects/GrDashingEffect.cpp
+++ b/src/gpu/effects/GrDashingEffect.cpp
@@ -29,8 +29,9 @@
// Returns whether or not the gpu can fast path the dash line effect.
static bool can_fast_path_dash(const SkPoint pts[2], const GrStrokeInfo& strokeInfo,
- const GrDrawTarget& target, const SkMatrix& viewMatrix) {
- if (target.getDrawState().getRenderTarget()->isMultisampled()) {
+ const GrDrawTarget& target, const GrDrawState& ds,
+ const SkMatrix& viewMatrix) {
+ if (ds.getRenderTarget()->isMultisampled()) {
return false;
}
@@ -170,11 +171,11 @@ static void setup_dashed_rect_pos(const SkRect& rect, int idx, const SkMatrix& m
matrix.mapPoints(&verts[idx], 4);
}
-bool GrDashingEffect::DrawDashLine(const SkPoint pts[2], const GrPaint& paint,
- const GrStrokeInfo& strokeInfo, GrGpu* gpu,
- GrDrawTarget* target, const SkMatrix& vm) {
+bool GrDashingEffect::DrawDashLine(GrGpu* gpu, GrDrawTarget* target, GrDrawState* drawState,
+ const SkPoint pts[2], const GrPaint& paint,
+ const GrStrokeInfo& strokeInfo, const SkMatrix& vm) {
- if (!can_fast_path_dash(pts, strokeInfo, *target, vm)) {
+ if (!can_fast_path_dash(pts, strokeInfo, *target, *drawState, vm)) {
return false;
}
@@ -319,7 +320,6 @@ bool GrDashingEffect::DrawDashLine(const SkPoint pts[2], const GrPaint& paint,
SkScalar devBloat = useAA ? 0.5f : 0.f;
- GrDrawState* drawState = target->drawState();
if (devIntervals[1] <= 0.f && useAA) {
// Case when we end up drawing a solid AA rect
// Reset the start rect to draw this single solid rect
@@ -372,7 +372,9 @@ bool GrDashingEffect::DrawDashLine(const SkPoint pts[2], const GrPaint& paint,
totalRectCnt += hasStartRect ? 1 : 0;
totalRectCnt += hasEndRect ? 1 : 0;
- GrDrawTarget::AutoReleaseGeometry geo(target, totalRectCnt * 4, 0);
+ GrDrawTarget::AutoReleaseGeometry geo(target,
+ totalRectCnt * 4,
+ drawState->getVertexStride(), 0);
if (!geo.succeeded()) {
SkDebugf("Failed to get space for vertices!\n");
return false;
@@ -438,7 +440,7 @@ bool GrDashingEffect::DrawDashLine(const SkPoint pts[2], const GrPaint& paint,
}
target->setIndexSourceToBuffer(gpu->getContext()->getQuadIndexBuffer());
- target->drawIndexedInstances(kTriangles_GrPrimitiveType, totalRectCnt, 4, 6);
+ target->drawIndexedInstances(drawState, kTriangles_GrPrimitiveType, totalRectCnt, 4, 6);
target->resetIndexSource();
return true;
}
« no previous file with comments | « src/gpu/effects/GrDashingEffect.h ('k') | src/gpu/gl/GrGpuGL.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698