summaryrefslogtreecommitdiff
path: root/gsk
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2023-05-10 03:17:38 +0200
committerBenjamin Otte <otte@redhat.com>2023-05-17 02:25:32 +0200
commitb14c0678e5f4010a923cecf3c6958b1a674a0de2 (patch)
treef8912a6fa5b0173e7c8623f525596a172d44c8ce /gsk
parent974abf2d3c5020eb19f76edbb9e8a7c216525aed (diff)
downloadgtk+-b14c0678e5f4010a923cecf3c6958b1a674a0de2.tar.gz
vulkan: Pass scale to offscreens
Create offscreens with enough pixels for the given scale and ensure the scale is passed on. This improves text rendering on offscreens quite a bit.
Diffstat (limited to 'gsk')
-rw-r--r--gsk/vulkan/gskvulkanrenderpass.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/gsk/vulkan/gskvulkanrenderpass.c b/gsk/vulkan/gskvulkanrenderpass.c
index a7ec60bd8b..d890c36fab 100644
--- a/gsk/vulkan/gskvulkanrenderpass.c
+++ b/gsk/vulkan/gskvulkanrenderpass.c
@@ -1009,21 +1009,24 @@ gsk_vulkan_render_pass_render_offscreen (GdkVulkanContext *vulkan,
GskVulkanUploader *uploader,
VkSemaphore semaphore,
GskRenderNode *node,
+ const graphene_vec2_t *scale,
const graphene_rect_t *viewport)
{
graphene_rect_t view;
cairo_region_t *clip;
GskVulkanRenderPass *pass;
GskVulkanImage *result;
+ float scale_x, scale_y;
+ scale_x = graphene_vec2_get_x (scale);
+ scale_y = graphene_vec2_get_y (scale);
view = GRAPHENE_RECT_INIT (viewport->origin.x,
viewport->origin.y,
- ceil (viewport->size.width),
- ceil (viewport->size.height));
+ ceil (scale_x * viewport->size.width),
+ ceil (scale_y * viewport->size.height));
result = gsk_vulkan_image_new_for_offscreen (vulkan,
- view.size.width,
- view.size.height);
+ view.size.width, view.size.height);
#ifdef G_ENABLE_DEBUG
{
@@ -1042,7 +1045,7 @@ gsk_vulkan_render_pass_render_offscreen (GdkVulkanContext *vulkan,
pass = gsk_vulkan_render_pass_new (vulkan,
result,
- graphene_vec2_one (),
+ scale,
&view,
clip,
semaphore);
@@ -1119,6 +1122,7 @@ gsk_vulkan_render_pass_get_node_as_texture (GskVulkanRenderPass *self,
uploader,
semaphore,
node,
+ &self->scale,
&clipped);
}
}
@@ -1350,6 +1354,7 @@ gsk_vulkan_render_pass_upload (GskVulkanRenderPass *self,
uploader,
semaphore,
child,
+ &self->scale,
child_bounds);
get_tex_rect (&op->render.source_rect, &op->render.node->bounds, child_bounds);
}