[vlc-commits] [Git][videolan/vlc][master] 3 commits: qt/RoundImage: fix incorrect image displayed

Jean-Baptiste Kempf (@jbk) gitlab at videolan.org
Sun Feb 13 10:42:26 UTC 2022



Jean-Baptiste Kempf pushed to branch master at VideoLAN / VLC


Commits:
42dd825c by Prince Gupta at 2022-02-13T10:20:31+00:00
qt/RoundImage: fix incorrect image displayed

previously when the image is found in the cache, the generator
was not reset, this caused an invalid image to be loaded

reset the image generator on update request

- - - - -
9734618e by Prince Gupta at 2022-02-13T10:20:31+00:00
qt/RoundImage: fix typo in variable name

- - - - -
5c9ae311 by Prince Gupta at 2022-02-13T10:20:31+00:00
qt/RoundImage: handle network reply error

- - - - -


1 changed file:

- modules/gui/qt/widgets/native/roundimage.cpp


Changes:

=====================================
modules/gui/qt/widgets/native/roundimage.cpp
=====================================
@@ -93,6 +93,12 @@ namespace
             QObject::connect(reply, SIGNAL(finished()), &loop, SLOT(quit()));
             loop.exec();
 
+            if (reply->error() != QNetworkReply::NoError)
+            {
+                qDebug() << reply->errorString();
+                return {};
+            }
+
             class DataOwningBuffer : public QBuffer
             {
             public:
@@ -243,6 +249,8 @@ void RoundImage::regenerateRoundImage()
     if (!m_isComponentComplete || m_enqueuedGeneration)
         return;
 
+    m_roundImageGenerator.reset();
+
     // use Qt::QueuedConnection to delay generation, so that dependent properties
     // subsequent updates can be merged, f.e when VLCStyle.scale changes
     m_enqueuedGeneration = true;
@@ -250,12 +258,13 @@ void RoundImage::regenerateRoundImage()
     QMetaObject::invokeMethod(this, [this] ()
     {
         m_enqueuedGeneration = false;
+        assert(!m_roundImageGenerator);
 
-        const qreal scaleWidth = this->width() * m_dpr;
+        const qreal scaledWidth = this->width() * m_dpr;
         const qreal scaledHeight = this->height() * m_dpr;
         const qreal scaledRadius = this->radius() * m_dpr;
 
-        const ImageCacheKey key {source(), QSizeF {scaleWidth, scaledHeight}.toSize(), scaledRadius};
+        const ImageCacheKey key {source(), QSizeF {scaledWidth, scaledHeight}.toSize(), scaledRadius};
         if (auto image = imageCache.object(key)) // should only by called in mainthread
         {
             m_roundImage = *image;
@@ -267,7 +276,7 @@ void RoundImage::regenerateRoundImage()
 
         // Image is generated in size factor of `m_dpr` to avoid scaling artefacts when
         // generated image is set with device pixel ratio
-        m_roundImageGenerator.reset(new RoundImageGenerator(m_source, scaleWidth, scaledHeight, scaledRadius));
+        m_roundImageGenerator.reset(new RoundImageGenerator(m_source, scaledWidth, scaledHeight, scaledRadius));
         connect(m_roundImageGenerator.get(), &BaseAsyncTask::result, this, [this, key]()
         {
             const auto image = new QImage(m_roundImageGenerator->takeResult());



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/25556bcb4eed9ba69ab0299af06e0e3235fbb2cd...5c9ae3119a34db16a2543b43eb3585777ecc146d

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/25556bcb4eed9ba69ab0299af06e0e3235fbb2cd...5c9ae3119a34db16a2543b43eb3585777ecc146d
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