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

Unified Diff: gm/xfermodeimagefilter.cpp

Issue 182983003: Factory methods for heap-allocated SkImageFilter objects. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Rebase Created 6 years, 9 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 | « gm/tileimagefilter.cpp ('k') | include/effects/SkBicubicImageFilter.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/xfermodeimagefilter.cpp
diff --git a/gm/xfermodeimagefilter.cpp b/gm/xfermodeimagefilter.cpp
index 446961871751c2b89f0cee7417ea14ab8dfa2d7d..2b14f4dfaab25d062e58881c72bf41d20218094a 100644
--- a/gm/xfermodeimagefilter.cpp
+++ b/gm/xfermodeimagefilter.cpp
@@ -130,11 +130,10 @@ protected:
};
int x = 0, y = 0;
- SkAutoTUnref<SkImageFilter> background(SkNEW_ARGS(SkBitmapSource, (fCheckerboard)));
+ SkAutoTUnref<SkImageFilter> background(SkBitmapSource::Create(fCheckerboard));
for (size_t i = 0; i < SK_ARRAY_COUNT(gModes); i++) {
SkAutoTUnref<SkXfermode> mode(SkXfermode::Create(gModes[i].fMode));
- SkAutoTUnref<SkImageFilter> filter(SkNEW_ARGS(
- SkXfermodeImageFilter, (mode, background)));
+ SkAutoTUnref<SkImageFilter> filter(SkXfermodeImageFilter::Create(mode, background));
paint.setImageFilter(filter);
drawClippedBitmap(canvas, fBitmap, paint, x, y);
x += fBitmap.width() + MARGIN;
@@ -145,7 +144,7 @@ protected:
}
// Test arithmetic mode as image filter
SkAutoTUnref<SkXfermode> mode(SkArithmeticMode::Create(0, SK_Scalar1, SK_Scalar1, 0));
- SkAutoTUnref<SkImageFilter> filter(SkNEW_ARGS(SkXfermodeImageFilter, (mode, background)));
+ SkAutoTUnref<SkImageFilter> filter(SkXfermodeImageFilter::Create(mode, background));
paint.setImageFilter(filter);
drawClippedBitmap(canvas, fBitmap, paint, x, y);
x += fBitmap.width() + MARGIN;
@@ -154,7 +153,7 @@ protected:
y += fBitmap.height() + MARGIN;
}
// Test NULL mode
- filter.reset(SkNEW_ARGS(SkXfermodeImageFilter, (NULL, background)));
+ filter.reset(SkXfermodeImageFilter::Create(NULL, background));
paint.setImageFilter(filter);
drawClippedBitmap(canvas, fBitmap, paint, x, y);
x += fBitmap.width() + MARGIN;
@@ -165,14 +164,13 @@ protected:
SkRect clipRect = SkRect::MakeWH(SkIntToScalar(fBitmap.width() + 4),
SkIntToScalar(fBitmap.height() + 4));
// Test offsets on SrcMode (uses fixed-function blend)
- SkAutoTUnref<SkImageFilter> foreground(SkNEW_ARGS(SkBitmapSource, (fBitmap)));
- SkAutoTUnref<SkImageFilter> offsetForeground(SkNEW_ARGS(SkOffsetImageFilter,
- (SkIntToScalar(4), SkIntToScalar(-4), foreground)));
- SkAutoTUnref<SkImageFilter> offsetBackground(SkNEW_ARGS(SkOffsetImageFilter,
- (SkIntToScalar(4), SkIntToScalar(4), background)));
+ SkAutoTUnref<SkImageFilter> foreground(SkBitmapSource::Create(fBitmap));
+ SkAutoTUnref<SkImageFilter> offsetForeground(SkOffsetImageFilter::Create(
+ SkIntToScalar(4), SkIntToScalar(-4), foreground));
+ SkAutoTUnref<SkImageFilter> offsetBackground(SkOffsetImageFilter::Create(
+ SkIntToScalar(4), SkIntToScalar(4), background));
mode.reset(SkXfermode::Create(SkXfermode::kSrcOver_Mode));
- filter.reset(SkNEW_ARGS(SkXfermodeImageFilter,
- (mode, offsetBackground, offsetForeground)));
+ filter.reset(SkXfermodeImageFilter::Create(mode, offsetBackground, offsetForeground));
paint.setImageFilter(filter);
drawClippedPaint(canvas, clipRect, paint, x, y);
x += fBitmap.width() + MARGIN;
@@ -182,7 +180,7 @@ protected:
}
// Test offsets on Darken (uses shader blend)
mode.reset(SkXfermode::Create(SkXfermode::kDarken_Mode));
- filter.reset(SkNEW_ARGS(SkXfermodeImageFilter, (mode, offsetBackground, offsetForeground)));
+ filter.reset(SkXfermodeImageFilter::Create(mode, offsetBackground, offsetForeground));
paint.setImageFilter(filter);
drawClippedPaint(canvas, clipRect, paint, x, y);
x += fBitmap.width() + MARGIN;
@@ -205,8 +203,8 @@ protected:
fBitmap.height() + offsets[i][3]);
SkImageFilter::CropRect rect(SkRect::Make(cropRect));
mode.reset(SkXfermode::Create(sampledModes[i]));
- filter.reset(SkNEW_ARGS(SkXfermodeImageFilter,
- (mode, offsetBackground, offsetForeground, &rect)));
+ filter.reset(SkXfermodeImageFilter::Create(
+ mode, offsetBackground, offsetForeground, &rect));
paint.setImageFilter(filter);
drawClippedPaint(canvas, clipRect, paint, x, y);
x += fBitmap.width() + MARGIN;
« no previous file with comments | « gm/tileimagefilter.cpp ('k') | include/effects/SkBicubicImageFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698