OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkColor.h" | 9 #include "SkColor.h" |
10 #include "SkGradientShader.h" | 10 #include "SkGradientShader.h" |
11 #include "SkMatrix.h" | 11 #include "SkMatrix.h" |
12 #include "SkPaint.h" | 12 #include "SkPaint.h" |
13 #include "SkPoint.h" | 13 #include "SkPoint.h" |
14 #include "SkRect.h" | 14 #include "SkRect.h" |
15 #include "SkRefCnt.h" | 15 #include "SkRefCnt.h" |
16 #include "SkScalar.h" | 16 #include "SkScalar.h" |
17 #include "SkSize.h" | 17 #include "SkSize.h" |
18 #include "SkString.h" | 18 #include "SkString.h" |
19 | 19 |
20 #include "gm.h" | 20 #include "gm.h" |
21 | 21 |
22 static const SkColor gColors[] = { | 22 static const SkColor gColors[] = { |
23 SK_ColorRED, SK_ColorYELLOW | 23 SK_ColorRED, SK_ColorYELLOW |
24 }; | 24 }; |
25 | 25 |
26 // These annoying defines are necessary, because the only other alternative | 26 // These annoying defines are necessary, because the only other alternative |
27 // is to use SkIntToScalar(...) or SkFloatToScalar(...) everywhere. | 27 // is to use SkIntToScalar(...) everywhere. |
28 static const SkScalar sZero = 0; | 28 static const SkScalar sZero = 0; |
29 static const SkScalar sHalf = SK_ScalarHalf; | 29 static const SkScalar sHalf = SK_ScalarHalf; |
30 static const SkScalar sOne = SK_Scalar1; | 30 static const SkScalar sOne = SK_Scalar1; |
31 | 31 |
32 // These arrays define the gradient stop points | 32 // These arrays define the gradient stop points |
33 // as x1, y1, x2, y2 per gradient to draw. | 33 // as x1, y1, x2, y2 per gradient to draw. |
34 static const SkPoint linearPts[][2] = { | 34 static const SkPoint linearPts[][2] = { |
35 {{sZero, sZero}, {sOne, sZero}}, | 35 {{sZero, sZero}, {sOne, sZero}}, |
36 {{sZero, sZero}, {sZero, sOne}}, | 36 {{sZero, sZero}, {sZero, sOne}}, |
37 {{sOne, sZero}, {sZero, sZero}}, | 37 {{sOne, sZero}, {sZero, sZero}}, |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 draw_gradients(canvas, &make_radial_gradient, | 137 draw_gradients(canvas, &make_radial_gradient, |
138 radialPts, SK_ARRAY_COUNT(radialPts)); | 138 radialPts, SK_ARRAY_COUNT(radialPts)); |
139 } | 139 } |
140 | 140 |
141 private: | 141 private: |
142 typedef GM INHERITED; | 142 typedef GM INHERITED; |
143 }; | 143 }; |
144 | 144 |
145 DEF_GM( return new GradientMatrixGM; ) | 145 DEF_GM( return new GradientMatrixGM; ) |
146 } | 146 } |
OLD | NEW |