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
diff --git a/src/gpu/SkGpuDevice.cpp b/src/gpu/SkGpuDevice.cpp
index b0f4ac1..cdccbcd 100644
--- a/src/gpu/SkGpuDevice.cpp
+++ b/src/gpu/SkGpuDevice.cpp
@@ -584,6 +584,16 @@
return false;
}
+ // since our texture coords will be in local space, we whack the texture
+ // matrix to map them back into 0...1 before we load it
+ if (shader->hasLocalMatrix()) {
+ SkMatrix inverse;
+ if (!shader->getLocalMatrix().invert(&inverse)) {
+ return false;
+ }
+ matrix.preConcat(inverse);
+ }
+
// Must set wrap and filter on the sampler before requesting a texture.
GrTextureParams params(tileModes, skPaint.isFilterBitmap());
GrTexture* texture = textures[kShaderTextureIdx].set(dev, bitmap, ¶ms);
@@ -593,15 +603,6 @@
return false;
}
- // since our texture coords will be in local space, we whack the texture
- // matrix to map them back into 0...1 before we load it
- SkMatrix localM;
- if (shader->getLocalMatrix(&localM)) {
- SkMatrix inverse;
- if (localM.invert(&inverse)) {
- matrix.preConcat(inverse);
- }
- }
if (SkShader::kDefault_BitmapType == bmptype) {
GrScalar sx = SkFloatToScalar(1.f / bitmap.width());
GrScalar sy = SkFloatToScalar(1.f / bitmap.height());