| OLD | NEW |
| 1 | 1 |
| 2 /* | 2 /* |
| 3 * Copyright 2011 Google Inc. | 3 * Copyright 2011 Google Inc. |
| 4 * | 4 * |
| 5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
| 6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
| 7 */ | 7 */ |
| 8 #include "gm.h" | 8 #include "gm.h" |
| 9 #include "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
| 10 #include "SkBlurMaskFilter.h" | 10 #include "SkBlurMaskFilter.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 | 48 |
| 49 SkScalar pos[] = {0, | 49 SkScalar pos[] = {0, |
| 50 SK_Scalar1 / 6, | 50 SK_Scalar1 / 6, |
| 51 2 * SK_Scalar1 / 6, | 51 2 * SK_Scalar1 / 6, |
| 52 3 * SK_Scalar1 / 6, | 52 3 * SK_Scalar1 / 6, |
| 53 4 * SK_Scalar1 / 6, | 53 4 * SK_Scalar1 / 6, |
| 54 5 * SK_Scalar1 / 6, | 54 5 * SK_Scalar1 / 6, |
| 55 SK_Scalar1}; | 55 SK_Scalar1}; |
| 56 | 56 |
| 57 SkPaint paint; | 57 SkPaint paint; |
| 58 paint.setShader(SkGradientShader::CreateRadial( | |
| 59 pt, radius, | |
| 60 colors, pos, | |
| 61 SK_ARRAY_COUNT(colors), | |
| 62 SkShader::kRepeat_TileMode))->unref(); | |
| 63 SkRect rect = SkRect::MakeWH(wScalar, hScalar); | 58 SkRect rect = SkRect::MakeWH(wScalar, hScalar); |
| 64 SkMatrix mat = SkMatrix::I(); | 59 SkMatrix mat = SkMatrix::I(); |
| 65 for (int i = 0; i < 4; ++i) { | 60 for (int i = 0; i < 4; ++i) { |
| 66 paint.getShader()->setLocalMatrix(mat); | 61 paint.setShader(SkGradientShader::CreateRadial( |
| 62 pt, radius, |
| 63 colors, pos, |
| 64 SK_ARRAY_COUNT(colors), |
| 65 SkShader::kRepeat_TileMode, |
| 66 NULL, 0, &mat))->unref(); |
| 67 canvas.drawRect(rect, paint); | 67 canvas.drawRect(rect, paint); |
| 68 rect.inset(wScalar / 8, hScalar / 8); | 68 rect.inset(wScalar / 8, hScalar / 8); |
| 69 mat.postScale(SK_Scalar1 / 4, SK_Scalar1 / 4); | 69 mat.postScale(SK_Scalar1 / 4, SK_Scalar1 / 4); |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 | 72 |
| 73 static const int gSize = 1024; | 73 static const int gSize = 1024; |
| 74 | 74 |
| 75 class DrawBitmapRectGM : public GM { | 75 class DrawBitmapRectGM : public GM { |
| 76 public: | 76 public: |
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 | 174 |
| 175 private: | 175 private: |
| 176 typedef GM INHERITED; | 176 typedef GM INHERITED; |
| 177 }; | 177 }; |
| 178 | 178 |
| 179 ////////////////////////////////////////////////////////////////////////////// | 179 ////////////////////////////////////////////////////////////////////////////// |
| 180 | 180 |
| 181 static GM* MyFactory(void*) { return new DrawBitmapRectGM; } | 181 static GM* MyFactory(void*) { return new DrawBitmapRectGM; } |
| 182 static GMRegistry reg(MyFactory); | 182 static GMRegistry reg(MyFactory); |
| 183 } | 183 } |
| OLD | NEW |