aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/batches/GrAAFillRectBatch.cpp
diff options
context:
space:
mode:
authorGravatar joshualitt <joshualitt@chromium.org>2015-08-12 12:52:47 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2015-08-12 12:52:47 -0700
commit27801bf140992bbf44b577ca289e321d85881f62 (patch)
tree758f2fe3d1a272340701367c35b9ca2a5d3de529 /src/gpu/batches/GrAAFillRectBatch.cpp
parenta50e17a391bb57771feac8c1e78a2b1627f7b9e2 (diff)
broken bots war
TBR=bsalomon@google.com BUG=skia: Review URL: https://codereview.chromium.org/1289803005
Diffstat (limited to 'src/gpu/batches/GrAAFillRectBatch.cpp')
-rw-r--r--src/gpu/batches/GrAAFillRectBatch.cpp46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/gpu/batches/GrAAFillRectBatch.cpp b/src/gpu/batches/GrAAFillRectBatch.cpp
index c9eeed3075..4fdf8f549c 100644
--- a/src/gpu/batches/GrAAFillRectBatch.cpp
+++ b/src/gpu/batches/GrAAFillRectBatch.cpp
@@ -24,6 +24,26 @@ static void set_inset_fan(SkPoint* pts, size_t stride,
r.fRight - dx, r.fBottom - dy, stride);
}
+static const int kNumAAFillRectsInIndexBuffer = 256;
+static const int kVertsPerAAFillRect = 8;
+static const int kIndicesPerAAFillRect = 30;
+
+const GrIndexBuffer* get_index_buffer(GrResourceProvider* resourceProvider) {
+ GR_DEFINE_STATIC_UNIQUE_KEY(gAAFillRectIndexBufferKey);
+
+ static const uint16_t gFillAARectIdx[] = {
+ 0, 1, 5, 5, 4, 0,
+ 1, 2, 6, 6, 5, 1,
+ 2, 3, 7, 7, 6, 2,
+ 3, 0, 4, 4, 7, 3,
+ 4, 5, 6, 6, 7, 4,
+ };
+ GR_STATIC_ASSERT(SK_ARRAY_COUNT(gFillAARectIdx) == kIndicesPerAAFillRect);
+ return resourceProvider->findOrCreateInstancedIndexBuffer(gFillAARectIdx,
+ kIndicesPerAAFillRect, kNumAAFillRectsInIndexBuffer, kVertsPerAAFillRect,
+ gAAFillRectIndexBufferKey);
+}
+
/*
* AAFillRectBatch is templated to optionally allow the insertion of an additional
* attribute for explicit local coordinates.
@@ -96,7 +116,7 @@ public:
this->usesLocalCoords()));
int instanceCount = fGeoData.count();
- SkAutoTUnref<const GrIndexBuffer> indexBuffer(this->getIndexBuffer(
+ SkAutoTUnref<const GrIndexBuffer> indexBuffer(get_index_buffer(
batchTarget->resourceProvider()));
InstancedHelper helper;
void* vertices = helper.init(batchTarget, kTriangles_GrPrimitiveType, vertexStride,
@@ -137,26 +157,6 @@ private:
fGeoData.push_back();
}
- static const int kNumAAFillRectsInIndexBuffer = 256;
- static const int kVertsPerAAFillRect = 8;
- static const int kIndicesPerAAFillRect = 30;
-
- const GrIndexBuffer* getIndexBuffer(GrResourceProvider* resourceProvider) {
- GR_DEFINE_STATIC_UNIQUE_KEY(gAAFillRectIndexBufferKey);
-
- static const uint16_t gFillAARectIdx[] = {
- 0, 1, 5, 5, 4, 0,
- 1, 2, 6, 6, 5, 1,
- 2, 3, 7, 7, 6, 2,
- 3, 0, 4, 4, 7, 3,
- 4, 5, 6, 6, 7, 4,
- };
- GR_STATIC_ASSERT(SK_ARRAY_COUNT(gFillAARectIdx) == kIndicesPerAAFillRect);
- return resourceProvider->findOrCreateInstancedIndexBuffer(gFillAARectIdx,
- kIndicesPerAAFillRect, kNumAAFillRectsInIndexBuffer, kVertsPerAAFillRect,
- gAAFillRectIndexBufferKey);
- }
-
GrColor color() const { return fBatch.fColor; }
bool usesLocalCoords() const { return fBatch.fUsesLocalCoords; }
bool canTweakAlphaForCoverage() const { return fBatch.fCanTweakAlphaForCoverage; }
@@ -304,10 +304,11 @@ private:
Coverage coverage(coverageType);
// We assume the caller has inverted the viewmatrix
- LocalCoords localCoords(usesLocalCoords ? localCoordsType : LocalCoords::kUnused_Type);
if (LocalCoords::kHasExplicit_Type == localCoordsType) {
+ LocalCoords localCoords(localCoordsType);
return GrDefaultGeoProcFactory::Create(color, coverage, localCoords, SkMatrix::I());
} else {
+ LocalCoords localCoords(usesLocalCoords ? localCoordsType : LocalCoords::kUnused_Type);
return CreateForDeviceSpace(color, coverage, localCoords, viewMatrix);
}
}
@@ -377,7 +378,6 @@ public:
inline static bool StrideCheck(size_t vertexStride, bool canTweakAlphaForCoverage,
bool usesLocalCoords) {
// Whomever created us should not have done so if there are no local coords
- SkASSERT(usesLocalCoords);
return canTweakAlphaForCoverage ?
vertexStride == sizeof(GrDefaultGeoProcFactory::PositionColorLocalCoordAttr) :
vertexStride == sizeof(GrDefaultGeoProcFactory::PositionColorLocalCoordCoverage);