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

Side by Side Diff: gm/imagefiltersclipped.cpp

Issue 1817383002: switch surface to sk_sp (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 9 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/imagefilters.cpp ('k') | gm/imagefilterscropexpand.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 29 matching lines...) Expand all
40 } 40 }
41 41
42 SkISize onISize() override { 42 SkISize onISize() override {
43 return SkISize::Make(860, 500); 43 return SkISize::Make(860, 500);
44 } 44 }
45 45
46 void makeGradientCircle(int width, int height) { 46 void makeGradientCircle(int width, int height) {
47 SkScalar x = SkIntToScalar(width / 2); 47 SkScalar x = SkIntToScalar(width / 2);
48 SkScalar y = SkIntToScalar(height / 2); 48 SkScalar y = SkIntToScalar(height / 2);
49 SkScalar radius = SkMinScalar(x, y) * 0.8f; 49 SkScalar radius = SkMinScalar(x, y) * 0.8f;
50 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(width, hei ght)); 50 auto surface(SkSurface::MakeRasterN32Premul(width, height));
51 SkCanvas* canvas = surface->getCanvas(); 51 SkCanvas* canvas = surface->getCanvas();
52 canvas->clear(0x00000000); 52 canvas->clear(0x00000000);
53 SkColor colors[2]; 53 SkColor colors[2];
54 colors[0] = SK_ColorWHITE; 54 colors[0] = SK_ColorWHITE;
55 colors[1] = SK_ColorBLACK; 55 colors[1] = SK_ColorBLACK;
56 SkPaint paint; 56 SkPaint paint;
57 paint.setShader(SkGradientShader::MakeRadial(SkPoint::Make(x, y), radius , colors, nullptr, 57 paint.setShader(SkGradientShader::MakeRadial(SkPoint::Make(x, y), radius , colors, nullptr,
58 2, SkShader::kClamp_TileMod e)); 58 2, SkShader::kClamp_TileMod e));
59 canvas->drawCircle(x, y, radius, paint); 59 canvas->drawCircle(x, y, radius, paint);
60 fGradientCircle = surface->makeImageSnapshot(); 60 fGradientCircle = surface->makeImageSnapshot();
(...skipping 89 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/imagefilters.cpp ('k') | gm/imagefilterscropexpand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698