| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #include "SkDebuggerGUI.h" | 8 #include "SkDebuggerGUI.h" |
| 9 #include "PictureRenderer.h" | 9 #include "PictureRenderer.h" |
| 10 #include "SkPictureData.h" | 10 #include "SkPictureData.h" |
| (...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 731 const QStringList files = dir.entryList(); | 731 const QStringList files = dir.entryList(); |
| 732 foreach (QString f, files) { | 732 foreach (QString f, files) { |
| 733 if (f.contains(r)) | 733 if (f.contains(r)) |
| 734 fDirectoryWidget.addItem(f); | 734 fDirectoryWidget.addItem(f); |
| 735 } | 735 } |
| 736 } | 736 } |
| 737 | 737 |
| 738 void SkDebuggerGUI::loadPicture(const SkString& fileName) { | 738 void SkDebuggerGUI::loadPicture(const SkString& fileName) { |
| 739 fFileName = fileName; | 739 fFileName = fileName; |
| 740 fLoading = true; | 740 fLoading = true; |
| 741 SkStream* stream = SkNEW_ARGS(SkFILEStream, (fileName.c_str())); | 741 SkAutoTDelete<SkStream> stream(SkNEW_ARGS(SkFILEStream, (fileName.c_str())))
; |
| 742 | 742 |
| 743 SkPicture* picture = SkPicture::CreateFromStream(stream); | 743 SkPicture* picture = SkPicture::CreateFromStream(stream); |
| 744 | 744 |
| 745 if (NULL == picture) { | 745 if (NULL == picture) { |
| 746 QMessageBox::critical(this, "Error loading file", "Couldn't read file, s
orry."); | 746 QMessageBox::critical(this, "Error loading file", "Couldn't read file, s
orry."); |
| 747 SkSafeUnref(stream); | |
| 748 return; | 747 return; |
| 749 } | 748 } |
| 750 | 749 |
| 751 fCanvasWidget.resetWidgetTransform(); | 750 fCanvasWidget.resetWidgetTransform(); |
| 752 fDebugger.loadPicture(picture); | 751 fDebugger.loadPicture(picture); |
| 753 | 752 |
| 754 fSkipCommands.setCount(fDebugger.getSize()); | 753 fSkipCommands.setCount(fDebugger.getSize()); |
| 755 for (int i = 0; i < fSkipCommands.count(); ++i) { | 754 for (int i = 0; i < fSkipCommands.count(); ++i) { |
| 756 fSkipCommands[i] = false; | 755 fSkipCommands[i] = false; |
| 757 } | 756 } |
| 758 | 757 |
| 759 SkSafeUnref(stream); | |
| 760 SkSafeUnref(picture); | 758 SkSafeUnref(picture); |
| 761 | 759 |
| 762 fActionProfile.setDisabled(false); | 760 fActionProfile.setDisabled(false); |
| 763 | 761 |
| 764 /* fDebugCanvas is reinitialized every load picture. Need it to retain value | 762 /* fDebugCanvas is reinitialized every load picture. Need it to retain value |
| 765 * of the visibility filter. | 763 * of the visibility filter. |
| 766 * TODO(chudy): This should be deprecated since fDebugger is not | 764 * TODO(chudy): This should be deprecated since fDebugger is not |
| 767 * recreated. | 765 * recreated. |
| 768 * */ | 766 * */ |
| 769 fDebugger.highlightCurrentCommand(fSettingsWidget.isVisibilityFilterEnabled(
)); | 767 fDebugger.highlightCurrentCommand(fSettingsWidget.isVisibilityFilterEnabled(
)); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 fCanvasWidget.drawTo(fPausedRow); | 852 fCanvasWidget.drawTo(fPausedRow); |
| 855 } else { | 853 } else { |
| 856 fCanvasWidget.drawTo(fListWidget.currentRow()); | 854 fCanvasWidget.drawTo(fListWidget.currentRow()); |
| 857 } | 855 } |
| 858 } | 856 } |
| 859 | 857 |
| 860 void SkDebuggerGUI::updateHit(int newHit) { | 858 void SkDebuggerGUI::updateHit(int newHit) { |
| 861 fCommandHitBox.setText(QString::number(newHit)); | 859 fCommandHitBox.setText(QString::number(newHit)); |
| 862 } | 860 } |
| 863 | 861 |
| OLD | NEW |