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" |
11 #include "SkBlurImageFilter.h" | 11 #include "SkBlurImageFilter.h" |
12 #include "SkCanvas.h" | 12 #include "SkCanvas.h" |
13 #include "SkColorFilterImageFilter.h" | 13 #include "SkColorFilterImageFilter.h" |
14 #include "SkColorMatrixFilter.h" | 14 #include "SkColorMatrixFilter.h" |
15 #include "SkComposeImageFilter.h" | 15 #include "SkComposeImageFilter.h" |
16 #include "SkDeviceImageFilterProxy.h" | 16 #include "SkDeviceImageFilterProxy.h" |
17 #include "SkDisplacementMapEffect.h" | 17 #include "SkDisplacementMapEffect.h" |
18 #include "SkDropShadowImageFilter.h" | 18 #include "SkDropShadowImageFilter.h" |
19 #include "SkFlattenableSerialization.h" | 19 #include "SkFlattenableSerialization.h" |
20 #include "SkGradientShader.h" | 20 #include "SkGradientShader.h" |
| 21 #include "SkImagePriv.h" |
| 22 #include "SkImage_Base.h" |
21 #include "SkLightingImageFilter.h" | 23 #include "SkLightingImageFilter.h" |
22 #include "SkMatrixConvolutionImageFilter.h" | 24 #include "SkMatrixConvolutionImageFilter.h" |
23 #include "SkMergeImageFilter.h" | 25 #include "SkMergeImageFilter.h" |
24 #include "SkMorphologyImageFilter.h" | 26 #include "SkMorphologyImageFilter.h" |
25 #include "SkOffsetImageFilter.h" | 27 #include "SkOffsetImageFilter.h" |
26 #include "SkPerlinNoiseShader.h" | 28 #include "SkPerlinNoiseShader.h" |
27 #include "SkPicture.h" | 29 #include "SkPicture.h" |
28 #include "SkPictureImageFilter.h" | 30 #include "SkPictureImageFilter.h" |
29 #include "SkPictureRecorder.h" | 31 #include "SkPictureRecorder.h" |
30 #include "SkReadBuffer.h" | 32 #include "SkReadBuffer.h" |
(...skipping 11 matching lines...) Expand all Loading... |
42 static const int kBitmapSize = 4; | 44 static const int kBitmapSize = 4; |
43 | 45 |
44 namespace { | 46 namespace { |
45 | 47 |
46 class MatrixTestImageFilter : public SkImageFilter { | 48 class MatrixTestImageFilter : public SkImageFilter { |
47 public: | 49 public: |
48 MatrixTestImageFilter(skiatest::Reporter* reporter, const SkMatrix& expected
Matrix) | 50 MatrixTestImageFilter(skiatest::Reporter* reporter, const SkMatrix& expected
Matrix) |
49 : SkImageFilter(0, NULL), fReporter(reporter), fExpectedMatrix(expectedMat
rix) { | 51 : SkImageFilter(0, NULL), fReporter(reporter), fExpectedMatrix(expectedMat
rix) { |
50 } | 52 } |
51 | 53 |
52 virtual bool onFilterImage(Proxy*, const SkBitmap& src, const Context& ctx, | 54 virtual bool onFilterImage(Proxy*, const SkImage* src, const Context& ctx, |
53 SkBitmap* result, SkIPoint* offset) const SK_OVER
RIDE { | 55 SkAutoTUnref<const SkImage>& result, SkIPoint* of
fset) const SK_OVERRIDE { |
54 REPORTER_ASSERT(fReporter, ctx.ctm() == fExpectedMatrix); | 56 REPORTER_ASSERT(fReporter, ctx.ctm() == fExpectedMatrix); |
| 57 result.reset(SkRef(src)); |
55 return true; | 58 return true; |
56 } | 59 } |
57 | 60 |
58 SK_TO_STRING_OVERRIDE() | 61 SK_TO_STRING_OVERRIDE() |
59 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(MatrixTestImageFilter) | 62 SK_DECLARE_PUBLIC_FLATTENABLE_DESERIALIZATION_PROCS(MatrixTestImageFilter) |
60 | 63 |
61 protected: | 64 protected: |
62 void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE { | 65 void flatten(SkWriteBuffer& buffer) const SK_OVERRIDE { |
63 this->INHERITED::flatten(buffer); | 66 this->INHERITED::flatten(buffer); |
64 buffer.writeFunctionPtr(fReporter); | 67 buffer.writeFunctionPtr(fReporter); |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 SkIntToScalar(kBitmapSize)); | 265 SkIntToScalar(kBitmapSize)); |
263 canvas.drawRect(r, paint); | 266 canvas.drawRect(r, paint); |
264 } | 267 } |
265 } | 268 } |
266 } | 269 } |
267 | 270 |
268 static void test_crop_rects(SkBaseDevice* device, skiatest::Reporter* reporter)
{ | 271 static void test_crop_rects(SkBaseDevice* device, skiatest::Reporter* reporter)
{ |
269 // Check that all filters offset to their absolute crop rect, | 272 // Check that all filters offset to their absolute crop rect, |
270 // unaffected by the input crop rect. | 273 // unaffected by the input crop rect. |
271 // Tests pass by not asserting. | 274 // Tests pass by not asserting. |
272 SkBitmap bitmap; | 275 SkAutoTUnref<SkImage> image; |
273 bitmap.allocN32Pixels(100, 100); | 276 { |
274 bitmap.eraseARGB(0, 0, 0, 0); | 277 SkBitmap bitmap; |
| 278 bitmap.allocN32Pixels(100, 100); |
| 279 bitmap.eraseARGB(0, 0, 0, 0); |
| 280 image.reset(SkNewImageFromBitmap(bitmap, NULL)); |
| 281 REPORTER_ASSERT(reporter, image != NULL); |
| 282 } |
275 SkDeviceImageFilterProxy proxy(device, SkSurfaceProps(SkSurfaceProps::kLegac
yFontHost_InitType)); | 283 SkDeviceImageFilterProxy proxy(device, SkSurfaceProps(SkSurfaceProps::kLegac
yFontHost_InitType)); |
276 | 284 |
277 SkImageFilter::CropRect inputCropRect(SkRect::MakeXYWH(8, 13, 80, 80)); | 285 SkImageFilter::CropRect inputCropRect(SkRect::MakeXYWH(8, 13, 80, 80)); |
278 SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(20, 30, 60, 60)); | 286 SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(20, 30, 60, 60)); |
279 SkAutoTUnref<SkImageFilter> input(make_grayscale(NULL, &inputCropRect)); | 287 SkAutoTUnref<SkImageFilter> input(make_grayscale(NULL, &inputCropRect)); |
280 | 288 |
281 SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(SK_ColorRED,
SkXfermode::kSrcIn_Mode)); | 289 SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(SK_ColorRED,
SkXfermode::kSrcIn_Mode)); |
282 SkPoint3 location(0, 0, SK_Scalar1); | 290 SkPoint3 location(0, 0, SK_Scalar1); |
283 SkPoint3 target(SK_Scalar1, SK_Scalar1, SK_Scalar1); | 291 SkPoint3 target(SK_Scalar1, SK_Scalar1, SK_Scalar1); |
284 SkScalar kernel[9] = { | 292 SkScalar kernel[9] = { |
(...skipping 20 matching lines...) Expand all Loading... |
305 SkOffsetImageFilter::Create(SK_Scalar1, SK_Scalar1, input.get(), &cropRe
ct), | 313 SkOffsetImageFilter::Create(SK_Scalar1, SK_Scalar1, input.get(), &cropRe
ct), |
306 SkOffsetImageFilter::Create(SK_Scalar1, SK_Scalar1, input.get(), &cropRe
ct), | 314 SkOffsetImageFilter::Create(SK_Scalar1, SK_Scalar1, input.get(), &cropRe
ct), |
307 SkDilateImageFilter::Create(3, 2, input.get(), &cropRect), | 315 SkDilateImageFilter::Create(3, 2, input.get(), &cropRect), |
308 SkErodeImageFilter::Create(2, 3, input.get(), &cropRect), | 316 SkErodeImageFilter::Create(2, 3, input.get(), &cropRect), |
309 SkTileImageFilter::Create(inputCropRect.rect(), cropRect.rect(), input.g
et()), | 317 SkTileImageFilter::Create(inputCropRect.rect(), cropRect.rect(), input.g
et()), |
310 SkXfermodeImageFilter::Create(SkXfermode::Create(SkXfermode::kSrcOver_Mo
de), input.get(), input.get(), &cropRect), | 318 SkXfermodeImageFilter::Create(SkXfermode::Create(SkXfermode::kSrcOver_Mo
de), input.get(), input.get(), &cropRect), |
311 }; | 319 }; |
312 | 320 |
313 for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) { | 321 for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) { |
314 SkImageFilter* filter = filters[i]; | 322 SkImageFilter* filter = filters[i]; |
315 SkBitmap result; | 323 SkAutoTUnref<const SkImage> result; |
316 SkIPoint offset; | 324 SkIPoint offset; |
317 SkString str; | 325 SkString str; |
318 str.printf("filter %d", static_cast<int>(i)); | 326 str.printf("filter %d", static_cast<int>(i)); |
319 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), NULL); | 327 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), NULL); |
320 REPORTER_ASSERT_MESSAGE(reporter, filter->filterImage(&proxy, bitmap, ct
x, | 328 REPORTER_ASSERT_MESSAGE(reporter, filter->filterImage(&proxy, image, ctx
, |
321 &result, &offset), str.c_str()); | 329 result, &offset), str.c_str()); |
322 REPORTER_ASSERT_MESSAGE(reporter, offset.fX == 20 && offset.fY == 30, st
r.c_str()); | 330 REPORTER_ASSERT_MESSAGE(reporter, offset.fX == 20 && offset.fY == 30, st
r.c_str()); |
323 } | 331 } |
324 | 332 |
325 for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) { | 333 for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) { |
326 SkSafeUnref(filters[i]); | 334 SkSafeUnref(filters[i]); |
327 } | 335 } |
328 } | 336 } |
329 | 337 |
330 static SkBitmap make_gradient_circle(int width, int height) { | 338 static SkBitmap make_gradient_circle(int width, int height) { |
331 SkBitmap bitmap; | 339 SkBitmap bitmap; |
332 SkScalar x = SkIntToScalar(width / 2); | 340 SkScalar x = SkIntToScalar(width / 2); |
333 SkScalar y = SkIntToScalar(height / 2); | 341 SkScalar y = SkIntToScalar(height / 2); |
334 SkScalar radius = SkMinScalar(x, y) * 0.8f; | 342 SkScalar radius = SkMinScalar(x, y) * 0.8f; |
335 bitmap.allocN32Pixels(width, height); | 343 bitmap.allocN32Pixels(width, height); |
336 SkCanvas canvas(bitmap); | 344 SkCanvas canvas(bitmap); |
337 canvas.clear(0x00000000); | 345 canvas.clear(0x00000000); |
338 SkColor colors[2]; | 346 SkColor colors[2]; |
339 colors[0] = SK_ColorWHITE; | 347 colors[0] = SK_ColorWHITE; |
340 colors[1] = SK_ColorBLACK; | 348 colors[1] = SK_ColorBLACK; |
341 SkAutoTUnref<SkShader> shader( | 349 SkAutoTUnref<SkShader> shader( |
342 SkGradientShader::CreateRadial(SkPoint::Make(x, y), radius, colors, NULL
, 2, | 350 SkGradientShader::CreateRadial(SkPoint::Make(x, y), radius, colors, NULL
, 2, |
343 SkShader::kClamp_TileMode) | 351 SkShader::kClamp_TileMode) |
344 ); | 352 ); |
345 SkPaint paint; | 353 SkPaint paint; |
346 paint.setShader(shader); | 354 paint.setShader(shader); |
347 canvas.drawCircle(x, y, radius, paint); | 355 canvas.drawCircle(x, y, radius, paint); |
348 return bitmap; | 356 return bitmap; |
349 } | 357 } |
350 | 358 |
| 359 |
351 static void test_negative_blur_sigma(SkBaseDevice* device, skiatest::Reporter* r
eporter) { | 360 static void test_negative_blur_sigma(SkBaseDevice* device, skiatest::Reporter* r
eporter) { |
352 // Check that SkBlurImageFilter will accept a negative sigma, either in | 361 // Check that SkBlurImageFilter will accept a negative sigma, either in |
353 // the given arguments or after CTM application. | 362 // the given arguments or after CTM application. |
354 int width = 32, height = 32; | 363 int width = 32, height = 32; |
355 SkDeviceImageFilterProxy proxy(device, SkSurfaceProps(SkSurfaceProps::kLegac
yFontHost_InitType)); | 364 SkDeviceImageFilterProxy proxy(device, SkSurfaceProps(SkSurfaceProps::kLegac
yFontHost_InitType)); |
356 SkScalar five = SkIntToScalar(5); | 365 SkScalar five = SkIntToScalar(5); |
357 | 366 |
358 SkAutoTUnref<SkBlurImageFilter> positiveFilter( | 367 SkAutoTUnref<SkBlurImageFilter> positiveFilter( |
359 SkBlurImageFilter::Create(five, five) | 368 SkBlurImageFilter::Create(five, five) |
360 ); | 369 ); |
361 | 370 |
362 SkAutoTUnref<SkBlurImageFilter> negativeFilter( | 371 SkAutoTUnref<SkBlurImageFilter> negativeFilter( |
363 SkBlurImageFilter::Create(-five, five) | 372 SkBlurImageFilter::Create(-five, five) |
364 ); | 373 ); |
365 | 374 |
366 SkBitmap gradient = make_gradient_circle(width, height); | |
367 SkBitmap positiveResult1, negativeResult1; | 375 SkBitmap positiveResult1, negativeResult1; |
368 SkBitmap positiveResult2, negativeResult2; | 376 SkBitmap positiveResult2, negativeResult2; |
369 SkIPoint offset; | 377 { |
370 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), NULL); | 378 SkAutoTUnref<SkImage> gradient( |
371 positiveFilter->filterImage(&proxy, gradient, ctx, &positiveResult1, &offset
); | 379 SkNewImageFromBitmap(make_gradient_circle(width, height), NULL)); |
372 negativeFilter->filterImage(&proxy, gradient, ctx, &negativeResult1, &offset
); | 380 SkAutoTUnref<const SkImage> positiveResult1i, negativeResult1i; |
373 SkMatrix negativeScale; | 381 SkAutoTUnref<const SkImage> positiveResult2i, negativeResult2i; |
374 negativeScale.setScale(-SK_Scalar1, SK_Scalar1); | 382 SkIPoint offset; |
375 SkImageFilter::Context negativeCTX(negativeScale, SkIRect::MakeLargest(), NU
LL); | 383 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), NULL); |
376 positiveFilter->filterImage(&proxy, gradient, negativeCTX, &negativeResult2,
&offset); | 384 positiveFilter->filterImage(&proxy, gradient, ctx, positiveResult1i, &of
fset); |
377 negativeFilter->filterImage(&proxy, gradient, negativeCTX, &positiveResult2,
&offset); | 385 negativeFilter->filterImage(&proxy, gradient, ctx, negativeResult1i, &of
fset); |
| 386 SkMatrix negativeScale; |
| 387 negativeScale.setScale(-SK_Scalar1, SK_Scalar1); |
| 388 SkImageFilter::Context negativeCTX(negativeScale, SkIRect::MakeLargest()
, NULL); |
| 389 positiveFilter->filterImage(&proxy, gradient, negativeCTX, negativeResul
t2i, &offset); |
| 390 negativeFilter->filterImage(&proxy, gradient, negativeCTX, positiveResul
t2i, &offset); |
| 391 REPORTER_ASSERT(reporter, as_IB(positiveResult1i)->getROPixels(&positive
Result1)); |
| 392 REPORTER_ASSERT(reporter, as_IB(positiveResult2i)->getROPixels(&positive
Result2)); |
| 393 REPORTER_ASSERT(reporter, as_IB(negativeResult1i)->getROPixels(&negative
Result1)); |
| 394 REPORTER_ASSERT(reporter, as_IB(negativeResult2i)->getROPixels(&negative
Result2)); |
| 395 } |
| 396 |
378 SkAutoLockPixels lockP1(positiveResult1); | 397 SkAutoLockPixels lockP1(positiveResult1); |
379 SkAutoLockPixels lockP2(positiveResult2); | 398 SkAutoLockPixels lockP2(positiveResult2); |
380 SkAutoLockPixels lockN1(negativeResult1); | 399 SkAutoLockPixels lockN1(negativeResult1); |
381 SkAutoLockPixels lockN2(negativeResult2); | 400 SkAutoLockPixels lockN2(negativeResult2); |
382 for (int y = 0; y < height; y++) { | 401 for (int y = 0; y < height; y++) { |
383 int diffs = memcmp(positiveResult1.getAddr32(0, y), negativeResult1.getA
ddr32(0, y), positiveResult1.rowBytes()); | 402 int diffs = memcmp(positiveResult1.getAddr32(0, y), negativeResult1.getA
ddr32(0, y), positiveResult1.rowBytes()); |
384 REPORTER_ASSERT(reporter, !diffs); | 403 REPORTER_ASSERT(reporter, !diffs); |
385 if (diffs) { | 404 if (diffs) { |
386 break; | 405 break; |
387 } | 406 } |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 | 886 |
868 // Create an SkPicture which simply draws a green 1x1 rectangle. | 887 // Create an SkPicture which simply draws a green 1x1 rectangle. |
869 SkPaint greenPaint; | 888 SkPaint greenPaint; |
870 greenPaint.setColor(SK_ColorGREEN); | 889 greenPaint.setColor(SK_ColorGREEN); |
871 recordingCanvas->drawRect(SkRect::Make(SkIRect::MakeWH(1, 1)), greenPaint); | 890 recordingCanvas->drawRect(SkRect::Make(SkIRect::MakeWH(1, 1)), greenPaint); |
872 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); | 891 SkAutoTUnref<SkPicture> picture(recorder.endRecording()); |
873 | 892 |
874 SkAutoTUnref<SkImageFilter> imageFilter( | 893 SkAutoTUnref<SkImageFilter> imageFilter( |
875 SkPictureImageFilter::Create(picture.get())); | 894 SkPictureImageFilter::Create(picture.get())); |
876 | 895 |
877 SkBitmap result; | 896 SkAutoTUnref<const SkImage> result; |
878 SkIPoint offset; | 897 SkIPoint offset; |
879 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeXYWH(1, 1, 1, 1), NUL
L); | 898 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeXYWH(1, 1, 1, 1), NUL
L); |
| 899 SkAutoTUnref<const SkImage> image; |
880 SkBitmap bitmap; | 900 SkBitmap bitmap; |
881 bitmap.allocN32Pixels(2, 2); | 901 bitmap.allocN32Pixels(2, 2); |
| 902 image.reset(SkNewImageFromBitmap(bitmap, NULL)); |
882 SkBitmapDevice device(bitmap); | 903 SkBitmapDevice device(bitmap); |
883 SkDeviceImageFilterProxy proxy(&device, SkSurfaceProps(SkSurfaceProps::kLega
cyFontHost_InitType)); | 904 SkDeviceImageFilterProxy proxy(&device, SkSurfaceProps(SkSurfaceProps::kLega
cyFontHost_InitType)); |
884 REPORTER_ASSERT(reporter, !imageFilter->filterImage(&proxy, bitmap, ctx, &re
sult, &offset)); | 905 REPORTER_ASSERT(reporter, !imageFilter->filterImage(&proxy, image, ctx, resu
lt, &offset)); |
885 } | 906 } |
886 | 907 |
887 DEF_TEST(ImageFilterEmptySaveLayer, reporter) { | 908 DEF_TEST(ImageFilterEmptySaveLayer, reporter) { |
888 // Even when there's an empty saveLayer()/restore(), ensure that an image | 909 // Even when there's an empty saveLayer()/restore(), ensure that an image |
889 // filter or color filter which affects transparent black still draws. | 910 // filter or color filter which affects transparent black still draws. |
890 | 911 |
891 SkBitmap bitmap; | 912 SkBitmap bitmap; |
892 bitmap.allocN32Pixels(10, 10); | 913 bitmap.allocN32Pixels(10, 10); |
893 SkBitmapDevice device(bitmap); | 914 SkBitmapDevice device(bitmap); |
894 SkCanvas canvas(&device); | 915 SkCanvas canvas(&device); |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1117 SkBitmapDevice device(temp); | 1138 SkBitmapDevice device(temp); |
1118 test_xfermode_cropped_input(&device, reporter); | 1139 test_xfermode_cropped_input(&device, reporter); |
1119 } | 1140 } |
1120 | 1141 |
1121 DEF_TEST(ComposedImageFilterOffset, reporter) { | 1142 DEF_TEST(ComposedImageFilterOffset, reporter) { |
1122 SkBitmap bitmap; | 1143 SkBitmap bitmap; |
1123 bitmap.allocN32Pixels(100, 100); | 1144 bitmap.allocN32Pixels(100, 100); |
1124 bitmap.eraseARGB(0, 0, 0, 0); | 1145 bitmap.eraseARGB(0, 0, 0, 0); |
1125 SkBitmapDevice device(bitmap); | 1146 SkBitmapDevice device(bitmap); |
1126 SkDeviceImageFilterProxy proxy(&device, SkSurfaceProps(SkSurfaceProps::kLega
cyFontHost_InitType)); | 1147 SkDeviceImageFilterProxy proxy(&device, SkSurfaceProps(SkSurfaceProps::kLega
cyFontHost_InitType)); |
1127 | 1148 SkAutoTUnref<const SkImage> image(SkNewImageFromBitmap(bitmap, NULL)); |
1128 SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(1, 0, 20, 20)); | 1149 SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(1, 0, 20, 20)); |
1129 SkAutoTUnref<SkImageFilter> offsetFilter(SkOffsetImageFilter::Create(0, 0, N
ULL, &cropRect)); | 1150 SkAutoTUnref<SkImageFilter> offsetFilter(SkOffsetImageFilter::Create(0, 0, N
ULL, &cropRect)); |
1130 SkAutoTUnref<SkImageFilter> blurFilter(makeBlur()); | 1151 SkAutoTUnref<SkImageFilter> blurFilter(makeBlur()); |
1131 SkAutoTUnref<SkImageFilter> composedFilter(SkComposeImageFilter::Create(blur
Filter, offsetFilter.get())); | 1152 SkAutoTUnref<SkImageFilter> composedFilter(SkComposeImageFilter::Create(blur
Filter, offsetFilter.get())); |
1132 SkBitmap result; | 1153 SkAutoTUnref<const SkImage> result; |
1133 SkIPoint offset; | 1154 SkIPoint offset; |
1134 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), NULL); | 1155 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeLargest(), NULL); |
1135 REPORTER_ASSERT(reporter, composedFilter->filterImage(&proxy, bitmap, ctx, &
result, &offset)); | 1156 REPORTER_ASSERT(reporter, composedFilter->filterImage(&proxy, image, ctx, re
sult, &offset)); |
1136 REPORTER_ASSERT(reporter, offset.fX == 1 && offset.fY == 0); | 1157 REPORTER_ASSERT(reporter, offset.fX == 1 && offset.fY == 0); |
1137 } | 1158 } |
1138 | 1159 |
1139 #if SK_SUPPORT_GPU | 1160 #if SK_SUPPORT_GPU |
1140 const SkSurfaceProps gProps = SkSurfaceProps(SkSurfaceProps::kLegacyFontHost_Ini
tType); | 1161 const SkSurfaceProps gProps = SkSurfaceProps(SkSurfaceProps::kLegacyFontHost_Ini
tType); |
1141 | 1162 |
1142 DEF_GPUTEST(ImageFilterCropRectGPU, reporter, factory) { | 1163 DEF_GPUTEST(ImageFilterCropRectGPU, reporter, factory) { |
1143 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextTyp
e>(0)); | 1164 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextTyp
e>(0)); |
1144 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context, | 1165 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context, |
1145 SkSurface::kNo_Budgeted
, | 1166 SkSurface::kNo_Budgeted
, |
(...skipping 26 matching lines...) Expand all Loading... |
1172 DEF_GPUTEST(TestNegativeBlurSigmaGPU, reporter, factory) { | 1193 DEF_GPUTEST(TestNegativeBlurSigmaGPU, reporter, factory) { |
1173 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextTyp
e>(0)); | 1194 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextTyp
e>(0)); |
1174 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context, | 1195 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context, |
1175 SkSurface::kNo_Budgeted
, | 1196 SkSurface::kNo_Budgeted
, |
1176 SkImageInfo::MakeN32Pre
mul(1, 1), | 1197 SkImageInfo::MakeN32Pre
mul(1, 1), |
1177 0, | 1198 0, |
1178 &gProps)); | 1199 &gProps)); |
1179 test_negative_blur_sigma(device, reporter); | 1200 test_negative_blur_sigma(device, reporter); |
1180 } | 1201 } |
1181 #endif | 1202 #endif |
OLD | NEW |