diff options
| author | 2015-07-26 15:03:54 +0200 | |
|---|---|---|
| committer | 2015-07-26 16:23:28 +0200 | |
| commit | b335cce22ee803a1a467425a0cc689e2afbaf878 (patch) | |
| tree | 841a42d5ab0603cf3bb5a9ef53391e8fc0ceb3dd /src/citra_qt/debugger/graphics_cmdlists.cpp | |
| parent | citra-qt/command list: Add mask column (diff) | |
| download | yuzu-b335cce22ee803a1a467425a0cc689e2afbaf878.tar.gz yuzu-b335cce22ee803a1a467425a0cc689e2afbaf878.tar.xz yuzu-b335cce22ee803a1a467425a0cc689e2afbaf878.zip | |
citra-qt/command list: Do not recreate a widget after each selection
Recreating / replacing a widget is slow since it triggers a layout pass.
Diffstat (limited to 'src/citra_qt/debugger/graphics_cmdlists.cpp')
| -rw-r--r-- | src/citra_qt/debugger/graphics_cmdlists.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/src/citra_qt/debugger/graphics_cmdlists.cpp b/src/citra_qt/debugger/graphics_cmdlists.cpp index 0427ebc95..e51a4480f 100644 --- a/src/citra_qt/debugger/graphics_cmdlists.cpp +++ b/src/citra_qt/debugger/graphics_cmdlists.cpp | |||
| @@ -262,7 +262,7 @@ void GPUCommandListWidget::OnCommandDoubleClicked(const QModelIndex& index) { | |||
| 262 | } | 262 | } |
| 263 | 263 | ||
| 264 | void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index) { | 264 | void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index) { |
| 265 | QWidget* new_info_widget; | 265 | QWidget* new_info_widget = nullptr; |
| 266 | 266 | ||
| 267 | const unsigned int command_id = list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toUInt(); | 267 | const unsigned int command_id = list_widget->model()->data(index, GPUCommandListModel::CommandIdRole).toUInt(); |
| 268 | if (COMMAND_IN_RANGE(command_id, texture0) || | 268 | if (COMMAND_IN_RANGE(command_id, texture0) || |
| @@ -283,14 +283,15 @@ void GPUCommandListWidget::SetCommandInfo(const QModelIndex& index) { | |||
| 283 | auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(config, format); | 283 | auto info = Pica::DebugUtils::TextureInfo::FromPicaRegister(config, format); |
| 284 | u8* src = Memory::GetPhysicalPointer(config.GetPhysicalAddress()); | 284 | u8* src = Memory::GetPhysicalPointer(config.GetPhysicalAddress()); |
| 285 | new_info_widget = new TextureInfoWidget(src, info); | 285 | new_info_widget = new TextureInfoWidget(src, info); |
| 286 | } else { | ||
| 287 | new_info_widget = new QWidget; | ||
| 288 | } | 286 | } |
| 289 | 287 | if (command_info_widget) { | |
| 290 | widget()->layout()->removeWidget(command_info_widget); | 288 | delete command_info_widget; |
| 291 | delete command_info_widget; | 289 | command_info_widget = nullptr; |
| 292 | widget()->layout()->addWidget(new_info_widget); | 290 | } |
| 293 | command_info_widget = new_info_widget; | 291 | if (new_info_widget) { |
| 292 | widget()->layout()->addWidget(new_info_widget); | ||
| 293 | command_info_widget = new_info_widget; | ||
| 294 | } | ||
| 294 | } | 295 | } |
| 295 | #undef COMMAND_IN_RANGE | 296 | #undef COMMAND_IN_RANGE |
| 296 | 297 | ||
| @@ -328,7 +329,7 @@ GPUCommandListWidget::GPUCommandListWidget(QWidget* parent) : QDockWidget(tr("Pi | |||
| 328 | 329 | ||
| 329 | connect(copy_all, SIGNAL(clicked()), this, SLOT(CopyAllToClipboard())); | 330 | connect(copy_all, SIGNAL(clicked()), this, SLOT(CopyAllToClipboard())); |
| 330 | 331 | ||
| 331 | command_info_widget = new QWidget; | 332 | command_info_widget = nullptr; |
| 332 | 333 | ||
| 333 | QVBoxLayout* main_layout = new QVBoxLayout; | 334 | QVBoxLayout* main_layout = new QVBoxLayout; |
| 334 | main_layout->addWidget(list_widget); | 335 | main_layout->addWidget(list_widget); |
| @@ -338,7 +339,6 @@ GPUCommandListWidget::GPUCommandListWidget(QWidget* parent) : QDockWidget(tr("Pi | |||
| 338 | sub_layout->addWidget(copy_all); | 339 | sub_layout->addWidget(copy_all); |
| 339 | main_layout->addLayout(sub_layout); | 340 | main_layout->addLayout(sub_layout); |
| 340 | } | 341 | } |
| 341 | main_layout->addWidget(command_info_widget); | ||
| 342 | main_widget->setLayout(main_layout); | 342 | main_widget->setLayout(main_layout); |
| 343 | 343 | ||
| 344 | setWidget(main_widget); | 344 | setWidget(main_widget); |