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

Side by Side Diff: tests/ImageFilterTest.cpp

Issue 1395403002: change more effects to only expose factories (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 2 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/SkColorFilters.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 886 matching lines...) Expand 10 before | Expand all | Expand 10 after
897 897
898 SkBitmap bitmap; 898 SkBitmap bitmap;
899 bitmap.allocN32Pixels(10, 10); 899 bitmap.allocN32Pixels(10, 10);
900 SkCanvas canvas(bitmap); 900 SkCanvas canvas(bitmap);
901 901
902 SkRTreeFactory factory; 902 SkRTreeFactory factory;
903 SkPictureRecorder recorder; 903 SkPictureRecorder recorder;
904 904
905 SkAutoTUnref<SkColorFilter> green( 905 SkAutoTUnref<SkColorFilter> green(
906 SkColorFilter::CreateModeFilter(SK_ColorGREEN, SkXfermode::kSrc_Mode)); 906 SkColorFilter::CreateModeFilter(SK_ColorGREEN, SkXfermode::kSrc_Mode));
907 SkAutoTUnref<SkColorFilterImageFilter> imageFilter( 907 SkAutoTUnref<SkImageFilter> imageFilter(
908 SkColorFilterImageFilter::Create(green.get())); 908 SkColorFilterImageFilter::Create(green.get()));
909 SkPaint imageFilterPaint; 909 SkPaint imageFilterPaint;
910 imageFilterPaint.setImageFilter(imageFilter.get()); 910 imageFilterPaint.setImageFilter(imageFilter.get());
911 SkPaint colorFilterPaint; 911 SkPaint colorFilterPaint;
912 colorFilterPaint.setColorFilter(green.get()); 912 colorFilterPaint.setColorFilter(green.get());
913 913
914 SkRect bounds = SkRect::MakeWH(10, 10); 914 SkRect bounds = SkRect::MakeWH(10, 10);
915 915
916 SkCanvas* recordingCanvas = recorder.beginRecording(10, 10, &factory, 0); 916 SkCanvas* recordingCanvas = recorder.beginRecording(10, 10, &factory, 0);
917 recordingCanvas->saveLayer(&bounds, &imageFilterPaint); 917 recordingCanvas->saveLayer(&bounds, &imageFilterPaint);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1020 1020
1021 static void test_xfermode_cropped_input(SkCanvas* canvas, skiatest::Reporter* re porter) { 1021 static void test_xfermode_cropped_input(SkCanvas* canvas, skiatest::Reporter* re porter) {
1022 canvas->clear(0); 1022 canvas->clear(0);
1023 1023
1024 SkBitmap bitmap; 1024 SkBitmap bitmap;
1025 bitmap.allocN32Pixels(1, 1); 1025 bitmap.allocN32Pixels(1, 1);
1026 bitmap.eraseARGB(255, 255, 255, 255); 1026 bitmap.eraseARGB(255, 255, 255, 255);
1027 1027
1028 SkAutoTUnref<SkColorFilter> green( 1028 SkAutoTUnref<SkColorFilter> green(
1029 SkColorFilter::CreateModeFilter(SK_ColorGREEN, SkXfermode::kSrcIn_Mode)) ; 1029 SkColorFilter::CreateModeFilter(SK_ColorGREEN, SkXfermode::kSrcIn_Mode)) ;
1030 SkAutoTUnref<SkColorFilterImageFilter> greenFilter( 1030 SkAutoTUnref<SkImageFilter> greenFilter(SkColorFilterImageFilter::Create(gre en.get()));
1031 SkColorFilterImageFilter::Create(green.get()));
1032 SkImageFilter::CropRect cropRect(SkRect::MakeEmpty()); 1031 SkImageFilter::CropRect cropRect(SkRect::MakeEmpty());
1033 SkAutoTUnref<SkColorFilterImageFilter> croppedOut( 1032 SkAutoTUnref<SkImageFilter> croppedOut(
1034 SkColorFilterImageFilter::Create(green.get(), nullptr, &cropRect)); 1033 SkColorFilterImageFilter::Create(green.get(), nullptr, &cropRect));
1035 1034
1036 // Check that an xfermode image filter whose input has been cropped out stil l draws the other 1035 // Check that an xfermode image filter whose input has been cropped out stil l draws the other
1037 // input. Also check that drawing with both inputs cropped out doesn't cause a GPU warning. 1036 // input. Also check that drawing with both inputs cropped out doesn't cause a GPU warning.
1038 SkXfermode* mode = SkXfermode::Create(SkXfermode::kSrcOver_Mode); 1037 SkXfermode* mode = SkXfermode::Create(SkXfermode::kSrcOver_Mode);
1039 SkAutoTUnref<SkImageFilter> xfermodeNoFg( 1038 SkAutoTUnref<SkImageFilter> xfermodeNoFg(
1040 SkXfermodeImageFilter::Create(mode, greenFilter, croppedOut)); 1039 SkXfermodeImageFilter::Create(mode, greenFilter, croppedOut));
1041 SkAutoTUnref<SkImageFilter> xfermodeNoBg( 1040 SkAutoTUnref<SkImageFilter> xfermodeNoBg(
1042 SkXfermodeImageFilter::Create(mode, croppedOut, greenFilter)); 1041 SkXfermodeImageFilter::Create(mode, croppedOut, greenFilter));
1043 SkAutoTUnref<SkImageFilter> xfermodeNoFgNoBg( 1042 SkAutoTUnref<SkImageFilter> xfermodeNoFgNoBg(
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 SkSurface::kNo_Budgeted , 1303 SkSurface::kNo_Budgeted ,
1305 SkImageInfo::MakeN32Pre mul(1, 1), 1304 SkImageInfo::MakeN32Pre mul(1, 1),
1306 0, 1305 0,
1307 &props, 1306 &props,
1308 SkGpuDevice::kUninit_In itContents)); 1307 SkGpuDevice::kUninit_In itContents));
1309 SkImageFilter::Proxy proxy(device); 1308 SkImageFilter::Proxy proxy(device);
1310 1309
1311 test_negative_blur_sigma(&proxy, reporter); 1310 test_negative_blur_sigma(&proxy, reporter);
1312 } 1311 }
1313 #endif 1312 #endif
OLDNEW
« no previous file with comments | « src/effects/SkColorFilters.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698