OLD | NEW |
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 Loading... |
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 Loading... |
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; ) |
OLD | NEW |