[cogl] android: add an onscreen API to notify cogl of window resize



commit c31a13972633e01cf35ed1f5baaf74ba076cdd5c
Author: Lionel Landwerlin <llandwerlin gmail com>
Date:   Sat May 26 17:19:28 2012 +0100

    android: add an onscreen API to notify cogl of window resize
    
    Because of the way android apps manage window resize events, we need to
    notify Cogl that the framebuffer has been resized.
    
    This patch adds an API on CoglOnscreen to do so.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=676909
    
    Reviewed-by: Robert Bragg <robert linux intel com>

 cogl/cogl-onscreen.h                  |   23 +++++++++++++++++++++++
 cogl/winsys/cogl-winsys-egl-android.c |    9 +++++++++
 2 files changed, 32 insertions(+), 0 deletions(-)
---
diff --git a/cogl/cogl-onscreen.h b/cogl/cogl-onscreen.h
index c4c4dfd..5f443f7 100644
--- a/cogl/cogl-onscreen.h
+++ b/cogl/cogl-onscreen.h
@@ -222,6 +222,29 @@ cogl_wayland_onscreen_resize (CoglOnscreen *onscreen,
                               int           offset_y);
 #endif /* COGL_HAS_EGL_PLATFORM_WAYLAND_SUPPORT */
 
+#if defined (COGL_HAS_EGL_PLATFORM_ANDROID_SUPPORT)
+/**
+ * cogl_android_onscreen_update_size:
+ * @onscreen: A #CoglOnscreen framebuffer
+ * @width: The desired width of the framebuffer
+ * @height: The desired height of the framebuffer
+ *
+ * Allows applications to notify Cogl when an Android window has been
+ * resized. Android applications get notified by the window system if
+ * an onscreen window has been resized and since Cogl is not hooked
+ * into these events directly the application needs to inform Cogl
+ * when the framebuffer size has changed.
+ *
+ * Since: 1.12
+ * Stability: unstable
+ */
+void
+cogl_android_onscreen_update_size (CoglOnscreen *onscreen,
+                                   int width,
+                                   int height);
+#endif /* COGL_HAS_EGL_PLATFORM_ANDROID_SUPPORT */
+
+
 /**
  * cogl_onscreen_set_swap_throttled:
  * @onscreen: A #CoglOncsreen framebuffer
diff --git a/cogl/winsys/cogl-winsys-egl-android.c b/cogl/winsys/cogl-winsys-egl-android.c
index 269d65d..4f52cde 100644
--- a/cogl/winsys/cogl-winsys-egl-android.c
+++ b/cogl/winsys/cogl-winsys-egl-android.c
@@ -212,6 +212,15 @@ _cogl_winsys_egl_onscreen_init (CoglOnscreen *onscreen,
   return TRUE;
 }
 
+void
+cogl_android_onscreen_update_size (CoglOnscreen *onscreen,
+                                   int width,
+                                   int height)
+{
+  CoglFramebuffer *fb = COGL_FRAMEBUFFER (onscreen);
+  _cogl_framebuffer_winsys_update_size (fb, width, height);
+}
+
 static const CoglWinsysEGLVtable
 _cogl_winsys_egl_vtable =
   {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]