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

Side by Side Diff: tests/ImageFilterTest.cpp

Issue 1676103002: msan: initialize buffer BlurLargeImage blurs (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: missed Created 4 years, 10 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 | « no previous file | tools/dm_flags.json » ('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 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 REPORTER_ASSERT(reporter, !cf->asColorMatrix(nullptr)); 178 REPORTER_ASSERT(reporter, !cf->asColorMatrix(nullptr));
179 cf->unref(); 179 cf->unref();
180 } 180 }
181 181
182 { 182 {
183 // Check that a color filter image filter without a crop rect can be 183 // Check that a color filter image filter without a crop rect can be
184 // expressed as a color filter. 184 // expressed as a color filter.
185 SkAutoTUnref<SkImageFilter> gray(make_grayscale(nullptr, nullptr)); 185 SkAutoTUnref<SkImageFilter> gray(make_grayscale(nullptr, nullptr));
186 REPORTER_ASSERT(reporter, true == gray->asColorFilter(nullptr)); 186 REPORTER_ASSERT(reporter, true == gray->asColorFilter(nullptr));
187 } 187 }
188 188
189 { 189 {
190 // Check that a colorfilterimage filter without a crop rect but with an input 190 // Check that a colorfilterimage filter without a crop rect but with an input
191 // that is another colorfilterimage can be expressed as a colorfilter (c omposed). 191 // that is another colorfilterimage can be expressed as a colorfilter (c omposed).
192 SkAutoTUnref<SkImageFilter> mode(make_blue(nullptr, nullptr)); 192 SkAutoTUnref<SkImageFilter> mode(make_blue(nullptr, nullptr));
193 SkAutoTUnref<SkImageFilter> gray(make_grayscale(mode, nullptr)); 193 SkAutoTUnref<SkImageFilter> gray(make_grayscale(mode, nullptr));
194 REPORTER_ASSERT(reporter, true == gray->asColorFilter(nullptr)); 194 REPORTER_ASSERT(reporter, true == gray->asColorFilter(nullptr));
195 } 195 }
196 196
197 { 197 {
198 // Test that if we exceed the limit of what ComposeColorFilter can combi ne, we still 198 // Test that if we exceed the limit of what ComposeColorFilter can combi ne, we still
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 SkPictureRecorder crossProcessRecorder; 880 SkPictureRecorder crossProcessRecorder;
881 SkCanvas* crossProcessCanvas = crossProcessRecorder.beginRecording(1, 1, &fa ctory, 0); 881 SkCanvas* crossProcessCanvas = crossProcessRecorder.beginRecording(1, 1, &fa ctory, 0);
882 crossProcessCanvas->drawRect(SkRect::Make(SkIRect::MakeWH(1, 1)), redPaintWi thFilter); 882 crossProcessCanvas->drawRect(SkRect::Make(SkIRect::MakeWH(1, 1)), redPaintWi thFilter);
883 SkAutoTUnref<SkPicture> crossProcessPicture(crossProcessRecorder.endRecordin g()); 883 SkAutoTUnref<SkPicture> crossProcessPicture(crossProcessRecorder.endRecordin g());
884 884
885 canvas.clear(0x0); 885 canvas.clear(0x0);
886 canvas.drawPicture(crossProcessPicture); 886 canvas.drawPicture(crossProcessPicture);
887 pixel = *bitmap.getAddr32(0, 0); 887 pixel = *bitmap.getAddr32(0, 0);
888 // If the security precautions are enabled, the result here should not be gr een, since the 888 // If the security precautions are enabled, the result here should not be gr een, since the
889 // filter draws nothing. 889 // filter draws nothing.
890 REPORTER_ASSERT(reporter, SkPicture::PictureIOSecurityPrecautionsEnabled() 890 REPORTER_ASSERT(reporter, SkPicture::PictureIOSecurityPrecautionsEnabled()
891 ? pixel != SK_ColorGREEN : pixel == SK_ColorGREEN); 891 ? pixel != SK_ColorGREEN : pixel == SK_ColorGREEN);
892 } 892 }
893 893
894 DEF_TEST(ImageFilterClippedPictureImageFilter, reporter) { 894 DEF_TEST(ImageFilterClippedPictureImageFilter, reporter) {
895 SkRTreeFactory factory; 895 SkRTreeFactory factory;
896 SkPictureRecorder recorder; 896 SkPictureRecorder recorder;
897 SkCanvas* recordingCanvas = recorder.beginRecording(1, 1, &factory, 0); 897 SkCanvas* recordingCanvas = recorder.beginRecording(1, 1, &factory, 0);
898 898
899 // Create an SkPicture which simply draws a green 1x1 rectangle. 899 // Create an SkPicture which simply draws a green 1x1 rectangle.
900 SkPaint greenPaint; 900 SkPaint greenPaint;
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after
1267 int largeW = 5000; 1267 int largeW = 5000;
1268 int largeH = 5000; 1268 int largeH = 5000;
1269 #if SK_SUPPORT_GPU 1269 #if SK_SUPPORT_GPU
1270 // If we're GPU-backed make the bitmap too large to be converted into a text ure. 1270 // If we're GPU-backed make the bitmap too large to be converted into a text ure.
1271 if (GrContext* ctx = canvas->getGrContext()) { 1271 if (GrContext* ctx = canvas->getGrContext()) {
1272 largeW = ctx->caps()->maxTextureSize() + 1; 1272 largeW = ctx->caps()->maxTextureSize() + 1;
1273 } 1273 }
1274 #endif 1274 #endif
1275 1275
1276 largeBmp.allocN32Pixels(largeW, largeH); 1276 largeBmp.allocN32Pixels(largeW, largeH);
1277 largeBmp.eraseColor(0);
1277 if (!largeBmp.getPixels()) { 1278 if (!largeBmp.getPixels()) {
1278 ERRORF(reporter, "Failed to allocate large bmp."); 1279 ERRORF(reporter, "Failed to allocate large bmp.");
1279 return; 1280 return;
1280 } 1281 }
1281 1282
1282 SkAutoTUnref<SkImage> largeImage(SkImage::NewFromBitmap(largeBmp)); 1283 SkAutoTUnref<SkImage> largeImage(SkImage::NewFromBitmap(largeBmp));
1283 if (!largeImage) { 1284 if (!largeImage) {
1284 ERRORF(reporter, "Failed to create large image."); 1285 ERRORF(reporter, "Failed to create large image.");
1285 return; 1286 return;
1286 } 1287 }
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
1367 test_negative_blur_sigma(&proxy, reporter); 1368 test_negative_blur_sigma(&proxy, reporter);
1368 } 1369 }
1369 1370
1370 DEF_GPUTEST_FOR_ALL_CONTEXTS(BlurLargeImage_Gpu, reporter, context) { 1371 DEF_GPUTEST_FOR_ALL_CONTEXTS(BlurLargeImage_Gpu, reporter, context) {
1371 SkAutoTUnref<SkSurface> surface( 1372 SkAutoTUnref<SkSurface> surface(
1372 SkSurface::NewRenderTarget(context, SkSurface::kYes_Budgeted, 1373 SkSurface::NewRenderTarget(context, SkSurface::kYes_Budgeted,
1373 SkImageInfo::MakeN32Premul(100, 100))); 1374 SkImageInfo::MakeN32Premul(100, 100)));
1374 test_large_blur_input(reporter, surface->getCanvas()); 1375 test_large_blur_input(reporter, surface->getCanvas());
1375 } 1376 }
1376 #endif 1377 #endif
OLDNEW
« no previous file with comments | « no previous file | tools/dm_flags.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698