OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright 2015 Google Inc. | 2 * Copyright 2015 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 | 60 |
61 void advance(const SkRect& bounds) { | 61 void advance(const SkRect& bounds) { |
62 fCenter += fVelocity; | 62 fCenter += fVelocity; |
63 if (fCenter.fX > bounds.right()) { | 63 if (fCenter.fX > bounds.right()) { |
64 SkASSERT(fVelocity.fX > 0); | 64 SkASSERT(fVelocity.fX > 0); |
65 fVelocity.fX = -fVelocity.fX; | 65 fVelocity.fX = -fVelocity.fX; |
66 } else if (fCenter.fX < bounds.left()) { | 66 } else if (fCenter.fX < bounds.left()) { |
67 SkASSERT(fVelocity.fX < 0); | 67 SkASSERT(fVelocity.fX < 0); |
68 fVelocity.fX = -fVelocity.fX; | 68 fVelocity.fX = -fVelocity.fX; |
69 } | 69 } |
70 if (fCenter.fY > bounds.bottom()) { | 70 if (fCenter.fY > bounds.bottom()) { |
robertphillips
2015/06/25 15:53:21
??
reed1
2015/06/25 19:12:29
reverting
| |
71 SkASSERT(fVelocity.fY > 0); | 71 // SkASSERT(fVelocity.fY > 0); |
72 fVelocity.fY = -fVelocity.fY; | 72 fVelocity.fY = -fVelocity.fY; |
73 } else if (fCenter.fY < bounds.top()) { | 73 } else if (fCenter.fY < bounds.top()) { |
74 SkASSERT(fVelocity.fY < 0); | 74 SkASSERT(fVelocity.fY < 0); |
75 fVelocity.fY = -fVelocity.fY; | 75 fVelocity.fY = -fVelocity.fY; |
76 } | 76 } |
77 | 77 |
78 fScale += fDScale; | 78 fScale += fDScale; |
79 if (fScale > 2 || fScale < SK_Scalar1/2) { | 79 if (fScale > 2 || fScale < SK_Scalar1/2) { |
80 fDScale = -fDScale; | 80 fDScale = -fDScale; |
81 } | 81 } |
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
225 #endif | 225 #endif |
226 | 226 |
227 private: | 227 private: |
228 typedef SampleView INHERITED; | 228 typedef SampleView INHERITED; |
229 }; | 229 }; |
230 | 230 |
231 ////////////////////////////////////////////////////////////////////////////// | 231 ////////////////////////////////////////////////////////////////////////////// |
232 | 232 |
233 static SkView* MyFactory() { return new DrawAtlasView; } | 233 static SkView* MyFactory() { return new DrawAtlasView; } |
234 static SkViewRegister reg(MyFactory); | 234 static SkViewRegister reg(MyFactory); |
OLD | NEW |