tpl_wayland_egl: Invert y to rect of the damaged region. 92/95592/2
authorjoonbum.ko <joonbum.ko@samsung.com>
Fri, 4 Nov 2016 02:38:30 +0000 (11:38 +0900)
committerGwan-gyeong Mun <kk.moon@samsung.com>
Tue, 8 Nov 2016 11:49:59 +0000 (03:49 -0800)
 - 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 <joonbum.ko@samsung.com>
src/tpl_wayland_egl.c

index 8e92f0b..e118a55 100644 (file)
@@ -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]);
                }
        }