diff options
author | Alexander Larsson <alexl@redhat.com> | 2020-03-12 11:12:01 +0100 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2020-03-13 14:59:37 +0100 |
commit | 086a577fd164db2b8530892b6b8eaabee98780b4 (patch) | |
tree | 4e2db065616e39c7ae9706557bc330e23f430253 /gsk | |
parent | 9d98707f6694bf9c51767bee474309baa0fe353f (diff) | |
download | gtk+-086a577fd164db2b8530892b6b8eaabee98780b4.tar.gz |
broadway: Handle browser hidpi scale factor
Diffstat (limited to 'gsk')
-rw-r--r-- | gsk/broadway/gskbroadwayrenderer.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/gsk/broadway/gskbroadwayrenderer.c b/gsk/broadway/gskbroadwayrenderer.c index 1dbfc9c11c..cb46f92bc2 100644 --- a/gsk/broadway/gskbroadwayrenderer.c +++ b/gsk/broadway/gskbroadwayrenderer.c @@ -477,6 +477,7 @@ gsk_broadway_renderer_add_node (GskRenderer *renderer, float offset_y) { GdkDisplay *display = gdk_surface_get_display (gsk_renderer_get_surface (renderer)); + GdkBroadwayDisplay *broadway_display = GDK_BROADWAY_DISPLAY (display); GskBroadwayRenderer *self = GSK_BROADWAY_RENDERER (renderer); GArray *nodes = self->nodes; @@ -753,9 +754,11 @@ gsk_broadway_renderer_add_node (GskRenderer *renderer, int y = floorf (node->bounds.origin.y); int width = ceil (node->bounds.origin.x + node->bounds.size.width) - x; int height = ceil (node->bounds.origin.y + node->bounds.size.height) - y; + int scale = broadway_display->scale_factor; - surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width, height); + surface = cairo_image_surface_create (CAIRO_FORMAT_ARGB32, width * scale, height * scale); cr = cairo_create (surface); + cairo_scale (cr, scale, scale); cairo_translate (cr, -x, -y); gsk_render_node_draw (node, cr); cairo_destroy (cr); @@ -766,8 +769,8 @@ gsk_broadway_renderer_add_node (GskRenderer *renderer, texture_id = gdk_broadway_display_ensure_texture (display, texture); add_float (nodes, x - offset_x); add_float (nodes, y - offset_y); - add_float (nodes, gdk_texture_get_width (texture)); - add_float (nodes, gdk_texture_get_height (texture)); + add_float (nodes, width); + add_float (nodes, height); add_uint32 (nodes, texture_id); } } |