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 #include "TransitionView.h" | 7 #include "TransitionView.h" |
8 | 8 |
9 #include "OverView.h" | 9 #include "OverView.h" |
10 #include "SampleCode.h" | 10 #include "SampleCode.h" |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 fBegin[kNextX] = lr; | 151 fBegin[kNextX] = lr; |
152 fBegin[kNextY] = ud; | 152 fBegin[kNextY] = ud; |
153 fNext->setLocX(lr); | 153 fNext->setLocX(lr); |
154 fNext->setLocY(ud); | 154 fNext->setLocY(ud); |
155 | 155 |
156 if (is_transition(fPrev)) | 156 if (is_transition(fPrev)) |
157 lr = ud = 0; | 157 lr = ud = 0; |
158 fEnd[kPrevX] = -lr; | 158 fEnd[kPrevX] = -lr; |
159 fEnd[kPrevY] = -ud; | 159 fEnd[kPrevY] = -ud; |
160 fEnd[kNextX] = fEnd[kNextY] = 0; | 160 fEnd[kNextX] = fEnd[kNextY] = 0; |
161 SkScalar blend[] = { SkFloatToScalar(0.8f), SkFloatToScalar(0.0f), | 161 SkScalar blend[] = { 0.8f, 0.0f, |
162 SkFloatToScalar(0.0f), SK_Scalar1 }; | 162 0.0f, SK_Scalar1 }; |
163 fInterp.setKeyFrame(0, SkTime::GetMSecs(), fBegin, blend); | 163 fInterp.setKeyFrame(0, SkTime::GetMSecs(), fBegin, blend); |
164 fInterp.setKeyFrame(1, SkTime::GetMSecs()+kDurationMS, fEnd, blend); | 164 fInterp.setKeyFrame(1, SkTime::GetMSecs()+kDurationMS, fEnd, blend); |
165 } | 165 } |
166 | 166 |
167 private: | 167 private: |
168 enum { | 168 enum { |
169 kPrevX = 0, | 169 kPrevX = 0, |
170 kPrevY = 1, | 170 kPrevY = 1, |
171 kNextX = 2, | 171 kNextX = 2, |
172 kNextY = 3 | 172 kNextY = 3 |
(...skipping 22 matching lines...) Expand all Loading... |
195 }; | 195 }; |
196 | 196 |
197 SkView* create_transition(SkView* prev, SkView* next, int direction) { | 197 SkView* create_transition(SkView* prev, SkView* next, int direction) { |
198 #ifdef SK_BUILD_FOR_ANDROID | 198 #ifdef SK_BUILD_FOR_ANDROID |
199 // Disable transitions for Android | 199 // Disable transitions for Android |
200 return next; | 200 return next; |
201 #else | 201 #else |
202 return SkNEW_ARGS(TransitionView, (prev, next, direction)); | 202 return SkNEW_ARGS(TransitionView, (prev, next, direction)); |
203 #endif | 203 #endif |
204 } | 204 } |
OLD | NEW |