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

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

Issue 1121463002: Move bounds to GrBatch (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tweak 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/GrTestBatch.h ('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 a284b272db239bea4d31ac991a2b81aca6615a7e..3f0df6737796a42a0ccbba098e23855843908d50 100644
--- a/src/gpu/effects/GrDashingEffect.cpp
+++ b/src/gpu/effects/GrDashingEffect.cpp
@@ -256,7 +256,6 @@ public:
SkScalar fIntervals[2];
SkScalar fParallelScale;
SkScalar fPerpendicularScale;
- SkDEBUGCODE(SkRect fDevBounds;)
};
static GrBatch* Create(const Geometry& geometry, SkPaint::Cap cap, DashAAMode aaMode,
@@ -367,9 +366,6 @@ public:
SkScalar startAdj = 0;
- SkMatrix& combinedMatrix = args.fSrcRotInv;
- combinedMatrix.postConcat(args.fViewMatrix);
-
bool lineDone = false;
// Too simplify the algorithm, we always push back rects for start and end rect.
@@ -646,6 +642,17 @@ private:
fBatch.fAAMode = aaMode;
fBatch.fCap = cap;
fBatch.fFullDash = fullDash;
+
+ // compute bounds
+ SkScalar halfStrokeWidth = 0.5f * geometry.fSrcStrokeWidth;
+ SkScalar xBloat = SkPaint::kButt_Cap == cap ? 0 : halfStrokeWidth;
+ fBounds.set(geometry.fPtsRot[0], geometry.fPtsRot[1]);
+ fBounds.outset(xBloat, halfStrokeWidth);
+
+ // Note, we actually create the combined matrix here, and save the work
+ SkMatrix& combinedMatrix = fGeoData[0].fSrcRotInv;
+ combinedMatrix.postConcat(geometry.fViewMatrix);
+ combinedMatrix.mapRect(&fBounds);
}
bool onCombineIfPossible(GrBatch* t) override {
@@ -674,6 +681,7 @@ private:
}
fGeoData.push_back_n(that->geoData()->count(), that->geoData()->begin());
+ this->joinBounds(that->bounds());
return true;
}
« no previous file with comments | « src/gpu/GrTestBatch.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698