diff options
author | mtklein <mtklein@chromium.org> | 2015-04-21 15:23:59 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-04-21 15:24:00 -0700 |
commit | 98b8485a4cc911420e20af2670d21a5478a06264 (patch) | |
tree | 4a2fa7f3eba5368bd32656d4e1cffdfa8287f870 /src/utils/SkPictureUtils.cpp | |
parent | 5ae0e2b56373b67a0fe6a0f9d7a0373712d1fa63 (diff) |
O(1) SkPictureUtils::ApproxBytesUsed()
Chrome wants to call this more often, and it's quite slow today.
Seems like this could be clearer if SkPictureUtils::ApproxBytesUsed() were SkPicture::approxBytesUsed().
BUG=chromium:471873
Review URL: https://codereview.chromium.org/1090943004
Diffstat (limited to 'src/utils/SkPictureUtils.cpp')
-rw-r--r-- | src/utils/SkPictureUtils.cpp | 12 |
1 files changed, 1 insertions, 11 deletions
diff --git a/src/utils/SkPictureUtils.cpp b/src/utils/SkPictureUtils.cpp index be7c431946..a8a251c927 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; } |