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

Side by Side Diff: gm/imagefiltersclipped.cpp

Issue 1793303002: Reland of "more shader-->sp conversions (patchset #5 id:80001 of https://codereview.chromium… (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: make pictureRef a value, so its clearer what's going on 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 );
60 SkPaint paint; 56 SkPaint paint;
61 paint.setShader(shader); 57 paint.setShader(SkGradientShader::MakeRadial(SkPoint::Make(x, y), radius , colors, nullptr,
58 2, SkShader::kClamp_TileMod e));
62 canvas->drawCircle(x, y, radius, paint); 59 canvas->drawCircle(x, y, radius, paint);
63 fGradientCircle.reset(surface->newImageSnapshot()); 60 fGradientCircle.reset(surface->newImageSnapshot());
64 } 61 }
65 62
66 static void draw_clipped_filter(SkCanvas* canvas, SkImageFilter* filter, siz e_t i, 63 static void draw_clipped_filter(SkCanvas* canvas, SkImageFilter* filter, siz e_t i,
67 const SkRect& primBounds, const SkRect& clip Bounds) { 64 const SkRect& primBounds, const SkRect& clip Bounds) {
68 SkPaint paint; 65 SkPaint paint;
69 paint.setColor(SK_ColorWHITE); 66 paint.setColor(SK_ColorWHITE);
70 paint.setImageFilter(filter); 67 paint.setImageFilter(filter);
71 paint.setAntiAlias(true); 68 paint.setAntiAlias(true);
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 private: 150 private:
154 SkAutoTUnref<SkImage> fCheckerboard, fGradientCircle; 151 SkAutoTUnref<SkImage> fCheckerboard, fGradientCircle;
155 152
156 typedef GM INHERITED; 153 typedef GM INHERITED;
157 }; 154 };
158 155
159 ////////////////////////////////////////////////////////////////////////////// 156 //////////////////////////////////////////////////////////////////////////////
160 157
161 DEF_GM(return new ImageFiltersClippedGM;) 158 DEF_GM(return new ImageFiltersClippedGM;)
162 } 159 }
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