diff options
author | Mike Reed <reed@google.com> | 2017-12-23 20:54:53 -0500 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2017-12-24 13:40:41 +0000 |
commit | bfc11853a88cda6951ae97399577fadadf2adcd5 (patch) | |
tree | b69901d8d0513b28074c4303edad3005eaa8f58a /src/core | |
parent | 3c678ffe2ca1099e37d3dbbf2984362551fba75e (diff) |
remove approxbytes api from SkPicture
Bug: skia:
Change-Id: I292bc9ab52fe8df3ce97a2ad4b06085b0332b19d
Reviewed-on: https://skia-review.googlesource.com/89440
Reviewed-by: Mike Reed <reed@google.com>
Commit-Queue: Mike Reed <reed@google.com>
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkBigPicture.cpp | 11 | ||||
-rw-r--r-- | src/core/SkBigPicture.h | 5 | ||||
-rw-r--r-- | src/core/SkMiniRecorder.cpp | 2 | ||||
-rw-r--r-- | src/core/SkPictureRecorder.cpp | 7 | ||||
-rw-r--r-- | src/core/SkRecordedDrawable.cpp | 7 | ||||
-rw-r--r-- | src/core/SkRecorder.cpp | 1 |
6 files changed, 5 insertions, 28 deletions
diff --git a/src/core/SkBigPicture.cpp b/src/core/SkBigPicture.cpp index 2ae9248d47..62f54e08bb 100644 --- a/src/core/SkBigPicture.cpp +++ b/src/core/SkBigPicture.cpp @@ -15,10 +15,8 @@ SkBigPicture::SkBigPicture(const SkRect& cull, SkRecord* record, SnapshotArray* drawablePicts, - SkBBoxHierarchy* bbh, - size_t approxBytesUsedBySubPictures) + SkBBoxHierarchy* bbh) : fCullRect(cull) - , fApproxBytesUsedBySubPictures(approxBytesUsedBySubPictures) , fRecord(record) // Take ownership of caller's ref. , fDrawablePicts(drawablePicts) // Take ownership. , fBBH(bbh) // Take ownership of caller's ref. @@ -54,12 +52,7 @@ void SkBigPicture::partialPlayback(SkCanvas* canvas, } SkRect SkBigPicture::cullRect() const { return fCullRect; } -int SkBigPicture::approximateOpCount() const { return fRecord->count(); } -size_t SkBigPicture::approximateBytesUsed() const { - size_t bytes = sizeof(*this) + fRecord->bytesUsed() + fApproxBytesUsedBySubPictures; - if (fBBH) { bytes += fBBH->bytesUsed(); } - return bytes; -} +int SkBigPicture::approximateOpCount() const { return fRecord->count(); } int SkBigPicture::drawableCount() const { return fDrawablePicts ? fDrawablePicts->count() : 0; diff --git a/src/core/SkBigPicture.h b/src/core/SkBigPicture.h index cbe492cc22..6edf4004c1 100644 --- a/src/core/SkBigPicture.h +++ b/src/core/SkBigPicture.h @@ -36,15 +36,13 @@ public: SkBigPicture(const SkRect& cull, SkRecord*, // We take ownership of the caller's ref. SnapshotArray*, // We take exclusive ownership. - SkBBoxHierarchy*, // We take ownership of the caller's ref. - size_t approxBytesUsedBySubPictures); + SkBBoxHierarchy*); // We take ownership of the caller's ref. // SkPicture overrides void playback(SkCanvas*, AbortCallback*) const override; SkRect cullRect() const override; int approximateOpCount() const override; - size_t approximateBytesUsed() const override; const SkBigPicture* asSkBigPicture() const override { return this; } // Used by GrLayerHoister @@ -61,7 +59,6 @@ private: SkPicture const* const* drawablePicts() const; const SkRect fCullRect; - const size_t fApproxBytesUsedBySubPictures; sk_sp<const SkRecord> fRecord; std::unique_ptr<const SnapshotArray> fDrawablePicts; sk_sp<const SkBBoxHierarchy> fBBH; diff --git a/src/core/SkMiniRecorder.cpp b/src/core/SkMiniRecorder.cpp index ec089373e1..deda976bd0 100644 --- a/src/core/SkMiniRecorder.cpp +++ b/src/core/SkMiniRecorder.cpp @@ -20,7 +20,6 @@ class SkEmptyPicture final : public SkPicture { public: void playback(SkCanvas*, AbortCallback*) const override { } - size_t approximateBytesUsed() const override { return sizeof(*this); } int approximateOpCount() const override { return 0; } SkRect cullRect() const override { return SkRect::MakeEmpty(); } }; @@ -53,7 +52,6 @@ public: SkRecords::Draw(c, nullptr, nullptr, 0, nullptr)(fOp); } - size_t approximateBytesUsed() const override { return sizeof(*this); } int approximateOpCount() const override { return 1; } SkRect cullRect() const override { return fCull; } diff --git a/src/core/SkPictureRecorder.cpp b/src/core/SkPictureRecorder.cpp index a37cd4826c..6c23cc075e 100644 --- a/src/core/SkPictureRecorder.cpp +++ b/src/core/SkPictureRecorder.cpp @@ -83,12 +83,7 @@ sk_sp<SkPicture> SkPictureRecorder::finishRecordingAsPicture(uint32_t finishFlag fCullRect = bbhBound; } - size_t subPictureBytes = fRecorder->approxBytesUsedBySubPictures(); - for (int i = 0; pictList && i < pictList->count(); i++) { - subPictureBytes += pictList->begin()[i]->approximateBytesUsed(); - } - return sk_make_sp<SkBigPicture>(fCullRect, fRecord.release(), pictList, fBBH.release(), - subPictureBytes); + return sk_make_sp<SkBigPicture>(fCullRect, fRecord.release(), pictList, fBBH.release()); } sk_sp<SkPicture> SkPictureRecorder::finishRecordingAsPictureWithCull(const SkRect& cullRect, diff --git a/src/core/SkRecordedDrawable.cpp b/src/core/SkRecordedDrawable.cpp index 342701a365..bb57885d5d 100644 --- a/src/core/SkRecordedDrawable.cpp +++ b/src/core/SkRecordedDrawable.cpp @@ -31,14 +31,9 @@ SkPicture* SkRecordedDrawable::onNewPictureSnapshot() { pictList = fDrawableList->newDrawableSnapshot(); } - size_t subPictureBytes = 0; - for (int i = 0; pictList && i < pictList->count(); i++) { - subPictureBytes += pictList->begin()[i]->approximateBytesUsed(); - } // SkBigPicture will take ownership of a ref on both fRecord and fBBH. // We're not willing to give up our ownership, so we must ref them for SkPicture. - return new SkBigPicture(fBounds, SkRef(fRecord.get()), pictList, SkSafeRef(fBBH.get()), - subPictureBytes); + return new SkBigPicture(fBounds, SkRef(fRecord.get()), pictList, SkSafeRef(fBBH.get())); } void SkRecordedDrawable::flatten(SkWriteBuffer& buffer) const { diff --git a/src/core/SkRecorder.cpp b/src/core/SkRecorder.cpp index 9374b60264..26fcaa4af4 100644 --- a/src/core/SkRecorder.cpp +++ b/src/core/SkRecorder.cpp @@ -302,7 +302,6 @@ void SkRecorder::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y, void SkRecorder::onDrawPicture(const SkPicture* pic, const SkMatrix* matrix, const SkPaint* paint) { if (fDrawPictureMode == Record_DrawPictureMode) { - fApproxBytesUsedBySubPictures += pic->approximateBytesUsed(); APPEND(DrawPicture, this->copy(paint), sk_ref_sp(pic), matrix ? *matrix : SkMatrix::I()); } else { SkASSERT(fDrawPictureMode == Playback_DrawPictureMode); |