OLD | NEW |
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 "gm.h" | 8 #include "gm.h" |
9 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
10 #include "SkColorFilter.h" | 10 #include "SkColorFilter.h" |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 canvas.drawRect(SkRect::MakeXYWH(8, 8, 8, 8), darkPaint); | 136 canvas.drawRect(SkRect::MakeXYWH(8, 8, 8, 8), darkPaint); |
137 canvas.restore(); | 137 canvas.restore(); |
138 } | 138 } |
139 } | 139 } |
140 } | 140 } |
141 | 141 |
142 static sk_sp<SkImage> MakeGradientCircle(int width, int height) { | 142 static sk_sp<SkImage> MakeGradientCircle(int width, int height) { |
143 SkScalar x = SkIntToScalar(width / 2); | 143 SkScalar x = SkIntToScalar(width / 2); |
144 SkScalar y = SkIntToScalar(height / 2); | 144 SkScalar y = SkIntToScalar(height / 2); |
145 SkScalar radius = SkMinScalar(x, y) * 0.8f; | 145 SkScalar radius = SkMinScalar(x, y) * 0.8f; |
146 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(width, hei
ght)); | 146 auto surface(SkSurface::MakeRasterN32Premul(width, height)); |
147 SkCanvas* canvas = surface->getCanvas(); | 147 SkCanvas* canvas = surface->getCanvas(); |
148 canvas->clear(0x00000000); | 148 canvas->clear(0x00000000); |
149 SkColor colors[2]; | 149 SkColor colors[2]; |
150 colors[0] = SK_ColorWHITE; | 150 colors[0] = SK_ColorWHITE; |
151 colors[1] = SK_ColorBLACK; | 151 colors[1] = SK_ColorBLACK; |
152 SkPaint paint; | 152 SkPaint paint; |
153 paint.setShader(SkGradientShader::MakeRadial(SkPoint::Make(x, y), radius
, colors, nullptr, | 153 paint.setShader(SkGradientShader::MakeRadial(SkPoint::Make(x, y), radius
, colors, nullptr, |
154 2, SkShader::kClamp_TileMod
e)); | 154 2, SkShader::kClamp_TileMod
e)); |
155 canvas->drawCircle(x, y, radius, paint); | 155 canvas->drawCircle(x, y, radius, paint); |
156 | 156 |
(...skipping 14 matching lines...) Expand all Loading... |
171 | 171 |
172 canvas->translate(SkIntToScalar(80), 0); | 172 canvas->translate(SkIntToScalar(80), 0); |
173 } | 173 } |
174 | 174 |
175 typedef GM INHERITED; | 175 typedef GM INHERITED; |
176 }; | 176 }; |
177 | 177 |
178 /////////////////////////////////////////////////////////////////////////////// | 178 /////////////////////////////////////////////////////////////////////////////// |
179 | 179 |
180 DEF_GM( return new ImageFiltersCropExpandGM; ) | 180 DEF_GM( return new ImageFiltersCropExpandGM; ) |
OLD | NEW |