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 "SampleCode.h" | 8 #include "SampleCode.h" |
9 #include "SkView.h" | 9 #include "SkView.h" |
10 #include "SkCanvas.h" | 10 #include "SkCanvas.h" |
11 #include "Sk64.h" | 11 #include "Sk64.h" |
12 #include "SkGradientShader.h" | 12 #include "SkGradientShader.h" |
13 #include "SkString.h" | 13 #include "SkString.h" |
14 | 14 |
15 static void draw_gradient2(SkCanvas* canvas, const SkRect& rect, SkScalar delta)
{ | 15 static void draw_gradient2(SkCanvas* canvas, const SkRect& rect, SkScalar delta)
{ |
16 SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorMAGEN
TA }; | 16 SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE, SK_ColorMAGEN
TA }; |
17 SkScalar pos[] = { 0, SkFloatToScalar(0.25f), SkFloatToScalar(0.75f), SK_Sca
lar1 }; | 17 SkScalar pos[] = { 0, 0.25f, 0.75f, SK_Scalar1 }; |
18 | 18 |
19 SkScalar l = rect.fLeft; | 19 SkScalar l = rect.fLeft; |
20 SkScalar t = rect.fTop; | 20 SkScalar t = rect.fTop; |
21 SkScalar w = rect.width(); | 21 SkScalar w = rect.width(); |
22 SkScalar h = rect.height(); | 22 SkScalar h = rect.height(); |
23 | 23 |
24 SkASSERT(0 == SkScalarMod(w, SK_Scalar1 * 5)); | 24 SkASSERT(0 == SkScalarMod(w, SK_Scalar1 * 5)); |
25 | 25 |
26 SkPoint c0 = { l + 2 * w / 5 + delta, t + h / 2 }; | 26 SkPoint c0 = { l + 2 * w / 5 + delta, t + h / 2 }; |
27 SkPoint c1 = { l + 3 * w / 5, t + h / 2 }; | 27 SkPoint c1 = { l + 3 * w / 5, t + h / 2 }; |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 | 83 |
84 private: | 84 private: |
85 SkScalar fTime; | 85 SkScalar fTime; |
86 typedef SampleView INHERITED; | 86 typedef SampleView INHERITED; |
87 }; | 87 }; |
88 | 88 |
89 ////////////////////////////////////////////////////////////////////////////// | 89 ////////////////////////////////////////////////////////////////////////////// |
90 | 90 |
91 static SkView* MyFactory() { return new DegenerateTwoPtRadialsView; } | 91 static SkView* MyFactory() { return new DegenerateTwoPtRadialsView; } |
92 static SkViewRegister reg(MyFactory); | 92 static SkViewRegister reg(MyFactory); |
OLD | NEW |