diff options
author | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-10-31 18:09:01 +0000 |
---|---|---|
committer | bsalomon@google.com <bsalomon@google.com@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2012-10-31 18:09:01 +0000 |
commit | f94b3a4cebd4adab09c40ebe23c02a615e10c394 (patch) | |
tree | a611a0cb0e1db232fbe5a1af0312eea05428dce1 /src/core/SkDraw.cpp | |
parent | c1f6db86dcf478d3c067bfc3fd99174b23d81732 (diff) |
Make SkShader store localM directly rather than as a separate alloc.
May cause very slight GM changes in gpu two pt radial/conical radients.
Review URL: https://codereview.appspot.com/6821056
git-svn-id: http://skia.googlecode.com/svn/trunk@6221 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkDraw.cpp')
-rw-r--r-- | src/core/SkDraw.cpp | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/src/core/SkDraw.cpp b/src/core/SkDraw.cpp index 885a810836..2af86c086a 100644 --- a/src/core/SkDraw.cpp +++ b/src/core/SkDraw.cpp @@ -2374,8 +2374,11 @@ void SkDraw::drawVertices(SkCanvas::VertexMode vmode, int count, VertState::Proc vertProc = state.chooseProc(vmode); if (NULL != textures || NULL != colors) { - SkMatrix localM, tempM; - bool hasLocalM = shader && shader->getLocalMatrix(&localM); + SkMatrix tempM; + SkMatrix savedLocalM; + if (shader) { + savedLocalM = shader->getLocalMatrix(); + } if (NULL != colors) { if (!triShader.setContext(*fBitmap, p, *fMatrix)) { @@ -2386,9 +2389,7 @@ void SkDraw::drawVertices(SkCanvas::VertexMode vmode, int count, while (vertProc(&state)) { if (NULL != textures) { if (texture_to_matrix(state, vertices, textures, &tempM)) { - if (hasLocalM) { - tempM.postConcat(localM); - } + tempM.postConcat(savedLocalM); shader->setLocalMatrix(tempM); // need to recal setContext since we changed the local matrix if (!shader->setContext(*fBitmap, p, *fMatrix)) { @@ -2410,11 +2411,7 @@ void SkDraw::drawVertices(SkCanvas::VertexMode vmode, int count, } // now restore the shader's original local matrix if (NULL != shader) { - if (hasLocalM) { - shader->setLocalMatrix(localM); - } else { - shader->resetLocalMatrix(); - } + shader->setLocalMatrix(savedLocalM); } } else { // no colors[] and no texture |