[Xquartz-changes] [176] AppleSGLX/trunk

source_changes at macosforge.org source_changes at macosforge.org
Thu Feb 19 14:39:03 PST 2009


Revision: 176
          http://trac.macosforge.org/projects/xquartz/changeset/176
Author:   gstaplin at apple.com
Date:     2009-02-19 14:39:03 -0800 (Thu, 19 Feb 2009)
Log Message:
-----------
Add apple_glx_pixmap_query.  It's used by glXQueryDrawable.

Also remove the is_current from the pixmap struct -- it was an incomplete idea.

Modified Paths:
--------------
    AppleSGLX/trunk/apple_glx_context.c
    AppleSGLX/trunk/apple_glx_pixmap.c
    AppleSGLX/trunk/apple_glx_pixmap.h
    AppleSGLX/trunk/glx_pbuffer.c

Modified: AppleSGLX/trunk/apple_glx_context.c
===================================================================
--- AppleSGLX/trunk/apple_glx_context.c	2009-02-19 07:15:19 UTC (rev 175)
+++ AppleSGLX/trunk/apple_glx_context.c	2009-02-19 22:39:03 UTC (rev 176)
@@ -434,8 +434,7 @@
 
 	if(false == apple_glx_pixmap_data(dpy, ac->drawable->drawable,
 					  &width, &height, &pitch, &bpp,
-					  &ptr, &ctxobjptr,
-					  /*mark current*/ true)) {
+					  &ptr, &ctxobjptr)) {
 	    return true;
 	}
 

Modified: AppleSGLX/trunk/apple_glx_pixmap.c
===================================================================
--- AppleSGLX/trunk/apple_glx_pixmap.c	2009-02-19 07:15:19 UTC (rev 175)
+++ AppleSGLX/trunk/apple_glx_pixmap.c	2009-02-19 22:39:03 UTC (rev 176)
@@ -38,6 +38,7 @@
 #include "apple_visual.h"
 #include "apple_glx_pixmap.h"
 #include "appledri.h"
+#include "glcontextmodes.h"
 
 struct apple_glx_pixmap {
     GLXPixmap xpixmap;
@@ -48,8 +49,9 @@
     int fd;
     CGLPixelFormatObj pixel_format_obj;
     CGLContextObj context_obj;
-    bool is_current;
-    struct apple_glx_pixmap *next, *previous;
+    GLint fbconfigID;
+    
+    struct apple_glx_pixmap *next, *previous;    
 };
 
 static pthread_mutex_t pixmap_lock = PTHREAD_MUTEX_INITIALIZER;
@@ -99,6 +101,7 @@
     struct apple_glx_pixmap *p;
     bool double_buffered;
     CGLError error;
+    const __GLcontextModes *cmodes = mode;
     
     p = malloc(sizeof(*p));
 
@@ -149,9 +152,9 @@
 	free(p);
 	return true;
     }
+    
+    p->fbconfigID = cmodes->fbconfigID;
 
-    p->is_current = false;
-
     lock_pixmap_list();
     
     p->previous = NULL;
@@ -224,7 +227,7 @@
 
 bool apple_glx_pixmap_data(Display *dpy, GLXPixmap pixmap, int *width,
 			   int *height, int *pitch, int *bpp, void **ptr,
-			   void **contextptr, bool mark_current) {
+			   void **contextptr) {
     struct apple_glx_pixmap *p;
     bool result = false;
 
@@ -237,9 +240,7 @@
 	*bpp = p->bpp;
 	*ptr = p->buffer;
 	*contextptr = p->context_obj;
-	
-	p->is_current = mark_current;
-
+		
 	result = true;
     }
 
@@ -247,3 +248,34 @@
 
     return result;    
 }
+
+
+bool apple_glx_pixmap_query(GLXPixmap pixmap, int attr, unsigned int *value) {
+    bool result = false;
+    struct apple_glx_pixmap *p;
+
+    lock_pixmap_list();
+
+    if(find_pixmap(pixmap, &p)) {
+	switch(attr) {
+	case GLX_WIDTH:
+	    *value = p->width;
+	    result = true;
+	    break;
+
+	case GLX_HEIGHT:
+	    *value = p->height;
+	    result = true;
+	    break;
+	    
+	case GLX_FBCONFIG_ID:
+	    *value = p->fbconfigID;
+	    result = true;
+	    break;
+	}
+    }
+
+    unlock_pixmap_list();
+
+    return result;
+}

Modified: AppleSGLX/trunk/apple_glx_pixmap.h
===================================================================
--- AppleSGLX/trunk/apple_glx_pixmap.h	2009-02-19 07:15:19 UTC (rev 175)
+++ AppleSGLX/trunk/apple_glx_pixmap.h	2009-02-19 22:39:03 UTC (rev 176)
@@ -45,6 +45,9 @@
 /* Returns true if the pixmap is valid, and there is data for it. */
 bool apple_glx_pixmap_data(Display *dpy, GLXPixmap pixmap, int *width,
 			   int *height, int *pitch, int *bpp, void **ptr,
-			   void **contextptr, bool mark_current);
+			   void **contextptr);
 
+bool apple_glx_pixmap_query(GLXPixmap pixmap, int attribute,
+			    unsigned int *value);
+
 #endif

Modified: AppleSGLX/trunk/glx_pbuffer.c
===================================================================
--- AppleSGLX/trunk/glx_pbuffer.c	2009-02-19 07:15:19 UTC (rev 175)
+++ AppleSGLX/trunk/glx_pbuffer.c	2009-02-19 22:39:03 UTC (rev 176)
@@ -42,6 +42,7 @@
 //#include "glheader.h"
 
 #include "apple_glx_pbuffer.h"
+#include "apple_glx_pixmap.h"
 
 /**
  * Change a drawable's attribute.
@@ -650,6 +651,10 @@
     GLXContext gc = __glXGetCurrentContext();
     xError error;
 
+
+    if(apple_glx_pixmap_query(drawable, attribute, value))
+	return; /*done*/
+
     switch(attribute) {
     case GLX_WIDTH: {
 	int width;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/xquartz-changes/attachments/20090219/dbd4b86f/attachment.html>


More information about the Xquartz-changes mailing list