gtkglarea r113 - in trunk: . gtkgl



Author: samh
Date: Sun Oct 19 22:48:43 2008
New Revision: 113
URL: http://svn.gnome.org/viewvc/gtkglarea?rev=113&view=rev

Log:
* gdkgl.c gtkglarea.c: minor code factorisation.

Modified:
   trunk/ChangeLog
   trunk/gtkgl/gdkgl.c
   trunk/gtkgl/gtkglarea.c

Modified: trunk/gtkgl/gdkgl.c
==============================================================================
--- trunk/gtkgl/gdkgl.c	(original)
+++ trunk/gtkgl/gdkgl.c	Sun Oct 19 22:48:43 2008
@@ -300,10 +300,8 @@
 
   vi = get_xvisualinfo(visual);
 
-  if (sharelist)
-    glxcontext = glXCreateContext(dpy, vi, sharelist->glxcontext, direct ? True : False);
-  else
-    glxcontext = glXCreateContext(dpy, vi, 0, direct ? True : False);
+  glxcontext = glXCreateContext(dpy, vi, sharelist ? sharelist->glxcontext : 0,
+                                direct ? True : False);
 
   XFree(vi);
   if (glxcontext == NULL) {

Modified: trunk/gtkgl/gtkglarea.c
==============================================================================
--- trunk/gtkgl/gtkglarea.c	(original)
+++ trunk/gtkgl/gtkglarea.c	Sun Oct 19 22:48:43 2008
@@ -116,48 +116,39 @@
 GtkWidget*
 gtk_gl_area_share_new (int *attrlist, GtkGLArea *share)
 {
-
-#if !defined(WIN32)
-
-  GdkVisual *visual;
   GdkGLContext *glcontext;
   GtkGLArea *gl_area;
+#if !defined(WIN32)
+  GdkVisual *visual;
+#endif
 
   g_return_val_if_fail(share == NULL || GTK_IS_GL_AREA(share), NULL);
 
+#if !defined(WIN32)
   visual = gdk_gl_choose_visual(attrlist);
   if (visual == NULL)
     return NULL;
 
   glcontext = gdk_gl_context_share_new(visual, share ? share->glcontext : NULL, TRUE);
+#else
+  glcontext = gdk_gl_context_attrlist_share_new(attrlist, share ? share->glcontext : NULL, TRUE);
+#endif
   if (glcontext == NULL)
     return NULL;
 
+#if !defined(WIN32)
   /* use colormap and visual suitable for OpenGL rendering */
   gtk_widget_push_colormap(gdk_colormap_new(visual,TRUE));
   gtk_widget_push_visual(visual);
+#endif
 
   gl_area = g_object_new(GTK_TYPE_GL_AREA, NULL);
   gl_area->glcontext = glcontext;
 
+#if !defined(WIN32)
   /* pop back defaults */
   gtk_widget_pop_visual();
   gtk_widget_pop_colormap();
-
-#else
-
-  GdkGLContext *glcontext;
-  GtkGLArea *gl_area;
-
-  g_return_val_if_fail(share == NULL || GTK_IS_GL_AREA(share), NULL);
-
-  glcontext = gdk_gl_context_attrlist_share_new(attrlist, share ? share->glcontext : NULL, TRUE);
-  if (glcontext == NULL)
-    return NULL;
-
-  gl_area = g_object_new(GTK_TYPE_GL_AREA, NULL);
-  gl_area->glcontext = glcontext;
-
 #endif
 
   return GTK_WIDGET(gl_area);



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