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

Unified Diff: src/gpu/batches/GrAAFillRectBatch.cpp

Issue 1293543002: drawBitmapImage can batch across AA rects (Closed) Base URL: https://skia.googlesource.com/skia.git@gmfordrawimagerect
Patch Set: tweaks 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/SkGpuDevice.cpp ('k') | src/gpu/batches/GrRectBatchFactory.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/batches/GrAAFillRectBatch.cpp
diff --git a/src/gpu/batches/GrAAFillRectBatch.cpp b/src/gpu/batches/GrAAFillRectBatch.cpp
index 94cc5ce635397eda7a6d3a16684874703d8ebd13..d8ef3d3152d399fca510dde504d758eb9c17fe76 100644
--- a/src/gpu/batches/GrAAFillRectBatch.cpp
+++ b/src/gpu/batches/GrAAFillRectBatch.cpp
@@ -250,12 +250,15 @@ private:
// Make verts point to vertex color and then set all the color and coverage vertex attrs
// values.
verts += sizeof(SkPoint);
+
+ // The coverage offset is always the last vertex attribute
+ intptr_t coverageOffset = vertexStride - sizeof(GrColor) - sizeof(SkPoint);
for (int i = 0; i < 4; ++i) {
if (tweakAlphaForCoverage) {
*reinterpret_cast<GrColor*>(verts + i * vertexStride) = 0;
} else {
*reinterpret_cast<GrColor*>(verts + i * vertexStride) = args.fColor;
- *reinterpret_cast<float*>(verts + i * vertexStride + sizeof(GrColor)) = 0;
+ *reinterpret_cast<float*>(verts + i * vertexStride + coverageOffset) = 0;
}
}
@@ -278,7 +281,7 @@ private:
} else {
*reinterpret_cast<GrColor*>(verts + i * vertexStride) = args.fColor;
*reinterpret_cast<float*>(verts + i * vertexStride +
- sizeof(GrColor)) = innerCoverage;
+ coverageOffset) = innerCoverage;
}
}
}
@@ -392,7 +395,7 @@ public:
}
SkMatrix localCoordMatrix;
localCoordMatrix.setConcat(args.fLocalMatrix, invViewMatrix);
- SkPoint* fan0Loc = reinterpret_cast<SkPoint*>(vertices + vertexStride - sizeof(SkPoint));
+ SkPoint* fan0Loc = reinterpret_cast<SkPoint*>(vertices + sizeof(SkPoint) + sizeof(GrColor));
localCoordMatrix.mapPointsWithStride(fan0Loc, fan0Pos, vertexStride, 8);
}
};
« no previous file with comments | « src/gpu/SkGpuDevice.cpp ('k') | src/gpu/batches/GrRectBatchFactory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698