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: gm/imagefiltersclipped.cpp

Issue 1829303002: move setshader to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: addressing comments from #8 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 | « gm/image.cpp ('k') | gm/imagefiltersscaled.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 2014 Google Inc. 2 * Copyright 2014 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 "sk_tool_utils.h" 8 #include "sk_tool_utils.h"
9 #include "SkBlurImageFilter.h" 9 #include "SkBlurImageFilter.h"
10 #include "SkColor.h" 10 #include "SkColor.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 fCheckerboard = SkImage::MakeFromBitmap 83 fCheckerboard = SkImage::MakeFromBitmap
84 (sk_tool_utils::create_checkerboard_bitmap(64, 64, 0xFFA0A0A0, 0xFF4 04040, 8)); 84 (sk_tool_utils::create_checkerboard_bitmap(64, 64, 0xFFA0A0A0, 0xFF4 04040, 8));
85 this->makeGradientCircle(64, 64); 85 this->makeGradientCircle(64, 64);
86 } 86 }
87 87
88 void onDraw(SkCanvas* canvas) override { 88 void onDraw(SkCanvas* canvas) override {
89 canvas->clear(SK_ColorBLACK); 89 canvas->clear(SK_ColorBLACK);
90 90
91 SkAutoTUnref<SkImageFilter> gradient(SkImageSource::Create(fGradientCirc le.get())); 91 SkAutoTUnref<SkImageFilter> gradient(SkImageSource::Create(fGradientCirc le.get()));
92 SkAutoTUnref<SkImageFilter> checkerboard(SkImageSource::Create(fCheckerb oard.get())); 92 SkAutoTUnref<SkImageFilter> checkerboard(SkImageSource::Create(fCheckerb oard.get()));
93 SkAutoTUnref<SkShader> noise(SkPerlinNoiseShader::CreateFractalNoise( 93 sk_sp<SkShader> noise(SkPerlinNoiseShader::MakeFractalNoise(
94 SkDoubleToScalar(0.1), SkDoubleToScalar(0.05), 1, 0)); 94 SkDoubleToScalar(0.1), SkDoubleToScalar(0.05), 1, 0));
95 SkMatrix resizeMatrix; 95 SkMatrix resizeMatrix;
96 resizeMatrix.setScale(RESIZE_FACTOR_X, RESIZE_FACTOR_Y); 96 resizeMatrix.setScale(RESIZE_FACTOR_X, RESIZE_FACTOR_Y);
97 SkPoint3 pointLocation = SkPoint3::Make(32, 32, SkIntToScalar(10)); 97 SkPoint3 pointLocation = SkPoint3::Make(32, 32, SkIntToScalar(10));
98 98
99 SkImageFilter* filters[] = { 99 SkImageFilter* filters[] = {
100 SkBlurImageFilter::Create(SkIntToScalar(12), SkIntToScalar(12)), 100 SkBlurImageFilter::Create(SkIntToScalar(12), SkIntToScalar(12)),
101 SkDropShadowImageFilter::Create(SkIntToScalar(10), SkIntToScalar(10) , 101 SkDropShadowImageFilter::Create(SkIntToScalar(10), SkIntToScalar(10) ,
102 SkIntToScalar(3), SkIntToScalar(3), SK_ColorGREEN, 102 SkIntToScalar(3), SkIntToScalar(3), SK_ColorGREEN,
103 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode), 103 SkDropShadowImageFilter::kDrawShadowAndForeground_ShadowMode),
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 private: 150 private:
151 sk_sp<SkImage> fCheckerboard, fGradientCircle; 151 sk_sp<SkImage> fCheckerboard, fGradientCircle;
152 152
153 typedef GM INHERITED; 153 typedef GM INHERITED;
154 }; 154 };
155 155
156 ////////////////////////////////////////////////////////////////////////////// 156 //////////////////////////////////////////////////////////////////////////////
157 157
158 DEF_GM(return new ImageFiltersClippedGM;) 158 DEF_GM(return new ImageFiltersClippedGM;)
159 } 159 }
OLDNEW
« no previous file with comments | « gm/image.cpp ('k') | gm/imagefiltersscaled.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698