OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkBicubicImageFilter.h" | 8 #include "SkBicubicImageFilter.h" |
9 #include "SkBitmap.h" | 9 #include "SkBitmap.h" |
10 #include "SkBitmapDevice.h" | 10 #include "SkBitmapDevice.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 new SkErodeImageFilter(2, 3, input.get(), &cropRect), | 205 new SkErodeImageFilter(2, 3, input.get(), &cropRect), |
206 new SkTileImageFilter(inputCropRect.rect(), cropRect.rect(), input.get()
), | 206 new SkTileImageFilter(inputCropRect.rect(), cropRect.rect(), input.get()
), |
207 new SkXfermodeImageFilter(SkXfermode::Create(SkXfermode::kSrcOver_Mode),
input.get(), input.get(), &cropRect), | 207 new SkXfermodeImageFilter(SkXfermode::Create(SkXfermode::kSrcOver_Mode),
input.get(), input.get(), &cropRect), |
208 }; | 208 }; |
209 | 209 |
210 for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) { | 210 for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) { |
211 SkImageFilter* filter = filters[i]; | 211 SkImageFilter* filter = filters[i]; |
212 SkBitmap result; | 212 SkBitmap result; |
213 SkIPoint offset; | 213 SkIPoint offset; |
214 SkString str; | 214 SkString str; |
215 str.printf("filter %zd", i); | 215 str.printf("filter %d", static_cast<int>(i)); |
216 REPORTER_ASSERT_MESSAGE(reporter, filter->filterImage(&proxy, bitmap, Sk
Matrix::I(), &result, &offset), str.c_str()); | 216 REPORTER_ASSERT_MESSAGE(reporter, filter->filterImage(&proxy, bitmap, Sk
Matrix::I(), &result, &offset), str.c_str()); |
217 REPORTER_ASSERT_MESSAGE(reporter, offset.fX == 20 && offset.fY == 30, st
r.c_str()); | 217 REPORTER_ASSERT_MESSAGE(reporter, offset.fX == 20 && offset.fY == 30, st
r.c_str()); |
218 } | 218 } |
219 | 219 |
220 for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) { | 220 for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) { |
221 SkSafeUnref(filters[i]); | 221 SkSafeUnref(filters[i]); |
222 } | 222 } |
223 } | 223 } |
224 | 224 |
225 DEF_TEST(ImageFilterCropRect, reporter) { | 225 DEF_TEST(ImageFilterCropRect, reporter) { |
226 SkBitmap temp; | 226 SkBitmap temp; |
227 temp.setConfig(SkBitmap::kARGB_8888_Config, 100, 100); | 227 temp.setConfig(SkBitmap::kARGB_8888_Config, 100, 100); |
228 temp.allocPixels(); | 228 temp.allocPixels(); |
229 SkBitmapDevice device(temp); | 229 SkBitmapDevice device(temp); |
230 test_crop_rects(&device, reporter); | 230 test_crop_rects(&device, reporter); |
231 } | 231 } |
232 | 232 |
233 #if SK_SUPPORT_GPU | 233 #if SK_SUPPORT_GPU |
234 DEF_GPUTEST(ImageFilterCropRectGPU, reporter, factory) { | 234 DEF_GPUTEST(ImageFilterCropRectGPU, reporter, factory) { |
235 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextTyp
e>(0)); | 235 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextTyp
e>(0)); |
236 SkGpuDevice device(context, SkBitmap::kARGB_8888_Config, 100, 100); | 236 SkGpuDevice device(context, SkBitmap::kARGB_8888_Config, 100, 100); |
237 test_crop_rects(&device, reporter); | 237 test_crop_rects(&device, reporter); |
238 } | 238 } |
239 #endif | 239 #endif |
OLD | NEW |