@@ -835,15 +835,41 @@ tilecache_draw_bounds(GtkSnapshot *snapshot,
835835 }
836836}
837837
838+ #ifndef HAVE_GTK_SNAPSHOT_SET_SNAP
839+ /* Snap a graphene rect to a hardware pixel boundary on the output surface. We
840+ * need to do this if the gtk snap mechachanism is missing or we'll get thin
841+ * white lines on tile edges.
842+ */
843+ static void
844+ tilecache_snap_rect_to_boundary (graphene_rect_t * bounds , double scale )
845+ {
846+ double left = rint (bounds -> origin .x * scale ) / scale ;
847+ double top = rint (bounds -> origin .y * scale ) / scale ;
848+ double right =
849+ rint ((bounds -> origin .x + bounds -> size .width ) * scale ) / scale ;
850+ double bottom =
851+ rint ((bounds -> origin .y + bounds -> size .height ) * scale ) / scale ;
852+
853+ bounds -> origin .x = left ;
854+ bounds -> origin .y = top ;
855+ bounds -> size .width = right - left ;
856+ bounds -> size .height = bottom - top ;
857+ }
858+ #endif /*!HAVE_GTK_SNAPSHOT_SET_SNAP*/
859+
838860/* Scale is how much the level0 image has been scaled, x/y is the position of
839- * the top-left corner of the paint_rect area in the scaled image.
861+ * the top-left corner of @paint in the scaled image.
862+ *
863+ * @pixel_scale is gdk_surface_get_scale() for the surface this snapshot will
864+ * be rendered to.
840865 *
841- * paint_rect is the pixel area in gtk coordinates that we paint in the widget.
866+ * @paint is the pixel area in gtk coordinates that we paint in the widget.
842867 *
843868 * Set debug to draw tile boundaries for debugging.
844869 */
845870void
846871tilecache_snapshot (Tilecache * tilecache , GtkSnapshot * snapshot ,
872+ double scale_factor ,
847873 double scale , double x , double y , graphene_rect_t * paint , gboolean debug )
848874{
849875 /* In debug mode, scale and offset so we can see tile clipping.
@@ -947,11 +973,9 @@ tilecache_snapshot(Tilecache *tilecache, GtkSnapshot *snapshot,
947973 bounds .size .height = tile -> bounds0 .height * scale ;
948974
949975#ifndef HAVE_GTK_SNAPSHOT_SET_SNAP
950- /* Without set snap, we have to hide tile edges by expanding the
951- * tile.
976+ /* Without gtk snap, we have to snap tiles edges ourselves.
952977 */
953- bounds .size .width += 1 ;
954- bounds .size .height += 1 ;
978+ tilecache_snap_rect_to_boundary (& bounds , scale_factor );
955979#endif /*!HAVE_GTK_SNAPSHOT_SET_SNAP*/
956980
957981 gtk_snapshot_append_scaled_texture (snapshot ,
0 commit comments