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

Side by Side Diff: tests/ImageFilterTest.cpp

Issue 725243004: Disable LCD text explicitly in SkPictureImageFilter::onFilterImage() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: comment Created 6 years, 1 month 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/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 "SkBitmapSource.h" 10 #include "SkBitmapSource.h"
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 } 228 }
229 } 229 }
230 230
231 static void test_crop_rects(SkBaseDevice* device, skiatest::Reporter* reporter) { 231 static void test_crop_rects(SkBaseDevice* device, skiatest::Reporter* reporter) {
232 // Check that all filters offset to their absolute crop rect, 232 // Check that all filters offset to their absolute crop rect,
233 // unaffected by the input crop rect. 233 // unaffected by the input crop rect.
234 // Tests pass by not asserting. 234 // Tests pass by not asserting.
235 SkBitmap bitmap; 235 SkBitmap bitmap;
236 bitmap.allocN32Pixels(100, 100); 236 bitmap.allocN32Pixels(100, 100);
237 bitmap.eraseARGB(0, 0, 0, 0); 237 bitmap.eraseARGB(0, 0, 0, 0);
238 SkDeviceImageFilterProxy proxy(device); 238 SkDeviceImageFilterProxy proxy(device, SkSurfaceProps(SkSurfaceProps::kLegac yFontHost_InitType));
239 239
240 SkImageFilter::CropRect inputCropRect(SkRect::MakeXYWH(8, 13, 80, 80)); 240 SkImageFilter::CropRect inputCropRect(SkRect::MakeXYWH(8, 13, 80, 80));
241 SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(20, 30, 60, 60)); 241 SkImageFilter::CropRect cropRect(SkRect::MakeXYWH(20, 30, 60, 60));
242 SkAutoTUnref<SkImageFilter> input(make_grayscale(NULL, &inputCropRect)); 242 SkAutoTUnref<SkImageFilter> input(make_grayscale(NULL, &inputCropRect));
243 243
244 SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(SK_ColorRED, SkXfermode::kSrcIn_Mode)); 244 SkAutoTUnref<SkColorFilter> cf(SkColorFilter::CreateModeFilter(SK_ColorRED, SkXfermode::kSrcIn_Mode));
245 SkPoint3 location(0, 0, SK_Scalar1); 245 SkPoint3 location(0, 0, SK_Scalar1);
246 SkPoint3 target(SK_Scalar1, SK_Scalar1, SK_Scalar1); 246 SkPoint3 target(SK_Scalar1, SK_Scalar1, SK_Scalar1);
247 SkScalar kernel[9] = { 247 SkScalar kernel[9] = {
248 SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1), 248 SkIntToScalar( 1), SkIntToScalar( 1), SkIntToScalar( 1),
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 SkPaint paint; 308 SkPaint paint;
309 paint.setShader(shader); 309 paint.setShader(shader);
310 canvas.drawCircle(x, y, radius, paint); 310 canvas.drawCircle(x, y, radius, paint);
311 return bitmap; 311 return bitmap;
312 } 312 }
313 313
314 static void test_negative_blur_sigma(SkBaseDevice* device, skiatest::Reporter* r eporter) { 314 static void test_negative_blur_sigma(SkBaseDevice* device, skiatest::Reporter* r eporter) {
315 // Check that SkBlurImageFilter will accept a negative sigma, either in 315 // Check that SkBlurImageFilter will accept a negative sigma, either in
316 // the given arguments or after CTM application. 316 // the given arguments or after CTM application.
317 int width = 32, height = 32; 317 int width = 32, height = 32;
318 SkDeviceImageFilterProxy proxy(device); 318 SkDeviceImageFilterProxy proxy(device, SkSurfaceProps(SkSurfaceProps::kLegac yFontHost_InitType));
319 SkScalar five = SkIntToScalar(5); 319 SkScalar five = SkIntToScalar(5);
320 320
321 SkAutoTUnref<SkBlurImageFilter> positiveFilter( 321 SkAutoTUnref<SkBlurImageFilter> positiveFilter(
322 SkBlurImageFilter::Create(five, five) 322 SkBlurImageFilter::Create(five, five)
323 ); 323 );
324 324
325 SkAutoTUnref<SkBlurImageFilter> negativeFilter( 325 SkAutoTUnref<SkBlurImageFilter> negativeFilter(
326 SkBlurImageFilter::Create(-five, five) 326 SkBlurImageFilter::Create(-five, five)
327 ); 327 );
328 328
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 818
819 SkAutoTUnref<SkImageFilter> imageFilter( 819 SkAutoTUnref<SkImageFilter> imageFilter(
820 SkPictureImageFilter::Create(picture.get())); 820 SkPictureImageFilter::Create(picture.get()));
821 821
822 SkBitmap result; 822 SkBitmap result;
823 SkIPoint offset; 823 SkIPoint offset;
824 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeXYWH(1, 1, 1, 1), NUL L); 824 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeXYWH(1, 1, 1, 1), NUL L);
825 SkBitmap bitmap; 825 SkBitmap bitmap;
826 bitmap.allocN32Pixels(2, 2); 826 bitmap.allocN32Pixels(2, 2);
827 SkBitmapDevice device(bitmap); 827 SkBitmapDevice device(bitmap);
828 SkDeviceImageFilterProxy proxy(&device); 828 SkDeviceImageFilterProxy proxy(&device, SkSurfaceProps(SkSurfaceProps::kLega cyFontHost_InitType));
829 REPORTER_ASSERT(reporter, !imageFilter->filterImage(&proxy, bitmap, ctx, &re sult, &offset)); 829 REPORTER_ASSERT(reporter, !imageFilter->filterImage(&proxy, bitmap, ctx, &re sult, &offset));
830 } 830 }
831 831
832 DEF_TEST(ImageFilterEmptySaveLayer, reporter) { 832 DEF_TEST(ImageFilterEmptySaveLayer, reporter) {
833 // Even when there's an empty saveLayer()/restore(), ensure that an image 833 // Even when there's an empty saveLayer()/restore(), ensure that an image
834 // filter or color filter which affects transparent black still draws. 834 // filter or color filter which affects transparent black still draws.
835 835
836 SkBitmap bitmap; 836 SkBitmap bitmap;
837 bitmap.allocN32Pixels(10, 10); 837 bitmap.allocN32Pixels(10, 10);
838 SkBitmapDevice device(bitmap); 838 SkBitmapDevice device(bitmap);
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
1095 1095
1096 DEF_GPUTEST(TestNegativeBlurSigmaGPU, reporter, factory) { 1096 DEF_GPUTEST(TestNegativeBlurSigmaGPU, reporter, factory) {
1097 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextTyp e>(0)); 1097 GrContext* context = factory->get(static_cast<GrContextFactory::GLContextTyp e>(0));
1098 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context, 1098 SkAutoTUnref<SkGpuDevice> device(SkGpuDevice::Create(context,
1099 SkImageInfo::MakeN32Pre mul(1, 1), 1099 SkImageInfo::MakeN32Pre mul(1, 1),
1100 gProps, 1100 gProps,
1101 0)); 1101 0));
1102 test_negative_blur_sigma(device, reporter); 1102 test_negative_blur_sigma(device, reporter);
1103 } 1103 }
1104 #endif 1104 #endif
OLDNEW
« no previous file with comments | « src/gpu/SkGpuDevice.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698