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

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

Issue 1293583002: Introduce GrBatch subclasses GrDrawBatch and GrVertexBatch to prepare for non-drawing batches (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: remove duplicated fields in GrVertexBatch Created 5 years, 4 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/batches/GrTestBatch.h ('k') | tests/GLProgramsTest.cpp » ('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 6a894f9e0e6ec8c8f681e0394433ea58528eebb8..92f6104e154486ff352ef8223a509a78e64b90b3 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();
« no previous file with comments | « src/gpu/batches/GrTestBatch.h ('k') | tests/GLProgramsTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698