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

Unified Diff: gm/imagefiltersgraph.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/imagefilterscropped.cpp ('k') | gm/imagefiltersscaled.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/imagefiltersgraph.cpp
diff --git a/gm/imagefiltersgraph.cpp b/gm/imagefiltersgraph.cpp
index f97072e443d1fff61760c7946112023844804260..fb957e72f288ec69fcecf7814caf958476700226 100644
--- a/gm/imagefiltersgraph.cpp
+++ b/gm/imagefiltersgraph.cpp
@@ -121,13 +121,13 @@ protected:
}
canvas->clear(0x00000000);
{
- SkAutoTUnref<SkImageFilter> bitmapSource(new SkBitmapSource(fBitmap));
+ SkAutoTUnref<SkImageFilter> bitmapSource(SkBitmapSource::Create(fBitmap));
SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(SK_ColorRED,
SkXfermode::kSrcIn_Mode));
- SkAutoTUnref<SkImageFilter> blur(new SkBlurImageFilter(4.0f, 4.0f, bitmapSource));
- SkAutoTUnref<SkImageFilter> erode(new SkErodeImageFilter(4, 4, blur));
+ SkAutoTUnref<SkImageFilter> blur(SkBlurImageFilter::Create(4.0f, 4.0f, bitmapSource));
+ SkAutoTUnref<SkImageFilter> erode(SkErodeImageFilter::Create(4, 4, blur));
SkAutoTUnref<SkImageFilter> color(SkColorFilterImageFilter::Create(cf, erode));
- SkAutoTUnref<SkImageFilter> merge(new SkMergeImageFilter(blur, color));
+ SkAutoTUnref<SkImageFilter> merge(SkMergeImageFilter::Create(blur, color));
SkPaint paint;
paint.setImageFilter(merge);
@@ -135,7 +135,7 @@ protected:
canvas->translate(SkIntToScalar(100), 0);
}
{
- SkAutoTUnref<SkImageFilter> morph(new SkDilateImageFilter(5, 5));
+ SkAutoTUnref<SkImageFilter> morph(SkDilateImageFilter::Create(5, 5));
SkScalar matrix[20] = { SK_Scalar1, 0, 0, 0, 0,
0, SK_Scalar1, 0, 0, 0,
@@ -145,7 +145,7 @@ protected:
SkAutoTUnref<SkColorFilter> matrixFilter(SkColorMatrixFilter::Create(matrix));
SkAutoTUnref<SkImageFilter> colorMorph(SkColorFilterImageFilter::Create(matrixFilter, morph));
SkAutoTUnref<SkXfermode> mode(SkXfermode::Create(SkXfermode::kSrcOver_Mode));
- SkAutoTUnref<SkImageFilter> blendColor(new SkXfermodeImageFilter(mode, colorMorph));
+ SkAutoTUnref<SkImageFilter> blendColor(SkXfermodeImageFilter::Create(mode, colorMorph));
SkPaint paint;
paint.setImageFilter(blendColor);
@@ -162,20 +162,22 @@ protected:
SimpleOffsetFilter offsetFilter(SkIntToScalar(10), SkIntToScalar(10), matrixFilter);
SkAutoTUnref<SkXfermode> arith(SkArithmeticMode::Create(0, SK_Scalar1, SK_Scalar1, 0));
- SkXfermodeImageFilter arithFilter(arith, matrixFilter, &offsetFilter);
+ SkAutoTUnref<SkXfermodeImageFilter> arithFilter(
+ SkXfermodeImageFilter::Create(arith, matrixFilter, &offsetFilter));
SkPaint paint;
- paint.setImageFilter(&arithFilter);
+ paint.setImageFilter(arithFilter);
drawClippedBitmap(canvas, fBitmap, paint);
canvas->translate(SkIntToScalar(100), 0);
}
{
- SkAutoTUnref<SkImageFilter> blur(new SkBlurImageFilter(
+ SkAutoTUnref<SkImageFilter> blur(SkBlurImageFilter::Create(
SkIntToScalar(10), SkIntToScalar(10)));
SkAutoTUnref<SkXfermode> mode(SkXfermode::Create(SkXfermode::kSrcIn_Mode));
SkImageFilter::CropRect cropRect(SkRect::MakeWH(SkIntToScalar(95), SkIntToScalar(100)));
- SkAutoTUnref<SkImageFilter> blend(new SkXfermodeImageFilter(mode, blur, NULL, &cropRect));
+ SkAutoTUnref<SkImageFilter> blend(
+ SkXfermodeImageFilter::Create(mode, blur, NULL, &cropRect));
SkPaint paint;
paint.setImageFilter(blend);
« no previous file with comments | « gm/imagefilterscropped.cpp ('k') | gm/imagefiltersscaled.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698