mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-12 20:00:09 +00:00
aff34e8d1b
In a very particular situation, it could happen that our renderpass reordering did not work out. Consider this nesting of renderpasses (indentation indicates subpasses): pass A subpass of A pass B subpass of B Out reordering code would reorder this as: subpass of B subpass of A pass A pass B Which doesn't sound too bad, the subpasses happen before the passes after all. However, a subpass might be a pass that converts the image for a texture stored in the texture cache and then updates the cached image. If "subpass of A" is such a pass *and* if "subpass of B" then renders with exactly this texture, then "subpass of B" will use the result of "subpass of A" as a source. The fix is to ensure that subpasses stay ordered, too. The new order moves subpasses right before their parent pass, so the order of the example now looks like: subpass of A pass A subpass of B pass B The place where this would happen most common was when drawing thumbnail images in Nautilus, the GTK filechooser or Fractal. Those images are usually PNG files, which are straight alpha. They are then drawn with a drop shadow, which requires an offscreen for drawing as well as those images as premultipled sources, so lots of subpasses happen. If there is then a redraw with a somewhat tricky subregion, then the slicing of the region code could end up generating 2 passes that each draw half of the thumbnail image - the first pass drawing the top half and the second pass drawing the bottom half. And due to the bug the bottom half would then be drawn from the offscreen before the actual contents of the offscreen would be drawn, leading to a corrupt bottom part of the image. Test included. Fixes: #6318
118 B
20x20px
118 B
20x20px