11From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
22From: Kleis Auke Wolthuizen <
[email protected] >
33Date: Thu, 26 Oct 2023 17:00:00 +0200
4- Subject: [PATCH 1/2 ] Make gtk4-builder-tool optional
4+ Subject: [PATCH 1/3 ] Make gtk4-builder-tool optional
55
66
77diff --git a/docs/reference/gtk/images/meson.build b/docs/reference/gtk/images/meson.build
@@ -24,7 +24,7 @@ index 1111111..2222222 100644
2424From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2525From: Christoph Reiter <
[email protected] >
2626Date: Sat, 7 Sep 2024 13:39:22 +0200
27- Subject: [PATCH 2/2 ] Disable automatic font rendering settings
27+ Subject: [PATCH 2/3 ] Disable automatic font rendering settings
2828
2929To restore the old code taking Windows settings into account.
3030
@@ -44,3 +44,83 @@ index 1111111..2222222 100644
4444 GTK_PARAM_READWRITE);
4545
4646 g_object_class_install_properties (gobject_class, NUM_PROPERTIES, pspecs);
47+
48+ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
49+ From: Kleis Auke Wolthuizen <
[email protected] >
50+ Date: Thu, 26 Jun 2025 14:50:16 +0200
51+ Subject: [PATCH 3/3] gpu: Snap texture scale nodes to grid
52+
53+ Upstream-Status: Inappropriate [other]
54+ This patch is effectively equivalent to calling
55+ `gtk_snapshot_set_snap(snapshot, GSK_RECT_SNAP_ROUND)` when
56+ https://gitlab.gnome.org/GNOME/gtk/-/merge_requests/8494 lands.
57+
58+ diff --git a/gsk/gpu/gskgpunodeprocessor.c b/gsk/gpu/gskgpunodeprocessor.c
59+ index 1111111..2222222 100644
60+ --- a/gsk/gpu/gskgpunodeprocessor.c
61+ +++ b/gsk/gpu/gskgpunodeprocessor.c
62+ @@ -2289,6 +2289,7 @@ gsk_gpu_node_processor_add_texture_scale_node (GskGpuNodeProcessor *self,
63+ GdkColorState *image_cs;
64+ GskScalingFilter scaling_filter;
65+ gboolean need_mipmap, need_offscreen;
66+ + graphene_rect_t bounds;
67+
68+ texture = gsk_texture_scale_node_get_texture (node);
69+ scaling_filter = gsk_texture_scale_node_get_filter (node);
70+ @@ -2352,6 +2353,8 @@ gsk_gpu_node_processor_add_texture_scale_node (GskGpuNodeProcessor *self,
71+ return;
72+ }
73+
74+ + gsk_rect_snap_to_grid_round (&node->bounds, &self->scale, &self->offset, &bounds);
75+ +
76+ if ((gsk_gpu_image_get_flags (image) & GSK_GPU_IMAGE_STRAIGHT_ALPHA) ||
77+ (need_mipmap && !(gsk_gpu_image_get_flags (image) & GSK_GPU_IMAGE_CAN_MIPMAP)) ||
78+ !gdk_color_state_equal (image_cs, self->ccs))
79+ @@ -2368,13 +2371,13 @@ gsk_gpu_node_processor_add_texture_scale_node (GskGpuNodeProcessor *self,
80+ gsk_gpu_mipmap_op (self->frame, image);
81+
82+ gsk_gpu_texture_op (self->frame,
83+ - gsk_gpu_clip_get_shader_clip (&self->clip, &self->offset, &node->bounds),
84+ + gsk_gpu_clip_get_shader_clip (&self->clip, &self->offset, &bounds),
85+ &self->offset,
86+ &(GskGpuShaderImage) {
87+ image,
88+ gsk_gpu_sampler_for_scaling_filter (scaling_filter),
89+ - &node->bounds,
90+ - &node->bounds,
91+ + &bounds,
92+ + &bounds,
93+ });
94+
95+ g_object_unref (image);
96+ diff --git a/gsk/gskrectprivate.h b/gsk/gskrectprivate.h
97+ index 1111111..2222222 100644
98+ --- a/gsk/gskrectprivate.h
99+ +++ b/gsk/gskrectprivate.h
100+ @@ -199,6 +199,26 @@ gsk_rect_snap_to_grid (const graphene_rect_t *src,
101+ (ceilf ((src->origin.y + grid_offset->y + src->size.height) * yscale) - y) / yscale);
102+ }
103+
104+ + static inline void
105+ + gsk_rect_snap_to_grid_round (const graphene_rect_t *src,
106+ + const graphene_vec2_t *grid_scale,
107+ + const graphene_point_t *grid_offset,
108+ + graphene_rect_t *dest)
109+ + {
110+ + float x, y, xscale, yscale;
111+ +
112+ + xscale = graphene_vec2_get_x (grid_scale);
113+ + yscale = graphene_vec2_get_y (grid_scale);
114+ +
115+ + x = round ((src->origin.x + grid_offset->x) * xscale);
116+ + y = round ((src->origin.y + grid_offset->y) * yscale);
117+ + *dest = GRAPHENE_RECT_INIT (
118+ + x / xscale - grid_offset->x,
119+ + y / yscale - grid_offset->y,
120+ + (round ((src->origin.x + grid_offset->x + src->size.width) * xscale) - x) / xscale,
121+ + (round ((src->origin.y + grid_offset->y + src->size.height) * yscale) - y) / yscale);
122+ + }
123+ +
124+ static inline gboolean G_GNUC_PURE
125+ gsk_rect_is_empty (const graphene_rect_t *rect)
126+ {
0 commit comments