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

Unified Diff: gm/imagefilterscropped.cpp

Issue 23600047: Implement crop rect support for the merge image filter. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Remove useless #include. Created 7 years, 3 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 | include/effects/SkMergeImageFilter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/imagefilterscropped.cpp
diff --git a/gm/imagefilterscropped.cpp b/gm/imagefilterscropped.cpp
index b21131c362241b5aa49596d4b05cbefd43febf52..767973d07d1356448c92a1c2631e3a56f01fdc3f 100644
--- a/gm/imagefilterscropped.cpp
+++ b/gm/imagefilterscropped.cpp
@@ -13,6 +13,8 @@
#include "SkBlurImageFilter.h"
#include "SkColorFilterImageFilter.h"
+#include "SkMergeImageFilter.h"
+#include "SkOffsetImageFilter.h"
#include "SkTestImageFilters.h"
///////////////////////////////////////////////////////////////////////////////
@@ -129,22 +131,27 @@ protected:
draw_sprite, draw_bitmap, draw_path, draw_paint, draw_text
};
- SkColorFilter* cf = SkColorFilter::CreateModeFilter(SK_ColorRED,
- SkXfermode::kSrcIn_Mode);
+ SkAutoTUnref<SkColorFilter> cf(
+ SkColorFilter::CreateModeFilter(SK_ColorBLUE, SkXfermode::kSrcIn_Mode));
SkIRect cropRect = SkIRect::MakeXYWH(10, 10, 44, 44);
SkIRect bogusRect = SkIRect::MakeXYWH(-100, -100, 10, 10);
+ SkAutoTUnref<SkImageFilter> offset(new SkOffsetImageFilter(
+ SkIntToScalar(-10), SkIntToScalar(-10)));
+
+ SkAutoTUnref<SkImageFilter> cfOffset(SkColorFilterImageFilter::Create(cf.get(), offset.get()));
+
SkImageFilter* filters[] = {
NULL,
- SkColorFilterImageFilter::Create(cf, NULL, &cropRect),
+ SkColorFilterImageFilter::Create(cf.get(), NULL, &cropRect),
new SkBlurImageFilter(1.0f, 1.0f, NULL, &cropRect),
new SkBlurImageFilter(8.0f, 0.0f, NULL, &cropRect),
new SkBlurImageFilter(0.0f, 8.0f, NULL, &cropRect),
new SkBlurImageFilter(8.0f, 8.0f, NULL, &cropRect),
+ new SkMergeImageFilter(NULL, cfOffset.get(), SkXfermode::kSrcOver_Mode, &cropRect),
new SkBlurImageFilter(8.0f, 8.0f, NULL, &bogusRect),
- SkColorFilterImageFilter::Create(cf, NULL, &bogusRect),
+ SkColorFilterImageFilter::Create(cf.get(), NULL, &bogusRect),
};
- cf->unref();
SkRect r = SkRect::MakeWH(SkIntToScalar(64), SkIntToScalar(64));
SkScalar MARGIN = SkIntToScalar(16);
« no previous file with comments | « no previous file | include/effects/SkMergeImageFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698