From f94b3a4cebd4adab09c40ebe23c02a615e10c394 Mon Sep 17 00:00:00 2001 From: "bsalomon@google.com" Date: Wed, 31 Oct 2012 18:09:01 +0000 Subject: 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 --- src/core/SkDraw.cpp | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) (limited to 'src/core/SkDraw.cpp') 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 -- cgit v1.2.3