OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
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 "SkCamera.h" | 8 #include "SkCamera.h" |
9 | 9 |
10 static SkScalar SkScalarDotDiv(int count, const SkScalar a[], int step_a, | 10 static SkScalar SkScalarDotDiv(int count, const SkScalar a[], int step_a, |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 | 284 |
285 Sk3DView::Sk3DView() { | 285 Sk3DView::Sk3DView() { |
286 fInitialRec.fMatrix.reset(); | 286 fInitialRec.fMatrix.reset(); |
287 fRec = &fInitialRec; | 287 fRec = &fInitialRec; |
288 } | 288 } |
289 | 289 |
290 Sk3DView::~Sk3DView() { | 290 Sk3DView::~Sk3DView() { |
291 Rec* rec = fRec; | 291 Rec* rec = fRec; |
292 while (rec != &fInitialRec) { | 292 while (rec != &fInitialRec) { |
293 Rec* next = rec->fNext; | 293 Rec* next = rec->fNext; |
294 SkDELETE(rec); | 294 delete rec; |
295 rec = next; | 295 rec = next; |
296 } | 296 } |
297 } | 297 } |
298 | 298 |
299 void Sk3DView::save() { | 299 void Sk3DView::save() { |
300 Rec* rec = SkNEW(Rec); | 300 Rec* rec = new Rec; |
301 rec->fNext = fRec; | 301 rec->fNext = fRec; |
302 rec->fMatrix = fRec->fMatrix; | 302 rec->fMatrix = fRec->fMatrix; |
303 fRec = rec; | 303 fRec = rec; |
304 } | 304 } |
305 | 305 |
306 void Sk3DView::restore() { | 306 void Sk3DView::restore() { |
307 SkASSERT(fRec != &fInitialRec); | 307 SkASSERT(fRec != &fInitialRec); |
308 Rec* next = fRec->fNext; | 308 Rec* next = fRec->fNext; |
309 SkDELETE(fRec); | 309 delete fRec; |
310 fRec = next; | 310 fRec = next; |
311 } | 311 } |
312 | 312 |
313 #ifdef SK_BUILD_FOR_ANDROID | 313 #ifdef SK_BUILD_FOR_ANDROID |
314 void Sk3DView::setCameraLocation(SkScalar x, SkScalar y, SkScalar z) { | 314 void Sk3DView::setCameraLocation(SkScalar x, SkScalar y, SkScalar z) { |
315 // the camera location is passed in inches, set in pt | 315 // the camera location is passed in inches, set in pt |
316 SkScalar lz = z * 72.0f; | 316 SkScalar lz = z * 72.0f; |
317 fCamera.fLocation.set(x * 72.0f, y * 72.0f, lz); | 317 fCamera.fLocation.set(x * 72.0f, y * 72.0f, lz); |
318 fCamera.fObserver.set(0, 0, lz); | 318 fCamera.fObserver.set(0, 0, lz); |
319 fCamera.update(); | 319 fCamera.update(); |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 } | 364 } |
365 | 365 |
366 #include "SkCanvas.h" | 366 #include "SkCanvas.h" |
367 | 367 |
368 void Sk3DView::applyToCanvas(SkCanvas* canvas) const { | 368 void Sk3DView::applyToCanvas(SkCanvas* canvas) const { |
369 SkMatrix matrix; | 369 SkMatrix matrix; |
370 | 370 |
371 this->getMatrix(&matrix); | 371 this->getMatrix(&matrix); |
372 canvas->concat(matrix); | 372 canvas->concat(matrix); |
373 } | 373 } |
OLD | NEW |