mirror of
https://github.com/baldurk/renderdoc.git
synced 2026-09-23 14:15:42 +00:00
Avoid unnecessary re-layouts when populating thumbnails
This commit is contained in:
@@ -58,10 +58,8 @@ public:
|
||||
void setActive(bool b)
|
||||
{
|
||||
m_Active = b;
|
||||
if(b)
|
||||
show();
|
||||
else
|
||||
hide();
|
||||
// we unconditionally hide the preview, the thumbnail strip will show it
|
||||
hide();
|
||||
}
|
||||
bool isActive() { return m_Active; }
|
||||
void setSize(QSize s);
|
||||
|
||||
@@ -77,6 +77,9 @@ void ThumbnailStrip::showEvent(QShowEvent *event)
|
||||
|
||||
void ThumbnailStrip::refreshLayout()
|
||||
{
|
||||
if(updatesEnabled())
|
||||
setUpdatesEnabled(false);
|
||||
|
||||
QRect avail = geometry();
|
||||
avail.adjust(6, 6, -6, -6);
|
||||
|
||||
@@ -97,9 +100,7 @@ void ThumbnailStrip::refreshLayout()
|
||||
ui->scrollArea->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
|
||||
delete layout;
|
||||
layout = new QHBoxLayout(ui->scrollAreaWidgetContents);
|
||||
for(ResourcePreview *w : m_Thumbnails)
|
||||
layout->addWidget(w);
|
||||
layout = new QHBoxLayout();
|
||||
layout->setSpacing(6);
|
||||
layout->setContentsMargins(6, 6, 6, 6);
|
||||
layout->setAlignment(Qt::AlignTop);
|
||||
@@ -139,9 +140,7 @@ void ThumbnailStrip::refreshLayout()
|
||||
ui->scrollArea->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
||||
|
||||
delete layout;
|
||||
layout = new QVBoxLayout(ui->scrollAreaWidgetContents);
|
||||
for(ResourcePreview *w : m_Thumbnails)
|
||||
layout->addWidget(w);
|
||||
layout = new QVBoxLayout();
|
||||
layout->setSpacing(6);
|
||||
layout->setContentsMargins(6, 6, 6, 6);
|
||||
layout->setAlignment(Qt::AlignTop);
|
||||
@@ -172,4 +171,15 @@ void ThumbnailStrip::refreshLayout()
|
||||
c->setSize(QSize(avail.width(), aspectHeight));
|
||||
}
|
||||
}
|
||||
|
||||
for(ResourcePreview *w : m_Thumbnails)
|
||||
layout->addWidget(w);
|
||||
|
||||
for(ResourcePreview *w : m_Thumbnails)
|
||||
if(w->isActive())
|
||||
w->show();
|
||||
|
||||
ui->scrollAreaWidgetContents->setLayout(layout);
|
||||
|
||||
setUpdatesEnabled(true);
|
||||
}
|
||||
|
||||
@@ -3013,6 +3013,9 @@ void TextureViewer::OnEventChanged(uint32_t eventId)
|
||||
int outIndex = 0;
|
||||
int inIndex = 0;
|
||||
|
||||
ui->outputThumbs->setUpdatesEnabled(false);
|
||||
ui->inputThumbs->setUpdatesEnabled(false);
|
||||
|
||||
bool copy = false, clear = false, compute = false;
|
||||
Following::GetDrawContext(m_Ctx, copy, clear, compute);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user