aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/effects
diff options
context:
space:
mode:
authorGravatar bsalomon <bsalomon@google.com>2015-08-13 13:34:48 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-08-13 13:34:48 -0700
commitabd30f54b7ff1704a8930c4307ea242d09425d02 (patch)
tree08eb5fdaa2fbe55f2e763a1d3c05054896919b68 /src/gpu/effects
parent8f34372f7e97482e5e61ab298b7edaa008ba2f4c (diff)
Introduce GrBatch subclasses GrDrawBatch and GrVertexBatch to prepare for non-drawing batches
Diffstat (limited to 'src/gpu/effects')
-rw-r--r--src/gpu/effects/GrDashingEffect.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/gpu/effects/GrDashingEffect.cpp b/src/gpu/effects/GrDashingEffect.cpp
index 6a894f9e0e..92f6104e15 100644
--- a/src/gpu/effects/GrDashingEffect.cpp
+++ b/src/gpu/effects/GrDashingEffect.cpp
@@ -243,7 +243,7 @@ static GrGeometryProcessor* create_dash_gp(GrColor,
const SkMatrix& localMatrix,
bool usesLocalCoords);
-class DashBatch : public GrBatch {
+class DashBatch : public GrVertexBatch {
public:
struct Geometry {
GrColor fColor;
@@ -257,8 +257,8 @@ public:
SkScalar fPerpendicularScale;
};
- static GrBatch* Create(const Geometry& geometry, SkPaint::Cap cap, DashAAMode aaMode,
- bool fullDash) {
+ static GrDrawBatch* Create(const Geometry& geometry, SkPaint::Cap cap, DashAAMode aaMode,
+ bool fullDash) {
return SkNEW_ARGS(DashBatch, (geometry, cap, aaMode, fullDash));
}
@@ -618,13 +618,12 @@ private:
}
bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
- if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipeline(), t->bounds(),
- caps)) {
+ DashBatch* that = t->cast<DashBatch>();
+ if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeline(),
+ that->bounds(), caps)) {
return false;
}
- DashBatch* that = t->cast<DashBatch>();
-
if (this->aaMode() != that->aaMode()) {
return false;
}
@@ -677,8 +676,8 @@ private:
SkSTArray<1, Geometry, true> fGeoData;
};
-static GrBatch* create_batch(GrColor color, const SkMatrix& viewMatrix, const SkPoint pts[2],
- bool useAA, const GrStrokeInfo& strokeInfo, bool msaaRT) {
+static GrDrawBatch* create_batch(GrColor color, const SkMatrix& viewMatrix, const SkPoint pts[2],
+ bool useAA, const GrStrokeInfo& strokeInfo, bool msaaRT) {
const SkScalar* intervals = strokeInfo.getDashIntervals();
SkScalar phase = strokeInfo.getDashPhase();
@@ -734,7 +733,7 @@ bool GrDashingEffect::DrawDashLine(GrDrawTarget* target,
const GrPipelineBuilder& pipelineBuilder, GrColor color,
const SkMatrix& viewMatrix, const SkPoint pts[2],
bool useAA, const GrStrokeInfo& strokeInfo) {
- SkAutoTUnref<GrBatch> batch(
+ SkAutoTUnref<GrDrawBatch> batch(
create_batch(color, viewMatrix, pts, useAA, strokeInfo,
pipelineBuilder.getRenderTarget()->isUnifiedMultisampled()));
if (!batch) {
@@ -1229,7 +1228,7 @@ static GrGeometryProcessor* create_dash_gp(GrColor color,
#ifdef GR_TEST_UTILS
-BATCH_TEST_DEFINE(DashBatch) {
+DRAW_BATCH_TEST_DEFINE(DashBatch) {
GrColor color = GrRandomColor(random);
SkMatrix viewMatrix = GrTest::TestMatrixPreservesRightAngles(random);
bool useAA = random->nextBool();