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

Side by Side Diff: src/utils/SkCamera.cpp

Issue 85463005: remove SkFloatToScalar macro (Closed) Base URL: https://skia.googlecode.com/svn/trunk
Patch Set: add flag to expose SkFloatToScalar to chromium Created 7 years 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 | Annotate | Revision Log
« no previous file with comments | « src/ports/SkFontHost_win_dw.cpp ('k') | src/utils/SkPathUtils.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 /* 2 /*
3 * Copyright 2006 The Android Open Source Project 3 * Copyright 2006 The Android Open Source Project
4 * 4 *
5 * Use of this source code is governed by a BSD-style license that can be 5 * Use of this source code is governed by a BSD-style license that can be
6 * found in the LICENSE file. 6 * found in the LICENSE file.
7 */ 7 */
8 8
9 9
10 #include "SkCamera.h" 10 #include "SkCamera.h"
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
358 void Sk3DView::restore() { 358 void Sk3DView::restore() {
359 SkASSERT(fRec != &fInitialRec); 359 SkASSERT(fRec != &fInitialRec);
360 Rec* next = fRec->fNext; 360 Rec* next = fRec->fNext;
361 SkDELETE(fRec); 361 SkDELETE(fRec);
362 fRec = next; 362 fRec = next;
363 } 363 }
364 364
365 #ifdef SK_BUILD_FOR_ANDROID 365 #ifdef SK_BUILD_FOR_ANDROID
366 void Sk3DView::setCameraLocation(SkScalar x, SkScalar y, SkScalar z) { 366 void Sk3DView::setCameraLocation(SkScalar x, SkScalar y, SkScalar z) {
367 // the camera location is passed in inches, set in pt 367 // the camera location is passed in inches, set in pt
368 SkScalar lz = z * SkFloatToScalar(72.0f); 368 SkScalar lz = z * 72.0f;
369 fCamera.fLocation.set(x * SkFloatToScalar(72.0f), y * SkFloatToScalar(72.0f) , lz); 369 fCamera.fLocation.set(x * 72.0f, y * 72.0f, lz);
370 fCamera.fObserver.set(0, 0, lz); 370 fCamera.fObserver.set(0, 0, lz);
371 fCamera.update(); 371 fCamera.update();
372 372
373 } 373 }
374 374
375 SkScalar Sk3DView::getCameraLocationX() { 375 SkScalar Sk3DView::getCameraLocationX() {
376 return fCamera.fLocation.fX / SkFloatToScalar(72.0f); 376 return fCamera.fLocation.fX / 72.0f;
377 } 377 }
378 378
379 SkScalar Sk3DView::getCameraLocationY() { 379 SkScalar Sk3DView::getCameraLocationY() {
380 return fCamera.fLocation.fY / SkFloatToScalar(72.0f); 380 return fCamera.fLocation.fY / 72.0f;
381 } 381 }
382 382
383 SkScalar Sk3DView::getCameraLocationZ() { 383 SkScalar Sk3DView::getCameraLocationZ() {
384 return fCamera.fLocation.fZ / SkFloatToScalar(72.0f); 384 return fCamera.fLocation.fZ / 72.0f;
385 } 385 }
386 #endif 386 #endif
387 387
388 void Sk3DView::translate(SkScalar x, SkScalar y, SkScalar z) { 388 void Sk3DView::translate(SkScalar x, SkScalar y, SkScalar z) {
389 fRec->fMatrix.preTranslate(x, y, z); 389 fRec->fMatrix.preTranslate(x, y, z);
390 } 390 }
391 391
392 void Sk3DView::rotateX(SkScalar deg) { 392 void Sk3DView::rotateX(SkScalar deg) {
393 fRec->fMatrix.preRotateX(deg); 393 fRec->fMatrix.preRotateX(deg);
394 } 394 }
(...skipping 21 matching lines...) Expand all
416 } 416 }
417 417
418 #include "SkCanvas.h" 418 #include "SkCanvas.h"
419 419
420 void Sk3DView::applyToCanvas(SkCanvas* canvas) const { 420 void Sk3DView::applyToCanvas(SkCanvas* canvas) const {
421 SkMatrix matrix; 421 SkMatrix matrix;
422 422
423 this->getMatrix(&matrix); 423 this->getMatrix(&matrix);
424 canvas->concat(matrix); 424 canvas->concat(matrix);
425 } 425 }
OLDNEW
« no previous file with comments | « src/ports/SkFontHost_win_dw.cpp ('k') | src/utils/SkPathUtils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698