Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(58)

Unified Diff: gm/matrixconvolution.cpp

Issue 1500923004: Matrix convolution bounds fix; affectsTransparentBlack fixes. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Alternate, more future-proof fix Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | include/core/SkImageFilter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/matrixconvolution.cpp
diff --git a/gm/matrixconvolution.cpp b/gm/matrixconvolution.cpp
index 6d16f8dfa74df4f5e92a93c176f8e527a1375f67..3b159f455bd084df5255f3b4dcff62ad01d46030 100644
--- a/gm/matrixconvolution.cpp
+++ b/gm/matrixconvolution.cpp
@@ -86,21 +86,22 @@ protected:
void onDraw(SkCanvas* canvas) override {
canvas->clear(SK_ColorBLACK);
SkIPoint kernelOffset = SkIPoint::Make(1, 0);
+ SkImageFilter::CropRect rect(SkRect::Make(fBitmap.bounds()));
for (int x = 10; x < 310; x += 100) {
- this->draw(canvas, x, 10, kernelOffset, MCIF::kClamp_TileMode, true);
- this->draw(canvas, x, 110, kernelOffset, MCIF::kClampToBlack_TileMode, true);
- this->draw(canvas, x, 210, kernelOffset, MCIF::kRepeat_TileMode, true);
+ this->draw(canvas, x, 10, kernelOffset, MCIF::kClamp_TileMode, true, &rect);
+ this->draw(canvas, x, 110, kernelOffset, MCIF::kClampToBlack_TileMode, true, &rect);
+ this->draw(canvas, x, 210, kernelOffset, MCIF::kRepeat_TileMode, true, &rect);
kernelOffset.fY++;
}
kernelOffset.fY = 1;
- SkImageFilter::CropRect rect(SkRect::MakeXYWH(10, 5, 60, 60));
- this->draw(canvas, 310, 10, kernelOffset, MCIF::kClamp_TileMode, true, &rect);
- this->draw(canvas, 310, 110, kernelOffset, MCIF::kClampToBlack_TileMode, true, &rect);
- this->draw(canvas, 310, 210, kernelOffset, MCIF::kRepeat_TileMode, true, &rect);
-
- this->draw(canvas, 410, 10, kernelOffset, MCIF::kClamp_TileMode, false);
- this->draw(canvas, 410, 110, kernelOffset, MCIF::kClampToBlack_TileMode, false);
- this->draw(canvas, 410, 210, kernelOffset, MCIF::kRepeat_TileMode, false);
+ SkImageFilter::CropRect smallRect(SkRect::MakeXYWH(10, 5, 60, 60));
+ this->draw(canvas, 310, 10, kernelOffset, MCIF::kClamp_TileMode, true, &smallRect);
+ this->draw(canvas, 310, 110, kernelOffset, MCIF::kClampToBlack_TileMode, true, &smallRect);
+ this->draw(canvas, 310, 210, kernelOffset, MCIF::kRepeat_TileMode, true, &smallRect);
+
+ this->draw(canvas, 410, 10, kernelOffset, MCIF::kClamp_TileMode, false, &rect);
+ this->draw(canvas, 410, 110, kernelOffset, MCIF::kClampToBlack_TileMode, false, &rect);
+ this->draw(canvas, 410, 210, kernelOffset, MCIF::kRepeat_TileMode, false, &rect);
}
private:
« no previous file with comments | « no previous file | include/core/SkImageFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698