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

Unified Diff: src/core/SkRecorder.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/SkRecorder.h ('k') | src/core/SkVarAlloc.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkRecorder.cpp
diff --git a/src/core/SkRecorder.cpp b/src/core/SkRecorder.cpp
index 8684a8e2ebf7cb516ff8c8b9f8aa975aedd019e8..0a2d43edbf22c74956bdd17b83c70ec40b686e8c 100644
--- a/src/core/SkRecorder.cpp
+++ b/src/core/SkRecorder.cpp
@@ -5,9 +5,10 @@
* found in the LICENSE file.
*/
-#include "SkRecorder.h"
#include "SkPatchUtils.h"
#include "SkPicture.h"
+#include "SkPictureUtils.h"
+#include "SkRecorder.h"
SkDrawableList::~SkDrawableList() {
fArray.unrefAll();
@@ -33,10 +34,12 @@ void SkDrawableList::append(SkDrawable* drawable) {
SkRecorder::SkRecorder(SkRecord* record, int width, int height)
: SkCanvas(SkIRect::MakeWH(width, height), SkCanvas::kConservativeRasterClip_InitFlag)
+ , fApproxBytesUsedBySubPictures(0)
, fRecord(record) {}
SkRecorder::SkRecorder(SkRecord* record, const SkRect& bounds)
: SkCanvas(bounds.roundOut(), SkCanvas::kConservativeRasterClip_InitFlag)
+ , fApproxBytesUsedBySubPictures(0)
, fRecord(record) {}
void SkRecorder::reset(SkRecord* record, const SkRect& bounds) {
@@ -47,6 +50,7 @@ void SkRecorder::reset(SkRecord* record, const SkRect& bounds) {
void SkRecorder::forgetRecord() {
fDrawableList.reset(NULL);
+ fApproxBytesUsedBySubPictures = 0;
fRecord = NULL;
}
@@ -248,6 +252,7 @@ void SkRecorder::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
}
void SkRecorder::onDrawPicture(const SkPicture* pic, const SkMatrix* matrix, const SkPaint* paint) {
+ fApproxBytesUsedBySubPictures += SkPictureUtils::ApproximateBytesUsed(pic);
APPEND(DrawPicture, this->copy(paint), pic, matrix ? *matrix : SkMatrix::I());
}
« no previous file with comments | « src/core/SkRecorder.h ('k') | src/core/SkVarAlloc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698