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 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 SkTileImageFilter::Create(inputCropRect.rect(), cropRect.rect(), input.g
et()), | 239 SkTileImageFilter::Create(inputCropRect.rect(), cropRect.rect(), input.g
et()), |
240 SkXfermodeImageFilter::Create(SkXfermode::Create(SkXfermode::kSrcOver_Mo
de), input.get(), input.get(), &cropRect), | 240 SkXfermodeImageFilter::Create(SkXfermode::Create(SkXfermode::kSrcOver_Mo
de), input.get(), input.get(), &cropRect), |
241 }; | 241 }; |
242 | 242 |
243 for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) { | 243 for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) { |
244 SkImageFilter* filter = filters[i]; | 244 SkImageFilter* filter = filters[i]; |
245 SkBitmap result; | 245 SkBitmap result; |
246 SkIPoint offset; | 246 SkIPoint offset; |
247 SkString str; | 247 SkString str; |
248 str.printf("filter %d", static_cast<int>(i)); | 248 str.printf("filter %d", static_cast<int>(i)); |
249 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeEmpty()); | 249 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest()); |
250 REPORTER_ASSERT_MESSAGE(reporter, filter->filterImage(&proxy, bitmap, ct
x, &result, &offset), str.c_str()); | 250 REPORTER_ASSERT_MESSAGE(reporter, filter->filterImage(&proxy, bitmap, ct
x, &result, &offset), str.c_str()); |
251 REPORTER_ASSERT_MESSAGE(reporter, offset.fX == 20 && offset.fY == 30, st
r.c_str()); | 251 REPORTER_ASSERT_MESSAGE(reporter, offset.fX == 20 && offset.fY == 30, st
r.c_str()); |
252 } | 252 } |
253 | 253 |
254 for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) { | 254 for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) { |
255 SkSafeUnref(filters[i]); | 255 SkSafeUnref(filters[i]); |
256 } | 256 } |
257 } | 257 } |
258 | 258 |
259 DEF_TEST(ImageFilterCropRect, reporter) { | 259 DEF_TEST(ImageFilterCropRect, reporter) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 | 297 |
298 #if SK_SUPPORT_GPU | 298 #if SK_SUPPORT_GPU |
299 DEF_GPUTEST(ImageFilterCropRectGPU, reporter, factory) { | 299 DEF_GPUTEST(ImageFilterCropRectGPU, reporter, factory) { |
300 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextTyp
e>(0)); | 300 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextTyp
e>(0)); |
301 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context, | 301 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context, |
302 SkImageInfo::MakeN32Pre
mul(100, 100), | 302 SkImageInfo::MakeN32Pre
mul(100, 100), |
303 0)); | 303 0)); |
304 test_crop_rects(device, reporter); | 304 test_crop_rects(device, reporter); |
305 } | 305 } |
306 #endif | 306 #endif |
OLD | NEW |