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