| 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 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1140 | 1140 |
| 1141 DEF_TEST(PartialCropRect, reporter) { | 1141 DEF_TEST(PartialCropRect, reporter) { |
| 1142 SkBitmap bitmap; | 1142 SkBitmap bitmap; |
| 1143 bitmap.allocN32Pixels(100, 100); | 1143 bitmap.allocN32Pixels(100, 100); |
| 1144 bitmap.eraseARGB(0, 0, 0, 0); | 1144 bitmap.eraseARGB(0, 0, 0, 0); |
| 1145 const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType); | 1145 const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType); |
| 1146 SkBitmapDevice device(bitmap, props); | 1146 SkBitmapDevice device(bitmap, props); |
| 1147 SkImageFilter::Proxy proxy(&device); | 1147 SkImageFilter::Proxy proxy(&device); |
| 1148 | 1148 |
| 1149 SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(100, 0, 20, 30), | 1149 SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(100, 0, 20, 30), |
| 1150 SkImageFilter::CropRect::kHasRight_CropEdge | SkImageFilter::CropRect::k
HasBottom_CropEdge); | 1150 SkImageFilter::CropRect::kHasWidth_CropEdge | SkImageFilter::CropRect::k
HasHeight_CropEdge); |
| 1151 SkAutoTUnref<SkImageFilter> filter(make_grayscale(NULL, &cropRect)); | 1151 SkAutoTUnref<SkImageFilter> filter(make_grayscale(NULL, &cropRect)); |
| 1152 SkBitmap result; | 1152 SkBitmap result; |
| 1153 SkIPoint offset; | 1153 SkIPoint offset; |
| 1154 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), NULL); | 1154 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), NULL); |
| 1155 REPORTER_ASSERT(reporter, filter->filterImage(&proxy, bitmap, ctx, &result,
&offset)); | 1155 REPORTER_ASSERT(reporter, filter->filterImage(&proxy, bitmap, ctx, &result,
&offset)); |
| 1156 REPORTER_ASSERT(reporter, offset.fX == 0); | 1156 REPORTER_ASSERT(reporter, offset.fX == 0); |
| 1157 REPORTER_ASSERT(reporter, offset.fY == 0); | 1157 REPORTER_ASSERT(reporter, offset.fY == 0); |
| 1158 REPORTER_ASSERT(reporter, result.width() == 20); | 1158 REPORTER_ASSERT(reporter, result.width() == 20); |
| 1159 REPORTER_ASSERT(reporter, result.height() == 30); | 1159 REPORTER_ASSERT(reporter, result.height() == 30); |
| 1160 } | 1160 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1226 SkSurface::kNo_Budgeted
, | 1226 SkSurface::kNo_Budgeted
, |
| 1227 SkImageInfo::MakeN32Pre
mul(1, 1), | 1227 SkImageInfo::MakeN32Pre
mul(1, 1), |
| 1228 0, | 1228 0, |
| 1229 &props, | 1229 &props, |
| 1230 SkGpuDevice::kUninit_In
itContents)); | 1230 SkGpuDevice::kUninit_In
itContents)); |
| 1231 SkImageFilter::Proxy proxy(device); | 1231 SkImageFilter::Proxy proxy(device); |
| 1232 | 1232 |
| 1233 test_negative_blur_sigma(&proxy, reporter); | 1233 test_negative_blur_sigma(&proxy, reporter); |
| 1234 } | 1234 } |
| 1235 #endif | 1235 #endif |
| OLD | NEW |