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

Side by Side Diff: tests/ImageFilterTest.cpp

Issue 834673006: Require explicit disabling of cross process pictureimagefilters (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix unit test Created 5 years, 11 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 | « src/effects/SkPictureImageFilter.cpp ('k') | no next file » | 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 * 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 784 matching lines...) Expand 10 before | Expand all | Expand 10 after
795 795
796 redPaintWithFilter.setImageFilter(unflattenedFilter); 796 redPaintWithFilter.setImageFilter(unflattenedFilter);
797 SkPictureRecorder crossProcessRecorder; 797 SkPictureRecorder crossProcessRecorder;
798 SkCanvas* crossProcessCanvas = crossProcessRecorder.beginRecording(1, 1, &fa ctory, 0); 798 SkCanvas* crossProcessCanvas = crossProcessRecorder.beginRecording(1, 1, &fa ctory, 0);
799 crossProcessCanvas->drawRect(SkRect::Make(SkIRect::MakeWH(1, 1)), redPaintWi thFilter); 799 crossProcessCanvas->drawRect(SkRect::Make(SkIRect::MakeWH(1, 1)), redPaintWi thFilter);
800 SkAutoTUnref<SkPicture> crossProcessPicture(crossProcessRecorder.endRecordin g()); 800 SkAutoTUnref<SkPicture> crossProcessPicture(crossProcessRecorder.endRecordin g());
801 801
802 canvas.clear(0x0); 802 canvas.clear(0x0);
803 canvas.drawPicture(crossProcessPicture); 803 canvas.drawPicture(crossProcessPicture);
804 pixel = *bitmap.getAddr32(0, 0); 804 pixel = *bitmap.getAddr32(0, 0);
805 #ifdef SK_DISALLOW_CROSSPROCESS_PICTUREIMAGEFILTERS
805 // The result here should not be green, since the filter draws nothing. 806 // The result here should not be green, since the filter draws nothing.
806 REPORTER_ASSERT(reporter, pixel != SK_ColorGREEN); 807 REPORTER_ASSERT(reporter, pixel != SK_ColorGREEN);
808 #else
809 REPORTER_ASSERT(reporter, pixel == SK_ColorGREEN);
810 #endif
807 } 811 }
808 812
809 DEF_TEST(ImageFilterClippedPictureImageFilter, reporter) { 813 DEF_TEST(ImageFilterClippedPictureImageFilter, reporter) {
810 SkRTreeFactory factory; 814 SkRTreeFactory factory;
811 SkPictureRecorder recorder; 815 SkPictureRecorder recorder;
812 SkCanvas* recordingCanvas = recorder.beginRecording(1, 1, &factory, 0); 816 SkCanvas* recordingCanvas = recorder.beginRecording(1, 1, &factory, 0);
813 817
814 // Create an SkPicture which simply draws a green 1x1 rectangle. 818 // Create an SkPicture which simply draws a green 1x1 rectangle.
815 SkPaint greenPaint; 819 SkPaint greenPaint;
816 greenPaint.setColor(SK_ColorGREEN); 820 greenPaint.setColor(SK_ColorGREEN);
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
1096 1100
1097 DEF_GPUTEST(TestNegativeBlurSigmaGPU, reporter, factory) { 1101 DEF_GPUTEST(TestNegativeBlurSigmaGPU, reporter, factory) {
1098 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextTyp e>(0)); 1102 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextTyp e>(0));
1099 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context, 1103 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context,
1100 SkImageInfo::MakeN32Pre mul(1, 1), 1104 SkImageInfo::MakeN32Pre mul(1, 1),
1101 gProps, 1105 gProps,
1102 0)); 1106 0));
1103 test_negative_blur_sigma(device, reporter); 1107 test_negative_blur_sigma(device, reporter);
1104 } 1108 }
1105 #endif 1109 #endif
OLDNEW
« no previous file with comments | « src/effects/SkPictureImageFilter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698