| 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 761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 } | 772 } |
| 773 | 773 |
| 774 void SkDebuggerGUI::setupListWidget() { | 774 void SkDebuggerGUI::setupListWidget() { |
| 775 | 775 |
| 776 SkASSERT(!strcmp("Save", | 776 SkASSERT(!strcmp("Save", |
| 777 SkDrawCommand::GetCommandString(SkDrawCommand::kSave_OpType
))); | 777 SkDrawCommand::GetCommandString(SkDrawCommand::kSave_OpType
))); |
| 778 SkASSERT(!strcmp("SaveLayer", | 778 SkASSERT(!strcmp("SaveLayer", |
| 779 SkDrawCommand::GetCommandString(SkDrawCommand::kSaveLayer_O
pType))); | 779 SkDrawCommand::GetCommandString(SkDrawCommand::kSaveLayer_O
pType))); |
| 780 SkASSERT(!strcmp("Restore", | 780 SkASSERT(!strcmp("Restore", |
| 781 SkDrawCommand::GetCommandString(SkDrawCommand::kRestore_OpT
ype))); | 781 SkDrawCommand::GetCommandString(SkDrawCommand::kRestore_OpT
ype))); |
| 782 SkASSERT(!strcmp("BeginCommentGroup", | |
| 783 SkDrawCommand::GetCommandString(SkDrawCommand::kBeginCommen
tGroup_OpType))); | |
| 784 SkASSERT(!strcmp("EndCommentGroup", | |
| 785 SkDrawCommand::GetCommandString(SkDrawCommand::kEndCommentG
roup_OpType))); | |
| 786 SkASSERT(!strcmp("BeginDrawPicture", | 782 SkASSERT(!strcmp("BeginDrawPicture", |
| 787 SkDrawCommand::GetCommandString(SkDrawCommand::kBeginDrawPi
cture_OpType))); | 783 SkDrawCommand::GetCommandString(SkDrawCommand::kBeginDrawPi
cture_OpType))); |
| 788 SkASSERT(!strcmp("EndDrawPicture", | 784 SkASSERT(!strcmp("EndDrawPicture", |
| 789 SkDrawCommand::GetCommandString(SkDrawCommand::kEndDrawPict
ure_OpType))); | 785 SkDrawCommand::GetCommandString(SkDrawCommand::kEndDrawPict
ure_OpType))); |
| 790 | 786 |
| 791 fListWidget.clear(); | 787 fListWidget.clear(); |
| 792 int counter = 0; | 788 int counter = 0; |
| 793 int indent = 0; | 789 int indent = 0; |
| 794 for (int i = 0; i < fDebugger.getSize(); i++) { | 790 for (int i = 0; i < fDebugger.getSize(); i++) { |
| 795 QListWidgetItem *item = new QListWidgetItem(); | 791 QListWidgetItem *item = new QListWidgetItem(); |
| 796 SkDrawCommand* command = fDebugger.getDrawCommandAt(i); | 792 SkDrawCommand* command = fDebugger.getDrawCommandAt(i); |
| 797 SkString commandString = command->toString(); | 793 SkString commandString = command->toString(); |
| 798 item->setData(Qt::DisplayRole, commandString.c_str()); | 794 item->setData(Qt::DisplayRole, commandString.c_str()); |
| 799 item->setData(Qt::UserRole + 1, counter++); | 795 item->setData(Qt::UserRole + 1, counter++); |
| 800 | 796 |
| 801 if (0 == strcmp("Restore", commandString.c_str()) || | 797 if (0 == strcmp("Restore", commandString.c_str()) || |
| 802 0 == strcmp("EndCommentGroup", commandString.c_str()) || | |
| 803 0 == strcmp("EndDrawPicture", commandString.c_str())) { | 798 0 == strcmp("EndDrawPicture", commandString.c_str())) { |
| 804 indent -= 10; | 799 indent -= 10; |
| 805 } | 800 } |
| 806 | 801 |
| 807 item->setData(Qt::UserRole + 3, indent); | 802 item->setData(Qt::UserRole + 3, indent); |
| 808 | 803 |
| 809 if (0 == strcmp("Save", commandString.c_str()) || | 804 if (0 == strcmp("Save", commandString.c_str()) || |
| 810 0 == strcmp("SaveLayer", commandString.c_str()) || | 805 0 == strcmp("SaveLayer", commandString.c_str()) || |
| 811 0 == strcmp("BeginCommentGroup", commandString.c_str()) || | |
| 812 0 == strcmp("BeginDrawPicture", commandString.c_str())) { | 806 0 == strcmp("BeginDrawPicture", commandString.c_str())) { |
| 813 indent += 10; | 807 indent += 10; |
| 814 } | 808 } |
| 815 | 809 |
| 816 item->setData(Qt::UserRole + 4, -1); | 810 item->setData(Qt::UserRole + 4, -1); |
| 817 | 811 |
| 818 fListWidget.addItem(item); | 812 fListWidget.addItem(item); |
| 819 } | 813 } |
| 820 } | 814 } |
| 821 | 815 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 856 fCanvasWidget.drawTo(fPausedRow); | 850 fCanvasWidget.drawTo(fPausedRow); |
| 857 } else { | 851 } else { |
| 858 fCanvasWidget.drawTo(fListWidget.currentRow()); | 852 fCanvasWidget.drawTo(fListWidget.currentRow()); |
| 859 } | 853 } |
| 860 } | 854 } |
| 861 | 855 |
| 862 void SkDebuggerGUI::updateHit(int newHit) { | 856 void SkDebuggerGUI::updateHit(int newHit) { |
| 863 fCommandHitBox.setText(QString::number(newHit)); | 857 fCommandHitBox.setText(QString::number(newHit)); |
| 864 } | 858 } |
| 865 | 859 |
| OLD | NEW |