Closed PreferLinux closed 4 years ago
Just tried this in a couple of Debian VMs, both have the problem. Here's version numbers: Debian 10, libgdiplus 6.0.4, Cairo 1.16.0, Pixman 0.36.0, xlib 1.6.7, Xorg 1.20.4 Debian 9, libgdiplus 6.0.4, Cairo 1.14.8, Pixman 0.34.0, xlib 1.6.4, Xorg 1.19.2
I also tried it on my Chromebook (Linux mode), and it worked correctly (Debian 9 derivative in a VM with the same versions as above, however uses XWayland + a Wayland proxy...).
So inspired by that, I tried my main system (details earlier) with Wayland, so that Mono used XWayland, and it worked correctly too.
Another data point: Ubuntu 18.04, libgdiplus master, Cairo 1.15.10-2ubuntu0.1, Pixman 0.34.0-2, xlib 2:1.6.4-3ubuntu0.2, VcXsrv 1.20.6 Ubuntu 18.04, libgdiplus 6.0.4, Cairo 1.15.10-2ubuntu0.1, Pixman 0.34.0-2, xlib 2:1.6.4-3ubuntu0.2, VcXsrv 1.20.6
There's a problem that I've seen with drawing images in WinForms when a double-buffered control with the image is the same size as or smaller than the image itself. It does not happen with indexed or 24-bit + alpha PNGs, but does with 24-bit PNGs and JPEGs. Also doesn't happen with a PictureBox with a border. Resizing the form to (partially) cover the image that isn't drawing and then resizing it back out again will result in the covered part appearing, as does moving a control over it and back.
Changing
gdip_bitmap_ensure_surface
to always useCAIRO_FORMAT_ARGB32
as a debugging measure got them drawing correctly – which is weird. But interestingly, that is the format that both the PNG and JPEG codecs claim to be (and store inGpImage->cairo_format
, so I'm not sure why this code chooses the Cairo format itself).Below is a repro. I've got four test-cases there; the first row shows the custom control which is simply to have a minimum of WinForms influence, the second uses PictureBox to have BorderStyle available. The left images don't draw, the right ones do. testpic10.png testpic11.png
Here's what I get: (Linux (openSUSE Tumbleweed), libgdiplus is master from mid-January, Cairo 1.16.0, Pixman 0.36.0, xlib 1.6.9, Xorg server 1.20.7)
Also seen the same thing on a CentOS 8 install, libgdiplus 6.0.4, Cairo 1.15.12, Pixman 0.36.0, xlib 1.6.7, Xorg server 1.20.3
Alternatively, I tried this on my macOS + XQuartz setup, and this drew correctly (libgdiplus is master from a few days ago, Cairo 1.15.2, the rest whatever comes with XQuartz).
Just a suspicion, but the real problem here may actually be in Cairo, Pixman, or Xorg.