Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,20 @@ add_project_arguments('-DHAVE_CONFIG_H', language: 'c')
# so it can find config.h
add_project_arguments('-I.', language: 'c')

gtk_dep = dependency('gtk4', version: '>=4.14')
# use this to fix tile alignment, not yet merged
config_h.set('HAVE_GTK_SNAPSHOT_SET_SNAP', cc.has_header_symbol('gtk.h', 'gtk_snapshot_set_snap', dependencies: gtk_dep))

configure_file(
output: 'config.h',
configuration: config_h,
)

# need vips_thread_execute()
vips_dep = dependency('vips', version: '>=8.17')
glib_dep = dependency('glib-2.0')
gtk_dep = dependency('gtk4')
m_dep = cc.find_library('m')

glib_dep = dependency('glib-2.0')
if not cc.has_header_symbol('glib.h', 'g_autofree', dependencies : glib_dep)
error('vipsdisp requires the GNU C "cleanup" attribute.')
endif
Expand Down
7 changes: 7 additions & 0 deletions src/imagedisplay.c
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,13 @@ imagedisplay_snapshot(GtkWidget *widget, GtkSnapshot *snapshot)

GTK_WIDGET_CLASS(imagedisplay_parent_class)->snapshot(widget, snapshot);

#ifdef HAVE_GTK_SNAPSHOT_SET_SNAP
/* Round tile bounds to the closest pixel edge on all sides to prevent
* seams.
*/
gtk_snapshot_set_snap(snapshot, GSK_RECT_SNAP_ROUND);
#endif /*HAVE_GTK_SNAPSHOT_SET_SNAP*/

/* Clip to the widget area, or we may paint over the display control
* bar.
*/
Expand Down
2 changes: 1 addition & 1 deletion src/tile.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ tile_touch(Tile *tile)
}

/* Make a tile on an image. left/top in this image's coordinates (not level0
* coordfinates).
* coordinates).
*/
Tile *
tile_new(VipsImage *level, int left, int top, int z)
Expand Down
13 changes: 10 additions & 3 deletions src/tilecache.c
Original file line number Diff line number Diff line change
Expand Up @@ -1023,11 +1023,18 @@ tilecache_snapshot(Tilecache *tilecache, GtkSnapshot *snapshot,

graphene_rect_t bounds;

// +1 to hide tile boundaries
bounds.origin.x = tile->bounds.left * scale - x + paint->origin.x;
bounds.origin.y = tile->bounds.top * scale - y + paint->origin.y;
bounds.size.width = tile->bounds.width * scale + 1;
bounds.size.height = tile->bounds.height * scale + 1;
bounds.size.width = tile->bounds.width * scale;
bounds.size.height = tile->bounds.height * scale;

#ifndef HAVE_GTK_SNAPSHOT_SET_SNAP
/* Without set snap, we have to hide tile edges by expanding the
* tile.
*/
bounds.size.width += 1;
bounds.size.height += 1;
#endif /*!HAVE_GTK_SNAPSHOT_SET_SNAP*/

gtk_snapshot_append_scaled_texture(snapshot,
tile_get_texture(tile), filter, &bounds);
Expand Down
4 changes: 0 additions & 4 deletions src/vipsdisp.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@
*/
#define MAX_TILES (2 * (4096 / TILE_SIZE) * (2048 / TILE_SIZE))

/* We GtkInfoBar, which is going away in gtk5.
*/
G_GNUC_BEGIN_IGNORE_DEPRECATIONS

#define FREESID(SID, OBJ) \
G_STMT_START \
{ \
Expand Down