Axis aligned shader-based rect drawing
https://codereview.chromium.org/14314004/
git-svn-id: http://skia.googlecode.com/svn/trunk@8960 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/include/gpu/GrAARectRenderer.h b/include/gpu/GrAARectRenderer.h
index 84dd52f..b544294 100644
--- a/include/gpu/GrAARectRenderer.h
+++ b/include/gpu/GrAARectRenderer.h
@@ -38,19 +38,25 @@
// TODO: potentialy fuse the fill & stroke methods and differentiate
// between them by passing in strokeWidth (<0 means fill).
- // TODO: Remove the useVertexCoverage boolean. Just use it all the time
- // since we now have a coverage vertex attribute
void fillAARect(GrGpu* gpu,
GrDrawTarget* target,
+ const GrRect& rect,
+ const SkMatrix& combinedMatrix,
const GrRect& devRect,
- bool useVertexCoverage);
-
- void shaderFillAARect(GrGpu* gpu,
- GrDrawTarget* target,
- const GrRect& rect,
- const SkMatrix& combinedMatrix,
- const GrRect& devRect,
- bool useVertexCoverage);
+ bool useVertexCoverage) {
+#ifdef SHADER_AA_FILL_RECT
+ if (combinedMatrix.rectStaysRect()) {
+ this->shaderFillAlignedAARect(gpu, target,
+ combinedMatrix, devRect);
+ } else {
+ this->shaderFillAARect(gpu, target,
+ rect, combinedMatrix, devRect);
+ }
+#else
+ this->geometryFillAARect(gpu, target,
+ devRect, useVertexCoverage);
+#endif
+ }
void strokeAARect(GrGpu* gpu,
GrDrawTarget* target,
@@ -67,6 +73,25 @@
static int aaStrokeRectIndexCount();
GrIndexBuffer* aaStrokeRectIndexBuffer(GrGpu* gpu);
+ // TODO: Remove the useVertexCoverage boolean. Just use it all the time
+ // since we now have a coverage vertex attribute
+ void geometryFillAARect(GrGpu* gpu,
+ GrDrawTarget* target,
+ const GrRect& devRect,
+ bool useVertexCoverage);
+
+ void shaderFillAARect(GrGpu* gpu,
+ GrDrawTarget* target,
+ const GrRect& rect,
+ const SkMatrix& combinedMatrix,
+ const GrRect& devRect);
+
+ void shaderFillAlignedAARect(GrGpu* gpu,
+ GrDrawTarget* target,
+ const GrRect& rect,
+ const SkMatrix& combinedMatrix,
+ const GrRect& devRect);
+
typedef GrRefCnt INHERITED;
};