OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 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 "SkBlurMask.h" | 9 #include "SkBlurMask.h" |
10 #include "SkBlurMaskFilter.h" | 10 #include "SkBlurMaskFilter.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 2 * SK_Scalar1 / 6, | 63 2 * SK_Scalar1 / 6, |
64 3 * SK_Scalar1 / 6, | 64 3 * SK_Scalar1 / 6, |
65 4 * SK_Scalar1 / 6, | 65 4 * SK_Scalar1 / 6, |
66 5 * SK_Scalar1 / 6, | 66 5 * SK_Scalar1 / 6, |
67 SK_Scalar1}; | 67 SK_Scalar1}; |
68 | 68 |
69 SkPaint paint; | 69 SkPaint paint; |
70 SkRect rect = SkRect::MakeWH(wScalar, hScalar); | 70 SkRect rect = SkRect::MakeWH(wScalar, hScalar); |
71 SkMatrix mat = SkMatrix::I(); | 71 SkMatrix mat = SkMatrix::I(); |
72 for (int i = 0; i < 4; ++i) { | 72 for (int i = 0; i < 4; ++i) { |
73 paint.setShader(SkGradientShader::CreateRadial( | 73 paint.setShader(SkGradientShader::MakeRadial( |
74 pt, radius, | 74 pt, radius, |
75 colors, pos, | 75 colors, pos, |
76 SK_ARRAY_COUNT(colors), | 76 SK_ARRAY_COUNT(colors), |
77 SkShader::kRepeat_TileMode, | 77 SkShader::kRepeat_TileMode, |
78 0, &mat))->unref(); | 78 0, &mat)); |
79 canvas->drawRect(rect, paint); | 79 canvas->drawRect(rect, paint); |
80 rect.inset(wScalar / 8, hScalar / 8); | 80 rect.inset(wScalar / 8, hScalar / 8); |
81 mat.postScale(SK_Scalar1 / 4, SK_Scalar1 / 4); | 81 mat.postScale(SK_Scalar1 / 4, SK_Scalar1 / 4); |
82 } | 82 } |
83 | 83 |
84 SkImage* image = surface->newImageSnapshot(); | 84 SkImage* image = surface->newImageSnapshot(); |
85 | 85 |
86 SkBitmap tempBM; | 86 SkBitmap tempBM; |
87 | 87 |
88 #if SK_SUPPORT_GPU | 88 #if SK_SUPPORT_GPU |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 canvas->drawBitmapRect(bm, srcRect, dstRect, &paint); | 220 canvas->drawBitmapRect(bm, srcRect, dstRect, &paint); |
221 } | 221 } |
222 } | 222 } |
223 | 223 |
224 private: | 224 private: |
225 typedef skiagm::GM INHERITED; | 225 typedef skiagm::GM INHERITED; |
226 }; | 226 }; |
227 | 227 |
228 DEF_GM( return new DrawBitmapRectGM(canvasproc, nullptr); ) | 228 DEF_GM( return new DrawBitmapRectGM(canvasproc, nullptr); ) |
229 DEF_GM( return new DrawBitmapRectGM(imageproc, "-imagerect"); ) | 229 DEF_GM( return new DrawBitmapRectGM(imageproc, "-imagerect"); ) |
OLD | NEW |