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 "SampleCode.h" | 8 #include "SampleCode.h" |
9 #include "SkView.h" | |
10 #include "SkCanvas.h" | 9 #include "SkCanvas.h" |
11 #include "SkGradientShader.h" | 10 #include "SkGradientShader.h" |
| 11 #include "SkPath.h" |
| 12 #include "SkView.h" |
12 | 13 |
13 static void makebm(SkBitmap* bm, int w, int h) { | 14 static void makebm(SkBitmap* bm, int w, int h) { |
14 bm->allocN32Pixels(w, h); | 15 bm->allocN32Pixels(w, h); |
15 bm->eraseColor(SK_ColorTRANSPARENT); | 16 bm->eraseColor(SK_ColorTRANSPARENT); |
16 | 17 |
17 SkCanvas canvas(*bm); | 18 SkCanvas canvas(*bm); |
18 SkScalar s = SkIntToScalar(w < h ? w : h); | 19 SkScalar s = SkIntToScalar(w < h ? w : h); |
19 SkPoint pts[] = { { 0, 0 }, { s, s } }; | 20 SkPoint pts[] = { { 0, 0 }, { s, s } }; |
20 SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE }; | 21 SkColor colors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorBLUE }; |
21 SkScalar pos[] = { 0, SK_Scalar1/2, SK_Scalar1 }; | 22 SkScalar pos[] = { 0, SK_Scalar1/2, SK_Scalar1 }; |
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 } | 189 } |
189 | 190 |
190 private: | 191 private: |
191 typedef SampleView INHERITED; | 192 typedef SampleView INHERITED; |
192 }; | 193 }; |
193 | 194 |
194 /////////////////////////////////////////////////////////////////////////////// | 195 /////////////////////////////////////////////////////////////////////////////// |
195 | 196 |
196 static SkView* MyFactory() { return new ShaderTextView; } | 197 static SkView* MyFactory() { return new ShaderTextView; } |
197 static SkViewRegister reg(MyFactory); | 198 static SkViewRegister reg(MyFactory); |
OLD | NEW |