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 "SkBlurImageFilter.h" | 10 #include "SkBlurImageFilter.h" |
(...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1145 DEF_TEST(ComposedImageFilterOffset, reporter) { | 1145 DEF_TEST(ComposedImageFilterOffset, reporter) { |
1146 SkBitmap bitmap; | 1146 SkBitmap bitmap; |
1147 bitmap.allocN32Pixels(100, 100); | 1147 bitmap.allocN32Pixels(100, 100); |
1148 bitmap.eraseARGB(0, 0, 0, 0); | 1148 bitmap.eraseARGB(0, 0, 0, 0); |
1149 const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType); | 1149 const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType); |
1150 SkBitmapDevice device(bitmap, props); | 1150 SkBitmapDevice device(bitmap, props); |
1151 SkImageFilter::DeviceProxy proxy(&device); | 1151 SkImageFilter::DeviceProxy proxy(&device); |
1152 | 1152 |
1153 SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(1, 0, 20, 20)); | 1153 SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(1, 0, 20, 20)); |
1154 SkAutoTUnref<SkImageFilter> offsetFilter(SkOffsetImageFilter::Create(0, 0, n
ullptr, &cropRect)); | 1154 SkAutoTUnref<SkImageFilter> offsetFilter(SkOffsetImageFilter::Create(0, 0, n
ullptr, &cropRect)); |
1155 SkAutoTUnref<SkImageFilter> blurFilter(makeBlur()); | 1155 SkAutoTUnref<SkImageFilter> blurFilter(SkBlurImageFilter::Create(SK_Scalar1,
SK_Scalar1, |
1156 SkAutoTUnref<SkImageFilter> composedFilter(SkComposeImageFilter::Create(blur
Filter, offsetFilter.get())); | 1156 nullptr, &c
ropRect)); |
| 1157 SkAutoTUnref<SkImageFilter> composedFilter(SkComposeImageFilter::Create(blur
Filter, |
| 1158 offs
etFilter.get())); |
1157 SkBitmap result; | 1159 SkBitmap result; |
1158 SkIPoint offset; | 1160 SkIPoint offset; |
1159 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeWH(100, 100), nullptr
, SkImageFilter::kApprox_SizeConstraint); | 1161 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeWH(100, 100), nullptr
, SkImageFilter::kApprox_SizeConstraint); |
1160 REPORTER_ASSERT(reporter, composedFilter->filterImage(&proxy, bitmap, ctx, &
result, &offset)); | 1162 REPORTER_ASSERT(reporter, composedFilter->filterImage(&proxy, bitmap, ctx, &
result, &offset)); |
1161 REPORTER_ASSERT(reporter, offset.fX == 1 && offset.fY == 0); | 1163 REPORTER_ASSERT(reporter, offset.fX == 1 && offset.fY == 0); |
1162 } | 1164 } |
1163 | 1165 |
1164 DEF_TEST(PartialCropRect, reporter) { | 1166 DEF_TEST(PartialCropRect, reporter) { |
1165 SkBitmap bitmap; | 1167 SkBitmap bitmap; |
1166 bitmap.allocN32Pixels(100, 100); | 1168 bitmap.allocN32Pixels(100, 100); |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1310 SkSurface::kNo_Budgeted
, | 1312 SkSurface::kNo_Budgeted
, |
1311 SkImageInfo::MakeN32Pre
mul(1, 1), | 1313 SkImageInfo::MakeN32Pre
mul(1, 1), |
1312 0, | 1314 0, |
1313 &props, | 1315 &props, |
1314 SkGpuDevice::kUninit_In
itContents)); | 1316 SkGpuDevice::kUninit_In
itContents)); |
1315 SkImageFilter::DeviceProxy proxy(device); | 1317 SkImageFilter::DeviceProxy proxy(device); |
1316 | 1318 |
1317 test_negative_blur_sigma(&proxy, reporter); | 1319 test_negative_blur_sigma(&proxy, reporter); |
1318 } | 1320 } |
1319 #endif | 1321 #endif |
OLD | NEW |