aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/batches
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@chromium.org>2015-08-17 10:51:22 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-08-17 10:51:22 -0700
commita61c817272c4e0e4dac9d8e24226d0881e27c5c1 (patch)
tree6ff151351a1be5b5fd5295d51bc492b19eb09c69 /src/gpu/batches
parentb279668c645dcf1c001fb0b42a9f623522fbfefb (diff)
drawBitmapImage can batch across AA rects
Diffstat (limited to 'src/gpu/batches')
-rw-r--r--src/gpu/batches/GrAAFillRectBatch.cpp9
-rw-r--r--src/gpu/batches/GrRectBatchFactory.h16
2 files changed, 18 insertions, 7 deletions
diff --git a/src/gpu/batches/GrAAFillRectBatch.cpp b/src/gpu/batches/GrAAFillRectBatch.cpp
index 94cc5ce635..d8ef3d3152 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);
}
};
diff --git a/src/gpu/batches/GrRectBatchFactory.h b/src/gpu/batches/GrRectBatchFactory.h
index 7eaec795e8..5a43a34214 100644
--- a/src/gpu/batches/GrRectBatchFactory.h
+++ b/src/gpu/batches/GrRectBatchFactory.h
@@ -23,10 +23,10 @@ class SkStrokeRec;
namespace GrRectBatchFactory {
inline GrDrawBatch* CreateFillBW(GrColor color,
- const SkMatrix& viewMatrix,
- const SkRect& rect,
- const SkRect* localRect,
- const SkMatrix* localMatrix) {
+ const SkMatrix& viewMatrix,
+ const SkRect& rect,
+ const SkRect* localRect,
+ const SkMatrix* localMatrix) {
return GrBWFillRectBatch::Create(color, viewMatrix, rect, localRect, localMatrix);
}
@@ -37,6 +37,14 @@ inline GrDrawBatch* CreateFillAA(GrColor color,
return GrAAFillRectBatch::Create(color, viewMatrix, rect, devRect);
}
+inline GrDrawBatch* CreateFillAA(GrColor color,
+ const SkMatrix& viewMatrix,
+ const SkMatrix& localMatrix,
+ const SkRect& rect,
+ const SkRect& devRect) {
+ return GrAAFillRectBatch::Create(color, viewMatrix, localMatrix, rect, devRect);
+}
+
GrDrawBatch* CreateStrokeBW(GrColor color,
const SkMatrix& viewMatrix,
const SkRect& rect,