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

Side by Side Diff: tests/ImageFilterTest.cpp

Issue 1847583002: Update SkMergeImageFilter to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: update to To Created 4 years, 8 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/SkXfermodeImageFilter.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 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode, input, cropRect)); 162 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode, input, cropRect));
163 this->addFilter("diffuse lighting", SkLightingImageFilter::CreatePointLi tDiffuse( 163 this->addFilter("diffuse lighting", SkLightingImageFilter::CreatePointLi tDiffuse(
164 location, SK_ColorGREEN, 0, 0, input, cropRect)); 164 location, SK_ColorGREEN, 0, 0, input, cropRect));
165 this->addFilter("specular lighting", 165 this->addFilter("specular lighting",
166 SkLightingImageFilter::CreatePointLitSpecular(location, SK_Col orGREEN, 0, 0, 0, 166 SkLightingImageFilter::CreatePointLitSpecular(location, SK_Col orGREEN, 0, 0, 0,
167 input, cropRect) ); 167 input, cropRect) );
168 this->addFilter("matrix convolution", 168 this->addFilter("matrix convolution",
169 SkMatrixConvolutionImageFilter::Create( 169 SkMatrixConvolutionImageFilter::Create(
170 kernelSize, kernel, gain, bias, SkIPoint::Make(1, 1), 170 kernelSize, kernel, gain, bias, SkIPoint::Make(1, 1),
171 SkMatrixConvolutionImageFilter::kRepeat_TileMode, false, i nput, cropRect)); 171 SkMatrixConvolutionImageFilter::kRepeat_TileMode, false, i nput, cropRect));
172 this->addFilter("merge", SkMergeImageFilter::Create(input, input, SkXfer mode::kSrcOver_Mode, 172 this->addFilter("merge", SkMergeImageFilter::Make(sk_ref_sp<SkImageFilte r>(input),
173 cropRect)); 173 sk_ref_sp<SkImageFilte r>(input),
174 this->addFilter("merge with disjoint inputs", SkMergeImageFilter::Create ( 174 SkXfermode::kSrcOver_M ode,
175 paintFilterLeft.get(), paintFilterRight.get(), 175 cropRect).release());
176 SkXfermode::kSrcOver_Mode, cropRect)); 176 this->addFilter("merge with disjoint inputs", SkMergeImageFilter::Make(
177 std::move(paintFilterLeft), std::move(paintFilterRight),
178 SkXfermode::kSrcOver_Mode, cropRect).release());
177 this->addFilter("offset", 179 this->addFilter("offset",
178 SkOffsetImageFilter::Create(SK_Scalar1, SK_Scalar1, inpu t, cropRect)); 180 SkOffsetImageFilter::Create(SK_Scalar1, SK_Scalar1, inpu t, cropRect));
179 this->addFilter("dilate", SkDilateImageFilter::Create(3, 2, input, cropR ect)); 181 this->addFilter("dilate", SkDilateImageFilter::Create(3, 2, input, cropR ect));
180 this->addFilter("erode", SkErodeImageFilter::Create(2, 3, input, cropRec t)); 182 this->addFilter("erode", SkErodeImageFilter::Create(2, 3, input, cropRec t));
181 this->addFilter("tile", SkTileImageFilter::Create( 183 this->addFilter("tile", SkTileImageFilter::Create(
182 SkRect::MakeXYWH(0, 0, 50, 50), 184 SkRect::MakeXYWH(0, 0, 50, 50),
183 cropRect ? cropRect->rect() : SkRect::MakeXYWH(0, 0, 100, 100), 185 cropRect ? cropRect->rect() : SkRect::MakeXYWH(0, 0, 100, 100),
184 input)); 186 input));
185 if (!cropRect) { 187 if (!cropRect) {
186 this->addFilter("matrix", SkImageFilter::CreateMatrixFilter( 188 this->addFilter("matrix", SkImageFilter::CreateMatrixFilter(
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 } 819 }
818 } 820 }
819 821
820 static void test_imagefilter_merge_result_size(SkImageFilter::Proxy* proxy, 822 static void test_imagefilter_merge_result_size(SkImageFilter::Proxy* proxy,
821 skiatest::Reporter* reporter, 823 skiatest::Reporter* reporter,
822 GrContext* context) { 824 GrContext* context) {
823 SkBitmap greenBM; 825 SkBitmap greenBM;
824 greenBM.allocN32Pixels(20, 20); 826 greenBM.allocN32Pixels(20, 20);
825 greenBM.eraseColor(SK_ColorGREEN); 827 greenBM.eraseColor(SK_ColorGREEN);
826 sk_sp<SkImage> greenImage(SkImage::MakeFromBitmap(greenBM)); 828 sk_sp<SkImage> greenImage(SkImage::MakeFromBitmap(greenBM));
827 SkAutoTUnref<SkImageFilter> source(SkImageSource::Create(greenImage.get())); 829 sk_sp<SkImageFilter> source(SkImageSource::Create(greenImage.get()));
828 SkAutoTUnref<SkImageFilter> merge(SkMergeImageFilter::Create(source.get(), s ource.get())); 830 sk_sp<SkImageFilter> merge(SkMergeImageFilter::Make(source, source));
829 831
830 sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, proxy, 1)); 832 sk_sp<SkSpecialImage> srcImg(create_empty_special_image(context, proxy, 1));
831 833
832 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeXYWH(0, 0, 100, 100), nullptr); 834 SkImageFilter::Context ctx(SkMatrix::I(), SkIRect::MakeXYWH(0, 0, 100, 100), nullptr);
833 SkIPoint offset; 835 SkIPoint offset;
834 836
835 sk_sp<SkSpecialImage> resultImg(merge->filterImage(srcImg.get(), ctx, &offse t)); 837 sk_sp<SkSpecialImage> resultImg(merge->filterImage(srcImg.get(), ctx, &offse t));
836 REPORTER_ASSERT(reporter, resultImg); 838 REPORTER_ASSERT(reporter, resultImg);
837 839
838 REPORTER_ASSERT(reporter, resultImg->width() == 20 && resultImg->height() == 20); 840 REPORTER_ASSERT(reporter, resultImg->width() == 20 && resultImg->height() == 20);
(...skipping 748 matching lines...) Expand 10 before | Expand all | Expand 10 after
1587 1589
1588 test_xfermode_cropped_input(&canvas, reporter); 1590 test_xfermode_cropped_input(&canvas, reporter);
1589 } 1591 }
1590 1592
1591 DEF_GPUTEST_FOR_ALL_CONTEXTS(BlurLargeImage_Gpu, reporter, context) { 1593 DEF_GPUTEST_FOR_ALL_CONTEXTS(BlurLargeImage_Gpu, reporter, context) {
1592 auto surface(SkSurface::MakeRenderTarget(context, SkBudgeted::kYes, 1594 auto surface(SkSurface::MakeRenderTarget(context, SkBudgeted::kYes,
1593 SkImageInfo::MakeN32Premul(100, 100 ))); 1595 SkImageInfo::MakeN32Premul(100, 100 )));
1594 test_large_blur_input(reporter, surface->getCanvas()); 1596 test_large_blur_input(reporter, surface->getCanvas());
1595 } 1597 }
1596 #endif 1598 #endif
OLDNEW
« no previous file with comments | « src/effects/SkXfermodeImageFilter.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698