Ken Thomases : winemac: Don' t recreate the GL view when the pixel format is set again.

Alexandre Julliard julliard at winehq.org
Mon Mar 24 15:59:45 CDT 2014


Module: wine
Branch: master
Commit: 10f50b89c664c8942e5274c3492ddebcac3147aa
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=10f50b89c664c8942e5274c3492ddebcac3147aa

Author: Ken Thomases <ken at codeweavers.com>
Date:   Sun Mar 23 22:44:18 2014 -0500

winemac: Don't recreate the GL view when the pixel format is set again.

It's not necessary.  Unlike with X11, on Mac OS X the pixel format doesn't affect
the properties of windows and views.  The pixel format is a property of the GL
context, which can attach to any view.

---

 dlls/winemac.drv/opengl.c |   31 ++++++++++++++++---------------
 1 file changed, 16 insertions(+), 15 deletions(-)

diff --git a/dlls/winemac.drv/opengl.c b/dlls/winemac.drv/opengl.c
index 825e523..4265797 100644
--- a/dlls/winemac.drv/opengl.c
+++ b/dlls/winemac.drv/opengl.c
@@ -1311,28 +1311,29 @@ static BOOL get_gl_view_window_rect(struct macdrv_win_data *data, macdrv_window
  */
 static BOOL set_win_format(struct macdrv_win_data *data, int format)
 {
-    macdrv_window cocoa_window;
-
     TRACE("hwnd %p format %d\n", data->hwnd, format);
 
-    if (!get_gl_view_window_rect(data, &cocoa_window, &data->gl_rect))
+    if (!data->gl_view)
     {
-        ERR("no top-level parent with Cocoa window in this process\n");
-        return FALSE;
-    }
+        macdrv_window cocoa_window;
+
+        if (!get_gl_view_window_rect(data, &cocoa_window, &data->gl_rect))
+        {
+            ERR("no top-level parent with Cocoa window in this process\n");
+            return FALSE;
+        }
 
-    if (data->gl_view) macdrv_dispose_view(data->gl_view);
-    data->gl_view = macdrv_create_view(cocoa_window, cgrect_from_rect(data->gl_rect));
+        data->gl_view = macdrv_create_view(cocoa_window, cgrect_from_rect(data->gl_rect));
+        if (!data->gl_view)
+        {
+            WARN("failed to create GL view for window %p rect %s\n", cocoa_window, wine_dbgstr_rect(&data->gl_rect));
+            return FALSE;
+        }
 
-    if (!data->gl_view)
-    {
-        WARN("failed to create GL view for window %p rect %s\n", cocoa_window, wine_dbgstr_rect(&data->gl_rect));
-        return FALSE;
+        TRACE("created GL view %p in window %p at %s\n", data->gl_view, cocoa_window,
+              wine_dbgstr_rect(&data->gl_rect));
     }
 
-    TRACE("created GL view %p in window %p at %s\n", data->gl_view, cocoa_window,
-          wine_dbgstr_rect(&data->gl_rect));
-
     data->pixel_format = format;
 
     return TRUE;




More information about the wine-cvs mailing list