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

Unified Diff: src/core/SkPictureRecorder.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/SkPicture.cpp ('k') | src/core/SkRecorder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkPictureRecorder.cpp
diff --git a/src/core/SkPictureRecorder.cpp b/src/core/SkPictureRecorder.cpp
index f622e66c842658df175a8b6fe2db7f411bb462b0..22b1ee3eac13ac6a8732bec8d9927695c33db986 100644
--- a/src/core/SkPictureRecorder.cpp
+++ b/src/core/SkPictureRecorder.cpp
@@ -9,10 +9,11 @@
#include "SkDrawable.h"
#include "SkLayerInfo.h"
#include "SkPictureRecorder.h"
+#include "SkPictureUtils.h"
#include "SkRecord.h"
#include "SkRecordDraw.h"
-#include "SkRecorder.h"
#include "SkRecordOpts.h"
+#include "SkRecorder.h"
#include "SkTypes.h"
SkPictureRecorder::SkPictureRecorder() {
@@ -72,7 +73,12 @@ SkPicture* SkPictureRecorder::endRecordingAsPicture() {
fCullRect = bbhBound;
}
- SkPicture* pict = SkNEW_ARGS(SkPicture, (fCullRect, fRecord, pictList, fBBH));
+ size_t subPictureBytes = fRecorder->approxBytesUsedBySubPictures();
+ for (int i = 0; pictList && i < pictList->count(); i++) {
+ subPictureBytes += SkPictureUtils::ApproximateBytesUsed(pictList->begin()[i]);
+ }
+ SkPicture* pict =
+ SkNEW_ARGS(SkPicture, (fCullRect, fRecord, pictList, fBBH, subPictureBytes));
if (saveLayerData) {
pict->EXPERIMENTAL_addAccelData(saveLayerData);
@@ -153,7 +159,12 @@ protected:
SkRecordComputeLayers(fBounds, *fRecord, pictList, bbh, saveLayerData);
}
- SkPicture* pict = SkNEW_ARGS(SkPicture, (fBounds, fRecord, pictList, fBBH));
+ size_t subPictureBytes = 0;
+ for (int i = 0; pictList && i < pictList->count(); i++) {
+ subPictureBytes += SkPictureUtils::ApproximateBytesUsed(pictList->begin()[i]);
+ }
+ SkPicture* pict =
+ SkNEW_ARGS(SkPicture, (fBounds, fRecord, pictList, fBBH, subPictureBytes));
if (saveLayerData) {
pict->EXPERIMENTAL_addAccelData(saveLayerData);
« no previous file with comments | « src/core/SkPicture.cpp ('k') | src/core/SkRecorder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698