diff options
author | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-03-11 23:47:35 +0000 |
---|---|---|
committer | commit-bot@chromium.org <commit-bot@chromium.org@2bbb7eff-a529-9590-31e7-b0007b416f81> | 2014-03-11 23:47:35 +0000 |
commit | cc2890466625d2e5cc813053fce3ef5e519fb355 (patch) | |
tree | 3ca28c561eab6ae249bb2dd9ae3cb1bed0a9a979 /core/SkPictureRecord.cpp | |
parent | 0002d2f9d0487dca580621e41541728f844c55c1 (diff) | |
download | src-cc2890466625d2e5cc813053fce3ef5e519fb355.tar.gz |
Revert of Revert "De-virtualize SkCanvas save/restore." (https://codereview.chromium.org/194923008/)
Reason for revert:
Re-landing after roll fix.
Original issue's description:
> Revert "De-virtualize SkCanvas save/restore."
>
> (To allow a roll fix into the tree).
>
> This reverts commit edf702204be42c945254191f9f9cd6585b3d189b.
>
> R=halcanary@google.com
>
> Committed: https://code.google.com/p/skia/source/detail?r=13748
R=halcanary@google.com, fmalita@chromium.org
TBR=fmalita@chromium.org, halcanary@google.com
NOTREECHECKS=true
NOTRY=true
Author: fmalita@google.com
Review URL: https://codereview.chromium.org/196323003
git-svn-id: http://skia.googlecode.com/svn/trunk/src@13754 2bbb7eff-a529-9590-31e7-b0007b416f81
Diffstat (limited to 'core/SkPictureRecord.cpp')
-rw-r--r-- | core/SkPictureRecord.cpp | 24 |
1 files changed, 11 insertions, 13 deletions
diff --git a/core/SkPictureRecord.cpp b/core/SkPictureRecord.cpp index 08b69b85..497ce8ec 100644 --- a/core/SkPictureRecord.cpp +++ b/core/SkPictureRecord.cpp @@ -146,7 +146,7 @@ static inline uint32_t getPaintOffset(DrawType op, uint32_t opSize) { return gPaintOffsets[op] * sizeof(uint32_t) + overflow; } -int SkPictureRecord::save(SaveFlags flags) { +void SkPictureRecord::onSave(SaveFlags flags) { #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE fMCMgr.save(flags); @@ -156,7 +156,8 @@ int SkPictureRecord::save(SaveFlags flags) { fRestoreOffsetStack.push(-(int32_t)fWriter.bytesWritten()); this->recordSave(flags); #endif - return this->INHERITED::save(flags); + + this->INHERITED::onSave(flags); } void SkPictureRecord::recordSave(SaveFlags flags) { @@ -168,12 +169,11 @@ void SkPictureRecord::recordSave(SaveFlags flags) { this->validate(initialOffset, size); } -int SkPictureRecord::saveLayer(const SkRect* bounds, const SkPaint* paint, - SaveFlags flags) { +bool SkPictureRecord::onSaveLayer(const SkRect* bounds, const SkPaint* paint, + SaveFlags flags) { - int count; #ifdef SK_COLLAPSE_MATRIX_CLIP_STATE - count = fMCMgr.saveLayer(bounds, paint, flags); + fMCMgr.saveLayer(bounds, paint, flags); #else // record the offset to us, making it non-positive to distinguish a save // from a clip entry. @@ -184,15 +184,13 @@ int SkPictureRecord::saveLayer(const SkRect* bounds, const SkPaint* paint, } #endif - /* Don't actually call INHERITED::saveLayer, because that will try to allocate - an offscreen device (potentially very big) which we don't actually need + this->INHERITED::onSaveLayer(bounds, paint, flags); + /* No need for a (potentially very big) layer which we don't actually need at this time (and may not be able to afford since during record our clip starts out the size of the picture, which is often much larger than the size of the actual device we'll use during playback). */ - count = this->INHERITED::save(flags); - this->clipRectBounds(bounds, flags, NULL); - return count; + return false; } void SkPictureRecord::recordSaveLayer(const SkRect* bounds, const SkPaint* paint, @@ -605,7 +603,7 @@ static void apply_optimization_to_bbh(PictureRecordOptType opt, SkPictureStateTr } } -void SkPictureRecord::restore() { +void SkPictureRecord::onRestore() { // FIXME: SkDeferredCanvas needs to be refactored to respect // save/restore balancing so that the following test can be // turned on permanently. @@ -653,7 +651,7 @@ void SkPictureRecord::restore() { fRestoreOffsetStack.pop(); #endif - return this->INHERITED::restore(); + this->INHERITED::onRestore(); } void SkPictureRecord::recordRestore(bool fillInSkips) { |