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

Side by Side Diff: tests/ImageFilterTest.cpp

Issue 1183853003: skia: Add runtime option to disable picture IO security precautions (Closed) Base URL: https://chromium.googlesource.com/skia.git@master
Patch Set: rename stuff Created 5 years, 6 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 841 matching lines...) Expand 10 before | Expand all | Expand 10 after
852 852
853 redPaintWithFilter.setImageFilter(unflattenedFilter); 853 redPaintWithFilter.setImageFilter(unflattenedFilter);
854 SkPictureRecorder crossProcessRecorder; 854 SkPictureRecorder crossProcessRecorder;
855 SkCanvas* crossProcessCanvas = crossProcessRecorder.beginRecording(1, 1, &fa ctory, 0); 855 SkCanvas* crossProcessCanvas = crossProcessRecorder.beginRecording(1, 1, &fa ctory, 0);
856 crossProcessCanvas->drawRect(SkRect::Make(SkIRect::MakeWH(1, 1)), redPaintWi thFilter); 856 crossProcessCanvas->drawRect(SkRect::Make(SkIRect::MakeWH(1, 1)), redPaintWi thFilter);
857 SkAutoTUnref<SkPicture> crossProcessPicture(crossProcessRecorder.endRecordin g()); 857 SkAutoTUnref<SkPicture> crossProcessPicture(crossProcessRecorder.endRecordin g());
858 858
859 canvas.clear(0x0); 859 canvas.clear(0x0);
860 canvas.drawPicture(crossProcessPicture); 860 canvas.drawPicture(crossProcessPicture);
861 pixel = *bitmap.getAddr32(0, 0); 861 pixel = *bitmap.getAddr32(0, 0);
862 #ifdef SK_DISALLOW_CROSSPROCESS_PICTUREIMAGEFILTERS 862 // If the security precautions are enabled, the result here should not be gr een, since the
863 // The result here should not be green, since the filter draws nothing. 863 // filter draws nothing.
864 REPORTER_ASSERT(reporter, pixel != SK_ColorGREEN); 864 REPORTER_ASSERT(reporter, SkPicture::PictureIOSecurityPrecautionsEnabled()
865 #else 865 ? pixel != SK_ColorGREEN : pixel == SK_ColorGREEN);
866 REPORTER_ASSERT(reporter, pixel == SK_ColorGREEN);
867 #endif
868 } 866 }
869 867
870 DEF_TEST(ImageFilterClippedPictureImageFilter, reporter) { 868 DEF_TEST(ImageFilterClippedPictureImageFilter, reporter) {
871 SkRTreeFactory factory; 869 SkRTreeFactory factory;
872 SkPictureRecorder recorder; 870 SkPictureRecorder recorder;
873 SkCanvas* recordingCanvas = recorder.beginRecording(1, 1, &factory, 0); 871 SkCanvas* recordingCanvas = recorder.beginRecording(1, 1, &factory, 0);
874 872
875 // Create an SkPicture which simply draws a green 1x1 rectangle. 873 // Create an SkPicture which simply draws a green 1x1 rectangle.
876 SkPaint greenPaint; 874 SkPaint greenPaint;
877 greenPaint.setColor(SK_ColorGREEN); 875 greenPaint.setColor(SK_ColorGREEN);
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 return; 1189 return;
1192 } 1190 }
1193 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context, 1191 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context,
1194 SkSurface::kNo_Budgeted , 1192 SkSurface::kNo_Budgeted ,
1195 SkImageInfo::MakeN32Pre mul(1, 1), 1193 SkImageInfo::MakeN32Pre mul(1, 1),
1196 0, 1194 0,
1197 &gProps)); 1195 &gProps));
1198 test_negative_blur_sigma(device, reporter); 1196 test_negative_blur_sigma(device, reporter);
1199 } 1197 }
1200 #endif 1198 #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