diff options
author | 2015-08-18 06:05:14 -0700 | |
---|---|---|
committer | 2015-08-18 06:05:14 -0700 | |
commit | e46f9feb44780a6269c6dcfe993f4215427fd98e (patch) | |
tree | 8aad4e37b1fffdf3d49d509c01ad5b672db12d4f /src/gpu/effects/GrDashingEffect.cpp | |
parent | cf9c4759039c1d6dc5834d653fb36e465e3166d1 (diff) |
Privatize GrBatch subclass overrides
Review URL: https://codereview.chromium.org/1301663002
Diffstat (limited to 'src/gpu/effects/GrDashingEffect.cpp')
-rw-r--r-- | src/gpu/effects/GrDashingEffect.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp index e888f6d88c..5fb45a3aab 100644 --- a/src/gpu/effects/GrDashingEffect.cpp +++ b/src/gpu/effects/GrDashingEffect.cpp @@ -272,6 +272,29 @@ public: out->setUnknownSingleComponent(); } + SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } + +private: + DashBatch(const Geometry& geometry, SkPaint::Cap cap, DashAAMode aaMode, bool fullDash) { + this->initClassID<DashBatch>(); + fGeoData.push_back(geometry); + + 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); + } + void initBatchTracker(const GrPipelineOptimizations& opt) override { // Handle any color overrides if (!opt.readsColor()) { @@ -594,29 +617,6 @@ public: helper.recordDraw(target); } - SkSTArray<1, Geometry, true>* geoData() { return &fGeoData; } - -private: - DashBatch(const Geometry& geometry, SkPaint::Cap cap, DashAAMode aaMode, bool fullDash) { - this->initClassID<DashBatch>(); - fGeoData.push_back(geometry); - - 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, const GrCaps& caps) override { DashBatch* that = t->cast<DashBatch>(); if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeline(), |