Remove SkPicture pointer from SkPicturePlayback
This CL simplifies the relationship between SkPicture and SkPicturePlayback by moving the path heap into SkPicturePlayback and removing SkPicturePlayback's SkPicture pointer.
R=mtklein@google.com, reed@google.com
Author: robertphillips@google.com
Review URL: https://codereview.chromium.org/334493002
diff --git a/debugger/QT/SkDebuggerGUI.cpp b/debugger/QT/SkDebuggerGUI.cpp
index 0f816ee..1873afc 100644
--- a/debugger/QT/SkDebuggerGUI.cpp
+++ b/debugger/QT/SkDebuggerGUI.cpp
@@ -160,23 +160,21 @@
// offsets to individual commands.
class SkTimedPicturePlayback : public SkPicturePlayback {
public:
- static SkTimedPicturePlayback* CreateFromStream(SkPicture* picture,
- SkStream* stream, const SkPictInfo& info,
+ static SkTimedPicturePlayback* CreateFromStream(SkStream* stream, const SkPictInfo& info,
SkPicture::InstallPixelRefProc proc,
const SkTDArray<bool>& deletedCommands) {
// Mimics SkPicturePlayback::CreateFromStream
SkAutoTDelete<SkTimedPicturePlayback> playback(SkNEW_ARGS(SkTimedPicturePlayback,
- (picture, deletedCommands, info)));
- if (!playback->parseStream(picture, stream, proc)) {
+ (deletedCommands, info)));
+ if (!playback->parseStream(stream, proc)) {
return NULL; // we're invalid
}
return playback.detach();
}
- SkTimedPicturePlayback(SkPicture* picture,
- const SkTDArray<bool>& deletedCommands,
+ SkTimedPicturePlayback(const SkTDArray<bool>& deletedCommands,
const SkPictInfo& info)
- : INHERITED(picture, info)
+ : INHERITED(info)
, fSkipCommands(deletedCommands)
, fTot(0.0)
, fCurCommand(0) {
@@ -272,21 +270,20 @@
return NULL;
}
- SkTimedPicture* newPict = SkNEW_ARGS(SkTimedPicture, (NULL, info.fWidth, info.fHeight));
// Check to see if there is a playback to recreate.
if (stream->readBool()) {
SkTimedPicturePlayback* playback = SkTimedPicturePlayback::CreateFromStream(
- newPict, stream,
+ stream,
info, proc,
deletedCommands);
if (NULL == playback) {
- SkDELETE(newPict);
return NULL;
}
- newPict->fPlayback = playback;
+
+ return SkNEW_ARGS(SkTimedPicture, (playback, info.fWidth, info.fHeight));
}
- return newPict;
+ return NULL;
}
void resetTimes() { ((SkTimedPicturePlayback*) fPlayback)->resetTimes(); }