After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 741060 - [PATCH] Graphical artifacts drawn on Win32 since 4ecbef0791d4
[PATCH] Graphical artifacts drawn on Win32 since 4ecbef0791d4
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Win32
2.24.x
Other Windows
: Normal major
: ---
Assigned To: gtk-win32 maintainers
gtk-bugs
: 744169 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2014-12-03 10:33 UTC by John Lindgren
Modified: 2015-02-17 20:01 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Replace create_cairo_surface() with ref_cairo_surface() (1.11 KB, patch)
2014-12-03 10:33 UTC, John Lindgren
committed Details | Review

Description John Lindgren 2014-12-03 10:33:25 UTC
Created attachment 292060 [details] [review]
Replace create_cairo_surface() with ref_cairo_surface()

As already noted in comments on bug #695636, very noticeable graphical artifacts have been showing up on Win32 (particularly in the file chooser) since commit 4ecbef0791d4.  That commit made _gdk_windowing_create_cairo_surface() correctly return a new cairo_surface_t on Win32 as it does on X11, rather than just calling _gdk_windowing_ref_cairo_surface().  However, it looks like the call to _gdk_windowing_create_cairo_surface() in gdk_window_begin_paint_region() now needs to be changed to _gdk_windowing_ref_cairo_surface() in order for rendering to work correctly on Win32.  Someone with more knowledge of the code should decide whether this is the right fix or not, but it does fix the graphical artifacts.
Comment 1 Alexander Larsson 2014-12-05 09:59:47 UTC
I agree, there should be no need to create multiple surface instances for the same offscreen bitmap during expose handling. Reusing the same one should be more efficient even.

And i can understand cairo being confused with multiple cairo surfaces refering to the same HDC and rendering to them. Some state is probably left from an earlier rendering that the later surface is not expecting.

In fact, i wonder if the same problem does not happen for the remaining use of 
_gdk_drawable_create_cairo_surface() in gdk_window_ref_cairo_surface(). This one is hit a bit less often (only for non-double-buffered rendering). That one needs a different surface object in order to have a different offset for each child window (of the same native window), but that could maybe be better done via cairo_surface_create_for_rectangle() subsurfaces rather than multiple surfaces based on the same hdc.
Comment 2 Alexander Larsson 2014-12-05 10:18:24 UTC
I pushed this as ad6271eca90e6139acd624209e10931d0dffbd73, as it seems correct, better and fixes a win32 issue.
I'll leave the other change for now as it seems much more intrusive while fixing a much less obvious issue which we are probably not even hitting atm.
Comment 3 Marko Lindqvist 2015-02-17 20:01:07 UTC
*** Bug 744169 has been marked as a duplicate of this bug. ***