| 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 18 matching lines...) Expand all Loading... |
| 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 SkAutoTUnref<SkSurface> surface(SkSurface::NewRasterN32Premul(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 SkAutoTUnref<SkShader> shader( | |
| 40 SkGradientShader::CreateRadial(SkPoint::Make(x, y), radius, colors, null
ptr, 2, | |
| 41 SkShader::kClamp_TileMode) | |
| 42 ); | |
| 43 SkPaint paint; | 39 SkPaint paint; |
| 44 paint.setShader(shader); | 40 paint.setShader(SkGradientShader::MakeRadial(SkPoint::Make(x, y), radius, co
lors, nullptr, 2, |
| 41 SkShader::kClamp_TileMode)); |
| 45 canvas->drawCircle(x, y, radius, paint); | 42 canvas->drawCircle(x, y, radius, paint); |
| 46 | 43 |
| 47 return surface->newImageSnapshot(); | 44 return surface->newImageSnapshot(); |
| 48 } | 45 } |
| 49 | 46 |
| 50 class ImageFiltersTransformedGM : public GM { | 47 class ImageFiltersTransformedGM : public GM { |
| 51 public: | 48 public: |
| 52 ImageFiltersTransformedGM() { | 49 ImageFiltersTransformedGM() { |
| 53 this->setBGColor(SK_ColorBLACK); | 50 this->setBGColor(SK_ColorBLACK); |
| 54 } | 51 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 SkAutoTUnref<SkImage> fCheckerboard; | 116 SkAutoTUnref<SkImage> fCheckerboard; |
| 120 SkAutoTUnref<SkImage> fGradientCircle; | 117 SkAutoTUnref<SkImage> fGradientCircle; |
| 121 typedef GM INHERITED; | 118 typedef GM INHERITED; |
| 122 }; | 119 }; |
| 123 | 120 |
| 124 ////////////////////////////////////////////////////////////////////////////// | 121 ////////////////////////////////////////////////////////////////////////////// |
| 125 | 122 |
| 126 DEF_GM( return new ImageFiltersTransformedGM; ) | 123 DEF_GM( return new ImageFiltersTransformedGM; ) |
| 127 | 124 |
| 128 } | 125 } |
| OLD | NEW |