Remove unused texture coordinate flags.
Currently we support 5 texture stages, each with 5 possible texture coordinate attributes.
However, we only ever use one explicit texture coordinate. This change removes all but one
(now named just "aTexCoord") of the possible explicit texture coordinates.
Review URL: https://codereview.appspot.com/7308094/
git-svn-id: http://skia.googlecode.com/svn/trunk@7737 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/gpu/GrInOrderDrawBuffer.cpp b/src/gpu/GrInOrderDrawBuffer.cpp
index 991d858..0ebf810 100644
--- a/src/gpu/GrInOrderDrawBuffer.cpp
+++ b/src/gpu/GrInOrderDrawBuffer.cpp
@@ -72,8 +72,9 @@
void GrInOrderDrawBuffer::drawRect(const GrRect& rect,
const SkMatrix* matrix,
- const GrRect* srcRects[],
- const SkMatrix* srcMatrices[]) {
+ const GrRect* srcRect,
+ const SkMatrix* srcMatrix,
+ int stage) {
GrVertexLayout layout = 0;
GrDrawState::AutoColorRestore acr;
@@ -96,15 +97,9 @@
}
uint32_t explicitCoordMask = 0;
- if (NULL != srcRects) {
- for (int s = 0; s < GrDrawState::kNumStages; ++s) {
- int numTC = 0;
- if (NULL != srcRects[s]) {
- layout |= GrDrawState::StageTexCoordVertexLayoutBit(s, numTC);
- ++numTC;
- explicitCoordMask |= (1 << s);
- }
- }
+ if (NULL != srcRect) {
+ layout |= GrDrawState::StageTexCoordVertexLayoutBit(stage);
+ explicitCoordMask = (1 << stage);
}
this->drawState()->setVertexLayout(layout);
@@ -122,7 +117,7 @@
combinedMatrix.reset();
}
combinedMatrix.postConcat(this->drawState()->getViewMatrix());
- // When the caller has provided an explicit source rects for a stage then we don't want to
+ // When the caller has provided an explicit source rect for a stage then we don't want to
// modify that stage's matrix. Otherwise if the effect is generating its source rect from
// the vertex positions then we have to account for the view matrix change.
GrDrawState::AutoDeviceCoordDraw adcd(this->drawState(), explicitCoordMask);
@@ -147,11 +142,11 @@
GrAssert(0 != stageOffsets[i]);
GrPoint* coords = GrTCast<GrPoint*>(GrTCast<intptr_t>(geo.vertices()) +
stageOffsets[i]);
- coords->setRectFan(srcRects[i]->fLeft, srcRects[i]->fTop,
- srcRects[i]->fRight, srcRects[i]->fBottom,
+ coords->setRectFan(srcRect->fLeft, srcRect->fTop,
+ srcRect->fRight, srcRect->fBottom,
vsize);
- if (NULL != srcMatrices && NULL != srcMatrices[i]) {
- srcMatrices[i]->mapPointsWithStride(coords, vsize, 4);
+ if (NULL != srcMatrix) {
+ srcMatrix->mapPointsWithStride(coords, vsize, 4);
}
} else {
GrAssert(0 == stageOffsets[i]);