gpu: Fix scale fluctuation

We want to use a viewport that gives us the right scale back.
This fixes problems where glyph lookups were inefficient because
the scale part of the key would fluctuate ever so slightly.
This commit is contained in:
Matthias Clasen 2024-02-09 18:21:12 -05:00
parent 7c38945abf
commit 1ac82528d9
3 changed files with 16 additions and 7 deletions

View File

@ -353,7 +353,10 @@ gsk_gpu_node_processor_init_draw (GskGpuNodeProcessor *self,
NULL, NULL,
image, image,
&area, &area,
viewport); &GRAPHENE_RECT_INIT (viewport->origin.x,
viewport->origin.y,
area.width / graphene_vec2_get_x (scale),
area.height / graphene_vec2_get_y (scale)));
gsk_gpu_render_pass_begin_op (frame, gsk_gpu_render_pass_begin_op (frame,
image, image,
@ -1007,7 +1010,10 @@ gsk_gpu_node_processor_blur_op (GskGpuNodeProcessor *self,
source_desc, source_desc,
intermediate, intermediate,
&(cairo_rectangle_int_t) { 0, 0, width, height }, &(cairo_rectangle_int_t) { 0, 0, width, height },
&intermediate_rect); &GRAPHENE_RECT_INIT (intermediate_rect.origin.x,
intermediate_rect.origin.y,
width / graphene_vec2_get_x (&self->scale),
height / graphene_vec2_get_y (&self->scale)));
gsk_gpu_render_pass_begin_op (other.frame, gsk_gpu_render_pass_begin_op (other.frame,
intermediate, intermediate,

View File

@ -391,7 +391,7 @@ gsk_gpu_renderer_render (GskRenderer *renderer,
GskGpuFrame *frame; GskGpuFrame *frame;
GskGpuImage *backbuffer; GskGpuImage *backbuffer;
cairo_region_t *render_region; cairo_region_t *render_region;
GdkSurface *surface; double scale;
if (cairo_region_is_empty (region)) if (cairo_region_is_empty (region))
{ {
@ -411,7 +411,7 @@ gsk_gpu_renderer_render (GskRenderer *renderer,
frame = gsk_gpu_renderer_get_frame (self); frame = gsk_gpu_renderer_get_frame (self);
render_region = get_render_region (self); render_region = get_render_region (self);
surface = gdk_draw_context_get_surface (priv->context); scale = gsk_gpu_renderer_get_scale (self);
gsk_gpu_frame_render (frame, gsk_gpu_frame_render (frame,
g_get_monotonic_time (), g_get_monotonic_time (),
@ -420,8 +420,8 @@ gsk_gpu_renderer_render (GskRenderer *renderer,
root, root,
&GRAPHENE_RECT_INIT ( &GRAPHENE_RECT_INIT (
0, 0, 0, 0,
gdk_surface_get_width (surface), gsk_gpu_image_get_width (backbuffer) / scale,
gdk_surface_get_height (surface) gsk_gpu_image_get_height (backbuffer) / scale
), ),
NULL); NULL);

View File

@ -360,7 +360,10 @@ gsk_gpu_render_pass_op_offscreen (GskGpuFrame *frame,
image, image,
&(cairo_rectangle_int_t) { 0, 0, width, height }, &(cairo_rectangle_int_t) { 0, 0, width, height },
node, node,
viewport); &GRAPHENE_RECT_INIT (viewport->origin.x,
viewport->origin.y,
width / graphene_vec2_get_x (scale),
height / graphene_vec2_get_y (scale)));
gsk_gpu_render_pass_end_op (frame, gsk_gpu_render_pass_end_op (frame,
image, image,