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

Side by Side Diff: gm/testimagefilters.cpp

Issue 1864583005: Update DownSampleImageFilter to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix fuzz 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 | « fuzz/FilterFuzz.cpp ('k') | include/effects/SkTestImageFilters.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"
11 #include "SkColorPriv.h" 11 #include "SkColorPriv.h"
12 #include "SkShader.h" 12 #include "SkShader.h"
13 13
14 #include "SkBlurImageFilter.h" 14 #include "SkBlurImageFilter.h"
15 #include "SkColorFilterImageFilter.h" 15 #include "SkColorFilterImageFilter.h"
16 #include "SkComposeImageFilter.h" 16 #include "SkComposeImageFilter.h"
17 #include "SkMergeImageFilter.h" 17 #include "SkMergeImageFilter.h"
18 #include "SkOffsetImageFilter.h" 18 #include "SkOffsetImageFilter.h"
19 #include "SkTestImageFilters.h" 19 #include "SkTestImageFilters.h"
20 20
21 #define FILTER_WIDTH SkIntToScalar(150) 21 #define FILTER_WIDTH SkIntToScalar(150)
22 #define FILTER_HEIGHT SkIntToScalar(200) 22 #define FILTER_HEIGHT SkIntToScalar(200)
23 23
24 static sk_sp<SkImageFilter> make0() { 24 static sk_sp<SkImageFilter> make0() {
25 return sk_sp<SkImageFilter>(SkDownSampleImageFilter::Create(SK_Scalar1 / 5)) ; 25 return SkDownSampleImageFilter::Make(SK_Scalar1 / 5, nullptr);
26 } 26 }
27 27
28 static sk_sp<SkImageFilter> make1() { 28 static sk_sp<SkImageFilter> make1() {
29 return SkOffsetImageFilter::Make(SkIntToScalar(16), SkIntToScalar(16), nullp tr); 29 return SkOffsetImageFilter::Make(SkIntToScalar(16), SkIntToScalar(16), nullp tr);
30 } 30 }
31 31
32 static sk_sp<SkImageFilter> make2() { 32 static sk_sp<SkImageFilter> make2() {
33 sk_sp<SkColorFilter> cf(SkColorFilter::MakeModeFilter(SK_ColorBLUE, SkXfermo de::kSrcIn_Mode)); 33 sk_sp<SkColorFilter> cf(SkColorFilter::MakeModeFilter(SK_ColorBLUE, SkXfermo de::kSrcIn_Mode));
34 return SkColorFilterImageFilter::Make(std::move(cf), nullptr); 34 return SkColorFilterImageFilter::Make(std::move(cf), nullptr);
35 } 35 }
36 36
37 static sk_sp<SkImageFilter> make3() { 37 static sk_sp<SkImageFilter> make3() {
38 return SkBlurImageFilter::Make(8, 0, nullptr); 38 return SkBlurImageFilter::Make(8, 0, nullptr);
39 } 39 }
40 40
41 static sk_sp<SkImageFilter> make4() { 41 static sk_sp<SkImageFilter> make4() {
42 sk_sp<SkImageFilter> outer(SkOffsetImageFilter::Make(SkIntToScalar(16), 42 sk_sp<SkImageFilter> outer(SkOffsetImageFilter::Make(SkIntToScalar(16),
43 SkIntToScalar(16), 43 SkIntToScalar(16),
44 nullptr)); 44 nullptr));
45 sk_sp<SkImageFilter> inner(SkDownSampleImageFilter::Create(SK_Scalar1 / 5)); 45 sk_sp<SkImageFilter> inner(SkDownSampleImageFilter::Make(SK_Scalar1 / 5, nul lptr));
46 return SkComposeImageFilter::Make(std::move(outer), std::move(inner)); 46 return SkComposeImageFilter::Make(std::move(outer), std::move(inner));
47 } 47 }
48 48
49 static sk_sp<SkImageFilter> make5() { 49 static sk_sp<SkImageFilter> make5() {
50 sk_sp<SkImageFilter> first(SkOffsetImageFilter::Make(SkIntToScalar(16), 50 sk_sp<SkImageFilter> first(SkOffsetImageFilter::Make(SkIntToScalar(16),
51 SkIntToScalar(16), 51 SkIntToScalar(16),
52 nullptr)); 52 nullptr));
53 sk_sp<SkImageFilter> second(SkDownSampleImageFilter::Create(SK_Scalar1 / 5)) ; 53 sk_sp<SkImageFilter> second(SkDownSampleImageFilter::Make(SK_Scalar1 / 5, nu llptr));
54 return SkMergeImageFilter::Make(std::move(first), std::move(second)); 54 return SkMergeImageFilter::Make(std::move(first), std::move(second));
55 } 55 }
56 56
57 static sk_sp<SkImageFilter> make6() { 57 static sk_sp<SkImageFilter> make6() {
58 sk_sp<SkImageFilter> outer(SkOffsetImageFilter::Make(SkIntToScalar(16), 58 sk_sp<SkImageFilter> outer(SkOffsetImageFilter::Make(SkIntToScalar(16),
59 SkIntToScalar(16), 59 SkIntToScalar(16),
60 nullptr)); 60 nullptr));
61 sk_sp<SkImageFilter> inner(SkDownSampleImageFilter::Create(SK_Scalar1 / 5)); 61 sk_sp<SkImageFilter> inner(SkDownSampleImageFilter::Make(SK_Scalar1 / 5, nul lptr));
62 sk_sp<SkImageFilter> compose(SkComposeImageFilter::Make(std::move(outer), st d::move(inner))); 62 sk_sp<SkImageFilter> compose(SkComposeImageFilter::Make(std::move(outer), st d::move(inner)));
63 63
64 sk_sp<SkColorFilter> cf(SkColorFilter::MakeModeFilter(0x880000FF, SkXfermode ::kSrcIn_Mode)); 64 sk_sp<SkColorFilter> cf(SkColorFilter::MakeModeFilter(0x880000FF, SkXfermode ::kSrcIn_Mode));
65 sk_sp<SkImageFilter> blue(SkColorFilterImageFilter::Make(std::move(cf), null ptr)); 65 sk_sp<SkImageFilter> blue(SkColorFilterImageFilter::Make(std::move(cf), null ptr));
66 66
67 return SkMergeImageFilter::Make(std::move(compose), std::move(blue)); 67 return SkMergeImageFilter::Make(std::move(compose), std::move(blue));
68 } 68 }
69 69
70 static sk_sp<SkImageFilter> make7() { 70 static sk_sp<SkImageFilter> make7() {
71 sk_sp<SkImageFilter> outer(SkOffsetImageFilter::Make(SkIntToScalar(16), 71 sk_sp<SkImageFilter> outer(SkOffsetImageFilter::Make(SkIntToScalar(16),
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 } 133 }
134 } 134 }
135 135
136 private: 136 private:
137 typedef GM INHERITED; 137 typedef GM INHERITED;
138 }; 138 };
139 139
140 ////////////////////////////////////////////////////////////////////////////// 140 //////////////////////////////////////////////////////////////////////////////
141 141
142 DEF_GM( return new TestImageFiltersGM; ) 142 DEF_GM( return new TestImageFiltersGM; )
OLDNEW
« no previous file with comments | « fuzz/FilterFuzz.cpp ('k') | include/effects/SkTestImageFilters.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698