Index: src/utils/SkPictureUtils.cpp |
diff --git a/src/utils/SkPictureUtils.cpp b/src/utils/SkPictureUtils.cpp |
index 85d523f46c566f7873b656e809d5d22725230579..e3c959ea3032881ea750c7abeb3d8c8358b9cf1d 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 { |
@@ -218,3 +220,20 @@ SkData* SkPictureUtils::GatherPixelRefs(const SkPicture* pict, const SkRect& are |
} |
return data; |
} |
+ |
+size_t SkPictureUtils::approximateBytesUsed(const SkPicture* pict) { |
+ size_t byteCount = sizeof(*pict); |
+ |
+ // No support for old SkPicture backend |
+ if (!pict->fRecord.get()) { |
mtklein
2014/11/17 20:19:32
You can assume fRecord now.
|
+ return 0; |
+ } |
+ |
+ byteCount += pict->fRecord->bytesUsed(); |
+ if (pict->fBBH.get()) { |
+ byteCount += pict->fBBH->bytesUsed(); |
+ } |
+ return byteCount; |
+} |
+ |
+ |