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

Side by Side Diff: tests/ImageFilterTest.cpp

Issue 265693005: Add a fix for a spurious assert in SkMatrixConvolutionImageFilter. (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « src/effects/SkMatrixConvolutionImageFilter.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 "SkBicubicImageFilter.h" 8 #include "SkBicubicImageFilter.h"
9 #include "SkBitmap.h" 9 #include "SkBitmap.h"
10 #include "SkBitmapDevice.h" 10 #include "SkBitmapDevice.h"
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
365 break; 365 break;
366 } 366 }
367 } 367 }
368 } 368 }
369 369
370 for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) { 370 for (size_t i = 0; i < SK_ARRAY_COUNT(filters); ++i) {
371 SkSafeUnref(filters[i].fFilter); 371 SkSafeUnref(filters[i].fFilter);
372 } 372 }
373 } 373 }
374 374
375 DEF_TEST(ImageFilterMatrixConvolution, reporter) {
376 // Check that a 1x3 filter does not cause a spurious assert.
377 SkScalar kernel[3] = {
378 SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1),
379 };
380 SkISize kernelSize = SkISize::Make(1, 3);
381 SkScalar gain = SK_Scalar1, bias = 0;
382 SkIPoint kernelOffset = SkIPoint::Make(0, 0);
383
384 SkAutoTUnref<SkImageFilter> filter(
385 SkMatrixConvolutionImageFilter::Create(
386 kernelSize, kernel, gain, bias, kernelOffset,
387 SkMatrixConvolutionImageFilter::kRepeat_TileMode, false));
388
389 SkBitmap result;
390 int width = 16, height = 16;
391 result.allocN32Pixels(width, height);
392 SkCanvas canvas(result);
393 canvas.clear(0);
394
395 SkPaint paint;
396 paint.setImageFilter(filter);
397 SkRect rect = SkRect::MakeWH(width, height);
398 canvas.drawRect(rect, paint);
399 }
400
375 DEF_TEST(ImageFilterCropRect, reporter) { 401 DEF_TEST(ImageFilterCropRect, reporter) {
376 SkBitmap temp; 402 SkBitmap temp;
377 temp.allocN32Pixels(100, 100); 403 temp.allocN32Pixels(100, 100);
378 SkBitmapDevice device(temp); 404 SkBitmapDevice device(temp);
379 test_crop_rects(&device, reporter); 405 test_crop_rects(&device, reporter);
380 } 406 }
381 407
382 DEF_TEST(ImageFilterMatrixTest, reporter) { 408 DEF_TEST(ImageFilterMatrixTest, reporter) {
383 SkBitmap temp; 409 SkBitmap temp;
384 temp.allocN32Pixels(100, 100); 410 temp.allocN32Pixels(100, 100);
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
553 } 579 }
554 580
555 DEF_GPUTEST(XfermodeImageFilterCroppedInputGPU, reporter, factory) { 581 DEF_GPUTEST(XfermodeImageFilterCroppedInputGPU, reporter, factory) {
556 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextTyp e>(0)); 582 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextTyp e>(0));
557 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context, 583 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context,
558 SkImageInfo::MakeN32Pre mul(1, 1), 584 SkImageInfo::MakeN32Pre mul(1, 1),
559 0)); 585 0));
560 test_xfermode_cropped_input(device, reporter); 586 test_xfermode_cropped_input(device, reporter);
561 } 587 }
562 #endif 588 #endif
OLDNEW
« no previous file with comments | « src/effects/SkMatrixConvolutionImageFilter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698