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

Side by Side Diff: gm/imagefiltersscaled.cpp

Issue 1789633002: more shader-->sp conversions (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
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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 static SkImage* MakeGradientCircle(int width, int height) { 138 static SkImage* MakeGradientCircle(int width, int height) {
139 SkScalar x = SkIntToScalar(width / 2); 139 SkScalar x = SkIntToScalar(width / 2);
140 SkScalar y = SkIntToScalar(height / 2); 140 SkScalar y = SkIntToScalar(height / 2);
141 SkScalar radius = SkScalarMul(SkMinScalar(x, y), SkIntToScalar(4) / SkIn tToScalar(5)); 141 SkScalar radius = SkScalarMul(SkMinScalar(x, y), SkIntToScalar(4) / SkIn tToScalar(5));
142 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(width, hei ght)); 142 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(width, hei ght));
143 SkCanvas* canvas = surface->getCanvas(); 143 SkCanvas* canvas = surface->getCanvas();
144 canvas->clear(0x00000000); 144 canvas->clear(0x00000000);
145 SkColor colors[2]; 145 SkColor colors[2];
146 colors[0] = SK_ColorWHITE; 146 colors[0] = SK_ColorWHITE;
147 colors[1] = SK_ColorBLACK; 147 colors[1] = SK_ColorBLACK;
148 SkAutoTUnref<SkShader> shader(
149 SkGradientShader::CreateRadial(SkPoint::Make(x, y), radius, colors, nullptr, 2,
150 SkShader::kClamp_TileMode)
151 );
152 SkPaint paint; 148 SkPaint paint;
153 paint.setShader(shader); 149 paint.setShader(SkGradientShader::MakeRadial(SkPoint::Make(x, y), radius , colors, nullptr,
150 2, SkShader::kClamp_TileMod e));
154 canvas->drawCircle(x, y, radius, paint); 151 canvas->drawCircle(x, y, radius, paint);
155 152
156 return surface->newImageSnapshot(); 153 return surface->newImageSnapshot();
157 } 154 }
158 155
159 SkAutoTUnref<SkImage> fCheckerboard, fGradientCircle; 156 SkAutoTUnref<SkImage> fCheckerboard, fGradientCircle;
160 157
161 typedef GM INHERITED; 158 typedef GM INHERITED;
162 }; 159 };
163 160
164 ////////////////////////////////////////////////////////////////////////////// 161 //////////////////////////////////////////////////////////////////////////////
165 162
166 DEF_GM(return new ImageFiltersScaledGM;) 163 DEF_GM(return new ImageFiltersScaledGM;)
167 } 164 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698