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

Unified Diff: src/core/SkPictureRecorder.cpp

Issue 1130283004: Revert of Sketch splitting SkPicture into an interface and SkBigPicture. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 7 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/SkPictureCommon.h ('k') | src/core/SkRecordDraw.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 c110e0a2db3e9b8b9282a841224478fa74054850..282e2c22dde20025b8d9e50da90cb32e6f1775cd 100644
--- a/src/core/SkPictureRecorder.cpp
+++ b/src/core/SkPictureRecorder.cpp
@@ -5,7 +5,6 @@
* found in the LICENSE file.
*/
-#include "SkBigPicture.h"
#include "SkData.h"
#include "SkDrawable.h"
#include "SkLayerInfo.h"
@@ -19,7 +18,7 @@
SkPictureRecorder::SkPictureRecorder() {
fActivelyRecording = false;
- fRecorder.reset(SkNEW_ARGS(SkRecorder, (nullptr, SkRect::MakeWH(0,0), &fMiniRecorder)));
+ fRecorder.reset(SkNEW_ARGS(SkRecorder, (nullptr, SkRect::MakeWH(0,0))));
}
SkPictureRecorder::~SkPictureRecorder() {}
@@ -35,10 +34,8 @@
SkASSERT(fBBH.get());
}
- if (!fRecord) {
- fRecord.reset(SkNEW(SkRecord));
- }
- fRecorder->reset(fRecord.get(), cullRect, &fMiniRecorder);
+ fRecord.reset(SkNEW(SkRecord));
+ fRecorder->reset(fRecord.get(), cullRect);
fActivelyRecording = true;
return this->getRecordingCanvas();
}
@@ -50,23 +47,19 @@
SkPicture* SkPictureRecorder::endRecordingAsPicture() {
fActivelyRecording = false;
fRecorder->restoreToCount(1); // If we were missing any restores, add them now.
-
- if (fRecord->count() == 0) {
- return fMiniRecorder.detachAsPicture(fCullRect);
- }
-
// TODO: delay as much of this work until just before first playback?
SkRecordOptimize(fRecord);
SkAutoTUnref<SkLayerInfo> saveLayerData;
if (fBBH && (fFlags & kComputeSaveLayerInfo_RecordFlag)) {
- saveLayerData.reset(SkNEW(SkLayerInfo));
+ SkPicture::AccelData::Key key = SkLayerInfo::ComputeKey();
+
+ saveLayerData.reset(SkNEW_ARGS(SkLayerInfo, (key)));
}
SkDrawableList* drawableList = fRecorder->getDrawableList();
- SkBigPicture::SnapshotArray* pictList =
- drawableList ? drawableList->newDrawableSnapshot() : NULL;
+ SkPicture::SnapshotArray* pictList = drawableList ? drawableList->newDrawableSnapshot() : NULL;
if (fBBH.get()) {
if (saveLayerData) {
@@ -84,12 +77,12 @@
for (int i = 0; pictList && i < pictList->count(); i++) {
subPictureBytes += SkPictureUtils::ApproximateBytesUsed(pictList->begin()[i]);
}
- return SkNEW_ARGS(SkBigPicture, (fCullRect,
- fRecord.detach(),
- pictList,
- fBBH.detach(),
- saveLayerData.detach(),
- subPictureBytes));
+ return SkNEW_ARGS(SkPicture, (fCullRect,
+ fRecord.detach(),
+ pictList,
+ fBBH.detach(),
+ saveLayerData.detach(),
+ subPictureBytes));
}
void SkPictureRecorder::partialReplay(SkCanvas* canvas) const {
@@ -140,7 +133,7 @@
}
SkPicture* onNewPictureSnapshot() override {
- SkBigPicture::SnapshotArray* pictList = NULL;
+ SkPicture::SnapshotArray* pictList = NULL;
if (fDrawableList) {
// TODO: should we plumb-down the BBHFactory and recordFlags from our host
// PictureRecorder?
@@ -150,7 +143,9 @@
SkAutoTUnref<SkLayerInfo> saveLayerData;
if (fBBH && fDoSaveLayerInfo) {
- saveLayerData.reset(SkNEW(SkLayerInfo));
+ SkPicture::AccelData::Key key = SkLayerInfo::ComputeKey();
+
+ saveLayerData.reset(SkNEW_ARGS(SkLayerInfo, (key)));
SkBBoxHierarchy* bbh = NULL; // we've already computed fBBH (received in constructor)
// TODO: update saveLayer info computation to reuse the already computed
@@ -162,22 +157,20 @@
for (int i = 0; pictList && i < pictList->count(); i++) {
subPictureBytes += SkPictureUtils::ApproximateBytesUsed(pictList->begin()[i]);
}
- // SkBigPicture will take ownership of a ref on both fRecord and fBBH.
+ // SkPicture will take ownership of a ref on both fRecord and fBBH.
// We're not willing to give up our ownership, so we must ref them for SkPicture.
- return SkNEW_ARGS(SkBigPicture, (fBounds,
- SkRef(fRecord.get()),
- pictList,
- SkSafeRef(fBBH.get()),
- saveLayerData.detach(),
- subPictureBytes));
+ return SkNEW_ARGS(SkPicture, (fBounds,
+ SkRef(fRecord.get()),
+ pictList,
+ SkSafeRef(fBBH.get()),
+ saveLayerData.detach(),
+ subPictureBytes));
}
};
SkDrawable* SkPictureRecorder::endRecordingAsDrawable() {
fActivelyRecording = false;
- fRecorder->flushMiniRecorder();
fRecorder->restoreToCount(1); // If we were missing any restores, add them now.
-
// TODO: delay as much of this work until just before first playback?
SkRecordOptimize(fRecord);
« no previous file with comments | « src/core/SkPictureCommon.h ('k') | src/core/SkRecordDraw.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698