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 "SkApplication.h" |
13 #include "SkDraw.h" | 13 #include "SkDraw.h" |
14 #include "SkGradientShader.h" | 14 #include "SkGradientShader.h" |
15 #include "SkGraphics.h" | 15 #include "SkGraphics.h" |
16 #include "SkUnitMappers.h" | 16 #include "SkUnitMappers.h" |
17 | 17 |
18 class HelloSkia : public SkExample { | 18 class HelloSkia : public SkExample { |
19 public: | 19 public: |
20 HelloSkia(SkExampleWindow* window) : SkExample(window) { | 20 HelloSkia(SkExampleWindow* window) : SkExample(window) { |
21 fName = "HelloSkia"; | 21 fName = "HelloSkia"; |
22 fBGColor = SK_ColorWHITE; | 22 fBGColor = SK_ColorWHITE; |
23 fRotationAngle = SkIntToScalar(0); | 23 fRotationAngle = SkIntToScalar(0); |
24 | 24 |
25 fWindow->setupBackend(SkExampleWindow::kGPU_DeviceType); | 25 fWindow->setupBackend(SkExampleWindow::kGPU_DeviceType); |
26 // Another option is software rendering: | 26 // Another option is software rendering: |
27 // setupBackend(SkExampleWindow::kRaster_DeviceType); | 27 // fWindow->setupBackend(SkExampleWindow::kRaster_DeviceType); |
28 } | 28 } |
29 | 29 |
30 protected: | 30 protected: |
31 void draw(SkCanvas* canvas) { | 31 void draw(SkCanvas* canvas) { |
32 // Clear background | 32 // Clear background |
33 canvas->drawColor(fBGColor); | 33 canvas->drawColor(fBGColor); |
34 | 34 |
35 SkPaint paint; | 35 SkPaint paint; |
36 paint.setColor(SK_ColorRED); | 36 paint.setColor(SK_ColorRED); |
37 | 37 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 SkScalar fRotationAngle; | 101 SkScalar fRotationAngle; |
102 SkColor fBGColor; | 102 SkColor fBGColor; |
103 }; | 103 }; |
104 | 104 |
105 static SkExample* MyFactory(SkExampleWindow* window) { | 105 static SkExample* MyFactory(SkExampleWindow* window) { |
106 return new HelloSkia(window); | 106 return new HelloSkia(window); |
107 } | 107 } |
108 | 108 |
109 // Register this class as a Skia Example. | 109 // Register this class as a Skia Example. |
110 SkExample::Registry registry(MyFactory); | 110 SkExample::Registry registry(MyFactory); |
OLD | NEW |