Fix saving modified skp from debugger

https://codereview.appspot.com/7181048/



git-svn-id: http://skia.googlecode.com/svn/trunk@7314 2bbb7eff-a529-9590-31e7-b0007b416f81
This commit is contained in:
robertphillips@google.com 2013-01-22 18:03:56 +00:00
parent 3f5ecd6cb4
commit 25bc2f86c2
3 changed files with 11 additions and 8 deletions

View File

@ -555,7 +555,9 @@ void SkDebuggerGUI::drawComplete() {
void SkDebuggerGUI::saveToFile(const SkString& filename) {
SkFILEWStream file(filename.c_str());
fDebugger.makePicture()->serialize(&file);
SkAutoTUnref<SkPicture> copy(fDebugger.copyPicture());
copy->serialize(&file);
}
void SkDebuggerGUI::loadFile(QListWidgetItem *item) {

View File

@ -34,11 +34,12 @@ void SkDebugger::loadPicture(SkPicture* picture) {
SkRefCnt_SafeAssign(fPicture, picture);
}
SkPicture* SkDebugger::makePicture() {
SkSafeUnref(fPicture);
fPicture = new SkPicture();
SkCanvas* canvas = fPicture->beginRecording(fPictureWidth, fPictureHeight);
SkPicture* SkDebugger::copyPicture() {
// We can't just call clone here since we want to removed the "deleted"
// commands. Playing back will strip those out.
SkPicture* newPicture = new SkPicture;
SkCanvas* canvas = newPicture->beginRecording(fPictureWidth, fPictureHeight);
fDebugCanvas->draw(canvas);
fPicture->endRecording();
return fPicture;
newPicture->endRecording();
return newPicture;
}

View File

@ -60,7 +60,7 @@ public:
void loadPicture(SkPicture* picture);
SkPicture* makePicture();
SkPicture* copyPicture();
int getSize() {
return fDebugCanvas->getSize();