[vlc-commits] [Git][videolan/vlc][master] qt: optimize status handling in RoundImage
Steve Lhomme (@robUx4)
gitlab at videolan.org
Mon Jul 29 06:43:17 UTC 2024
Steve Lhomme pushed to branch master at VideoLAN / VLC
Commits:
928f2e9e by Prince Gupta at 2024-07-29T06:15:51+00:00
qt: optimize status handling in RoundImage
this omits texture clearing incase the image is available in cache
- - - - -
1 changed file:
- modules/gui/qt/widgets/native/roundimage.cpp
Changes:
=====================================
modules/gui/qt/widgets/native/roundimage.cpp
=====================================
@@ -490,11 +490,25 @@ void RoundImage::setDPR(const qreal value)
void RoundImage::load()
{
+ // NOTE: at this point we still have old content displayed
+
m_enqueuedGeneration = false;
+ if (m_source.isEmpty())
+ {
+ // nothing to load, clear old content
+ setStatus(Status::Null);
+ setRoundImage({});
+
+ return;
+ }
+
auto engine = qmlEngine(this);
- if (!engine || m_source.isEmpty() || !m_sourceSize.isValid() || m_sourceSize.isEmpty())
+ if (!engine || !m_sourceSize.isValid() || m_sourceSize.isEmpty())
+ {
+ onRequestCompleted(Status::Error, {});
return;
+ }
const qreal scaledWidth = m_sourceSize.width() * m_dpr;
const qreal scaledHeight = m_sourceSize.height() * m_dpr;
@@ -519,6 +533,7 @@ void RoundImage::load()
m_activeImageResponse->saveInCache();
connect(m_activeImageResponse.get(), &RoundImageRequest::requestCompleted, this, &RoundImage::onRequestCompleted);
+
//at this point m_activeImageResponse is either in Loading or Error status
onRequestCompleted(RoundImage::Loading, {});
}
@@ -581,11 +596,6 @@ void RoundImage::regenerateRoundImage()
if (!isComponentComplete() || m_enqueuedGeneration)
return;
- setStatus(source().isEmpty() ? Status::Null : Status::Loading);
-
- // remove old contents
- setRoundImage({});
-
m_activeImageResponse.reset();
// use Qt::QueuedConnection to delay generation, so that dependent properties
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/928f2e9e4b840e094e074e55e1f6acc25c4568c4
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/commit/928f2e9e4b840e094e074e55e1f6acc25c4568c4
You're receiving this email because of your account on code.videolan.org.
VideoLAN code repository instance
More information about the vlc-commits
mailing list