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

Unified Diff: tests/ImageFilterTest.cpp

Issue 1908173006: allow imagefilter to manage CTM decomposition (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: switch to simple canHandleAffine pattern 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
« src/core/SkImageFilter.cpp ('K') | « src/effects/SkColorFilterImageFilter.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/ImageFilterTest.cpp
diff --git a/tests/ImageFilterTest.cpp b/tests/ImageFilterTest.cpp
index 4db9196db9bb220f2d0fb5c7e41b965b7d401876..7aefd484816b51e80d9f6a739126cefaa88bf5db 100644
--- a/tests/ImageFilterTest.cpp
+++ b/tests/ImageFilterTest.cpp
@@ -1706,3 +1706,31 @@ DEF_GPUTEST_FOR_ALL_GL_CONTEXTS(ImageFilterBlurLargeImage_Gpu, reporter, ctxInfo
test_large_blur_input(reporter, surface->getCanvas());
}
#endif
+
+/*
+ * Test that colorfilterimagefilter does not require its CTM to be decomposed when it has more
+ * than just scale/translate, but that other filters do.
+ */
+DEF_TEST(ImageFilterDecomposeCTM, reporter) {
+ // just need a colorfilter to exercise the corresponding imagefilter
+ sk_sp<SkColorFilter> cf = SkColorFilter::MakeModeFilter(SK_ColorRED, SkXfermode::kSrcATop_Mode);
+ sk_sp<SkImageFilter> cfif = SkColorFilterImageFilter::Make(cf, nullptr);
+ sk_sp<SkImageFilter> blif = SkBlurImageFilter::Make(3, 3, nullptr);
+
+ struct {
+ sk_sp<SkImageFilter> fFilter;
+ bool fExpectCanHandle;
+ } recs[] = {
+ { cfif, true },
+ { SkColorFilterImageFilter::Make(cf, cfif), true },
+ { SkMergeImageFilter::Make(cfif, cfif), true },
+ { blif, false },
+ { SkMergeImageFilter::Make(cfif, blif), false },
+ { SkColorFilterImageFilter::Make(cf, blif), false },
+ };
+
+ for (const auto& rec : recs) {
+ const bool canHandle = rec.fFilter->canHandleAffine();
+ REPORTER_ASSERT(reporter, canHandle == rec.fExpectCanHandle);
+ }
+}
« src/core/SkImageFilter.cpp ('K') | « src/effects/SkColorFilterImageFilter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698