| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 11 matching lines...) Expand all Loading... |
| 22 | 22 |
| 23 // This GM draws image filters with a CTM containing shearing / rotation. | 23 // This GM draws image filters with a CTM containing shearing / rotation. |
| 24 // It checks that the scale portion of the CTM is correctly extracted | 24 // It checks that the scale portion of the CTM is correctly extracted |
| 25 // and applied to the image inputs separately from the non-scale portion. | 25 // and applied to the image inputs separately from the non-scale portion. |
| 26 | 26 |
| 27 static sk_sp<SkImage> make_gradient_circle(int width, int height) { | 27 static sk_sp<SkImage> make_gradient_circle(int width, int height) { |
| 28 SkScalar x = SkIntToScalar(width / 2); | 28 SkScalar x = SkIntToScalar(width / 2); |
| 29 SkScalar y = SkIntToScalar(height / 2); | 29 SkScalar y = SkIntToScalar(height / 2); |
| 30 SkScalar radius = SkMinScalar(x, y) * 0.8f; | 30 SkScalar radius = SkMinScalar(x, y) * 0.8f; |
| 31 | 31 |
| 32 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(width, height)
); | 32 auto surface(SkSurface::MakeRasterN32Premul(width, height)); |
| 33 SkCanvas* canvas = surface->getCanvas(); | 33 SkCanvas* canvas = surface->getCanvas(); |
| 34 | 34 |
| 35 canvas->clear(0x00000000); | 35 canvas->clear(0x00000000); |
| 36 SkColor colors[2]; | 36 SkColor colors[2]; |
| 37 colors[0] = SK_ColorWHITE; | 37 colors[0] = SK_ColorWHITE; |
| 38 colors[1] = SK_ColorBLACK; | 38 colors[1] = SK_ColorBLACK; |
| 39 SkPaint paint; | 39 SkPaint paint; |
| 40 paint.setShader(SkGradientShader::MakeRadial(SkPoint::Make(x, y), radius, co
lors, nullptr, 2, | 40 paint.setShader(SkGradientShader::MakeRadial(SkPoint::Make(x, y), radius, co
lors, nullptr, 2, |
| 41 SkShader::kClamp_TileMode)); | 41 SkShader::kClamp_TileMode)); |
| 42 canvas->drawCircle(x, y, radius, paint); | 42 canvas->drawCircle(x, y, radius, paint); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 sk_sp<SkImage> fCheckerboard; | 116 sk_sp<SkImage> fCheckerboard; |
| 117 sk_sp<SkImage> fGradientCircle; | 117 sk_sp<SkImage> fGradientCircle; |
| 118 typedef GM INHERITED; | 118 typedef GM INHERITED; |
| 119 }; | 119 }; |
| 120 | 120 |
| 121 ////////////////////////////////////////////////////////////////////////////// | 121 ////////////////////////////////////////////////////////////////////////////// |
| 122 | 122 |
| 123 DEF_GM( return new ImageFiltersTransformedGM; ) | 123 DEF_GM( return new ImageFiltersTransformedGM; ) |
| 124 | 124 |
| 125 } | 125 } |
| OLD | NEW |