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

Unified Diff: gm/imagefilterstransformed.cpp

Issue 1902253003: add gm to exercise rotated imagefiltesr w/ and w/o antialiasing (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 8 months 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/imagefilterstransformed.cpp
diff --git a/gm/imagefilterstransformed.cpp b/gm/imagefilterstransformed.cpp
index ce7ba5d6e0793faa1f1c8964429925a3acde515b..7ceff001351e1cba1944c72313d2d2b2b953c7cb 100644
--- a/gm/imagefilterstransformed.cpp
+++ b/gm/imagefilterstransformed.cpp
@@ -113,9 +113,49 @@ private:
sk_sp<SkImage> fGradientCircle;
typedef GM INHERITED;
};
+DEF_GM( return new ImageFiltersTransformedGM; )
+}
//////////////////////////////////////////////////////////////////////////////
+#include "SkXfermodeImageFilter.h"
-DEF_GM( return new ImageFiltersTransformedGM; )
+DEF_SIMPLE_GM(rotate_imagefilter, canvas, 500, 500) {
+ SkPaint paint;
+ const SkRect r = SkRect::MakeXYWH(50, 50, 100, 100);
+
+ sk_sp<SkImageFilter> filters[] = {
+ nullptr,
+ SkBlurImageFilter::Make(6, 0, nullptr),
+ SkXfermodeImageFilter::Make(SkXfermode::Make(SkXfermode::kSrcOver_Mode), nullptr),
+ };
+
+ for (auto& filter : filters) {
+ paint.setAntiAlias(false);
+ paint.setImageFilter(filter);
+
+ canvas->save();
+
+ canvas->drawRect(r, paint);
+
+ canvas->translate(150, 0);
+ canvas->save();
+ canvas->translate(100, 100);
+ canvas->rotate(30);
+ canvas->translate(-100, -100);
+ canvas->drawRect(r, paint);
+ canvas->restore();
+
+ paint.setAntiAlias(true);
+ canvas->translate(150, 0);
+ canvas->save();
+ canvas->translate(100, 100);
+ canvas->rotate(30);
+ canvas->translate(-100, -100);
+ canvas->drawRect(r, paint);
+ canvas->restore();
+
+ canvas->restore();
+ canvas->translate(0, 150);
+ }
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698