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

Side by Side Diff: gm/testimagefilters.cpp

Issue 1847583002: Update SkMergeImageFilter to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to To 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 unified diff | Download patch
« no previous file with comments | « gm/imagefiltersgraph.cpp ('k') | include/core/SkImageFilter.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2011 Google Inc. 2 * Copyright 2011 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "gm.h" 8 #include "gm.h"
9 #include "SkCanvas.h" 9 #include "SkCanvas.h"
10 #include "SkColorFilter.h" 10 #include "SkColorFilter.h"
(...skipping 29 matching lines...) Expand all
40 40
41 static SkImageFilter* make4() { 41 static SkImageFilter* make4() {
42 sk_sp<SkImageFilter> outer(SkOffsetImageFilter::Create(SkIntToScalar(16), Sk IntToScalar(16))); 42 sk_sp<SkImageFilter> outer(SkOffsetImageFilter::Create(SkIntToScalar(16), Sk IntToScalar(16)));
43 sk_sp<SkImageFilter> inner(SkDownSampleImageFilter::Create(SK_Scalar1 / 5)); 43 sk_sp<SkImageFilter> inner(SkDownSampleImageFilter::Create(SK_Scalar1 / 5));
44 return SkComposeImageFilter::Make(std::move(outer), std::move(inner)).releas e(); 44 return SkComposeImageFilter::Make(std::move(outer), std::move(inner)).releas e();
45 } 45 }
46 46
47 static SkImageFilter* make5() { 47 static SkImageFilter* make5() {
48 sk_sp<SkImageFilter> first(SkOffsetImageFilter::Create(SkIntToScalar(16), Sk IntToScalar(16))); 48 sk_sp<SkImageFilter> first(SkOffsetImageFilter::Create(SkIntToScalar(16), Sk IntToScalar(16)));
49 sk_sp<SkImageFilter> second(SkDownSampleImageFilter::Create(SK_Scalar1 / 5)) ; 49 sk_sp<SkImageFilter> second(SkDownSampleImageFilter::Create(SK_Scalar1 / 5)) ;
50 return SkMergeImageFilter::Create(first.get(), second.get()); 50 return SkMergeImageFilter::Make(std::move(first), std::move(second)).release ();
51 } 51 }
52 52
53 static SkImageFilter* make6() { 53 static SkImageFilter* make6() {
54 sk_sp<SkImageFilter> outer(SkOffsetImageFilter::Create(SkIntToScalar(16), Sk IntToScalar(16))); 54 sk_sp<SkImageFilter> outer(SkOffsetImageFilter::Create(SkIntToScalar(16), Sk IntToScalar(16)));
55 sk_sp<SkImageFilter> inner(SkDownSampleImageFilter::Create(SK_Scalar1 / 5)); 55 sk_sp<SkImageFilter> inner(SkDownSampleImageFilter::Create(SK_Scalar1 / 5));
56 sk_sp<SkImageFilter> compose(SkComposeImageFilter::Make(std::move(outer), st d::move(inner))); 56 sk_sp<SkImageFilter> compose(SkComposeImageFilter::Make(std::move(outer), st d::move(inner)));
57 57
58 sk_sp<SkColorFilter> cf(SkColorFilter::MakeModeFilter(0x880000FF, SkXfermode ::kSrcIn_Mode)); 58 sk_sp<SkColorFilter> cf(SkColorFilter::MakeModeFilter(0x880000FF, SkXfermode ::kSrcIn_Mode));
59 sk_sp<SkImageFilter> blue(SkColorFilterImageFilter::Create(cf.get())); 59 sk_sp<SkImageFilter> blue(SkColorFilterImageFilter::Create(cf.get()));
60 60
61 return SkMergeImageFilter::Create(compose.get(), blue.get()); 61 return SkMergeImageFilter::Make(std::move(compose), std::move(blue)).release ();
62 } 62 }
63 63
64 static SkImageFilter* make7() { 64 static SkImageFilter* make7() {
65 sk_sp<SkImageFilter> outer(SkOffsetImageFilter::Create(SkIntToScalar(16), Sk IntToScalar(16))); 65 sk_sp<SkImageFilter> outer(SkOffsetImageFilter::Create(SkIntToScalar(16), Sk IntToScalar(16)));
66 sk_sp<SkImageFilter> inner(make3()); 66 sk_sp<SkImageFilter> inner(make3());
67 sk_sp<SkImageFilter> compose(SkComposeImageFilter::Make(std::move(outer), st d::move(inner))); 67 sk_sp<SkImageFilter> compose(SkComposeImageFilter::Make(std::move(outer), st d::move(inner)));
68 68
69 sk_sp<SkColorFilter> cf(SkColorFilter::MakeModeFilter(0x880000FF, SkXfermode ::kSrcIn_Mode)); 69 sk_sp<SkColorFilter> cf(SkColorFilter::MakeModeFilter(0x880000FF, SkXfermode ::kSrcIn_Mode));
70 sk_sp<SkImageFilter> blue(SkColorFilterImageFilter::Create(cf.get())); 70 sk_sp<SkImageFilter> blue(SkColorFilterImageFilter::Create(cf.get()));
71 71
72 return SkMergeImageFilter::Create(compose.get(), blue.get()); 72 return SkMergeImageFilter::Make(std::move(compose), std::move(blue)).release ();
73 } 73 }
74 74
75 static void draw0(SkCanvas* canvas) { 75 static void draw0(SkCanvas* canvas) {
76 SkPaint p; 76 SkPaint p;
77 p.setAntiAlias(true); 77 p.setAntiAlias(true);
78 SkRect r = SkRect::MakeWH(FILTER_WIDTH, FILTER_HEIGHT); 78 SkRect r = SkRect::MakeWH(FILTER_WIDTH, FILTER_HEIGHT);
79 r.inset(SK_Scalar1 * 12, SK_Scalar1 * 12); 79 r.inset(SK_Scalar1 * 12, SK_Scalar1 * 12);
80 p.setColor(SK_ColorRED); 80 p.setColor(SK_ColorRED);
81 canvas->drawOval(r, p); 81 canvas->drawOval(r, p);
82 } 82 }
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 } 125 }
126 } 126 }
127 127
128 private: 128 private:
129 typedef GM INHERITED; 129 typedef GM INHERITED;
130 }; 130 };
131 131
132 ////////////////////////////////////////////////////////////////////////////// 132 //////////////////////////////////////////////////////////////////////////////
133 133
134 DEF_GM( return new TestImageFiltersGM; ) 134 DEF_GM( return new TestImageFiltersGM; )
OLDNEW
« no previous file with comments | « gm/imagefiltersgraph.cpp ('k') | include/core/SkImageFilter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698