Merge pull request #1609 from aws-lumberyard-dev/Atom/mnaumov/cherryPick1571

Cherry-picking thumbnail performance improvements
This commit is contained in:
AMZN-mnaumov
2021-06-25 19:18:10 -07:00
committed by GitHub
5 changed files with 147 additions and 62 deletions
@@ -121,9 +121,9 @@ namespace AzToolsFramework
{
return 0;
}
bool thumbnailLoading;
ThumbnailerRequestsBus::BroadcastResult(thumbnailLoading, &ThumbnailerRequests::IsLoading, thumbnailKey, m_thumbnailContext.c_str());
if (thumbnailLoading)
const Thumbnail::State thumbnailState = thumbnail->GetState();
if (thumbnailState == Thumbnail::State::Loading)
{
AzQtComponents::StyledBusyLabel* busyLabel;
AssetBrowserComponentRequestBus::BroadcastResult(busyLabel , &AssetBrowserComponentRequests::GetStyledBusyLabel);
@@ -132,7 +132,7 @@ namespace AzToolsFramework
busyLabel->DrawTo(painter, QRectF(point.x(), point.y(), size.width(), size.height()));
}
}
else
else if (thumbnailState == Thumbnail::State::Ready)
{
// Scaling and centering pixmap within bounds to preserve aspect ratio
const QPixmap pixmap = thumbnail->GetPixmap().scaled(size, Qt::KeepAspectRatio, Qt::SmoothTransformation);
@@ -140,6 +140,10 @@ namespace AzToolsFramework
const QPoint pointDelta = QPoint(sizeDelta.width() / 2, sizeDelta.height() / 2);
painter->drawPixmap(point + pointDelta, pixmap);
}
else
{
AZ_Assert(false, "Thumbnail state %d unexpected here", int(thumbnailState));
}
return m_iconSize;
}