Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: samplecode/SampleApp.cpp

Issue 1138263002: Revert of stop calling SkScalarDiv (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « include/core/SkScalar.h ('k') | samplecode/SampleStringArt.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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 }
OLDNEW
« no previous file with comments | « include/core/SkScalar.h ('k') | samplecode/SampleStringArt.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698