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 "SkCornerPathEffect.h" | 11 #include "SkCornerPathEffect.h" |
12 #include "SkCullPoints.h" | 12 #include "SkCullPoints.h" |
13 #include "SkGradientShader.h" | 13 #include "SkGradientShader.h" |
14 #include "SkPath.h" | 14 #include "SkPath.h" |
15 #include "SkRegion.h" | 15 #include "SkRegion.h" |
16 #include "SkShader.h" | 16 #include "SkShader.h" |
17 #include "SkUtils.h" | 17 #include "SkUtils.h" |
18 | 18 |
19 static void create_bitmap(SkBitmap* bitmap) { | 19 static void create_bitmap(SkBitmap* bitmap) { |
20 const int W = 100; | 20 const int W = 100; |
21 const int H = 100; | 21 const int H = 100; |
22 bitmap->setConfig(SkBitmap::kARGB_8888_Config, W, H); | 22 bitmap->allocN32Pixels(W, H); |
23 bitmap->allocPixels(); | |
24 | 23 |
25 SkCanvas canvas(*bitmap); | 24 SkCanvas canvas(*bitmap); |
26 canvas.drawColor(SK_ColorRED); | 25 canvas.drawColor(SK_ColorRED); |
27 SkPaint paint; | 26 SkPaint paint; |
28 paint.setColor(SK_ColorBLUE); | 27 paint.setColor(SK_ColorBLUE); |
29 canvas.drawCircle(SkIntToScalar(W)/2, SkIntToScalar(H)/2, SkIntToScalar(W)/2
, paint); | 28 canvas.drawCircle(SkIntToScalar(W)/2, SkIntToScalar(H)/2, SkIntToScalar(W)/2
, paint); |
30 } | 29 } |
31 | 30 |
32 class WritePixelsView : public SampleView { | 31 class WritePixelsView : public SampleView { |
33 SkPath fPath; | 32 SkPath fPath; |
(...skipping 26 matching lines...) Expand all Loading... |
60 } | 59 } |
61 | 60 |
62 private: | 61 private: |
63 typedef SampleView INHERITED; | 62 typedef SampleView INHERITED; |
64 }; | 63 }; |
65 | 64 |
66 ////////////////////////////////////////////////////////////////////////////// | 65 ////////////////////////////////////////////////////////////////////////////// |
67 | 66 |
68 static SkView* MyFactory() { return new WritePixelsView; } | 67 static SkView* MyFactory() { return new WritePixelsView; } |
69 static SkViewRegister reg(MyFactory); | 68 static SkViewRegister reg(MyFactory); |
OLD | NEW |