diff options
author | Robert Phillips <robertphillips@google.com> | 2018-05-17 11:17:39 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-05-17 17:06:24 +0000 |
commit | 120784394c160d009bc3aa88dd217c13c105a6ca (patch) | |
tree | c2f3406ff37360a511af362138938e754c057619 /gm/matrixconvolution.cpp | |
parent | ffb3d688b0e76ad7d1517657b00e4525cc603f40 (diff) |
Fix srcBounds computation in SkMatrixConvolutionImageFilter
Note that this does change the behavior of the cropRect for the repeated case. The cropRect now only acts as a hard clip on the output.
BUG= skia:7766
Change-Id: I1d66678bc797cd4835701cd20c36e68b22ac880a
Reviewed-on: https://skia-review.googlesource.com/127338
Reviewed-by: Herb Derby <herb@google.com>
Commit-Queue: Robert Phillips <robertphillips@google.com>
Diffstat (limited to 'gm/matrixconvolution.cpp')
-rw-r--r-- | gm/matrixconvolution.cpp | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/gm/matrixconvolution.cpp b/gm/matrixconvolution.cpp index 4af12e172d..adb7eceff0 100644 --- a/gm/matrixconvolution.cpp +++ b/gm/matrixconvolution.cpp @@ -92,9 +92,14 @@ protected: cropRect)); canvas->save(); canvas->translate(SkIntToScalar(x), SkIntToScalar(y)); - canvas->clipRect(SkRect::MakeWH(SkIntToScalar(fBitmap.width()), - SkIntToScalar(fBitmap.height()))); - canvas->drawBitmap(fBitmap, 0, 0, &paint); + const SkRect layerBounds = SkRect::MakeIWH(fBitmap.width(), fBitmap.height()); + canvas->clipRect(layerBounds); + // This GM is, in part, intended to display the wrapping behavior of the + // matrix image filter. The only (rational) way to achieve that for repeat mode + // is to create a tight layer. + canvas->saveLayer(layerBounds, &paint); + canvas->drawBitmap(fBitmap, 0, 0, nullptr); + canvas->restore(); canvas->restore(); } |