Fix a problem in the matrix convolution image filter exposed by https://code.google.com/p/skia/source/detail?r=7152: when offsetting texture coordinates in a GrEffect, take the origin of the source bitmap origin into account, and flip Y coordinates when we need to.
NOTE: this will cause the matrixconvolution GM's to need to be rebaselined (again!).
Review URL: https://codereview.appspot.com/7086054
git-svn-id: http://skia.googlecode.com/svn/trunk@7168 2bbb7eff-a529-9590-31e7-b0007b416f81
diff --git a/src/effects/SkMatrixConvolutionImageFilter.cpp b/src/effects/SkMatrixConvolutionImageFilter.cpp
index 74f04bf..657c996 100644
--- a/src/effects/SkMatrixConvolutionImageFilter.cpp
+++ b/src/effects/SkMatrixConvolutionImageFilter.cpp
@@ -455,8 +455,9 @@
GrAssert(effect.kernelSize() == fKernelSize);
GrAssert(effect.tileMode() == fTileMode);
float imageIncrement[2];
+ float ySign = texture.origin() == GrSurface::kTopLeft_Origin ? 1.0f : -1.0f;
imageIncrement[0] = 1.0f / texture.width();
- imageIncrement[1] = 1.0f / texture.height();
+ imageIncrement[1] = ySign / texture.height();
uman.set2fv(fImageIncrementUni, 0, 1, imageIncrement);
uman.set2fv(fTargetUni, 0, 1, effect.target());
uman.set1fv(fKernelUni, 0, fKernelSize.width() * fKernelSize.height(), effect.kernel());