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

Side by Side Diff: tests/ImageFilterTest.cpp

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