OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2016 Google Inc. | 2 * Copyright 2016 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 "SkColor.h" | 10 #include "SkColor.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 root->appendChild(fPaddle0.shadowNode); | 129 root->appendChild(fPaddle0.shadowNode); |
130 root->appendChild(fPaddle1.shadowNode); | 130 root->appendChild(fPaddle1.shadowNode); |
131 root->appendChild(fBall.shadowNode); | 131 root->appendChild(fBall.shadowNode); |
132 root->appendChild(fPaddle0.objectNode); | 132 root->appendChild(fPaddle0.objectNode); |
133 root->appendChild(fPaddle1.objectNode); | 133 root->appendChild(fPaddle1.objectNode); |
134 root->appendChild(fBall.objectNode); | 134 root->appendChild(fBall.objectNode); |
135 | 135 |
136 // Handle everything in a normalized 1x1 space. | 136 // Handle everything in a normalized 1x1 space. |
137 root->setViewBox(SkSVGViewBoxType(SkRect::MakeWH(1, 1))); | 137 root->setViewBox(SkSVGViewBoxType(SkRect::MakeWH(1, 1))); |
138 | 138 |
139 fDom = sk_sp<SkSVGDOM>(new SkSVGDOM(SkSize::Make(this->width(), this->he
ight()))); | 139 fDom = sk_sp<SkSVGDOM>(new SkSVGDOM()); |
| 140 fDom->setContainerSize(SkSize::Make(this->width(), this->height())); |
140 fDom->setRoot(std::move(root)); | 141 fDom->setRoot(std::move(root)); |
141 | 142 |
142 // Off we go. | 143 // Off we go. |
143 this->updatePaddleStrategy(); | 144 this->updatePaddleStrategy(); |
144 } | 145 } |
145 | 146 |
146 bool onQuery(SkEvent* evt) override { | 147 bool onQuery(SkEvent* evt) override { |
147 if (SampleCode::TitleQ(*evt)) { | 148 if (SampleCode::TitleQ(*evt)) { |
148 SampleCode::TitleR(evt, "SVGPong"); | 149 SampleCode::TitleR(evt, "SVGPong"); |
149 return true; | 150 return true; |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 SkRandom fRand; | 278 SkRandom fRand; |
278 | 279 |
279 SkMSec fLastTick = 0; | 280 SkMSec fLastTick = 0; |
280 SkScalar fTimeScale = 1.0f; | 281 SkScalar fTimeScale = 1.0f; |
281 | 282 |
282 typedef SampleView INHERITED; | 283 typedef SampleView INHERITED; |
283 }; | 284 }; |
284 | 285 |
285 static SkView* SVGPongFactory() { return new SVGPongView; } | 286 static SkView* SVGPongFactory() { return new SVGPongView; } |
286 static SkViewRegister reg(SVGPongFactory); | 287 static SkViewRegister reg(SVGPongFactory); |
OLD | NEW |