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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
124 nullptr)); | 124 nullptr)); |
125 | 125 |
126 sk_sp<SkImageFilter> cfOffset(SkColorFilterImageFilter::Create(cf.get(),
offset.get())); | 126 sk_sp<SkImageFilter> cfOffset(SkColorFilterImageFilter::Create(cf.get(),
offset.get())); |
127 | 127 |
128 SkAutoTUnref<SkImageFilter> erodeX(SkErodeImageFilter::Create(8, 0, null
ptr, &cropRect)); | 128 SkAutoTUnref<SkImageFilter> erodeX(SkErodeImageFilter::Create(8, 0, null
ptr, &cropRect)); |
129 SkAutoTUnref<SkImageFilter> erodeY(SkErodeImageFilter::Create(0, 8, null
ptr, &cropRect)); | 129 SkAutoTUnref<SkImageFilter> erodeY(SkErodeImageFilter::Create(0, 8, null
ptr, &cropRect)); |
130 | 130 |
131 SkImageFilter* filters[] = { | 131 SkImageFilter* filters[] = { |
132 nullptr, | 132 nullptr, |
133 SkColorFilterImageFilter::Create(cf.get(), nullptr, &cropRect), | 133 SkColorFilterImageFilter::Create(cf.get(), nullptr, &cropRect), |
134 SkBlurImageFilter::Create(0.0f, 0.0f, nullptr, &cropRect), | 134 SkBlurImageFilter::Make(0.0f, 0.0f, nullptr, &cropRect).release(), |
135 SkBlurImageFilter::Create(1.0f, 1.0f, nullptr, &cropRect), | 135 SkBlurImageFilter::Make(1.0f, 1.0f, nullptr, &cropRect).release(), |
136 SkBlurImageFilter::Create(8.0f, 0.0f, nullptr, &cropRect), | 136 SkBlurImageFilter::Make(8.0f, 0.0f, nullptr, &cropRect).release(), |
137 SkBlurImageFilter::Create(0.0f, 8.0f, nullptr, &cropRect), | 137 SkBlurImageFilter::Make(0.0f, 8.0f, nullptr, &cropRect).release(), |
138 SkBlurImageFilter::Create(8.0f, 8.0f, nullptr, &cropRect), | 138 SkBlurImageFilter::Make(8.0f, 8.0f, nullptr, &cropRect).release(), |
139 SkErodeImageFilter::Create(1, 1, nullptr, &cropRect), | 139 SkErodeImageFilter::Create(1, 1, nullptr, &cropRect), |
140 SkErodeImageFilter::Create(8, 0, erodeY, &cropRect), | 140 SkErodeImageFilter::Create(8, 0, erodeY, &cropRect), |
141 SkErodeImageFilter::Create(0, 8, erodeX, &cropRect), | 141 SkErodeImageFilter::Create(0, 8, erodeX, &cropRect), |
142 SkErodeImageFilter::Create(8, 8, nullptr, &cropRect), | 142 SkErodeImageFilter::Create(8, 8, nullptr, &cropRect), |
143 SkMergeImageFilter::Make(nullptr, std::move(cfOffset), | 143 SkMergeImageFilter::Make(nullptr, std::move(cfOffset), |
144 SkXfermode::kSrcOver_Mode, &cropRect).relea
se(), | 144 SkXfermode::kSrcOver_Mode, &cropRect).relea
se(), |
145 SkBlurImageFilter::Create(8.0f, 8.0f, nullptr, &bogusRect), | 145 SkBlurImageFilter::Make(8.0f, 8.0f, nullptr, &bogusRect).release(), |
146 SkColorFilterImageFilter::Create(cf.get(), nullptr, &bogusRect), | 146 SkColorFilterImageFilter::Create(cf.get(), nullptr, &bogusRect), |
147 }; | 147 }; |
148 | 148 |
149 SkRect r = SkRect::MakeWH(SkIntToScalar(64), SkIntToScalar(64)); | 149 SkRect r = SkRect::MakeWH(SkIntToScalar(64), SkIntToScalar(64)); |
150 SkScalar MARGIN = SkIntToScalar(16); | 150 SkScalar MARGIN = SkIntToScalar(16); |
151 SkScalar DX = r.width() + MARGIN; | 151 SkScalar DX = r.width() + MARGIN; |
152 SkScalar DY = r.height() + MARGIN; | 152 SkScalar DY = r.height() + MARGIN; |
153 | 153 |
154 canvas->translate(MARGIN, MARGIN); | 154 canvas->translate(MARGIN, MARGIN); |
155 for (size_t j = 0; j < SK_ARRAY_COUNT(drawProc); ++j) { | 155 for (size_t j = 0; j < SK_ARRAY_COUNT(drawProc); ++j) { |
(...skipping 14 matching lines...) Expand all Loading... |
170 } | 170 } |
171 | 171 |
172 private: | 172 private: |
173 SkBitmap fCheckerboard; | 173 SkBitmap fCheckerboard; |
174 typedef GM INHERITED; | 174 typedef GM INHERITED; |
175 }; | 175 }; |
176 | 176 |
177 /////////////////////////////////////////////////////////////////////////////// | 177 /////////////////////////////////////////////////////////////////////////////// |
178 | 178 |
179 DEF_GM( return new ImageFiltersCroppedGM; ) | 179 DEF_GM( return new ImageFiltersCroppedGM; ) |
OLD | NEW |