Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1000)

Unified Diff: src/utils/SkPictureUtils.cpp

Issue 490253003: Implement SkPicture::bytesUsed() for SkRecord backend (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Unit test prevents bloat Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: src/utils/SkPictureUtils.cpp
diff --git a/src/utils/SkPictureUtils.cpp b/src/utils/SkPictureUtils.cpp
index dfa772a2da5be93e24bc645608c41052218f6822..337991e588f2974a802133c4526a93512fb9c191 100644
--- a/src/utils/SkPictureUtils.cpp
+++ b/src/utils/SkPictureUtils.cpp
@@ -5,6 +5,7 @@
* found in the LICENSE file.
*/
+#include "SkBBoxHierarchy.h"
#include "SkBitmapDevice.h"
#include "SkCanvas.h"
#include "SkData.h"
@@ -12,6 +13,7 @@
#include "SkPictureUtils.h"
#include "SkPixelRef.h"
#include "SkRRect.h"
+#include "SkRecord.h"
#include "SkShader.h"
class PixelRefSet {
@@ -215,3 +217,13 @@ SkData* SkPictureUtils::GatherPixelRefs(const SkPicture* pict, const SkRect& are
}
return data;
}
+
+size_t SkPictureUtils::approximateBytesUsed(const SkPicture* pict) {
+ size_t byteCount = sizeof(*pict);
+
+ byteCount += pict->fRecord->bytesUsed();
+ if (pict->fBBH.get()) {
+ byteCount += pict->fBBH->bytesUsed();
+ }
+ return byteCount;
+}

Powered by Google App Engine
This is Rietveld 408576698