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 "SkBitmap.h" | 8 #include "SkBitmap.h" |
9 #include "SkBitmapDevice.h" | 9 #include "SkBitmapDevice.h" |
10 #include "SkBitmapSource.h" | 10 #include "SkBitmapSource.h" |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 SkTileImageFilter::Create(inputCropRect.rect(), cropRect.rect(), input.g
et()), | 255 SkTileImageFilter::Create(inputCropRect.rect(), cropRect.rect(), input.g
et()), |
256 SkXfermodeImageFilter::Create(SkXfermode::Create(SkXfermode::kSrcOver_Mo
de), input.get(), input.get(), &cropRect), | 256 SkXfermodeImageFilter::Create(SkXfermode::Create(SkXfermode::kSrcOver_Mo
de), input.get(), input.get(), &cropRect), |
257 }; | 257 }; |
258 | 258 |
259 for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) { | 259 for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) { |
260 SkImageFilter* filter = filters[i]; | 260 SkImageFilter* filter = filters[i]; |
261 SkBitmap result; | 261 SkBitmap result; |
262 SkIPoint offset; | 262 SkIPoint offset; |
263 SkString str; | 263 SkString str; |
264 str.printf("filter %d", static_cast<int>(i)); | 264 str.printf("filter %d", static_cast<int>(i)); |
265 SkAutoTUnref<SkImageFilter::Cache> cache(SkImageFilter::Cache::Create(2)
); | 265 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), NULL); |
266 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), cache.
get()); | |
267 REPORTER_ASSERT_MESSAGE(reporter, filter->filterImage(&proxy, bitmap, ct
x, | 266 REPORTER_ASSERT_MESSAGE(reporter, filter->filterImage(&proxy, bitmap, ct
x, |
268 &result, &offset), str.c_str()); | 267 &result, &offset), str.c_str()); |
269 REPORTER_ASSERT_MESSAGE(reporter, offset.fX == 20 && offset.fY == 30, st
r.c_str()); | 268 REPORTER_ASSERT_MESSAGE(reporter, offset.fX == 20 && offset.fY == 30, st
r.c_str()); |
270 } | 269 } |
271 | 270 |
272 for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) { | 271 for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) { |
273 SkSafeUnref(filters[i]); | 272 SkSafeUnref(filters[i]); |
274 } | 273 } |
275 } | 274 } |
276 | 275 |
(...skipping 548 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
825 } | 824 } |
826 | 825 |
827 DEF_GPUTEST(XfermodeImageFilterCroppedInputGPU, reporter, factory) { | 826 DEF_GPUTEST(XfermodeImageFilterCroppedInputGPU, reporter, factory) { |
828 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextTyp
e>(0)); | 827 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextTyp
e>(0)); |
829 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context, | 828 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context, |
830 SkImageInfo::MakeN32Pre
mul(1, 1), | 829 SkImageInfo::MakeN32Pre
mul(1, 1), |
831 0)); | 830 0)); |
832 test_xfermode_cropped_input(device, reporter); | 831 test_xfermode_cropped_input(device, reporter); |
833 } | 832 } |
834 #endif | 833 #endif |
OLD | NEW |