diff options
author | 2012-09-27 20:31:31 +0000 | |
---|---|---|
committer | 2012-09-27 20:31:31 +0000 | |
commit | d86e7ab6044e4aba017cb126a26dd378eec9fcba (patch) | |
tree | db6283459541a83aacde094c8881fbe0830601fd /src/core/SkPictureRecord.cpp | |
parent | 7d44059b6ce099db117a70b8ea0929d7c7e4b02a (diff) |
remove call to setBitmapDevice (deprecated).
Review URL: https://codereview.appspot.com/6569070
git-svn-id: http://skia.googlecode.com/svn/trunk@5715 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'src/core/SkPictureRecord.cpp')
-rw-r--r-- | src/core/SkPictureRecord.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/core/SkPictureRecord.cpp b/src/core/SkPictureRecord.cpp index 944fd1898f..60e51d1829 100644 --- a/src/core/SkPictureRecord.cpp +++ b/src/core/SkPictureRecord.cpp @@ -15,10 +15,12 @@ #define HEAP_BLOCK_SIZE 4096 enum { + // just need a value that save or getSaveCount would never return kNoInitialSave = -1, }; -SkPictureRecord::SkPictureRecord(uint32_t flags) : +SkPictureRecord::SkPictureRecord(uint32_t flags, SkDevice* device) : + INHERITED(device), fBoundingHierarchy(NULL), fStateTree(NULL), fFlattenableHeap(HEAP_BLOCK_SIZE), @@ -33,12 +35,13 @@ SkPictureRecord::SkPictureRecord(uint32_t flags) : #endif fRestoreOffsetStack.setReserve(32); - fInitialSaveCount = kNoInitialSave; fBitmapHeap = SkNEW(SkBitmapHeap); fFlattenableHeap.setBitmapStorage(fBitmapHeap); fPathHeap = NULL; // lazy allocate fFirstSavedLayerIndex = kNoSavedLayerIndex; + + fInitialSaveCount = kNoInitialSave; } SkPictureRecord::~SkPictureRecord() { @@ -53,13 +56,8 @@ SkPictureRecord::~SkPictureRecord() { /////////////////////////////////////////////////////////////////////////////// SkDevice* SkPictureRecord::setDevice(SkDevice* device) { - SkASSERT(kNoInitialSave == fInitialSaveCount); - this->INHERITED::setDevice(device); - - // The bracketting save() call needs to be recorded after setting the - // device otherwise the clip stack will get messed-up - fInitialSaveCount = this->save(SkCanvas::kMatrixClip_SaveFlag); - return device; + SkASSERT(!"eeek, don't try to change the device on a recording canvas"); + return this->INHERITED::setDevice(device); } int SkPictureRecord::save(SaveFlags flags) { @@ -321,6 +319,13 @@ void SkPictureRecord::fillRestoreOffsetPlaceholdersForCurrentStackLevel( #endif } +void SkPictureRecord::beginRecording() { + // we have to call this *after* our constructor, to ensure that it gets + // recorded. This is balanced by restoreToCount() call from endRecording, + // which in-turn calls our overridden restore(), so those get recorded too. + fInitialSaveCount = this->save(kMatrixClip_SaveFlag); +} + void SkPictureRecord::endRecording() { SkASSERT(kNoInitialSave != fInitialSaveCount); this->restoreToCount(fInitialSaveCount); |