GNOME Bugzilla – Bug 772477
Recent changes have broken printing in gnome-maps
Last modified: 2016-10-15 20:28:29 UTC
In https://bugzilla.gnome.org/show_bug.cgi?id=771698 the exporting functionallity has been fixed after fallout from the wrapping implementation. However, when printing routing directions from gnome-maps, the route layer (a ChamplainPathLayer) is not exported to the resulting printout. A git bisect revealed this: 46cc00ab5bec50005bf0ccdb479a6c7fd58937a4 is the first bad commit commit 46cc00ab5bec50005bf0ccdb479a6c7fd58937a4 Author: Marius Stanciu <stanciumarius94@gmail.com> Date: Mon Aug 8 19:51:40 2016 +0300 Make path layer exportablility compatible with recent wrap changes. :040000 040000 f3da6b1a68f0c1246b947007f9d845e5072bde65 dc644f976c4a005295d74677bc197ff79ec52c0a M champlain The "Preview" button in the print dialog can be used to expose this bug.
I had one idea, that it might be because we set "horizontal-wrap" on the main map view, the one that gets exported when exporting the view to a PNG, while this is not the case for the map views that are created for the printout mini maps. So I tried setting that there as well, thinking that maybe there's a regression when exporting non-wrapped views, but that didn't make a difference. Then it struck me that the main map view is embedded in a GtkChamplainEmbed while the print views are created directly as straight ChamplainViews. Not sure if this could be the cause.
Created attachment 337107 [details] [review] debug output of exported surfaces
I tested adding some debug code to save the exported layers as PNG files "in-flight" in the layers_to_surface() function. Using this, one can see that the path layer is coming through when using the "export as image" functionallity, but not when printing.
OK, now I think I know the root of this problem: In champlain_path_layer.c:get_surface() it tries to return priv->surface But AFAICS this is not set unless the path layer has been redrawn, which would call update_surface() Just trying to replace ->surface with ->right_surface there makes the path show in the print again, but this would break wrapping if I understand it correctly.
Created attachment 337472 [details] [review] Ensure path layer surface is created When getting the surface from a path layer, ensure that the right and left surfaces are merged if the surface isn't yet available. This happens when a layer is realized "on-screen" as is the case when printing routes in gnome-maps.
Marcus, thanks a lot for investigating the issue and sorry for the late reply from me. Even though I didn't try printing, I checked your patch and it makes sense so I merged it. Thanks!!!