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

Side by Side Diff: gm/imagefiltersclipped.cpp

Issue 1790353002: Revert of 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
« no previous file with comments | « gm/hairmodes.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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(width, hei ght));
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 SkAutoTUnref<SkShader> shader(
57 SkGradientShader::CreateRadial(SkPoint::Make(x, y), radius, colors, nullptr, 2,
58 SkShader::kClamp_TileMode)
59 );
56 SkPaint paint; 60 SkPaint paint;
57 paint.setShader(SkGradientShader::MakeRadial(SkPoint::Make(x, y), radius , colors, nullptr, 61 paint.setShader(shader);
58 2, SkShader::kClamp_TileMod e));
59 canvas->drawCircle(x, y, radius, paint); 62 canvas->drawCircle(x, y, radius, paint);
60 fGradientCircle.reset(surface->newImageSnapshot()); 63 fGradientCircle.reset(surface->newImageSnapshot());
61 } 64 }
62 65
63 static void draw_clipped_filter(SkCanvas* canvas, SkImageFilter* filter, siz e_t i, 66 static void draw_clipped_filter(SkCanvas* canvas, SkImageFilter* filter, siz e_t i,
64 const SkRect& primBounds, const SkRect& clip Bounds) { 67 const SkRect& primBounds, const SkRect& clip Bounds) {
65 SkPaint paint; 68 SkPaint paint;
66 paint.setColor(SK_ColorWHITE); 69 paint.setColor(SK_ColorWHITE);
67 paint.setImageFilter(filter); 70 paint.setImageFilter(filter);
68 paint.setAntiAlias(true); 71 paint.setAntiAlias(true);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 private: 153 private:
151 SkAutoTUnref<SkImage> fCheckerboard, fGradientCircle; 154 SkAutoTUnref<SkImage> fCheckerboard, fGradientCircle;
152 155
153 typedef GM INHERITED; 156 typedef GM INHERITED;
154 }; 157 };
155 158
156 ////////////////////////////////////////////////////////////////////////////// 159 //////////////////////////////////////////////////////////////////////////////
157 160
158 DEF_GM(return new ImageFiltersClippedGM;) 161 DEF_GM(return new ImageFiltersClippedGM;)
159 } 162 }
OLDNEW
« no previous file with comments | « gm/hairmodes.cpp ('k') | gm/imagefilterscropexpand.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698