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

Unified Diff: src/gpu/GrAADistanceFieldPathRenderer.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/GrAAConvexPathRenderer.cpp ('k') | src/gpu/GrAAHairLinePathRenderer.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrAADistanceFieldPathRenderer.cpp
diff --git a/src/gpu/GrAADistanceFieldPathRenderer.cpp b/src/gpu/GrAADistanceFieldPathRenderer.cpp
index 50116dd3cb3255a7b16fe41bfcb668616f1b9bd8..c4d59dddf6edaf36ef5ae0917bd81cdce8a3cabf 100755
--- a/src/gpu/GrAADistanceFieldPathRenderer.cpp
+++ b/src/gpu/GrAADistanceFieldPathRenderer.cpp
@@ -109,7 +109,7 @@ bool GrAADistanceFieldPathRenderer::onCanDrawPath(const CanDrawPathArgs& args) c
// padding around path bounds to allow for antialiased pixels
static const SkScalar kAntiAliasPad = 1.0f;
-class AADistanceFieldPathBatch : public GrBatch {
+class AADistanceFieldPathBatch : public GrVertexBatch {
public:
typedef GrAADistanceFieldPathRenderer::PathData PathData;
typedef SkTDynamicHash<PathData, PathData::Key> PathCache;
@@ -123,8 +123,8 @@ public:
PathData* fPathData;
};
- static GrBatch* Create(const Geometry& geometry, GrColor color, const SkMatrix& viewMatrix,
- GrBatchAtlas* atlas, PathCache* pathCache, PathDataList* pathList) {
+ static GrDrawBatch* Create(const Geometry& geometry, GrColor color, const SkMatrix& viewMatrix,
+ GrBatchAtlas* atlas, PathCache* pathCache, PathDataList* pathList) {
return SkNEW_ARGS(AADistanceFieldPathBatch, (geometry, color, viewMatrix,
atlas, pathCache, pathList));
}
@@ -485,13 +485,12 @@ private:
bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; }
bool onCombineIfPossible(GrBatch* t, const GrCaps& caps) override {
- if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *t->pipeline(), t->bounds(),
- caps)) {
+ AADistanceFieldPathBatch* that = t->cast<AADistanceFieldPathBatch>();
+ if (!GrPipeline::CanCombine(*this->pipeline(), this->bounds(), *that->pipeline(),
+ that->bounds(), caps)) {
return false;
}
- AADistanceFieldPathBatch* that = t->cast<AADistanceFieldPathBatch>();
-
// TODO we could actually probably do a bunch of this work on the CPU, ie map viewMatrix,
// maybe upload color via attribute
if (this->color() != that->color()) {
@@ -543,9 +542,9 @@ bool GrAADistanceFieldPathRenderer::onDrawPath(const DrawPathArgs& args) {
geometry.fPath = *args.fPath;
geometry.fAntiAlias = args.fAntiAlias;
- SkAutoTUnref<GrBatch> batch(AADistanceFieldPathBatch::Create(geometry, args.fColor,
- *args.fViewMatrix, fAtlas,
- &fPathCache, &fPathList));
+ SkAutoTUnref<GrDrawBatch> batch(AADistanceFieldPathBatch::Create(geometry, args.fColor,
+ *args.fViewMatrix, fAtlas,
+ &fPathCache, &fPathList));
args.fTarget->drawBatch(*args.fPipelineBuilder, batch);
return true;
@@ -597,7 +596,7 @@ struct PathTestStruct {
PathDataList fPathList;
};
-BATCH_TEST_DEFINE(AADistanceFieldPathBatch) {
+DRAW_BATCH_TEST_DEFINE(AADistanceFieldPathBatch) {
static PathTestStruct gTestStruct;
if (context->uniqueID() != gTestStruct.fContextID) {
« no previous file with comments | « src/gpu/GrAAConvexPathRenderer.cpp ('k') | src/gpu/GrAAHairLinePathRenderer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698