forked from AuroraMiddleware/gtk
Merge branch 'wip/wayland-hidpi-swap-region' into 'master'
Fix HiDPI swap regions on Wayland See merge request GNOME/gtk!1228
This commit is contained in:
commit
564e8f483c
@ -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,
|
||||
}
|
||||
},
|
||||
};
|
||||
|
@ -244,14 +244,15 @@ gdk_wayland_gl_context_end_frame (GdkDrawContext *draw_context,
|
||||
EGLint *rects = g_new (EGLint, n_rects * 4);
|
||||
cairo_rectangle_int_t rect;
|
||||
int surface_height = gdk_surface_get_height (surface);
|
||||
int scale = gdk_surface_get_scale_factor (surface);
|
||||
|
||||
for (i = 0, j = 0; i < n_rects; i++)
|
||||
{
|
||||
cairo_region_get_rectangle (painted, i, &rect);
|
||||
rects[j++] = rect.x;
|
||||
rects[j++] = surface_height - rect.height - rect.y;
|
||||
rects[j++] = rect.width;
|
||||
rects[j++] = rect.height;
|
||||
rects[j++] = rect.x * scale;
|
||||
rects[j++] = (surface_height - rect.height - rect.y) * scale;
|
||||
rects[j++] = rect.width * scale;
|
||||
rects[j++] = rect.height * scale;
|
||||
}
|
||||
eglSwapBuffersWithDamageEXT (display_wayland->egl_display, egl_surface, rects, n_rects);
|
||||
g_free (rects);
|
||||
|
Loading…
Reference in New Issue
Block a user