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 1074 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1085 | 1085 |
1086 DEF_TEST(ComposedImageFilterOffset, reporter) { | 1086 DEF_TEST(ComposedImageFilterOffset, reporter) { |
1087 SkBitmap bitmap; | 1087 SkBitmap bitmap; |
1088 bitmap.allocN32Pixels(100, 100); | 1088 bitmap.allocN32Pixels(100, 100); |
1089 bitmap.eraseARGB(0, 0, 0, 0); | 1089 bitmap.eraseARGB(0, 0, 0, 0); |
1090 SkBitmapDevice device(bitmap); | 1090 SkBitmapDevice device(bitmap); |
1091 SkDeviceImageFilterProxy proxy(&device, SkSurfaceProps(SkSurfaceProps::kLega
cyFontHost_InitType)); | 1091 SkDeviceImageFilterProxy proxy(&device, SkSurfaceProps(SkSurfaceProps::kLega
cyFontHost_InitType)); |
1092 | 1092 |
1093 SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(1, 0, 20, 20)); | 1093 SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(1, 0, 20, 20)); |
1094 SkAutoTUnref<SkImageFilter> offsetFilter(SkOffsetImageFilter::Create(0, 0, N
ULL, &cropRect)); | 1094 SkAutoTUnref<SkImageFilter> offsetFilter(SkOffsetImageFilter::Create(0, 0, N
ULL, &cropRect)); |
1095 SkAutoTUnref<SkImageFilter> composedFilter(SkComposeImageFilter::Create(make
Blur(), offsetFilter.get())); | 1095 SkAutoTUnref<SkImageFilter> blurFilter(makeBlur()); |
| 1096 SkAutoTUnref<SkImageFilter> composedFilter(SkComposeImageFilter::Create(blur
Filter, offsetFilter.get())); |
1096 SkBitmap result; | 1097 SkBitmap result; |
1097 SkIPoint offset; | 1098 SkIPoint offset; |
1098 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), NULL); | 1099 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), NULL); |
1099 REPORTER_ASSERT(reporter, composedFilter->filterImage(&proxy, bitmap, ctx, &
result, &offset)); | 1100 REPORTER_ASSERT(reporter, composedFilter->filterImage(&proxy, bitmap, ctx, &
result, &offset)); |
1100 REPORTER_ASSERT(reporter, offset.fX == 1 && offset.fY == 0); | 1101 REPORTER_ASSERT(reporter, offset.fX == 1 && offset.fY == 0); |
1101 } | 1102 } |
1102 | 1103 |
1103 #if SK_SUPPORT_GPU | 1104 #if SK_SUPPORT_GPU |
1104 const SkSurfaceProps gProps = SkSurfaceProps(SkSurfaceProps::kLegacyFontHost_Ini
tType); | 1105 const SkSurfaceProps gProps = SkSurfaceProps(SkSurfaceProps::kLegacyFontHost_Ini
tType); |
1105 | 1106 |
(...skipping 30 matching lines...) Expand all Loading... |
1136 DEF_GPUTEST(TestNegativeBlurSigmaGPU, reporter, factory) { | 1137 DEF_GPUTEST(TestNegativeBlurSigmaGPU, reporter, factory) { |
1137 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextTyp
e>(0)); | 1138 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextTyp
e>(0)); |
1138 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context, | 1139 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context, |
1139 SkSurface::kNo_Budgeted
, | 1140 SkSurface::kNo_Budgeted
, |
1140 SkImageInfo::MakeN32Pre
mul(1, 1), | 1141 SkImageInfo::MakeN32Pre
mul(1, 1), |
1141 0, | 1142 0, |
1142 &gProps)); | 1143 &gProps)); |
1143 test_negative_blur_sigma(device, reporter); | 1144 test_negative_blur_sigma(device, reporter); |
1144 } | 1145 } |
1145 #endif | 1146 #endif |
OLD | NEW |