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
This commit is contained in:
senorblanco@chromium.org 2013-01-14 21:53:45 +00:00
parent a3bdc1a6cd
commit 027c10207a

View File

@ -455,8 +455,9 @@ void GrGLMatrixConvolutionEffect::setData(const GrGLUniformManager& uman,
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());