diff options
author | 2013-03-20 17:32:27 +0000 | |
---|---|---|
committer | 2013-03-20 17:32:27 +0000 | |
commit | ae81d5c4aa1716756b2cfb4c44f27f4dce2716ef (patch) | |
tree | 019b5c1b55da3c7da77943f8b93f5cc28da090c2 /src/gpu/GrDrawTarget.cpp | |
parent | 723dd790fbef396cd5c6619d0a3656c641b0c3f5 (diff) |
Adds local coords to GrEffect system.
Effects can ask the builder for local coords which may or may not be distinct from positions.
GrEffectStage tracks changes to relationship between pos and local coords.
GrGLEffectMatrix and GrSingleTextureEffect can use either pos or textures as intput coords
GrSimpleTextureEffect now allows for an explicit texture coords attribute.
Review URL: https://codereview.chromium.org/12531015
git-svn-id: http://skia.googlecode.com/svn/trunk@8264 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/gpu/GrDrawTarget.cpp')
-rw-r--r-- | src/gpu/GrDrawTarget.cpp | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/src/gpu/GrDrawTarget.cpp b/src/gpu/GrDrawTarget.cpp index 6fdc3a080f..cd4d4d2007 100644 --- a/src/gpu/GrDrawTarget.cpp +++ b/src/gpu/GrDrawTarget.cpp @@ -529,11 +529,9 @@ void GrDrawTarget::drawIndexedInstances(GrPrimitiveType type, void GrDrawTarget::drawRect(const GrRect& rect, const SkMatrix* matrix, - const GrRect* srcRect, - const SkMatrix* srcMatrix, - int stage) { + const GrRect* localRect, + const SkMatrix* localMatrix) { GrAttribBindings bindings = 0; - uint32_t explicitCoordMask = 0; // position + (optional) texture coord static const GrVertexAttrib kAttribs[] = { {kVec2f_GrVertexAttribType, 0}, @@ -541,16 +539,15 @@ void GrDrawTarget::drawRect(const GrRect& rect, }; int attribCount = 1; - if (NULL != srcRect) { - bindings |= GrDrawState::ExplicitTexCoordAttribBindingsBit(stage); + if (NULL != localRect) { + bindings |= GrDrawState::kLocalCoords_AttribBindingsBit; attribCount = 2; - this->drawState()->setAttribIndex(GrDrawState::kTexCoord_AttribIndex, 1); - explicitCoordMask = (1 << stage); + this->drawState()->setAttribIndex(GrDrawState::kLocalCoords_AttribIndex, 1); } GrDrawState::AutoViewMatrixRestore avmr; if (NULL != matrix) { - avmr.set(this->drawState(), *matrix, explicitCoordMask); + avmr.set(this->drawState(), *matrix); } this->drawState()->setVertexAttribs(kAttribs, attribCount); @@ -564,15 +561,15 @@ void GrDrawTarget::drawRect(const GrRect& rect, size_t vsize = this->drawState()->getVertexSize(); geo.positions()->setRectFan(rect.fLeft, rect.fTop, rect.fRight, rect.fBottom, vsize); - if (NULL != srcRect) { + if (NULL != localRect) { GrAssert(attribCount == 2); GrPoint* coords = GrTCast<GrPoint*>(GrTCast<intptr_t>(geo.vertices()) + kAttribs[1].fOffset); - coords->setRectFan(srcRect->fLeft, srcRect->fTop, - srcRect->fRight, srcRect->fBottom, - vsize); - if (NULL != srcMatrix) { - srcMatrix->mapPointsWithStride(coords, vsize, 4); + coords->setRectFan(localRect->fLeft, localRect->fTop, + localRect->fRight, localRect->fBottom, + vsize); + if (NULL != localMatrix) { + localMatrix->mapPointsWithStride(coords, vsize, 4); } } |