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 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 SkRect fDstR[2]; | 71 SkRect fDstR[2]; |
72 | 72 |
73 void bounce() { | 73 void bounce() { |
74 bounce_pt(&fSrcPts[0], &fSrcVec[0], fSrcLimit); | 74 bounce_pt(&fSrcPts[0], &fSrcVec[0], fSrcLimit); |
75 bounce_pt(&fSrcPts[1], &fSrcVec[1], fSrcLimit); | 75 bounce_pt(&fSrcPts[1], &fSrcVec[1], fSrcLimit); |
76 } | 76 } |
77 | 77 |
78 void resetBounce() { | 78 void resetBounce() { |
79 fSrcPts[0].set(0, 0); | 79 fSrcPts[0].set(0, 0); |
80 fSrcPts[1].set(SCALAR_SIZE, SCALAR_SIZE); | 80 fSrcPts[1].set(SCALAR_SIZE, SCALAR_SIZE); |
81 | 81 |
82 fSrcVec[0] = unit_vec(30); | 82 fSrcVec[0] = unit_vec(30); |
83 fSrcVec[1] = unit_vec(107); | 83 fSrcVec[1] = unit_vec(107); |
84 } | 84 } |
85 | 85 |
86 public: | 86 public: |
87 BitmapRectView() { | 87 BitmapRectView() { |
88 this->setBGColor(SK_ColorGRAY); | 88 this->setBGColor(SK_ColorGRAY); |
89 | 89 |
90 this->resetBounce(); | 90 this->resetBounce(); |
91 | 91 |
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 private: | 243 private: |
244 typedef SampleView INHERITED; | 244 typedef SampleView INHERITED; |
245 }; | 245 }; |
246 | 246 |
247 ////////////////////////////////////////////////////////////////////////////// | 247 ////////////////////////////////////////////////////////////////////////////// |
248 | 248 |
249 static SkView* F0() { return new BitmapRectView; } | 249 static SkView* F0() { return new BitmapRectView; } |
250 static SkView* F1() { return new BitmapRectView2; } | 250 static SkView* F1() { return new BitmapRectView2; } |
251 static SkViewRegister gR0(F0); | 251 static SkViewRegister gR0(F0); |
252 static SkViewRegister gR1(F1); | 252 static SkViewRegister gR1(F1); |
OLD | NEW |