From 6ab323a3e80bfa5135b1933f4359ddc4e7e0e567 Mon Sep 17 00:00:00 2001 From: "joonbum.ko" Date: Fri, 4 Nov 2016 11:38:30 +0900 Subject: [PATCH] tpl_wayland_egl: Invert y to rect of the damaged region. - Wayland Window System Coordinate uses top-left position as (0,0) ,but GL Window Surface Coordinate uses bottom-left position as (0,0). So, tpl_wayland_egl should covert "GL Window Surface Coordinate" to "Wayland Window System Coordinate" before calling of wl_surface_damage(). Wayland Window System Coordinate (0,0) (Width,0) +---------+ | | | | | | | | | | +---------+ (0,Height) (Width, Height) GL Window Surface Coordinate (0,Height) (Width,Height) +---------+ | | | | | | | | | | +---------+ (0,0) (Width, 0) * reference: https://www.khronos.org/registry/egl/extensions/EXT/EGL_EXT_buffer_age.txt https://www.khronos.org/registry/egl/extensions/KHR/EGL_KHR_partial_update.txt Change-Id: I2cc0eadda428028ac2a53983e9a18c13378ee777 Signed-off-by: joonbum.ko --- src/tpl_wayland_egl.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/tpl_wayland_egl.c b/src/tpl_wayland_egl.c index 8e92f0b..e118a55 100644 --- a/src/tpl_wayland_egl.c +++ b/src/tpl_wayland_egl.c @@ -724,9 +724,16 @@ __tpl_wayland_egl_surface_commit(tpl_surface_t *surface, wl_egl_window->width, wl_egl_window->height); } else { int i; + for (i = 0; i < num_rects; i++) { + /* The rectangles are specified relative to the bottom-left of the + * GL surface. So, these rectanglesd has to be converted to + * WINDOW(Top-left) coord like below. + * y = [WINDOW.HEIGHT] - (RECT.Y + RECT.HEIGHT) */ + int inverted_y = + wl_egl_window->height - (rects[i * 4 + 1] + rects[i * 4 + 3]); wl_surface_damage(wl_egl_window->surface, - rects[i * 4 + 0], rects[i * 4 + 1], + rects[i * 4 + 0], inverted_y, rects[i * 4 + 2], rects[i * 4 + 3]); } } -- 2.7.4