[gtk: 2/3] wayland/vulkancontext: Fix present region on HiDPI
- From: Timm Bäder <baedert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk: 2/3] wayland/vulkancontext: Fix present region on HiDPI
- Date: Tue, 3 Dec 2019 16:06:07 +0000 (UTC)
commit ba74f41a70a71f67d82e72f13f3c0c32071441d6
Author: Jonas Ådahl <jadahl gmail com>
Date: Tue Dec 3 16:42:03 2019 +0100
wayland/vulkancontext: Fix present region on HiDPI
VkPresentRegionsKHR is expected to operate in buffer coordinates, but
the region we get passed is in surface coordinates, so it must be scaled.
gdk/gdkvulkancontext.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
---
diff --git a/gdk/gdkvulkancontext.c b/gdk/gdkvulkancontext.c
index 247e6e094f..5582afeb92 100644
--- a/gdk/gdkvulkancontext.c
+++ b/gdk/gdkvulkancontext.c
@@ -441,11 +441,14 @@ gdk_vulkan_context_end_frame (GdkDrawContext *draw_context,
{
GdkVulkanContext *context = GDK_VULKAN_CONTEXT (draw_context);
GdkVulkanContextPrivate *priv = gdk_vulkan_context_get_instance_private (context);
+ GdkSurface *surface = gdk_draw_context_get_surface (draw_context);
VkPresentRegionsKHR *regionsptr = VK_NULL_HANDLE;
VkPresentRegionsKHR regions;
cairo_rectangle_int_t extents;
+ int scale;
cairo_region_get_extents (painted, &extents);
+ scale = gdk_surface_get_scale_factor (surface);
regions = (VkPresentRegionsKHR) {
.sType = VK_STRUCTURE_TYPE_PRESENT_REGIONS_KHR,
@@ -454,10 +457,10 @@ gdk_vulkan_context_end_frame (GdkDrawContext *draw_context,
.rectangleCount = 1,
.pRectangles = &(VkRectLayerKHR) {
.layer = 0,
- .offset.x = extents.x,
- .offset.y = extents.y,
- .extent.width = extents.width,
- .extent.height = extents.height,
+ .offset.x = extents.x * scale,
+ .offset.y = extents.y * scale,
+ .extent.width = extents.width * scale,
+ .extent.height = extents.height * scale,
}
},
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]