Module: Mesa
Branch: main
Commit: 11ee16493da3116cb24d52c193db12403fcc4ebd
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=11ee16493da3116cb24d52c193db12403fcc4ebd

Author: Jesse Natalie <[email protected]>
Date:   Thu Sep 16 11:52:05 2021 -0700

egl/wgl: Implement QuerySurface

Acked-by: Daniel Stone <[email protected]>
Acked-by: Mike Blumenkrantz <[email protected]>
Acked-by: Sidney Just <[email protected]>
Acked-by: Jason Ekstrand <[email protected]>
Tested-by: Yonggang Luo <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12964>

---

 src/egl/drivers/wgl/egl_wgl.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/src/egl/drivers/wgl/egl_wgl.c b/src/egl/drivers/wgl/egl_wgl.c
index bde80adaa3c..ad5962f695d 100644
--- a/src/egl/drivers/wgl/egl_wgl.c
+++ b/src/egl/drivers/wgl/egl_wgl.c
@@ -688,6 +688,27 @@ wgl_create_window_surface(_EGLDisplay *disp, _EGLConfig 
*conf,
    return &wgl_surf->base;
 }
 
+static EGLBoolean
+wgl_query_surface(_EGLDisplay *disp, _EGLSurface *surf,
+                  EGLint attribute, EGLint *value)
+{
+   struct wgl_egl_surface *wgl_surf = wgl_egl_surface(surf);
+   RECT client_rect;
+
+   switch (attribute) {
+   case EGL_WIDTH:
+   case EGL_HEIGHT:
+      if (GetClientRect(wgl_surf->fb->hWnd, &client_rect)) {
+         surf->Width = client_rect.right;
+         surf->Height = client_rect.bottom;
+      }
+      break;
+   default:
+      break;
+   }
+   return _eglQuerySurface(disp, surf, attribute, value);
+}
+
 static EGLBoolean
 wgl_swap_buffers(_EGLDisplay *disp, _EGLSurface *draw)
 {
@@ -710,6 +731,7 @@ struct _egl_driver _eglDriver = {
    .MakeCurrent = wgl_make_current,
    .CreateWindowSurface = wgl_create_window_surface,
    .DestroySurface = wgl_destroy_surface,
+   .QuerySurface = wgl_query_surface,
    .GetProcAddress = _glapi_get_proc_address,
    .SwapBuffers = wgl_swap_buffers,
 };

Reply via email to