Skip to content

qt: reuse textures in various places

This enables texture reusing in these places:

  • Drag item.
  • Grid view expansion.
  • Artist page header.

This should significantly reduce the time it takes to start dragging (current waiting bailout time is 50ms, and image loading from disk should take less than that, but it is still considerable), as the drag item would not bother loading images whenever the texture is provided. I'm not considering the image cache here, because we can not expect the source size to match (and as far as I see, that is the case).

I do not intend to overuse this approach everywhere, such as, having a single Image per source image and using it as texture provider among view delegate instances.

Draft because:

  • fillMode probably would not be applicable in this case, unless we do what Image is doing for things like having a texture with properties such as wrap mode set (we can do this with TextureProviderItem indirection) or calculating paintedWidth/Height ourselves as the source would have calculated it for the source's own fillMode. So far in ImageExt, we have been using the Image to help with fillMode to most extent (unless PreserveAspectCrop where we do the big work for defining a viewport).
  • Image in artist page header sometimes looks black, that's probably because of Qt's mipmapped texture sampling bug. I already have a workaround for that in https://code.videolan.org/videolan/vlc/-/blob/master/modules/gui/qt/util/qsgtextureview.cpp#L47, which can be used with TextureProviderItem without any graphics overhead here, but for now we demand an Image for external texture providers due to not being able to use textureSize() in GLSL and wanting to use probe the availability of the texture (I think both can be provided by a texture provider introspection helper class. TextureProviderObserver in !7461 (merged) can already provide the texture size, it can also provide the availability). I will investigate more if this can be mitigated like in !7461 (diffs) with TextureProviderItem.
  • If the texture and display sizes differ big, the image may noticeably appear sharp (downsampling) or blurry (upsampling). And we can not use mipmapping in most cases, as it would spoil atlas textures (which we need in view delegate, for example) and even if it was not it would still be debatable whether it is worth to use for this case.

Merge request reports

Loading