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 772477 - Recent changes have broken printing in gnome-maps
Recent changes have broken printing in gnome-maps
Status: RESOLVED FIXED
Product: libchamplain
Classification: Core
Component: view
unspecified
Other Linux
: Normal normal
: ---
Assigned To: libchamplain-maint
libchamplain-maint
Depends on:
Blocks:
 
 
Reported: 2016-10-05 20:59 UTC by Marcus Lundblad
Modified: 2016-10-15 20:28 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
debug output of exported surfaces (859 bytes, patch)
2016-10-06 19:55 UTC, Marcus Lundblad
none Details | Review
Ensure path layer surface is created (5.32 KB, patch)
2016-10-11 21:28 UTC, Marcus Lundblad
none Details | Review

Description Marcus Lundblad 2016-10-05 20:59:01 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.
Comment 1 Marcus Lundblad 2016-10-06 06:10:27 UTC
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.
Comment 2 Marcus Lundblad 2016-10-06 19:55:27 UTC
Created attachment 337107 [details] [review]
debug output of exported surfaces
Comment 3 Marcus Lundblad 2016-10-06 19:57:12 UTC
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.
Comment 4 Marcus Lundblad 2016-10-06 21:42:11 UTC
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.
Comment 5 Marcus Lundblad 2016-10-11 21:28:05 UTC
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.
Comment 6 Jiri Techet 2016-10-15 20:28:29 UTC
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!!!