Skip to content
Snippets Groups Projects

qt: assign value type source size as a whole to prevent potential double image loading

Merged Fatih Uzunoğlu requested to merge fuzun/vlc:qt/indeterminetesourcesize into master
  1. Feb 01, 2025
    • Fatih Uzunoğlu's avatar
      qml: prevent assigning intermediate value to source size in `MusicArtistDelegate.qml` · 32a0be32
      Fatih Uzunoğlu authored and Steve Lhomme's avatar Steve Lhomme committed
      Partially changing a value type changes the whole value. In
      image case, this means that the images can get re-loaded with
      indeterminate size just to discard them after the size is
      determined.
      
      Fortunately this does not happen currently, because the sizes
      are determined before the component is complete and QQuickImage
      only loads if the component is complete.
      
      However, due to the declarative nature of QML, bindings are
      evaluated and assigned one by one, this means that source size
      would be changed two times even if .width and .height are
      pending re-evaluation at the same time (such as both depend on
      DPR). At the same time, the order is also not defined, so
      with such a setup as following:
      
      sourceSize.width: width * eDPR
      sourceSize.height: height * eDPR
      
      When eDPR changes, Qt evaluates the binding for width or height,
      adjusts sourceSize, sourceSize changes and change signal is signalled,
      then evaluates the other sub-part of the value type (width or height),
      adjusts sourceSize, sourceSize changes again and change signal is
      signalled. Qt could technically optimize this, but as of Qt 6.8.1
      it is not the case.
      
      Meanwhile with the following:
      
      sourceSize: Qt.size(width * eDPR, height * eDPR)
      
      When eDPR changes, Qt evaluates the binding and adjusts the source
      size, sourceSize changes and change signal is signalled. Source size
      does not change two times, and the image would not be loaded two
      times.
      32a0be32
    • Fatih Uzunoğlu's avatar
      qml: prevent assigning intermediate value to source size in `MusicAlbumsGridExpandDelegate.qml` · 73066495
      Fatih Uzunoğlu authored and Steve Lhomme's avatar Steve Lhomme committed
      Partially changing a value type changes the whole value. In
      image case, this means that the images can get re-loaded with
      indeterminate size just to discard them after the size is
      determined.
      
      Fortunately this does not happen currently, because the sizes
      are determined before the component is complete and QQuickImage
      only loads if the component is complete.
      
      However, due to the declarative nature of QML, bindings are
      evaluated and assigned one by one, this means that source size
      would be changed two times even if .width and .height are
      pending re-evaluation at the same time (such as both depend on
      DPR). At the same time, the order is also not defined, so
      with such a setup as following:
      
      sourceSize.width: width * eDPR
      sourceSize.height: height * eDPR
      
      When eDPR changes, Qt evaluates the binding for width or height,
      adjusts sourceSize, sourceSize changes and change signal is signalled,
      then evaluates the other sub-part of the value type (width or height),
      adjusts sourceSize, sourceSize changes again and change signal is
      signalled. Qt could technically optimize this, but as of Qt 6.8.1
      it is not the case.
      
      Meanwhile with the following:
      
      sourceSize: Qt.size(width * eDPR, height * eDPR)
      
      When eDPR changes, Qt evaluates the binding and adjusts the source
      size, sourceSize changes and change signal is signalled. Source size
      does not change two times, and the image would not be loaded two
      times.
      73066495
    • Fatih Uzunoğlu's avatar
      qml: prevent assigning intermediate value to source size in `MediaCover.qml` · cec6daa9
      Fatih Uzunoğlu authored and Steve Lhomme's avatar Steve Lhomme committed
      Partially changing a value type changes the whole value. In
      image case, this means that the images can get re-loaded with
      indeterminate size just to discard them after the size is
      determined.
      
      Fortunately this does not happen currently, because the sizes
      are determined before the component is complete and QQuickImage
      only loads if the component is complete.
      
      However, due to the declarative nature of QML, bindings are
      evaluated and assigned one by one, this means that source size
      would be changed two times even if .width and .height are
      pending re-evaluation at the same time (such as both depend on
      DPR). At the same time, the order is also not defined, so
      with such a setup as following:
      
      sourceSize.width: width * eDPR
      sourceSize.height: height * eDPR
      
      When eDPR changes, Qt evaluates the binding for width or height,
      adjusts sourceSize, sourceSize changes and change signal is signalled,
      then evaluates the other sub-part of the value type (width or height),
      adjusts sourceSize, sourceSize changes again and change signal is
      signalled. Qt could technically optimize this, but as of Qt 6.8.1
      it is not the case.
      
      Meanwhile with the following:
      
      sourceSize: Qt.size(width * eDPR, height * eDPR)
      
      When eDPR changes, Qt evaluates the binding and adjusts the source
      size, sourceSize changes and change signal is signalled. Source size
      does not change two times, and the image would not be loaded two
      times.
      cec6daa9
    • Fatih Uzunoğlu's avatar
      qml: prevent assigning intermediate value to source size in `BannnerCone.qml` · 426d5085
      Fatih Uzunoğlu authored and Steve Lhomme's avatar Steve Lhomme committed
      Partially changing a value type changes the whole value. In
      image case, this means that the images can get re-loaded with
      indeterminate size just to discard them after the size is
      determined.
      
      Fortunately this does not happen currently, because the sizes
      are determined before the component is complete and QQuickImage
      only loads if the component is complete.
      
      However, due to the declarative nature of QML, bindings are
      evaluated and assigned one by one, this means that source size
      would be changed two times even if .width and .height are
      pending re-evaluation at the same time (such as both depend on
      DPR). At the same time, the order is also not defined, so
      with such a setup as following:
      
      sourceSize.width: width * eDPR
      sourceSize.height: height * eDPR
      
      When eDPR changes, Qt evaluates the binding for width or height,
      adjusts sourceSize, sourceSize changes and change signal is signalled,
      then evaluates the other sub-part of the value type (width or height),
      adjusts sourceSize, sourceSize changes again and change signal is
      signalled. Qt could technically optimize this, but as of Qt 6.8.1
      it is not the case.
      
      Meanwhile with the following:
      
      sourceSize: Qt.size(width * eDPR, height * eDPR)
      
      When eDPR changes, Qt evaluates the binding and adjusts the source
      size, sourceSize changes and change signal is signalled. Source size
      does not change two times, and the image would not be loaded two
      times.
      426d5085
    • Fatih Uzunoğlu's avatar
      qml: prevent assigning intermediate value to source size in `AtoBButton.qml` · 7adbf332
      Fatih Uzunoğlu authored and Steve Lhomme's avatar Steve Lhomme committed
      Partially changing a value type changes the whole value. In
      image case, this means that the images can get re-loaded with
      indeterminate size just to discard them after the size is
      determined.
      
      Fortunately this does not happen currently, because the sizes
      are determined before the component is complete and QQuickImage
      only loads if the component is complete.
      
      However, due to the declarative nature of QML, bindings are
      evaluated and assigned one by one, this means that source size
      would be changed two times even if .width and .height are
      pending re-evaluation at the same time (such as both depend on
      DPR). At the same time, the order is also not defined, so
      with such a setup as following:
      
      sourceSize.width: width * eDPR
      sourceSize.height: height * eDPR
      
      When eDPR changes, Qt evaluates the binding for width or height,
      adjusts sourceSize, sourceSize changes and change signal is signalled,
      then evaluates the other sub-part of the value type (width or height),
      adjusts sourceSize, sourceSize changes again and change signal is
      signalled. Qt could technically optimize this, but as of Qt 6.8.1
      it is not the case.
      
      Meanwhile with the following:
      
      sourceSize: Qt.size(width * eDPR, height * eDPR)
      
      When eDPR changes, Qt evaluates the binding and adjusts the source
      size, sourceSize changes and change signal is signalled. Source size
      does not change two times, and the image would not be loaded two
      times.
      7adbf332
    • Fatih Uzunoğlu's avatar
      qml: prevent assigning intermediate value to source size in `ArtistTopBanner.qml` · cf11d530
      Fatih Uzunoğlu authored and Steve Lhomme's avatar Steve Lhomme committed
      Partially changing a value type changes the whole value. In
      image case, this means that the images can get re-loaded with
      indeterminate size just to discard them after the size is
      determined.
      
      Fortunately this does not happen currently, because the sizes
      are determined before the component is complete and QQuickImage
      only loads if the component is complete.
      
      However, due to the declarative nature of QML, bindings are
      evaluated and assigned one by one, this means that source size
      would be changed two times even if .width and .height are
      pending re-evaluation at the same time (such as both depend on
      DPR). At the same time, the order is also not defined, so
      with such a setup as following:
      
      sourceSize.width: width * eDPR
      sourceSize.height: height * eDPR
      
      When eDPR changes, Qt evaluates the binding for width or height,
      adjusts sourceSize, sourceSize changes and change signal is signalled,
      then evaluates the other sub-part of the value type (width or height),
      adjusts sourceSize, sourceSize changes again and change signal is
      signalled. Qt could technically optimize this, but as of Qt 6.8.1
      it is not the case.
      
      Meanwhile with the following:
      
      sourceSize: Qt.size(width * eDPR, height * eDPR)
      
      When eDPR changes, Qt evaluates the binding and adjusts the source
      size, sourceSize changes and change signal is signalled. Source size
      does not change two times, and the image would not be loaded two
      times.
      cf11d530
    • Fatih Uzunoğlu's avatar
      qml: prevent assigning intermediate value to source size in `VideoInfoExpandPanel.qml` · a25a34da
      Fatih Uzunoğlu authored and Steve Lhomme's avatar Steve Lhomme committed
      Partially changing a value type changes the whole value. In
      image case, this means that the images can get re-loaded with
      indeterminate size just to discard them after the size is
      determined.
      
      Fortunately this does not happen currently, because the sizes
      are determined before the component is complete and QQuickImage
      only loads if the component is complete.
      
      However, due to the declarative nature of QML, bindings are
      evaluated and assigned one by one, this means that source size
      would be changed two times even if .width and .height are
      pending re-evaluation at the same time (such as both depend on
      DPR). At the same time, the order is also not defined, so
      with such a setup as following:
      
      sourceSize.width: width * eDPR
      sourceSize.height: height * eDPR
      
      When eDPR changes, Qt evaluates the binding for width or height,
      adjusts sourceSize, sourceSize changes and change signal is signalled,
      then evaluates the other sub-part of the value type (width or height),
      adjusts sourceSize, sourceSize changes again and change signal is
      signalled. Qt could technically optimize this, but as of Qt 6.8.1
      it is not the case.
      
      Meanwhile with the following:
      
      sourceSize: Qt.size(width * eDPR, height * eDPR)
      
      When eDPR changes, Qt evaluates the binding and adjusts the source
      size, sourceSize changes and change signal is signalled. Source size
      does not change two times, and the image would not be loaded two
      times.
      a25a34da
Loading