Skip to content

Commit 33faf59

Browse files
committed
improve antialising
1 parent d04bb4a commit 33faf59

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ master
22

33
- much better performance for images which are very tall and thin or very wide
44
and narrow
5+
- better antialiasing [Linden6]
56

67
## 3.1.0 28/10/24
78

src/tilecache.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -887,6 +887,13 @@ tilecache_snapshot(Tilecache *tilecache, GtkSnapshot *snapshot,
887887
graphene_rect_t bounds;
888888

889889
#if GTK_CHECK_VERSION(4, 10, 0)
890+
/* If we are zooming in beyond 1:1, we want nearest so we don't
891+
* blur the image. For zooming out, we want trilinear to get
892+
* mipmaps and antialiasing.
893+
*/
894+
GskScalingFilter filter = scale > 1.0 ?
895+
GSK_SCALING_FILTER_NEAREST : GSK_SCALING_FILTER_TRILINEAR;
896+
890897
// add a margin along the right and bottom to prevent black seams
891898
// at tile joins
892899
bounds.origin.x = tile->bounds.left * scale - x + paint_rect->left;
@@ -896,7 +903,7 @@ tilecache_snapshot(Tilecache *tilecache, GtkSnapshot *snapshot,
896903

897904
gtk_snapshot_append_scaled_texture(snapshot,
898905
tile_get_texture(tile),
899-
GSK_SCALING_FILTER_NEAREST,
906+
filter,
900907
&bounds);
901908
#else
902909
bounds.origin.x = tile->bounds.left * scale - x + paint_rect->left;

0 commit comments

Comments
 (0)