OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2008 The Android Open Source Project | 2 * Copyright 2008 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 "SkCanvas.h" | 8 #include "SkCanvas.h" |
9 #include "SkCanvasDrawable.h" | 9 #include "SkCanvasDrawable.h" |
10 #include "SkCanvasPriv.h" | 10 #include "SkCanvasPriv.h" |
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
512 | 512 |
513 SkCanvas::SkCanvas(SkBaseDevice* device) | 513 SkCanvas::SkCanvas(SkBaseDevice* device) |
514 : fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage)) | 514 : fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage)) |
515 , fProps(SkSurfaceProps::kLegacyFontHost_InitType) | 515 , fProps(SkSurfaceProps::kLegacyFontHost_InitType) |
516 { | 516 { |
517 inc_canvas(); | 517 inc_canvas(); |
518 | 518 |
519 this->init(device, kDefault_InitFlags); | 519 this->init(device, kDefault_InitFlags); |
520 } | 520 } |
521 | 521 |
522 SkCanvas::SkCanvas(const SkBitmap& bitmap, const SkSurfaceProps& props) | 522 SkCanvas::SkCanvas(const SkBitmap& bitmap, const SkSurfaceProps* props) |
523 : fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage)) | 523 : fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage)) |
524 , fProps(props) | 524 , fProps(SkSurfacePropsCopyOrDefault(props)) |
525 { | 525 { |
526 inc_canvas(); | 526 inc_canvas(); |
527 | 527 |
528 SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (bitmap))); | |
529 this->init(device, kDefault_InitFlags); | |
530 } | |
531 | |
532 SkCanvas::SkCanvas(const SkBitmap& bitmap) | |
533 : fMCStack(sizeof(MCRec), fMCRecStorage, sizeof(fMCRecStorage)) | |
534 , fProps(SkSurfaceProps::kLegacyFontHost_InitType) | |
535 { | |
536 inc_canvas(); | |
537 | |
538 SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (bitmap))); | 528 SkAutoTUnref<SkBaseDevice> device(SkNEW_ARGS(SkBitmapDevice, (bitmap))); |
539 this->init(device, kDefault_InitFlags); | 529 this->init(device, kDefault_InitFlags); |
540 } | 530 } |
541 | 531 |
542 SkCanvas::~SkCanvas() { | 532 SkCanvas::~SkCanvas() { |
543 // free up the contents of our deque | 533 // free up the contents of our deque |
544 this->restoreToCount(1); // restore everything but the last | 534 this->restoreToCount(1); // restore everything but the last |
545 | 535 |
546 this->internalRestore(); // restore the last, since we're going away | 536 this->internalRestore(); // restore the last, since we're going away |
547 | 537 |
(...skipping 2028 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2576 } | 2566 } |
2577 | 2567 |
2578 if (matrix) { | 2568 if (matrix) { |
2579 canvas->concat(*matrix); | 2569 canvas->concat(*matrix); |
2580 } | 2570 } |
2581 } | 2571 } |
2582 | 2572 |
2583 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { | 2573 SkAutoCanvasMatrixPaint::~SkAutoCanvasMatrixPaint() { |
2584 fCanvas->restoreToCount(fSaveCount); | 2574 fCanvas->restoreToCount(fSaveCount); |
2585 } | 2575 } |
OLD | NEW |