| 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())
; | 265 SkAutoTUnref<SkImageFilter::Cache> cache(SkImageFilter::Cache::Create(2)
); |
| 266 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), cache.
get()); | 266 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), cache.
get()); |
| 267 REPORTER_ASSERT_MESSAGE(reporter, filter->filterImage(&proxy, bitmap, ct
x, | 267 REPORTER_ASSERT_MESSAGE(reporter, filter->filterImage(&proxy, bitmap, ct
x, |
| 268 &result, &offset), str.c_str()); | 268 &result, &offset), str.c_str()); |
| 269 REPORTER_ASSERT_MESSAGE(reporter, offset.fX == 20 && offset.fY == 30, st
r.c_str()); | 269 REPORTER_ASSERT_MESSAGE(reporter, offset.fX == 20 && offset.fY == 30, st
r.c_str()); |
| 270 } | 270 } |
| 271 | 271 |
| 272 for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) { | 272 for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) { |
| 273 SkSafeUnref(filters[i]); | 273 SkSafeUnref(filters[i]); |
| 274 } | 274 } |
| 275 } | 275 } |
| (...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 } | 761 } |
| 762 | 762 |
| 763 DEF_GPUTEST(XfermodeImageFilterCroppedInputGPU, reporter, factory) { | 763 DEF_GPUTEST(XfermodeImageFilterCroppedInputGPU, reporter, factory) { |
| 764 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextTyp
e>(0)); | 764 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextTyp
e>(0)); |
| 765 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context, | 765 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context, |
| 766 SkImageInfo::MakeN32Pre
mul(1, 1), | 766 SkImageInfo::MakeN32Pre
mul(1, 1), |
| 767 0)); | 767 0)); |
| 768 test_xfermode_cropped_input(device, reporter); | 768 test_xfermode_cropped_input(device, reporter); |
| 769 } | 769 } |
| 770 #endif | 770 #endif |
| OLD | NEW |