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

Side by Side Diff: tests/ImageFilterTest.cpp

Issue 1837293003: Revert of Switch SkLocalMatrixImageFilter and SkPaintImageFilter over to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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/SkPictureImageFilter.cpp ('k') | tests/PaintImageFilterTest.cpp » ('j') | 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 131
132 SkPaint greenPaint; 132 SkPaint greenPaint;
133 greenPaint.setColor(SK_ColorGREEN); 133 greenPaint.setColor(SK_ColorGREEN);
134 recordingCanvas->drawRect(SkRect::Make(SkIRect::MakeXYWH(10, 10, 30, 20) ), greenPaint); 134 recordingCanvas->drawRect(SkRect::Make(SkIRect::MakeXYWH(10, 10, 30, 20) ), greenPaint);
135 sk_sp<SkPicture> picture(recorder.finishRecordingAsPicture()); 135 sk_sp<SkPicture> picture(recorder.finishRecordingAsPicture());
136 sk_sp<SkImageFilter> pictureFilter(SkPictureImageFilter::Make(picture)); 136 sk_sp<SkImageFilter> pictureFilter(SkPictureImageFilter::Make(picture));
137 sk_sp<SkShader> shader(SkPerlinNoiseShader::MakeTurbulence(SK_Scalar1, S K_Scalar1, 1, 0)); 137 sk_sp<SkShader> shader(SkPerlinNoiseShader::MakeTurbulence(SK_Scalar1, S K_Scalar1, 1, 0));
138 138
139 SkPaint paint; 139 SkPaint paint;
140 paint.setShader(shader); 140 paint.setShader(shader);
141 sk_sp<SkImageFilter> paintFilter(SkPaintImageFilter::Make(paint)); 141 SkAutoTUnref<SkImageFilter> paintFilter(SkPaintImageFilter::Create(paint ));
142 142
143 sk_sp<SkShader> greenColorShader(SkShader::MakeColorShader(SK_ColorGREEN )); 143 sk_sp<SkShader> greenColorShader(SkShader::MakeColorShader(SK_ColorGREEN ));
144 SkPaint greenColorShaderPaint; 144 SkPaint greenColorShaderPaint;
145 greenColorShaderPaint.setShader(greenColorShader); 145 greenColorShaderPaint.setShader(greenColorShader);
146 SkImageFilter::CropRect leftSideCropRect(SkRect::MakeXYWH(0, 0, 32, 64)) ; 146 SkImageFilter::CropRect leftSideCropRect(SkRect::MakeXYWH(0, 0, 32, 64)) ;
147 sk_sp<SkImageFilter> paintFilterLeft(SkPaintImageFilter::Make(greenColor ShaderPaint, 147 SkAutoTUnref<SkImageFilter> paintFilterLeft(SkPaintImageFilter::Create(
148 &leftSideC ropRect)); 148 greenColorShaderPaint, &leftSideCropRect));
149 SkImageFilter::CropRect rightSideCropRect(SkRect::MakeXYWH(32, 0, 32, 64 )); 149 SkImageFilter::CropRect rightSideCropRect(SkRect::MakeXYWH(32, 0, 32, 64 ));
150 sk_sp<SkImageFilter> paintFilterRight(SkPaintImageFilter::Make(greenColo rShaderPaint, 150 SkAutoTUnref<SkImageFilter> paintFilterRight(SkPaintImageFilter::Create(
151 &rightSid eCropRect)); 151 greenColorShaderPaint, &rightSideCropRect));
152 152
153 this->addFilter("color filter", 153 this->addFilter("color filter",
154 SkColorFilterImageFilter::Create(cf.get(), input, cropRect)); 154 SkColorFilterImageFilter::Create(cf.get(), input, cropRect));
155 this->addFilter("displacement map", SkDisplacementMapEffect::Create( 155 this->addFilter("displacement map", SkDisplacementMapEffect::Create(
156 SkDisplacementMapEffect::kR_ChannelSelectorType, 156 SkDisplacementMapEffect::kR_ChannelSelectorType,
157 SkDisplacementMapEffect::kB_ChannelSelectorType, 157 SkDisplacementMapEffect::kB_ChannelSelectorType,
158 20.0f, gradientSource.get(), input, cropRect)); 158 20.0f, gradientSource.get(), input, cropRect));
159 this->addFilter("blur", SkBlurImageFilter::Create(SK_Scalar1, SK_Scalar1 , input, cropRect)); 159 this->addFilter("blur", SkBlurImageFilter::Create(SK_Scalar1, SK_Scalar1 , input, cropRect));
160 this->addFilter("drop shadow", SkDropShadowImageFilter::Create( 160 this->addFilter("drop shadow", SkDropShadowImageFilter::Create(
161 SK_Scalar1, SK_Scalar1, SK_Scalar1, SK_Scalar1, SK_ColorGREEN, 161 SK_Scalar1, SK_Scalar1, SK_Scalar1, SK_Scalar1, SK_ColorGREEN,
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::Create(input, input, SkXfer mode::kSrcOver_Mode,
173 cropRect)); 173 cropRect));
174 this->addFilter("merge with disjoint inputs", SkMergeImageFilter::Create ( 174 this->addFilter("merge with disjoint inputs", SkMergeImageFilter::Create (
175 paintFilterLeft.get(), paintFilterRight.get(), 175 paintFilterLeft, paintFilterRight, SkXfermode::kSrcOver_Mode, cropRect));
176 SkXfermode::kSrcOver_Mode, cropRect));
177 this->addFilter("offset", 176 this->addFilter("offset",
178 SkOffsetImageFilter::Create(SK_Scalar1, SK_Scalar1, inpu t, cropRect)); 177 SkOffsetImageFilter::Create(SK_Scalar1, SK_Scalar1, inpu t, cropRect));
179 this->addFilter("dilate", SkDilateImageFilter::Create(3, 2, input, cropR ect)); 178 this->addFilter("dilate", SkDilateImageFilter::Create(3, 2, input, cropR ect));
180 this->addFilter("erode", SkErodeImageFilter::Create(2, 3, input, cropRec t)); 179 this->addFilter("erode", SkErodeImageFilter::Create(2, 3, input, cropRec t));
181 this->addFilter("tile", SkTileImageFilter::Create( 180 this->addFilter("tile", SkTileImageFilter::Create(
182 SkRect::MakeXYWH(0, 0, 50, 50), 181 SkRect::MakeXYWH(0, 0, 50, 50),
183 cropRect ? cropRect->rect() : SkRect::MakeXYWH(0, 0, 100, 100), 182 cropRect ? cropRect->rect() : SkRect::MakeXYWH(0, 0, 100, 100),
184 input)); 183 input));
185 if (!cropRect) { 184 if (!cropRect) {
186 this->addFilter("matrix", SkImageFilter::CreateMatrixFilter( 185 this->addFilter("matrix", SkImageFilter::CreateMatrixFilter(
(...skipping 1399 matching lines...) Expand 10 before | Expand all | Expand 10 after
1586 1585
1587 test_xfermode_cropped_input(&canvas, reporter); 1586 test_xfermode_cropped_input(&canvas, reporter);
1588 } 1587 }
1589 1588
1590 DEF_GPUTEST_FOR_ALL_CONTEXTS(BlurLargeImage_Gpu, reporter, context) { 1589 DEF_GPUTEST_FOR_ALL_CONTEXTS(BlurLargeImage_Gpu, reporter, context) {
1591 auto surface(SkSurface::MakeRenderTarget(context, SkBudgeted::kYes, 1590 auto surface(SkSurface::MakeRenderTarget(context, SkBudgeted::kYes,
1592 SkImageInfo::MakeN32Premul(100, 100 ))); 1591 SkImageInfo::MakeN32Premul(100, 100 )));
1593 test_large_blur_input(reporter, surface->getCanvas()); 1592 test_large_blur_input(reporter, surface->getCanvas());
1594 } 1593 }
1595 #endif 1594 #endif
OLDNEW
« no previous file with comments | « src/effects/SkPictureImageFilter.cpp ('k') | tests/PaintImageFilterTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698