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 "SampleApp.h" | 8 #include "SampleApp.h" |
9 | 9 |
10 #include "OverView.h" | 10 #include "OverView.h" |
(...skipping 1302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1313 canvas->rotate(gAnimTimer.scaled(10)); | 1313 canvas->rotate(gAnimTimer.scaled(10)); |
1314 canvas->translate(-cx, -cy); | 1314 canvas->translate(-cx, -cy); |
1315 } | 1315 } |
1316 | 1316 |
1317 if (fPerspAnim) { | 1317 if (fPerspAnim) { |
1318 SkScalar secs = gAnimTimer.scaled(1); | 1318 SkScalar secs = gAnimTimer.scaled(1); |
1319 | 1319 |
1320 static const SkScalar gAnimPeriod = 10 * SK_Scalar1; | 1320 static const SkScalar gAnimPeriod = 10 * SK_Scalar1; |
1321 static const SkScalar gAnimMag = SK_Scalar1 / 1000; | 1321 static const SkScalar gAnimMag = SK_Scalar1 / 1000; |
1322 SkScalar t = SkScalarMod(secs, gAnimPeriod); | 1322 SkScalar t = SkScalarMod(secs, gAnimPeriod); |
1323 if (SkScalarFloorToInt(secs / gAnimPeriod) & 0x1) { | 1323 if (SkScalarFloorToInt(SkScalarDiv(secs, gAnimPeriod)) & 0x1) { |
1324 t = gAnimPeriod - t; | 1324 t = gAnimPeriod - t; |
1325 } | 1325 } |
1326 t = 2 * t - gAnimPeriod; | 1326 t = 2 * t - gAnimPeriod; |
1327 t *= gAnimMag / gAnimPeriod; | 1327 t = SkScalarMul(SkScalarDiv(t, gAnimPeriod), gAnimMag); |
1328 SkMatrix m; | 1328 SkMatrix m; |
1329 m.reset(); | 1329 m.reset(); |
1330 #if 1 | 1330 #if 1 |
1331 m.setPerspY(t); | 1331 m.setPerspY(t); |
1332 #else | 1332 #else |
1333 m.setPerspY(SK_Scalar1 / 1000); | 1333 m.setPerspY(SK_Scalar1 / 1000); |
1334 m.setSkewX(8.0f / 25); | 1334 m.setSkewX(SkScalarDiv(8, 25)); |
1335 m.dump(); | 1335 m.dump(); |
1336 #endif | 1336 #endif |
1337 canvas->concat(m); | 1337 canvas->concat(m); |
1338 } | 1338 } |
1339 | 1339 |
1340 this->installDrawFilter(canvas); | 1340 this->installDrawFilter(canvas); |
1341 | 1341 |
1342 if (fMeasureFPS) { | 1342 if (fMeasureFPS) { |
1343 if (SampleView::SetRepeatDraw(child, FPS_REPEAT_COUNT)) { | 1343 if (SampleView::SetRepeatDraw(child, FPS_REPEAT_COUNT)) { |
1344 fMeasureFPS_StartTime = SkTime::GetMSecs(); | 1344 fMeasureFPS_StartTime = SkTime::GetMSecs(); |
(...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2299 setenv("ANDROID_ROOT", "/android/device/data", 0); | 2299 setenv("ANDROID_ROOT", "/android/device/data", 0); |
2300 #endif | 2300 #endif |
2301 SkGraphics::Init(); | 2301 SkGraphics::Init(); |
2302 SkEvent::Init(); | 2302 SkEvent::Init(); |
2303 } | 2303 } |
2304 | 2304 |
2305 void application_term() { | 2305 void application_term() { |
2306 SkEvent::Term(); | 2306 SkEvent::Term(); |
2307 SkGraphics::Term(); | 2307 SkGraphics::Term(); |
2308 } | 2308 } |
OLD | NEW |