aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--gm/matrixconvolution.cpp2
-rw-r--r--src/effects/SkMatrixConvolutionImageFilter.cpp14
2 files changed, 10 insertions, 6 deletions
diff --git a/gm/matrixconvolution.cpp b/gm/matrixconvolution.cpp
index 5c443da3ff..1863a7f597 100644
--- a/gm/matrixconvolution.cpp
+++ b/gm/matrixconvolution.cpp
@@ -93,7 +93,7 @@ protected:
target.fY++;
}
target.fY = 1;
- SkImageFilter::CropRect rect(SkRect::MakeXYWH(10, 10, 60, 60));
+ SkImageFilter::CropRect rect(SkRect::MakeXYWH(10, 5, 60, 60));
this->draw(canvas, 310, 10, target, MCIF::kClamp_TileMode, true, &rect);
this->draw(canvas, 310, 110, target, MCIF::kClampToBlack_TileMode, true, &rect);
this->draw(canvas, 310, 210, target, MCIF::kRepeat_TileMode, true, &rect);
diff --git a/src/effects/SkMatrixConvolutionImageFilter.cpp b/src/effects/SkMatrixConvolutionImageFilter.cpp
index 04326c6514..a9dfecce59 100644
--- a/src/effects/SkMatrixConvolutionImageFilter.cpp
+++ b/src/effects/SkMatrixConvolutionImageFilter.cpp
@@ -515,11 +515,15 @@ void GrGLMatrixConvolutionEffect::setData(const GrGLUniformManager& uman,
uman.set1f(fGainUni, conv.gain());
uman.set1f(fBiasUni, conv.bias());
const SkIRect& bounds = conv.bounds();
- uman.set4f(fBoundsUni,
- (float) bounds.left() / texture.width(),
- (float) bounds.top() / texture.height(),
- (float) bounds.right() / texture.width(),
- (float) bounds.bottom() / texture.height());
+ float left = (float) bounds.left() / texture.width();
+ float top = (float) bounds.top() / texture.height();
+ float right = (float) bounds.right() / texture.width();
+ float bottom = (float) bounds.bottom() / texture.height();
+ if (texture.origin() == kBottomLeft_GrSurfaceOrigin) {
+ uman.set4f(fBoundsUni, left, 1.0f - bottom, right, 1.0f - top);
+ } else {
+ uman.set4f(fBoundsUni, left, top, right, bottom);
+ }
}
GrMatrixConvolutionEffect::GrMatrixConvolutionEffect(GrTexture* texture,