Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1106)

Side by Side Diff: tests/ImageFilterTest.cpp

Issue 1821103004: Revert of Revert[2] of "switch colorfilters to sk_sp (patchset #11 id:200001 of https://codereview.chromium.o… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tests/GpuColorFilterTest.cpp ('k') | tests/PaintTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2013 Google Inc. 3 * Copyright 2013 Google Inc.
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkBitmapDevice.h" 10 #include "SkBitmapDevice.h"
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 130
131 return surface->makeImageSnapshot(); 131 return surface->makeImageSnapshot();
132 } 132 }
133 133
134 static SkImageFilter* make_scale(float amount, SkImageFilter* input = nullptr) { 134 static SkImageFilter* make_scale(float amount, SkImageFilter* input = nullptr) {
135 SkScalar s = amount; 135 SkScalar s = amount;
136 SkScalar matrix[20] = { s, 0, 0, 0, 0, 136 SkScalar matrix[20] = { s, 0, 0, 0, 0,
137 0, s, 0, 0, 0, 137 0, s, 0, 0, 0,
138 0, 0, s, 0, 0, 138 0, 0, s, 0, 0,
139 0, 0, 0, s, 0 }; 139 0, 0, 0, s, 0 };
140 auto filter(SkColorFilter::MakeMatrixFilterRowMajor255(matrix)); 140 SkAutoTUnref<SkColorFilter> filter(SkColorMatrixFilter::Create(matrix));
141 return SkColorFilterImageFilter::Create(filter.get(), input); 141 return SkColorFilterImageFilter::Create(filter, input);
142 } 142 }
143 143
144 static SkImageFilter* make_grayscale(SkImageFilter* input, const SkImageFilter:: CropRect* cropRect) { 144 static SkImageFilter* make_grayscale(SkImageFilter* input, const SkImageFilter:: CropRect* cropRect) {
145 SkScalar matrix[20]; 145 SkScalar matrix[20];
146 memset(matrix, 0, 20 * sizeof(SkScalar)); 146 memset(matrix, 0, 20 * sizeof(SkScalar));
147 matrix[0] = matrix[5] = matrix[10] = 0.2126f; 147 matrix[0] = matrix[5] = matrix[10] = 0.2126f;
148 matrix[1] = matrix[6] = matrix[11] = 0.7152f; 148 matrix[1] = matrix[6] = matrix[11] = 0.7152f;
149 matrix[2] = matrix[7] = matrix[12] = 0.0722f; 149 matrix[2] = matrix[7] = matrix[12] = 0.0722f;
150 matrix[18] = 1.0f; 150 matrix[18] = 1.0f;
151 auto filter(SkColorFilter::MakeMatrixFilterRowMajor255(matrix)); 151 SkAutoTUnref<SkColorFilter> filter(SkColorMatrixFilter::Create(matrix));
152 return SkColorFilterImageFilter::Create(filter.get(), input, cropRect); 152 return SkColorFilterImageFilter::Create(filter, input, cropRect);
153 } 153 }
154 154
155 static SkImageFilter* make_blue(SkImageFilter* input, const SkImageFilter::CropR ect* cropRect) { 155 static SkImageFilter* make_blue(SkImageFilter* input, const SkImageFilter::CropR ect* cropRect) {
156 auto filter(SkColorFilter::MakeModeFilter(SK_ColorBLUE, SkXfermode::kSrcIn_M ode)); 156 SkAutoTUnref<SkColorFilter> filter(SkColorFilter::CreateModeFilter(SK_ColorB LUE,
157 return SkColorFilterImageFilter::Create(filter.get(), input, cropRect); 157 SkXfermod e::kSrcIn_Mode));
158 return SkColorFilterImageFilter::Create(filter, input, cropRect);
158 } 159 }
159 160
160 static sk_sp<SkSpecialSurface> create_empty_special_surface(GrContext* context, 161 static sk_sp<SkSpecialSurface> create_empty_special_surface(GrContext* context,
161 SkImageFilter::Proxy * proxy, 162 SkImageFilter::Proxy * proxy,
162 int widthHeight) { 163 int widthHeight) {
163 if (context) { 164 if (context) {
164 GrSurfaceDesc desc; 165 GrSurfaceDesc desc;
165 desc.fConfig = kSkia8888_GrPixelConfig; 166 desc.fConfig = kSkia8888_GrPixelConfig;
166 desc.fFlags = kRenderTarget_GrSurfaceFlag; 167 desc.fFlags = kRenderTarget_GrSurfaceFlag;
167 desc.fWidth = widthHeight; 168 desc.fWidth = widthHeight;
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 REPORTER_ASSERT(reporter, false == grayWithCrop->asColorFilter(nullptr)) ; 251 REPORTER_ASSERT(reporter, false == grayWithCrop->asColorFilter(nullptr)) ;
251 } 252 }
252 253
253 { 254 {
254 // Check that two non-commutative matrices are concatenated in 255 // Check that two non-commutative matrices are concatenated in
255 // the correct order. 256 // the correct order.
256 SkScalar blueToRedMatrix[20] = { 0 }; 257 SkScalar blueToRedMatrix[20] = { 0 };
257 blueToRedMatrix[2] = blueToRedMatrix[18] = SK_Scalar1; 258 blueToRedMatrix[2] = blueToRedMatrix[18] = SK_Scalar1;
258 SkScalar redToGreenMatrix[20] = { 0 }; 259 SkScalar redToGreenMatrix[20] = { 0 };
259 redToGreenMatrix[5] = redToGreenMatrix[18] = SK_Scalar1; 260 redToGreenMatrix[5] = redToGreenMatrix[18] = SK_Scalar1;
260 auto blueToRed(SkColorFilter::MakeMatrixFilterRowMajor255(blueToRedMatri x)); 261 SkAutoTUnref<SkColorFilter> blueToRed(SkColorMatrixFilter::Create(blueTo RedMatrix));
261 SkAutoTUnref<SkImageFilter> filter1(SkColorFilterImageFilter::Create(blu eToRed.get())); 262 SkAutoTUnref<SkImageFilter> filter1(SkColorFilterImageFilter::Create(blu eToRed.get()));
262 auto redToGreen(SkColorFilter::MakeMatrixFilterRowMajor255(redToGreenMat rix)); 263 SkAutoTUnref<SkColorFilter> redToGreen(SkColorMatrixFilter::Create(redTo GreenMatrix));
263 SkAutoTUnref<SkImageFilter> filter2(SkColorFilterImageFilter::Create(red ToGreen.get(), filter1.get())); 264 SkAutoTUnref<SkImageFilter> filter2(SkColorFilterImageFilter::Create(red ToGreen.get(), filter1.get()));
264 265
265 SkBitmap result; 266 SkBitmap result;
266 result.allocN32Pixels(kBitmapSize, kBitmapSize); 267 result.allocN32Pixels(kBitmapSize, kBitmapSize);
267 268
268 SkPaint paint; 269 SkPaint paint;
269 paint.setColor(SK_ColorBLUE); 270 paint.setColor(SK_ColorBLUE);
270 paint.setImageFilter(filter2.get()); 271 paint.setImageFilter(filter2.get());
271 SkCanvas canvas(result); 272 SkCanvas canvas(result);
272 canvas.clear(0x0); 273 canvas.clear(0x0);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 // Check that all filters offset to their absolute crop rect, 313 // Check that all filters offset to their absolute crop rect,
313 // unaffected by the input crop rect. 314 // unaffected by the input crop rect.
314 // Tests pass by not asserting. 315 // Tests pass by not asserting.
315 sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, proxy, 100) ); 316 sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, proxy, 100) );
316 SkASSERT(srcImg); 317 SkASSERT(srcImg);
317 318
318 SkImageFilter::CropRect inputCropRect(SkRect::MakeXYWH(8, 13, 80, 80)); 319 SkImageFilter::CropRect inputCropRect(SkRect::MakeXYWH(8, 13, 80, 80));
319 SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(20, 30, 60, 60)); 320 SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(20, 30, 60, 60));
320 SkAutoTUnref<SkImageFilter> input(make_grayscale(nullptr, &inputCropRect)); 321 SkAutoTUnref<SkImageFilter> input(make_grayscale(nullptr, &inputCropRect));
321 322
322 auto cf(SkColorFilter::MakeModeFilter(SK_ColorRED, SkXfermode::kSrcIn_Mode)) ; 323 SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(SK_ColorRED, SkXfermode::kSrcIn_Mode));
323 SkPoint3 location = SkPoint3::Make(0, 0, SK_Scalar1); 324 SkPoint3 location = SkPoint3::Make(0, 0, SK_Scalar1);
324 SkScalar kernel[9] = { 325 SkScalar kernel[9] = {
325 SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1), 326 SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1),
326 SkIntToScalar( 1), SkIntToScalar(-7), SkIntToScalar( 1), 327 SkIntToScalar( 1), SkIntToScalar(-7), SkIntToScalar( 1),
327 SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1), 328 SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1),
328 }; 329 };
329 SkISize kernelSize = SkISize::Make(3, 3); 330 SkISize kernelSize = SkISize::Make(3, 3);
330 SkScalar gain = SK_Scalar1, bias = 0; 331 SkScalar gain = SK_Scalar1, bias = 0;
331 332
332 SkImageFilter* filters[] = { 333 SkImageFilter* filters[] = {
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 DEF_GPUTEST_FOR_NATIVE_CONTEXT(TestZeroBlurSigma_Gpu, reporter, context) { 557 DEF_GPUTEST_FOR_NATIVE_CONTEXT(TestZeroBlurSigma_Gpu, reporter, context) {
557 run_gpu_test(reporter, context, 100, test_zero_blur_sigma); 558 run_gpu_test(reporter, context, 100, test_zero_blur_sigma);
558 } 559 }
559 #endif 560 #endif
560 561
561 DEF_TEST(ImageFilterDrawTiled, reporter) { 562 DEF_TEST(ImageFilterDrawTiled, reporter) {
562 // Check that all filters when drawn tiled (with subsequent clip rects) exac tly 563 // Check that all filters when drawn tiled (with subsequent clip rects) exac tly
563 // match the same filters drawn with a single full-canvas bitmap draw. 564 // match the same filters drawn with a single full-canvas bitmap draw.
564 // Tests pass by not asserting. 565 // Tests pass by not asserting.
565 566
566 auto cf(SkColorFilter::MakeModeFilter(SK_ColorRED, SkXfermode::kSrcIn_Mode)) ; 567 SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(SK_ColorRED, SkXfermode::kSrcIn_Mode));
567 SkPoint3 location = SkPoint3::Make(0, 0, SK_Scalar1); 568 SkPoint3 location = SkPoint3::Make(0, 0, SK_Scalar1);
568 SkScalar kernel[9] = { 569 SkScalar kernel[9] = {
569 SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1), 570 SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1),
570 SkIntToScalar( 1), SkIntToScalar(-7), SkIntToScalar( 1), 571 SkIntToScalar( 1), SkIntToScalar(-7), SkIntToScalar( 1),
571 SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1), 572 SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1),
572 }; 573 };
573 const SkISize kernelSize = SkISize::Make(3, 3); 574 const SkISize kernelSize = SkISize::Make(3, 3);
574 const SkScalar gain = SK_Scalar1, bias = 0; 575 const SkScalar gain = SK_Scalar1, bias = 0;
575 const SkScalar five = SkIntToScalar(5); 576 const SkScalar five = SkIntToScalar(5);
576 577
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 SkSafeUnref(filters[i].fFilter); 686 SkSafeUnref(filters[i].fFilter);
686 } 687 }
687 } 688 }
688 689
689 static void draw_saveLayer_picture(int width, int height, int tileSize, 690 static void draw_saveLayer_picture(int width, int height, int tileSize,
690 SkBBHFactory* factory, SkBitmap* result) { 691 SkBBHFactory* factory, SkBitmap* result) {
691 692
692 SkMatrix matrix; 693 SkMatrix matrix;
693 matrix.setTranslate(SkIntToScalar(50), 0); 694 matrix.setTranslate(SkIntToScalar(50), 0);
694 695
695 auto cf(SkColorFilter::MakeModeFilter(SK_ColorWHITE, SkXfermode::kSrc_Mode)) ; 696 SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(SK_ColorWHITE , SkXfermode::kSrc_Mode));
696 SkAutoTUnref<SkImageFilter> cfif(SkColorFilterImageFilter::Create(cf.get())) ; 697 SkAutoTUnref<SkImageFilter> cfif(SkColorFilterImageFilter::Create(cf.get())) ;
697 SkAutoTUnref<SkImageFilter> imageFilter(SkImageFilter::CreateMatrixFilter(ma trix, kNone_SkFilterQuality, cfif.get())); 698 SkAutoTUnref<SkImageFilter> imageFilter(SkImageFilter::CreateMatrixFilter(ma trix, kNone_SkFilterQuality, cfif.get()));
698 699
699 SkPaint paint; 700 SkPaint paint;
700 paint.setImageFilter(imageFilter.get()); 701 paint.setImageFilter(imageFilter.get());
701 SkPictureRecorder recorder; 702 SkPictureRecorder recorder;
702 SkRect bounds = SkRect::Make(SkIRect::MakeXYWH(0, 0, 50, 50)); 703 SkRect bounds = SkRect::Make(SkIRect::MakeXYWH(0, 0, 50, 50));
703 SkCanvas* recordingCanvas = recorder.beginRecording(SkIntToScalar(width), 704 SkCanvas* recordingCanvas = recorder.beginRecording(SkIntToScalar(width),
704 SkIntToScalar(height), 705 SkIntToScalar(height),
705 factory, 0); 706 factory, 0);
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
1114 // Even when there's an empty saveLayer()/restore(), ensure that an image 1115 // Even when there's an empty saveLayer()/restore(), ensure that an image
1115 // filter or color filter which affects transparent black still draws. 1116 // filter or color filter which affects transparent black still draws.
1116 1117
1117 SkBitmap bitmap; 1118 SkBitmap bitmap;
1118 bitmap.allocN32Pixels(10, 10); 1119 bitmap.allocN32Pixels(10, 10);
1119 SkCanvas canvas(bitmap); 1120 SkCanvas canvas(bitmap);
1120 1121
1121 SkRTreeFactory factory; 1122 SkRTreeFactory factory;
1122 SkPictureRecorder recorder; 1123 SkPictureRecorder recorder;
1123 1124
1124 auto green(SkColorFilter::MakeModeFilter(SK_ColorGREEN, SkXfermode::kSrc_Mod e)); 1125 SkAutoTUnref<SkColorFilter> green(
1126 SkColorFilter::CreateModeFilter(SK_ColorGREEN, SkXfermode::kSrc_Mode));
1125 SkAutoTUnref<SkImageFilter> imageFilter( 1127 SkAutoTUnref<SkImageFilter> imageFilter(
1126 SkColorFilterImageFilter::Create(green.get())); 1128 SkColorFilterImageFilter::Create(green.get()));
1127 SkPaint imageFilterPaint; 1129 SkPaint imageFilterPaint;
1128 imageFilterPaint.setImageFilter(imageFilter.get()); 1130 imageFilterPaint.setImageFilter(imageFilter.get());
1129 SkPaint colorFilterPaint; 1131 SkPaint colorFilterPaint;
1130 colorFilterPaint.setColorFilter(green); 1132 colorFilterPaint.setColorFilter(green.get());
1131 1133
1132 SkRect bounds = SkRect::MakeWH(10, 10); 1134 SkRect bounds = SkRect::MakeWH(10, 10);
1133 1135
1134 SkCanvas* recordingCanvas = recorder.beginRecording(10, 10, &factory, 0); 1136 SkCanvas* recordingCanvas = recorder.beginRecording(10, 10, &factory, 0);
1135 recordingCanvas->saveLayer(&bounds, &imageFilterPaint); 1137 recordingCanvas->saveLayer(&bounds, &imageFilterPaint);
1136 recordingCanvas->restore(); 1138 recordingCanvas->restore();
1137 sk_sp<SkPicture> picture(recorder.finishRecordingAsPicture()); 1139 sk_sp<SkPicture> picture(recorder.finishRecordingAsPicture());
1138 1140
1139 canvas.clear(0); 1141 canvas.clear(0);
1140 canvas.drawPicture(picture); 1142 canvas.drawPicture(picture);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 REPORTER_ASSERT(reporter, nullptr == conv.get()); 1238 REPORTER_ASSERT(reporter, nullptr == conv.get());
1237 } 1239 }
1238 1240
1239 static void test_xfermode_cropped_input(SkCanvas* canvas, skiatest::Reporter* re porter) { 1241 static void test_xfermode_cropped_input(SkCanvas* canvas, skiatest::Reporter* re porter) {
1240 canvas->clear(0); 1242 canvas->clear(0);
1241 1243
1242 SkBitmap bitmap; 1244 SkBitmap bitmap;
1243 bitmap.allocN32Pixels(1, 1); 1245 bitmap.allocN32Pixels(1, 1);
1244 bitmap.eraseARGB(255, 255, 255, 255); 1246 bitmap.eraseARGB(255, 255, 255, 255);
1245 1247
1246 auto green(SkColorFilter::MakeModeFilter(SK_ColorGREEN, SkXfermode::kSrcIn_M ode)); 1248 SkAutoTUnref<SkColorFilter> green(
1249 SkColorFilter::CreateModeFilter(SK_ColorGREEN, SkXfermode::kSrcIn_Mode)) ;
1247 SkAutoTUnref<SkImageFilter> greenFilter(SkColorFilterImageFilter::Create(gre en.get())); 1250 SkAutoTUnref<SkImageFilter> greenFilter(SkColorFilterImageFilter::Create(gre en.get()));
1248 SkImageFilter::CropRect cropRect(SkRect::MakeEmpty()); 1251 SkImageFilter::CropRect cropRect(SkRect::MakeEmpty());
1249 SkAutoTUnref<SkImageFilter> croppedOut( 1252 SkAutoTUnref<SkImageFilter> croppedOut(
1250 SkColorFilterImageFilter::Create(green.get(), nullptr, &cropRect)); 1253 SkColorFilterImageFilter::Create(green.get(), nullptr, &cropRect));
1251 1254
1252 // Check that an xfermode image filter whose input has been cropped out stil l draws the other 1255 // Check that an xfermode image filter whose input has been cropped out stil l draws the other
1253 // input. Also check that drawing with both inputs cropped out doesn't cause a GPU warning. 1256 // input. Also check that drawing with both inputs cropped out doesn't cause a GPU warning.
1254 SkXfermode* mode = SkXfermode::Create(SkXfermode::kSrcOver_Mode); 1257 SkXfermode* mode = SkXfermode::Create(SkXfermode::kSrcOver_Mode);
1255 SkAutoTUnref<SkImageFilter> xfermodeNoFg( 1258 SkAutoTUnref<SkImageFilter> xfermodeNoFg(
1256 SkXfermodeImageFilter::Create(mode, greenFilter, croppedOut)); 1259 SkXfermodeImageFilter::Create(mode, greenFilter, croppedOut));
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 } 1460 }
1458 REPORTER_ASSERT(reporter, gray->canComputeFastBounds()); 1461 REPORTER_ASSERT(reporter, gray->canComputeFastBounds());
1459 1462
1460 SkAutoTUnref<SkImageFilter> grayBlur(SkBlurImageFilter::Create(SK_Scalar1, S K_Scalar1, gray.get())); 1463 SkAutoTUnref<SkImageFilter> grayBlur(SkBlurImageFilter::Create(SK_Scalar1, S K_Scalar1, gray.get()));
1461 REPORTER_ASSERT(reporter, grayBlur->canComputeFastBounds()); 1464 REPORTER_ASSERT(reporter, grayBlur->canComputeFastBounds());
1462 1465
1463 SkScalar greenMatrix[20] = { 0, 0, 0, 0, 0, 1466 SkScalar greenMatrix[20] = { 0, 0, 0, 0, 0,
1464 0, 0, 0, 0, 1, 1467 0, 0, 0, 0, 1,
1465 0, 0, 0, 0, 0, 1468 0, 0, 0, 0, 0,
1466 0, 0, 0, 0, 1 }; 1469 0, 0, 0, 0, 1 };
1467 auto greenCF(SkColorFilter::MakeMatrixFilterRowMajor255(greenMatrix)); 1470 SkAutoTUnref<SkColorFilter> greenCF(SkColorMatrixFilter::Create(greenMatrix) );
1468 SkAutoTUnref<SkImageFilter> green(SkColorFilterImageFilter::Create(greenCF.g et())); 1471 SkAutoTUnref<SkImageFilter> green(SkColorFilterImageFilter::Create(greenCF)) ;
1469 1472
1470 REPORTER_ASSERT(reporter, greenCF->affectsTransparentBlack()); 1473 REPORTER_ASSERT(reporter, greenCF->affectsTransparentBlack());
1471 REPORTER_ASSERT(reporter, !green->canComputeFastBounds()); 1474 REPORTER_ASSERT(reporter, !green->canComputeFastBounds());
1472 1475
1473 SkAutoTUnref<SkImageFilter> greenBlur(SkBlurImageFilter::Create(SK_Scalar1, SK_Scalar1, green.get())); 1476 SkAutoTUnref<SkImageFilter> greenBlur(SkBlurImageFilter::Create(SK_Scalar1, SK_Scalar1, green.get()));
1474 REPORTER_ASSERT(reporter, !greenBlur->canComputeFastBounds()); 1477 REPORTER_ASSERT(reporter, !greenBlur->canComputeFastBounds());
1475 1478
1476 uint8_t allOne[256], identity[256]; 1479 uint8_t allOne[256], identity[256];
1477 for (int i = 0; i < 256; ++i) { 1480 for (int i = 0; i < 256; ++i) {
1478 identity[i] = i; 1481 identity[i] = i;
1479 allOne[i] = 255; 1482 allOne[i] = 255;
1480 } 1483 }
1481 1484
1482 auto identityCF(SkTableColorFilter::MakeARGB(identity, identity, identity, a llOne)); 1485 SkAutoTUnref<SkColorFilter> identityCF(
1486 SkTableColorFilter::CreateARGB(identity, identity, identity, allOne));
1483 SkAutoTUnref<SkImageFilter> identityFilter(SkColorFilterImageFilter::Create( identityCF.get())); 1487 SkAutoTUnref<SkImageFilter> identityFilter(SkColorFilterImageFilter::Create( identityCF.get()));
1484 REPORTER_ASSERT(reporter, !identityCF->affectsTransparentBlack()); 1488 REPORTER_ASSERT(reporter, !identityCF->affectsTransparentBlack());
1485 REPORTER_ASSERT(reporter, identityFilter->canComputeFastBounds()); 1489 REPORTER_ASSERT(reporter, identityFilter->canComputeFastBounds());
1486 1490
1487 auto forceOpaqueCF(SkTableColorFilter::MakeARGB(allOne, identity, identity, identity)); 1491 SkAutoTUnref<SkColorFilter> forceOpaqueCF(
1492 SkTableColorFilter::CreateARGB(allOne, identity, identity, identity));
1488 SkAutoTUnref<SkImageFilter> forceOpaque(SkColorFilterImageFilter::Create(for ceOpaqueCF.get())); 1493 SkAutoTUnref<SkImageFilter> forceOpaque(SkColorFilterImageFilter::Create(for ceOpaqueCF.get()));
1489 REPORTER_ASSERT(reporter, forceOpaqueCF->affectsTransparentBlack()); 1494 REPORTER_ASSERT(reporter, forceOpaqueCF->affectsTransparentBlack());
1490 REPORTER_ASSERT(reporter, !forceOpaque->canComputeFastBounds()); 1495 REPORTER_ASSERT(reporter, !forceOpaque->canComputeFastBounds());
1491 } 1496 }
1492 1497
1493 // Verify that SkImageSource survives serialization 1498 // Verify that SkImageSource survives serialization
1494 DEF_TEST(ImageFilterImageSourceSerialization, reporter) { 1499 DEF_TEST(ImageFilterImageSourceSerialization, reporter) {
1495 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(10, 10)); 1500 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(10, 10));
1496 surface->getCanvas()->clear(SK_ColorGREEN); 1501 surface->getCanvas()->clear(SK_ColorGREEN);
1497 sk_sp<SkImage> image(surface->makeImageSnapshot()); 1502 sk_sp<SkImage> image(surface->makeImageSnapshot());
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
1593 test_xfermode_cropped_input(&canvas, reporter); 1598 test_xfermode_cropped_input(&canvas, reporter);
1594 } 1599 }
1595 1600
1596 DEF_GPUTEST_FOR_ALL_CONTEXTS(BlurLargeImage_Gpu, reporter, context) { 1601 DEF_GPUTEST_FOR_ALL_CONTEXTS(BlurLargeImage_Gpu, reporter, context) {
1597 SkAutoTUnref<SkSurface> surface( 1602 SkAutoTUnref<SkSurface> surface(
1598 SkSurface::NewRenderTarget(context, SkBudgeted::kYes, 1603 SkSurface::NewRenderTarget(context, SkBudgeted::kYes,
1599 SkImageInfo::MakeN32Premul(100, 100))); 1604 SkImageInfo::MakeN32Premul(100, 100)));
1600 test_large_blur_input(reporter, surface->getCanvas()); 1605 test_large_blur_input(reporter, surface->getCanvas());
1601 } 1606 }
1602 #endif 1607 #endif
OLDNEW
« no previous file with comments | « tests/GpuColorFilterTest.cpp ('k') | tests/PaintTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698