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 "SkAnimTimer.h" | 9 #include "SkAnimTimer.h" |
10 #include "SkView.h" | 10 #include "SkView.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 } | 50 } |
51 this->setBGColor(0xFFDDDDDD); | 51 this->setBGColor(0xFFDDDDDD); |
52 } | 52 } |
53 | 53 |
54 virtual ~CameraView() { | 54 virtual ~CameraView() { |
55 fShaders.unrefAll(); | 55 fShaders.unrefAll(); |
56 } | 56 } |
57 | 57 |
58 protected: | 58 protected: |
59 // overrides from SkEventSink | 59 // overrides from SkEventSink |
60 virtual bool onQuery(SkEvent* evt) { | 60 bool onQuery(SkEvent* evt) override { |
61 if (SampleCode::TitleQ(*evt)) { | 61 if (SampleCode::TitleQ(*evt)) { |
62 SampleCode::TitleR(evt, "Camera"); | 62 SampleCode::TitleR(evt, "Camera"); |
63 return true; | 63 return true; |
64 } | 64 } |
65 return this->INHERITED::onQuery(evt); | 65 return this->INHERITED::onQuery(evt); |
66 } | 66 } |
67 | 67 |
68 virtual void onDrawContent(SkCanvas* canvas) { | 68 void onDrawContent(SkCanvas* canvas) override { |
69 canvas->translate(this->width()/2, this->height()/2); | 69 canvas->translate(this->width()/2, this->height()/2); |
70 | 70 |
71 Sk3DView view; | 71 Sk3DView view; |
72 view.rotateX(fRX); | 72 view.rotateX(fRX); |
73 view.rotateY(fRY); | 73 view.rotateY(fRY); |
74 view.applyToCanvas(canvas); | 74 view.applyToCanvas(canvas); |
75 | 75 |
76 SkPaint paint; | 76 SkPaint paint; |
77 if (fShaders.count() > 0) { | 77 if (fShaders.count() > 0) { |
78 bool frontFace = view.dotWithNormal(0, 0, SK_Scalar1) < 0; | 78 bool frontFace = view.dotWithNormal(0, 0, SK_Scalar1) < 0; |
(...skipping 21 matching lines...) Expand all Loading... |
100 | 100 |
101 private: | 101 private: |
102 SkScalar fRX, fRY, fRZ; | 102 SkScalar fRX, fRY, fRZ; |
103 typedef SampleView INHERITED; | 103 typedef SampleView INHERITED; |
104 }; | 104 }; |
105 | 105 |
106 ////////////////////////////////////////////////////////////////////////////// | 106 ////////////////////////////////////////////////////////////////////////////// |
107 | 107 |
108 static SkView* MyFactory() { return new CameraView; } | 108 static SkView* MyFactory() { return new CameraView; } |
109 static SkViewRegister reg(MyFactory); | 109 static SkViewRegister reg(MyFactory); |
OLD | NEW |