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

Unified Diff: src/utils/SkPictureUtils.cpp

Issue 1090943004: O(1) SkPictureUtils::ApproxBytesUsed() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: const Created 5 years, 8 months 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
« no previous file with comments | « src/core/SkVarAlloc.cpp ('k') | tests/PictureTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/utils/SkPictureUtils.cpp
diff --git a/src/utils/SkPictureUtils.cpp b/src/utils/SkPictureUtils.cpp
index be7c431946c9d68d97df2f87b59febbe770ee04d..a8a251c92753c7d9f599475b71ba99dfc896a8c7 100644
--- a/src/utils/SkPictureUtils.cpp
+++ b/src/utils/SkPictureUtils.cpp
@@ -12,13 +12,6 @@
#include "SkRecord.h"
#include "SkShader.h"
-struct MeasureRecords {
- template <typename T> size_t operator()(const T& op) { return 0; }
- size_t operator()(const SkRecords::DrawPicture& op) {
- return SkPictureUtils::ApproximateBytesUsed(op.picture);
- }
-};
-
size_t SkPictureUtils::ApproximateBytesUsed(const SkPicture* pict) {
size_t byteCount = sizeof(*pict);
@@ -26,10 +19,7 @@ size_t SkPictureUtils::ApproximateBytesUsed(const SkPicture* pict) {
if (pict->fBBH.get()) {
byteCount += pict->fBBH->bytesUsed();
}
- MeasureRecords visitor;
- for (unsigned curOp = 0; curOp < pict->fRecord->count(); curOp++) {
- byteCount += pict->fRecord->visit<size_t>(curOp, visitor);
- }
+ byteCount += pict->fApproxBytesUsedBySubPictures;
return byteCount;
}
« no previous file with comments | « src/core/SkVarAlloc.cpp ('k') | tests/PictureTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698