OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 Google Inc. |
3 * | 3 * |
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 */ | 8 */ |
9 | 9 |
10 #include "SkExample.h" | 10 #include "SkExample.h" |
11 | 11 |
12 #include "SkApplication.h" | 12 #include "SkCanvas.h" |
13 #include "SkDraw.h" | |
14 #include "SkGradientShader.h" | 13 #include "SkGradientShader.h" |
15 #include "SkGraphics.h" | |
16 | 14 |
17 class HelloSkia : public SkExample { | 15 class HelloSkia : public SkExample { |
18 public: | 16 public: |
19 HelloSkia(SkExampleWindow* window) : SkExample(window) { | 17 HelloSkia(SkExampleWindow* window) : SkExample(window) { |
20 fName = "HelloSkia"; | 18 fName = "HelloSkia"; |
21 fBGColor = SK_ColorWHITE; | 19 fBGColor = SK_ColorWHITE; |
22 fRotationAngle = SkIntToScalar(0); | 20 fRotationAngle = SkIntToScalar(0); |
23 | |
24 fWindow->setupBackend(SkExampleWindow::kGPU_DeviceType); | |
25 // Another option is software rendering: | |
26 // fWindow->setupBackend(SkExampleWindow::kRaster_DeviceType); | |
27 } | 21 } |
28 | 22 |
29 protected: | 23 protected: |
30 void draw(SkCanvas* canvas) { | 24 void draw(SkCanvas* canvas) { |
31 // Clear background | 25 // Clear background |
32 canvas->drawColor(fBGColor); | 26 canvas->drawColor(fBGColor); |
33 | 27 |
34 SkPaint paint; | 28 SkPaint paint; |
35 paint.setColor(SK_ColorRED); | 29 paint.setColor(SK_ColorRED); |
36 | 30 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 SkScalar fRotationAngle; | 91 SkScalar fRotationAngle; |
98 SkColor fBGColor; | 92 SkColor fBGColor; |
99 }; | 93 }; |
100 | 94 |
101 static SkExample* MyFactory(SkExampleWindow* window) { | 95 static SkExample* MyFactory(SkExampleWindow* window) { |
102 return new HelloSkia(window); | 96 return new HelloSkia(window); |
103 } | 97 } |
104 | 98 |
105 // Register this class as a Skia Example. | 99 // Register this class as a Skia Example. |
106 SkExample::Registry registry(MyFactory); | 100 SkExample::Registry registry(MyFactory); |
OLD | NEW |