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

Side by Side Diff: tests/ImageFilterTest.cpp

Issue 1308703007: Fix filter primitive bounds computations. (Closed) Base URL: https://skia.googlesource.com/skia.git@saveLayer-bounds-not-transformed
Patch Set: Fix comment style; remove useless param names Created 5 years 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
« src/core/SkRecordDraw.cpp ('K') | « src/gpu/SkGpuDevice.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 "SkBlurImageFilter.h" 10 #include "SkBlurImageFilter.h"
(...skipping 1134 matching lines...) Expand 10 before | Expand all | Expand 10 after
1145 DEF_TEST(ComposedImageFilterOffset, reporter) { 1145 DEF_TEST(ComposedImageFilterOffset, reporter) {
1146 SkBitmap bitmap; 1146 SkBitmap bitmap;
1147 bitmap.allocN32Pixels(100, 100); 1147 bitmap.allocN32Pixels(100, 100);
1148 bitmap.eraseARGB(0, 0, 0, 0); 1148 bitmap.eraseARGB(0, 0, 0, 0);
1149 const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType); 1149 const SkSurfaceProps props(SkSurfaceProps::kLegacyFontHost_InitType);
1150 SkBitmapDevice device(bitmap, props); 1150 SkBitmapDevice device(bitmap, props);
1151 SkImageFilter::DeviceProxy proxy(&device); 1151 SkImageFilter::DeviceProxy proxy(&device);
1152 1152
1153 SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(1, 0, 20, 20)); 1153 SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(1, 0, 20, 20));
1154 SkAutoTUnref<SkImageFilter> offsetFilter(SkOffsetImageFilter::Create(0, 0, n ullptr, &cropRect)); 1154 SkAutoTUnref<SkImageFilter> offsetFilter(SkOffsetImageFilter::Create(0, 0, n ullptr, &cropRect));
1155 SkAutoTUnref<SkImageFilter> blurFilter(makeBlur()); 1155 SkAutoTUnref<SkImageFilter> blurFilter(SkBlurImageFilter::Create(SK_Scalar1, SK_Scalar1,
1156 SkAutoTUnref<SkImageFilter> composedFilter(SkComposeImageFilter::Create(blur Filter, offsetFilter.get())); 1156 nullptr, &c ropRect));
1157 SkAutoTUnref<SkImageFilter> composedFilter(SkComposeImageFilter::Create(blur Filter,
1158 offs etFilter.get()));
1157 SkBitmap result; 1159 SkBitmap result;
1158 SkIPoint offset; 1160 SkIPoint offset;
1159 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeWH(100, 100), nullptr , SkImageFilter::kApprox_SizeConstraint); 1161 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeWH(100, 100), nullptr , SkImageFilter::kApprox_SizeConstraint);
1160 REPORTER_ASSERT(reporter, composedFilter->filterImage(&proxy, bitmap, ctx, & result, &offset)); 1162 REPORTER_ASSERT(reporter, composedFilter->filterImage(&proxy, bitmap, ctx, & result, &offset));
1161 REPORTER_ASSERT(reporter, offset.fX == 1 && offset.fY == 0); 1163 REPORTER_ASSERT(reporter, offset.fX == 1 && offset.fY == 0);
1162 } 1164 }
1163 1165
1164 DEF_TEST(PartialCropRect, reporter) { 1166 DEF_TEST(PartialCropRect, reporter) {
1165 SkBitmap bitmap; 1167 SkBitmap bitmap;
1166 bitmap.allocN32Pixels(100, 100); 1168 bitmap.allocN32Pixels(100, 100);
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
1310 SkSurface::kNo_Budgeted , 1312 SkSurface::kNo_Budgeted ,
1311 SkImageInfo::MakeN32Pre mul(1, 1), 1313 SkImageInfo::MakeN32Pre mul(1, 1),
1312 0, 1314 0,
1313 &props, 1315 &props,
1314 SkGpuDevice::kUninit_In itContents)); 1316 SkGpuDevice::kUninit_In itContents));
1315 SkImageFilter::DeviceProxy proxy(device); 1317 SkImageFilter::DeviceProxy proxy(device);
1316 1318
1317 test_negative_blur_sigma(&proxy, reporter); 1319 test_negative_blur_sigma(&proxy, reporter);
1318 } 1320 }
1319 #endif 1321 #endif
OLDNEW
« src/core/SkRecordDraw.cpp ('K') | « src/gpu/SkGpuDevice.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698