| 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 "gm.h" | 8 #include "gm.h" |
| 9 #include "SkColorPriv.h" | 9 #include "SkColorPriv.h" |
| 10 #include "SkGradientShader.h" | 10 #include "SkGradientShader.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 3 * SK_Scalar1 / 6, | 39 3 * SK_Scalar1 / 6, |
| 40 4 * SK_Scalar1 / 6, | 40 4 * SK_Scalar1 / 6, |
| 41 5 * SK_Scalar1 / 6, | 41 5 * SK_Scalar1 / 6, |
| 42 SK_Scalar1}; | 42 SK_Scalar1}; |
| 43 | 43 |
| 44 SkASSERT(SK_ARRAY_COUNT(colors) == SK_ARRAY_COUNT(pos)); | 44 SkASSERT(SK_ARRAY_COUNT(colors) == SK_ARRAY_COUNT(pos)); |
| 45 SkPaint paint; | 45 SkPaint paint; |
| 46 SkRect rect = SkRect::MakeWH(wScalar, hScalar); | 46 SkRect rect = SkRect::MakeWH(wScalar, hScalar); |
| 47 SkMatrix mat = SkMatrix::I(); | 47 SkMatrix mat = SkMatrix::I(); |
| 48 for (int i = 0; i < 4; ++i) { | 48 for (int i = 0; i < 4; ++i) { |
| 49 paint.setShader(SkGradientShader::CreateRadial( | 49 paint.setShader(SkGradientShader::MakeRadial( |
| 50 pt, radius, | 50 pt, radius, |
| 51 colors, pos, | 51 colors, pos, |
| 52 SK_ARRAY_COUNT(colors), | 52 SK_ARRAY_COUNT(colors), |
| 53 SkShader::kRepeat_TileMode, | 53 SkShader::kRepeat_TileMode, |
| 54 0, &mat))->unref(); | 54 0, &mat)); |
| 55 canvas->drawRect(rect, paint); | 55 canvas->drawRect(rect, paint); |
| 56 rect.inset(wScalar / 8, hScalar / 8); | 56 rect.inset(wScalar / 8, hScalar / 8); |
| 57 mat.postScale(SK_Scalar1 / 4, SK_Scalar1 / 4); | 57 mat.postScale(SK_Scalar1 / 4, SK_Scalar1 / 4); |
| 58 } | 58 } |
| 59 return surface->newImageSnapshot(); | 59 return surface->newImageSnapshot(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 static const int gSize = 1024; | 62 static const int gSize = 1024; |
| 63 static const int gSurfaceSize = 2048; | 63 static const int gSurfaceSize = 2048; |
| 64 | 64 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 bool fAA; | 134 bool fAA; |
| 135 SkAutoTUnref<SkImage> fImage; | 135 SkAutoTUnref<SkImage> fImage; |
| 136 SkString fName; | 136 SkString fName; |
| 137 | 137 |
| 138 typedef skiagm::GM INHERITED; | 138 typedef skiagm::GM INHERITED; |
| 139 }; | 139 }; |
| 140 | 140 |
| 141 DEF_GM( return new DrawMiniBitmapRectGM(true); ) | 141 DEF_GM( return new DrawMiniBitmapRectGM(true); ) |
| 142 DEF_GM( return new DrawMiniBitmapRectGM(false); ) | 142 DEF_GM( return new DrawMiniBitmapRectGM(false); ) |
| 143 | 143 |
| OLD | NEW |