[cairo-commit] glitz/src/agl glitz-agl.h, 1.2, 1.3 glitz_agl_context.c, 1.4, 1.5 glitz_agl_drawable.c, 1.3, 1.4 glitz_agl_extension.c, 1.2, 1.3 glitz_agl_format.c, 1.2, 1.3 glitz_agl_info.c, 1.3, 1.4 glitz_agl_pbuffer.c, 1.2, 1.3 glitz_aglint.h, 1.3, 1.4

David Reveman commit at pdx.freedesktop.org
Wed Sep 14 08:57:18 PDT 2005


Committed by: davidr

Update of /cvs/cairo/glitz/src/agl
In directory gabe:/tmp/cvs-serv6486/src/agl

Modified Files:
	glitz-agl.h glitz_agl_context.c glitz_agl_drawable.c 
	glitz_agl_extension.c glitz_agl_format.c glitz_agl_info.c 
	glitz_agl_pbuffer.c glitz_aglint.h 
Log Message:
Merge new code

Index: glitz-agl.h
===================================================================
RCS file: /cvs/cairo/glitz/src/agl/glitz-agl.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- glitz-agl.h	25 Jan 2005 19:50:26 -0000	1.2
+++ glitz-agl.h	14 Sep 2005 15:57:16 -0000	1.3
@@ -1,6 +1,6 @@
 /*
  * Copyright © 2004 David Reveman
- * 
+ *
  * Permission to use, copy, modify, distribute, and sell this software
  * and its documentation for any purpose is hereby granted without
  * fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
  * software for any purpose. It is provided "as is" without express or
  * implied warranty.
  *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
  * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
@@ -42,28 +42,28 @@
 
 void
 glitz_agl_fini (void);
-  
-  
+
+
 /* glitz_agl_format.c */
 
 glitz_drawable_format_t *
 glitz_agl_find_drawable_format (unsigned long                 mask,
-                                const glitz_drawable_format_t *templ,
-                                int                           count);
-  
+				const glitz_drawable_format_t *templ,
+				int                           count);
+
 
 /* glitz_agl_drawable.c */
 
 glitz_drawable_t *
 glitz_agl_create_drawable_for_window (glitz_drawable_format_t *format,
-                                      WindowRef               window,
-                                      unsigned int            width,
-                                      unsigned int            height);
+				      WindowRef               window,
+				      unsigned int            width,
+				      unsigned int            height);
 
 glitz_drawable_t *
 glitz_agl_create_pbuffer_drawable (glitz_drawable_format_t *format,
-                                   unsigned int            width,
-                                   unsigned int            height);
+				   unsigned int            width,
+				   unsigned int            height);
 
 
 #if defined(__cplusplus) || defined(c_plusplus)

Index: glitz_agl_context.c
===================================================================
RCS file: /cvs/cairo/glitz/src/agl/glitz_agl_context.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- glitz_agl_context.c	4 Jul 2005 10:33:01 -0000	1.4
+++ glitz_agl_context.c	14 Sep 2005 15:57:16 -0000	1.5
@@ -1,6 +1,6 @@
 /*
  * Copyright © 2004 David Reveman
- * 
+ *
  * Permission to use, copy, modify, distribute, and sell this software
  * and its documentation for any purpose is hereby granted without
  * fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
  * software for any purpose. It is provided "as is" without express or
  * implied warranty.
  *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
  * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
@@ -34,439 +34,479 @@
 static CFBundleRef
 _glitz_agl_get_bundle (const char *name)
 {
-  CFBundleRef bundle = 0;
-  FSRefParam ref_param;
-  unsigned char framework_name[256];
+    CFBundleRef bundle = 0;
+    FSRefParam ref_param;
+    unsigned char framework_name[256];
 
-  framework_name[0] = strlen (name);
-  strcpy (&framework_name[1], name);
-  
-  memset (&ref_param, 0, sizeof (ref_param));
+    framework_name[0] = strlen (name);
+    strcpy (&framework_name[1], name);
 
-  if (FindFolder (kSystemDomain,
-                  kFrameworksFolderType,
-                  kDontCreateFolder,
-                  &ref_param.ioVRefNum,
-                  &ref_param.ioDirID) == noErr) {
-    FSRef ref;
+    memset (&ref_param, 0, sizeof (ref_param));
 
-    memset (&ref, 0, sizeof (ref));
+    if (FindFolder (kSystemDomain,
+		    kFrameworksFolderType,
+		    kDontCreateFolder,
+		    &ref_param.ioVRefNum,
+		    &ref_param.ioDirID) == noErr) {
+	FSRef ref;
 
-    ref_param.ioNamePtr = framework_name;
-    ref_param.newRef = &ref;
+	memset (&ref, 0, sizeof (ref));
 
-    if (PBMakeFSRefSync (&ref_param) == noErr) {
-      CFURLRef url;
+	ref_param.ioNamePtr = framework_name;
+	ref_param.newRef = &ref;
 
-      url = CFURLCreateFromFSRef (kCFAllocatorDefault, &ref);
-      if (url) {
-        bundle = CFBundleCreate (kCFAllocatorDefault, url);
-        CFRelease (url);
+	if (PBMakeFSRefSync (&ref_param) == noErr) {
+	    CFURLRef url;
 
-        if (!CFBundleLoadExecutable (bundle)) {
-          CFRelease (bundle);
-          return (CFBundleRef) 0;
-        }
-      }
+	    url = CFURLCreateFromFSRef (kCFAllocatorDefault, &ref);
+	    if (url) {
+		bundle = CFBundleCreate (kCFAllocatorDefault, url);
+		CFRelease (url);
+
+		if (!CFBundleLoadExecutable (bundle)) {
+		    CFRelease (bundle);
+		    return (CFBundleRef) 0;
+		}
+	    }
+	}
     }
-  }
-    
-  return bundle;
+
+    return bundle;
 }
 
 static void
 _glitz_agl_release_bundle (CFBundleRef bundle)
 {
-  if (bundle) {
-    CFBundleUnloadExecutable (bundle);
-    CFRelease (bundle);
-  }
+    if (bundle) {
+	CFBundleUnloadExecutable (bundle);
+	CFRelease (bundle);
+    }
 }
 
+static void
+_glitz_agl_notify_dummy (void            *abstract_drawable,
+			 glitz_surface_t *surface) {}
+
 static glitz_function_pointer_t
 _glitz_agl_get_proc_address (const char *name, void *closure)
 {
-  glitz_function_pointer_t address = NULL;
-  CFBundleRef bundle = (CFBundleRef) closure;
-  CFStringRef str;
-  
-  if (bundle) {
-    str = CFStringCreateWithCString (kCFAllocatorDefault, name,
-                                     kCFStringEncodingMacRoman);
+    glitz_function_pointer_t address = NULL;
+    CFBundleRef bundle = (CFBundleRef) closure;
+    CFStringRef str;
 
-    address = CFBundleGetFunctionPointerForName (bundle, str);
+    if (bundle) {
+	str = CFStringCreateWithCString (kCFAllocatorDefault, name,
+					 kCFStringEncodingMacRoman);
 
-    CFRelease (str);
-  }
-  
-  return address;
+	address = CFBundleGetFunctionPointerForName (bundle, str);
+
+	CFRelease (str);
+    }
+
+    return address;
 }
 
 static glitz_context_t *
 _glitz_agl_create_context (void                    *abstract_drawable,
-                           glitz_drawable_format_t *format)
+			   glitz_drawable_format_t *format)
 {
-  glitz_agl_drawable_t *drawable = (glitz_agl_drawable_t *) abstract_drawable;
-  glitz_agl_thread_info_t *thread_info = drawable->thread_info;
-  glitz_agl_context_t *context;
-  
-  context = malloc (sizeof (glitz_agl_context_t));
-  if (!context)
-    return NULL;
+    glitz_agl_drawable_t *drawable = (glitz_agl_drawable_t *)
+	abstract_drawable;
+    glitz_agl_thread_info_t *thread_info = drawable->thread_info;
+    glitz_agl_context_t *context;
 
-  context->context =
-    aglCreateContext (thread_info->pixel_formats[format->id],
-                      thread_info->root_context);
-  
-  _glitz_context_init (&context->base, &drawable->base);
+    context = malloc (sizeof (glitz_agl_context_t));
+    if (!context)
+	return NULL;
 
-  context->pbuffer = 0;
+    context->context =
+	aglCreateContext (thread_info->pixel_formats[format->id],
+			  thread_info->root_context);
 
-  return (glitz_context_t *) context;
+    _glitz_context_init (&context->base, &drawable->base);
+
+    context->pbuffer = 0;
+
+    return (glitz_context_t *) context;
 }
 
 static void
 _glitz_agl_context_destroy (void *abstract_context)
 {
-  glitz_agl_context_t *context = (glitz_agl_context_t *) abstract_context;
-  glitz_agl_drawable_t *drawable = (glitz_agl_drawable_t *)
-      context->base.drawable;
+    glitz_agl_context_t *context = (glitz_agl_context_t *) abstract_context;
+    glitz_agl_drawable_t *drawable = (glitz_agl_drawable_t *)
+	context->base.drawable;
 
-  if (drawable->thread_info->cctx == &context->base)
-  {
-      aglSetCurrentContext (NULL);
+    if (drawable->thread_info->cctx == &context->base)
+    {
+	aglSetCurrentContext (NULL);
 
-      drawable->thread_info->cctx = NULL;
-  }
+	drawable->thread_info->cctx = NULL;
+    }
 
-  aglDestroyContext (context->context);
+    aglDestroyContext (context->context);
 
-  _glitz_context_fini (&context->base);
-  
-  free (context);
+    _glitz_context_fini (&context->base);
+
+    free (context);
 }
 
 static void
 _glitz_agl_copy_context (void          *abstract_src,
-                         void          *abstract_dst,
-                         unsigned long mask)
+			 void          *abstract_dst,
+			 unsigned long mask)
 {
-  glitz_agl_context_t  *src = (glitz_agl_context_t *) abstract_src;
-  glitz_agl_context_t  *dst = (glitz_agl_context_t *) abstract_dst;
+    glitz_agl_context_t  *src = (glitz_agl_context_t *) abstract_src;
+    glitz_agl_context_t  *dst = (glitz_agl_context_t *) abstract_dst;
 
-  aglCopyContext (src->context, dst->context, mask);
+    aglCopyContext (src->context, dst->context, mask);
 }
 
 static void
-_glitz_agl_make_current (void *abstract_context,
-                         void *abstract_drawable)
+_glitz_agl_make_current (void *abstract_drawable,
+			 void *abstract_context)
 {
-  glitz_agl_context_t  *context = (glitz_agl_context_t *) abstract_context;
-  glitz_agl_drawable_t *drawable = (glitz_agl_drawable_t *) abstract_drawable;
-  int update = 0;
-  
-  if (aglGetCurrentContext () != context->context)
-  {
-      update = 1;
-  }
-  else
-  {
-      if (drawable->pbuffer)
-      {
-          AGLPbuffer pbuffer;
-          GLuint unused;
+    glitz_agl_context_t  *context = (glitz_agl_context_t *) abstract_context;
+    glitz_agl_drawable_t *drawable = (glitz_agl_drawable_t *)
+	abstract_drawable;
+    int update = 0;
 
-          aglGetPBuffer (context->context, &pbuffer,
-                         &unused, &unused, &unused);
-        
-        if (pbuffer != drawable->pbuffer)
-            update = 1;
-        
-      }
-      else if (drawable->drawable)
-      {
-          if (aglGetDrawable (context->context) != drawable->drawable)
-              update = 1;
-      }
-  }
-  
-  if (update)
-  {
-      if (drawable->thread_info->cctx)
-      {
-          glitz_context_t *ctx = drawable->thread_info->cctx;
+    if (drawable->base.width  != drawable->width ||
+	drawable->base.height != drawable->height)
+	_glitz_agl_drawable_update_size (drawable,
+					 drawable->base.width,
+					 drawable->base.height);
 
-          if (ctx->lose_current)
-              ctx->lose_current (ctx->closure);
-      }
-   
-      if (drawable->pbuffer) {
-          aglSetPBuffer (context->context, drawable->pbuffer, 0, 0,
-                         aglGetVirtualScreen (context->context));
-          context->pbuffer = 1;
-      }
-      else
-      {
-          if (context->pbuffer) {
-              aglSetDrawable (context->context, NULL);
-              context->pbuffer = 0;
-          }
-          aglSetDrawable (context->context, drawable->drawable);
-      }
-      
-      aglSetCurrentContext (context->context);
-  }
-  
-  drawable->thread_info->cctx = &context->base;
+    if (aglGetCurrentContext () != context->context)
+    {
+	update = 1;
+    }
+    else
+    {
+	if (drawable->pbuffer)
+	{
+	    AGLPbuffer pbuffer;
+	    GLuint unused;
+
+	    aglGetPBuffer (context->context, &pbuffer,
+			   &unused, &unused, &unused);
+
+	    if (pbuffer != drawable->pbuffer)
+		update = 1;
+
+	}
+	else if (drawable->drawable)
+	{
+	    if (aglGetDrawable (context->context) != drawable->drawable)
+		update = 1;
+	}
+    }
+
+    if (update)
+    {
+	if (drawable->thread_info->cctx)
+	{
+	    glitz_context_t *ctx = drawable->thread_info->cctx;
+
+	    if (ctx->lose_current)
+		ctx->lose_current (ctx->closure);
+	}
+
+	if (drawable->pbuffer) {
+	    aglSetPBuffer (context->context, drawable->pbuffer, 0, 0,
+			   aglGetVirtualScreen (context->context));
+	    context->pbuffer = 1;
+	}
+	else
+	{
+	    if (context->pbuffer) {
+		aglSetDrawable (context->context, NULL);
+		context->pbuffer = 0;
+	    }
+	    aglSetDrawable (context->context, drawable->drawable);
+	}
+
+	aglSetCurrentContext (context->context);
+    }
+
+    drawable->thread_info->cctx = &context->base;
 }
 
 static glitz_function_pointer_t
 _glitz_agl_context_get_proc_address (void       *abstract_context,
-                                     const char *name)
+				     const char *name)
 {
-  glitz_agl_context_t  *context = (glitz_agl_context_t *) abstract_context;
-  glitz_agl_drawable_t *drawable = (glitz_agl_drawable_t *)
-      context->base.drawable;
-  glitz_function_pointer_t func;
-  CFBundleRef bundle;
+    glitz_agl_context_t  *context = (glitz_agl_context_t *) abstract_context;
+    glitz_agl_drawable_t *drawable = (glitz_agl_drawable_t *)
+	context->base.drawable;
+    glitz_function_pointer_t func;
+    CFBundleRef bundle;
 
-  _glitz_agl_make_current (context, drawable);
+    _glitz_agl_make_current (drawable, context, NULL);
 
-  bundle = _glitz_agl_get_bundle ("OpenGL.framework");
+    bundle = _glitz_agl_get_bundle ("OpenGL.framework");
 
-  func = _glitz_agl_get_proc_address (name, (void *) bundle);
+    func = _glitz_agl_get_proc_address (name, (void *) bundle);
 
-  _glitz_agl_release_bundle (bundle);
+    _glitz_agl_release_bundle (bundle);
 
-  return func;
+    return func;
 }
 
 glitz_agl_context_t *
 glitz_agl_context_get (glitz_agl_thread_info_t *thread_info,
-                       glitz_drawable_format_t *format)
+		       glitz_drawable_format_t *format)
 {
-  glitz_agl_context_t *context;
-  glitz_agl_context_t **contexts = thread_info->contexts;
-  int index, n_contexts = thread_info->n_contexts;
+    glitz_agl_context_t *context;
+    glitz_agl_context_t **contexts = thread_info->contexts;
+    int index, n_contexts = thread_info->n_contexts;
 
-  for (; n_contexts; n_contexts--, contexts++)
-    if ((*contexts)->id == format->id)
-      return *contexts;
-  
-  index = thread_info->n_contexts++;
+    for (; n_contexts; n_contexts--, contexts++)
+	if ((*contexts)->id == format->id)
+	    return *contexts;
 
-  thread_info->contexts =
-    realloc (thread_info->contexts,
-             sizeof (glitz_agl_context_t *) * thread_info->n_contexts);
-  if (!thread_info->contexts)
-    return NULL;
+    index = thread_info->n_contexts++;
 
-  context = malloc (sizeof (glitz_agl_context_t));
-  if (!context)
-    return NULL;
-  
-  thread_info->contexts[index] = context;
+    thread_info->contexts =
+	realloc (thread_info->contexts,
+		 sizeof (glitz_agl_context_t *) * thread_info->n_contexts);
+    if (!thread_info->contexts)
+	return NULL;
 
-  context->context =
-    aglCreateContext (thread_info->pixel_formats[format->id],
-                      thread_info->root_context);
-  if (!context->context) {
-    free (context);
-    return NULL;
-  } 
-  
-  context->id = format->id;
-  context->pbuffer = 0;
+    context = malloc (sizeof (glitz_agl_context_t));
+    if (!context)
+	return NULL;
 
-  if (!thread_info->root_context)
-    thread_info->root_context = context->context;
+    thread_info->contexts[index] = context;
 
-  memcpy (&context->backend.gl,
-          &_glitz_agl_gl_proc_address,
-          sizeof (glitz_gl_proc_address_list_t));
+    context->context =
+	aglCreateContext (thread_info->pixel_formats[format->id],
+			  thread_info->root_context);
+    if (!context->context) {
+	free (context);
+	return NULL;
+    }
 
-  context->backend.create_pbuffer = glitz_agl_create_pbuffer;
-  context->backend.destroy = glitz_agl_destroy;
-  context->backend.push_current = glitz_agl_push_current;
-  context->backend.pop_current = glitz_agl_pop_current;
-  context->backend.swap_buffers = glitz_agl_swap_buffers;
+    context->id = format->id;
+    context->pbuffer = 0;
 
-  context->backend.create_context = _glitz_agl_create_context;
-  context->backend.destroy_context = _glitz_agl_context_destroy;
-  context->backend.copy_context = _glitz_agl_copy_context;
-  context->backend.make_current = _glitz_agl_make_current;
-  context->backend.get_proc_address = _glitz_agl_context_get_proc_address;
-  
-  context->backend.drawable_formats = thread_info->formats;
-  context->backend.n_drawable_formats = thread_info->n_formats;
+    if (!thread_info->root_context)
+	thread_info->root_context = context->context;
 
-  context->backend.texture_formats = NULL;
-  context->backend.formats = NULL;
-  context->backend.n_formats = 0;
-  
-  context->backend.program_map = &thread_info->program_map;
-  context->backend.feature_mask = 0;
+    context->backend.gl = &_glitz_agl_gl_proc_address;
 
-  context->initialized = 0;
-  
-  return context;
+    context->backend.create_pbuffer = glitz_agl_create_pbuffer;
+    context->backend.destroy = glitz_agl_destroy;
+    context->backend.push_current = glitz_agl_push_current;
+    context->backend.pop_current = glitz_agl_pop_current;
+    context->backend.attach_notify = _glitz_agl_notify_dummy;
+    context->backend.detach_notify = _glitz_agl_notify_dummy;
+    context->backend.swap_buffers = glitz_agl_swap_buffers;
+
+    context->backend.create_context = _glitz_agl_create_context;
+    context->backend.destroy_context = _glitz_agl_context_destroy;
+    context->backend.copy_context = _glitz_agl_copy_context;
+    context->backend.make_current = _glitz_agl_make_current;
+    context->backend.get_proc_address = _glitz_agl_context_get_proc_address;
+
+    context->backend.drawable_formats = NULL;
+    context->backend.n_drawable_formats = 0;
+
+    if (screen_info->n_formats)
+    {
+	int size;
+
+	size = sizeof (glitz_int_drawable_format_t) * screen_info->n_formats;
+	context->backend.drawable_formats = malloc (size);
+	if (context->backend.drawable_formats)
+	{
+	    memcpy (context->backend.drawable_formats, screen_info->formats,
+		    size);
+	    context->backend.n_drawable_formats = screen_info->n_formats;
+	}
+    }
+
+    context->backend.texture_formats = NULL;
+    context->backend.formats = NULL;
+    context->backend.n_formats = 0;
+
+    context->backend.program_map = &thread_info->program_map;
+    context->backend.feature_mask = 0;
+
+    context->initialized = 0;
+
+    return context;
 }
 
 void
 glitz_agl_context_destroy (glitz_agl_thread_info_t *thread_info,
-                           glitz_agl_context_t *context)
+			   glitz_agl_context_t *context)
 {
-  if (context->backend.formats)
-    free (context->backend.formats);
+    if (context->backend.drawable_formats)
+	free (context->backend.drawable_formats);
 
-  if (context->backend.texture_formats)
-    free (context->backend.texture_formats);
-  
-  aglDestroyContext (context->context);
-  
-  free (context);
+    if (context->backend.formats)
+	free (context->backend.formats);
+
+    if (context->backend.texture_formats)
+	free (context->backend.texture_formats);
+
+    aglDestroyContext (context->context);
+
+    free (context);
 }
 
 static void
 _glitz_agl_context_initialize (glitz_agl_thread_info_t *thread_info,
-                               glitz_agl_context_t     *context)
+			       glitz_agl_context_t     *context)
 {
-  CFBundleRef bundle;
-  
-  bundle = _glitz_agl_get_bundle ("OpenGL.framework");
+    CFBundleRef bundle;
 
-  glitz_backend_init (&context->backend,
-                      _glitz_agl_get_proc_address,
-                      (void *) bundle);
+    bundle = _glitz_agl_get_bundle ("OpenGL.framework");
 
-  _glitz_agl_release_bundle (bundle);
+    glitz_backend_init (&context->backend,
+			_glitz_agl_get_proc_address,
+			(void *) bundle);
 
-  context->backend.gl.get_integer_v (GLITZ_GL_MAX_VIEWPORT_DIMS,
-                                     context->max_viewport_dims);
+    _glitz_agl_release_bundle (bundle);
 
-  glitz_initiate_state (&_glitz_agl_gl_proc_address);
-    
-  context->initialized = 1;
+    glitz_initiate_state (&_glitz_agl_gl_proc_address);
+
+    context->initialized = 1;
 }
 
 static void
 _glitz_agl_context_make_current (glitz_agl_drawable_t *drawable,
-                                 glitz_bool_t         finish)
+				 glitz_bool_t         finish)
 {
-  if (finish)
-    glFinish ();
+    if (finish)
+	glFinish ();
 
-  if (drawable->thread_info->cctx)
-  {
-      glitz_context_t *ctx = drawable->thread_info->cctx;
+    if (drawable->thread_info->cctx)
+    {
+	glitz_context_t *ctx = drawable->thread_info->cctx;
 
-      if (ctx->lose_current)
-          ctx->lose_current (ctx->closure);
+	if (ctx->lose_current)
+	    ctx->lose_current (ctx->closure);
 
-      drawable->thread_info->cctx = NULL;
-  }
-  
-  if (drawable->pbuffer) {
-    aglSetPBuffer (drawable->context->context, drawable->pbuffer, 0, 0,
-                   aglGetVirtualScreen (drawable->context->context));
-    drawable->context->pbuffer = 1;
-  } else {
-    if (drawable->context->pbuffer) {
-      aglSetDrawable (drawable->context->context, NULL);
-      drawable->context->pbuffer = 0;
+	drawable->thread_info->cctx = NULL;
     }
-    
-    aglSetDrawable (drawable->context->context, drawable->drawable);
-  }
 
-  aglSetCurrentContext (drawable->context->context);
+    if (drawable->pbuffer) {
+	aglSetPBuffer (drawable->context->context, drawable->pbuffer, 0, 0,
+		       aglGetVirtualScreen (drawable->context->context));
+	drawable->context->pbuffer = 1;
+    } else {
+	if (drawable->context->pbuffer) {
+	    aglSetDrawable (drawable->context->context, NULL);
+	    drawable->context->pbuffer = 0;
+	}
 
-  drawable->base.update_all = 1;
-  
-  if (!drawable->context->initialized)
-    _glitz_agl_context_initialize (drawable->thread_info, drawable->context);
+	aglSetDrawable (drawable->context->context, drawable->drawable);
+    }
+
+    aglSetCurrentContext (drawable->context->context);
+
+    drawable->base.update_all = 1;
+
+    if (!drawable->context->initialized)
+	_glitz_agl_context_initialize (drawable->thread_info,
+				       drawable->context);
 }
 
 static void
 _glitz_agl_context_update (glitz_agl_drawable_t *drawable,
-                           glitz_constraint_t   constraint)
+			   glitz_constraint_t   constraint)
 {
-  AGLContext context;
+    AGLContext context;
 
-  switch (constraint) {
-  case GLITZ_NONE:
-    break;
-  case GLITZ_ANY_CONTEXT_CURRENT:
-    context = aglGetCurrentContext ();
-    if (context == (AGLContext) 0)
-      _glitz_agl_context_make_current (drawable, 0);
-    break;
-  case GLITZ_CONTEXT_CURRENT:
-    context = aglGetCurrentContext ();
-    if (context != drawable->context->context)
-      _glitz_agl_context_make_current (drawable, (context)? 1: 0);
-    break;
-  case GLITZ_DRAWABLE_CURRENT:
-    context = aglGetCurrentContext ();
-    if (context != drawable->context->context) {
-      _glitz_agl_context_make_current (drawable, (context)? 1: 0);
-    } else {
-      if (drawable->pbuffer) {
-        AGLPbuffer pbuffer;
-        GLuint unused;
+    switch (constraint) {
+    case GLITZ_NONE:
+	break;
+    case GLITZ_ANY_CONTEXT_CURRENT:
+	context = aglGetCurrentContext ();
+	if (context == (AGLContext) 0)
+	    _glitz_agl_context_make_current (drawable, 0);
+	break;
+    case GLITZ_CONTEXT_CURRENT:
+	context = aglGetCurrentContext ();
+	if (context != drawable->context->context)
+	    _glitz_agl_context_make_current (drawable, (context)? 1: 0);
+	break;
+    case GLITZ_DRAWABLE_CURRENT:
+	if (drawable->base.width  != drawable->width ||
+	    drawable->base.height != drawable->height)
+	    _glitz_agl_drawable_update_size (drawable,
+					     drawable->base.width,
+					     drawable->base.height);
 
-        aglGetPBuffer (drawable->context->context, &pbuffer,
-                       &unused, &unused, &unused);
-        
-        if (pbuffer != drawable->pbuffer)
-          _glitz_agl_context_make_current (drawable, (context)? 1: 0);
-        
-      } else if (drawable->drawable) {
-        if (aglGetDrawable (drawable->context->context) != drawable->drawable)
-          _glitz_agl_context_make_current (drawable, (context)? 1: 0);
-      }
+	context = aglGetCurrentContext ();
+	if (context != drawable->context->context) {
+	    _glitz_agl_context_make_current (drawable, (context)? 1: 0);
+	} else {
+	    if (drawable->pbuffer) {
+		AGLPbuffer pbuffer;
+		GLuint unused;
+
+		aglGetPBuffer (drawable->context->context, &pbuffer,
+			       &unused, &unused, &unused);
+
+		if (pbuffer != drawable->pbuffer)
+		    _glitz_agl_context_make_current (drawable,
+						     (context)? 1: 0);
+
+	    } else if (drawable->drawable) {
+		if (aglGetDrawable (drawable->context->context) !=
+		    drawable->drawable)
+		    _glitz_agl_context_make_current (drawable,
+						     (context)? 1: 0);
+	    }
+	}
+	break;
     }
-    break;
-  }
 }
 
-void
+glitz_bool_t
 glitz_agl_push_current (void               *abstract_drawable,
-                        glitz_surface_t    *surface,
-                        glitz_constraint_t constraint)
+			glitz_surface_t    *surface,
+			glitz_constraint_t constraint)
 {
-  glitz_agl_drawable_t *drawable = (glitz_agl_drawable_t *) abstract_drawable;
-  glitz_agl_context_info_t *context_info;
-  int index;
+    glitz_agl_drawable_t *drawable = (glitz_agl_drawable_t *)
+	abstract_drawable;
+    glitz_agl_context_info_t *context_info;
+    int index;
 
-  index = drawable->thread_info->context_stack_size++;
+    index = drawable->thread_info->context_stack_size++;
 
-  context_info = &drawable->thread_info->context_stack[index];
-  context_info->drawable = drawable;
-  context_info->surface = surface;
-  context_info->constraint = constraint;
-  
-  _glitz_agl_context_update (context_info->drawable, constraint);
+    context_info = &drawable->thread_info->context_stack[index];
+    context_info->drawable = drawable;
+    context_info->surface = surface;
+    context_info->constraint = constraint;
+
+    _glitz_agl_context_update (context_info->drawable, constraint);
+
+    return 1;
 }
 
 glitz_surface_t *
 glitz_agl_pop_current (void *abstract_drawable)
 {
-  glitz_agl_drawable_t *drawable = (glitz_agl_drawable_t *) abstract_drawable;
-  glitz_agl_context_info_t *context_info = NULL;
-  int index;
+    glitz_agl_drawable_t *drawable = (glitz_agl_drawable_t *)
+	abstract_drawable;
+    glitz_agl_context_info_t *context_info = NULL;
+    int index;
 
-  drawable->thread_info->context_stack_size--;
-  index = drawable->thread_info->context_stack_size - 1;
+    drawable->thread_info->context_stack_size--;
+    index = drawable->thread_info->context_stack_size - 1;
 
-  context_info = &drawable->thread_info->context_stack[index];
+    context_info = &drawable->thread_info->context_stack[index];
 
-  if (context_info->drawable)
-    _glitz_agl_context_update (context_info->drawable,
-                               context_info->constraint);
-  
-  if (context_info->constraint == GLITZ_DRAWABLE_CURRENT)
-      return context_info->surface;
-  
-  return NULL;
+    if (context_info->drawable)
+	_glitz_agl_context_update (context_info->drawable,
+				   context_info->constraint);
+
+    if (context_info->constraint == GLITZ_DRAWABLE_CURRENT)
+	return context_info->surface;
+
+    return NULL;
 }

Index: glitz_agl_drawable.c
===================================================================
RCS file: /cvs/cairo/glitz/src/agl/glitz_agl_drawable.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- glitz_agl_drawable.c	12 Apr 2005 14:54:56 -0000	1.3
+++ glitz_agl_drawable.c	14 Sep 2005 15:57:16 -0000	1.4
@@ -1,6 +1,6 @@
 /*
  * Copyright © 2004 David Reveman
- * 
+ *
  * Permission to use, copy, modify, distribute, and sell this software
  * and its documentation for any purpose is hereby granted without
  * fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
  * software for any purpose. It is provided "as is" without express or
  * implied warranty.
  *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
  * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
@@ -31,189 +31,222 @@
 
 static glitz_agl_drawable_t *
 _glitz_agl_create_drawable (glitz_agl_thread_info_t *thread_info,
-                            glitz_agl_context_t     *context,
-                            glitz_drawable_format_t *format,
-                            AGLDrawable             agl_drawable,
-                            AGLPbuffer              agl_pbuffer,
-                            unsigned int            width,
-                            unsigned int            height)
+			    glitz_agl_context_t     *context,
+			    glitz_drawable_format_t *format,
+			    AGLDrawable             agl_drawable,
+			    AGLPbuffer              agl_pbuffer,
+			    unsigned int            width,
+			    unsigned int            height)
 {
-  glitz_agl_drawable_t *drawable;
-  
-  if (width <= 0 || height <= 0)
-    return NULL;
+    glitz_agl_drawable_t *drawable;
 
-  drawable = (glitz_agl_drawable_t *) malloc (sizeof (glitz_agl_drawable_t));
-  if (drawable == NULL)
-    return NULL;
+    drawable = (glitz_agl_drawable_t *) malloc (sizeof (glitz_agl_drawable_t));
+    if (drawable == NULL)
+	return NULL;
 
-  drawable->base.ref_count = 1;
-  drawable->thread_info = thread_info;
-  drawable->context = context;
-  drawable->drawable = agl_drawable;
-  drawable->pbuffer = agl_pbuffer;
-  drawable->base.format = format;
-  drawable->base.backend = &context->backend;
+    drawable->thread_info = thread_info;
+    drawable->context = context;
+    drawable->drawable = agl_drawable;
+    drawable->pbuffer = agl_pbuffer;
+    drawable->width = width;
+    drawable->height = height;
 
-  glitz_drawable_update_size (&drawable->base, width, height);
-  
-  if (!context->initialized) {
-    glitz_agl_push_current (drawable, NULL, GLITZ_CONTEXT_CURRENT);
-    glitz_agl_pop_current (drawable);
-  }
-  
-  if (width > context->max_viewport_dims[0] ||
-      height > context->max_viewport_dims[1]) {
-    free (drawable);
-    return NULL;
-  }
+    _glitz_drawable_init (&drawable->base,
+			  format,
+			  &context->backend,
+			  width, height);
 
-  thread_info->drawables++;
-  
-  return drawable;
+    if (!context->initialized) {
+	glitz_agl_push_current (drawable, NULL, GLITZ_CONTEXT_CURRENT);
+	glitz_agl_pop_current (drawable);
+    }
+
+    if (width > context->backend.max_viewport_dims[0] ||
+	height > context->backend.max_viewport_dims[1]) {
+	free (drawable);
+	return NULL;
+    }
+
+    thread_info->drawables++;
+
+    return drawable;
+}
+
+glitz_bool_t
+_glitz_agl_drawable_update_size (glitz_agl_drawable_t *drawable,
+				 int                  width,
+				 int                  height)
+{
+    if (drawable->pbuffer)
+    {
+	glitz_agl_pbuffer_destroy (drawable->thread_info, drawable->pbuffer);
+	drawable->pbuffer =
+	    glitz_agl_pbuffer_create (drawable->thread_info,
+				      drawable->context->fbconfig,
+				      (int) width, (int) height);
+	if (!drawable->pbuffer)
+	    return 0;
+    }
+
+    drawable->width  = width;
+    drawable->height = height;
+
+    return 1;
 }
 
 static glitz_drawable_t *
 _glitz_agl_create_pbuffer_drawable (glitz_agl_thread_info_t *thread_info,
-                                    glitz_drawable_format_t *format,
-                                    unsigned int            width,
-                                    unsigned int            height)
+				    glitz_drawable_format_t *format,
+				    unsigned int            width,
+				    unsigned int            height)
 {
-  glitz_agl_drawable_t *drawable;
-  glitz_agl_context_t *context;
-  AGLPbuffer pbuffer;
+    glitz_agl_drawable_t *drawable;
+    glitz_agl_context_t *context;
+    AGLPbuffer pbuffer;
 
-  if (!format->types.pbuffer)
-    return NULL;
-  
-  context = glitz_agl_context_get (thread_info, format);
-  if (!context)
-    return NULL;
+    if (!format->types.pbuffer)
+	return NULL;
 
-  pbuffer = glitz_agl_pbuffer_create (thread_info, (int) width, (int) height);
-  if (!pbuffer)
-    return NULL;
-  
-  drawable = _glitz_agl_create_drawable (thread_info, context, format,
-                                         (AGLDrawable) 0, pbuffer,
-                                         width, height);
-  if (!drawable) {
-    glitz_agl_pbuffer_destroy (pbuffer);
-    return NULL;
-  }
-  
-  return &drawable->base;
+    context = glitz_agl_context_get (thread_info, format);
+    if (!context)
+	return NULL;
+
+    pbuffer = glitz_agl_pbuffer_create (thread_info,
+					(int) width, (int) height);
+    if (!pbuffer)
+	return NULL;
+
+    drawable = _glitz_agl_create_drawable (thread_info, context, format,
+					   (AGLDrawable) 0, pbuffer,
+					   width, height);
+    if (!drawable) {
+	glitz_agl_pbuffer_destroy (pbuffer);
+	return NULL;
+    }
+
+    return &drawable->base;
 }
 
 glitz_drawable_t *
 glitz_agl_create_pbuffer (void                    *abstract_templ,
-                          glitz_drawable_format_t *format,
-                          unsigned int            width,
-                          unsigned int            height)
+			  glitz_drawable_format_t *format,
+			  unsigned int            width,
+			  unsigned int            height)
 {
-  glitz_agl_drawable_t *templ = (glitz_agl_drawable_t *) abstract_templ;
+    glitz_agl_drawable_t *templ = (glitz_agl_drawable_t *) abstract_templ;
 
-  return _glitz_agl_create_pbuffer_drawable (templ->thread_info, format,
-                                             width, height);
+    return _glitz_agl_create_pbuffer_drawable (templ->thread_info, format,
+					       width, height);
 }
 
 glitz_drawable_t *
 glitz_agl_create_drawable_for_window (glitz_drawable_format_t *format,
-                                      WindowRef               window,
-                                      unsigned int            width,
-                                      unsigned int            height)
+				      WindowRef               window,
+				      unsigned int            width,
+				      unsigned int            height)
 {
-  glitz_agl_drawable_t *drawable;
-  glitz_agl_thread_info_t *thread_info;
-  glitz_agl_context_t *context;
-  AGLDrawable agl_drawable;
+    glitz_agl_drawable_t *drawable;
+    glitz_agl_thread_info_t *thread_info;
+    glitz_agl_context_t *context;
+    AGLDrawable agl_drawable;
 
-  agl_drawable = (AGLDrawable) GetWindowPort (window);
-  if (!agl_drawable)
-    return NULL;
+    agl_drawable = (AGLDrawable) GetWindowPort (window);
+    if (!agl_drawable)
+	return NULL;
 
-  thread_info = glitz_agl_thread_info_get ();
-  if (!thread_info)
-    return NULL;
+    thread_info = glitz_agl_thread_info_get ();
+    if (!thread_info)
+	return NULL;
 
-  context = glitz_agl_context_get (thread_info, format);
-  if (!context)
-    return NULL;
+    if (format->id >= screen_info->n_formats)
+	return NULL;
 
-  drawable = _glitz_agl_create_drawable (thread_info, context, format,
-                                         agl_drawable, (AGLPbuffer) 0,
-                                         width, height);
-  if (!drawable)
-    return NULL;
+    context = glitz_agl_context_get (thread_info, format);
+    if (!context)
+	return NULL;
 
-  return &drawable->base;
+    drawable = _glitz_agl_create_drawable (thread_info, context, format,
+					   agl_drawable, (AGLPbuffer) 0,
+					   width, height);
+    if (!drawable)
+	return NULL;
+
+    return &drawable->base;
 }
 slim_hidden_def(glitz_agl_create_drawable_for_window);
 
 glitz_drawable_t *
 glitz_agl_create_pbuffer_drawable (glitz_drawable_format_t *format,
-                                   unsigned int            width,
-                                   unsigned int            height)
+				   unsigned int            width,
+				   unsigned int            height)
 {
-  glitz_agl_thread_info_t *thread_info;
+    glitz_agl_thread_info_t *thread_info;
 
-  thread_info = glitz_agl_thread_info_get ();
-  if (!thread_info)
-    return NULL;
+    thread_info = glitz_agl_thread_info_get ();
+    if (!thread_info)
+	return NULL;
 
-  return _glitz_agl_create_pbuffer_drawable (thread_info, format,
-                                             width, height);
+    if (format->id >= screen_info->n_formats)
+	return NULL;
+
+    return _glitz_agl_create_pbuffer_drawable (thread_info, format,
+					       width, height);
 }
 slim_hidden_def(glitz_agl_create_pbuffer_drawable);
 
 void
 glitz_agl_destroy (void *abstract_drawable)
 {
-  glitz_agl_drawable_t *drawable = (glitz_agl_drawable_t *) abstract_drawable;
+    glitz_agl_drawable_t *drawable = (glitz_agl_drawable_t *)
+	abstract_drawable;
 
-  drawable->thread_info->drawables--;
-  if (drawable->thread_info->drawables == 0) {
-    /*
-     * Last drawable? We have to destroy all fragment programs as this may
-     * be our last chance to have a context current.
-     */
-    glitz_agl_push_current (abstract_drawable, NULL, GLITZ_CONTEXT_CURRENT);
-    glitz_program_map_fini (&drawable->base.backend->gl,
-                            &drawable->thread_info->program_map);
-    glitz_agl_pop_current (abstract_drawable);
-  }
+    drawable->thread_info->drawables--;
+    if (drawable->thread_info->drawables == 0) {
+	/*
+	 * Last drawable? We have to destroy all fragment programs as this may
+	 * be our last chance to have a context current.
+	 */
+	glitz_agl_push_current (abstract_drawable, NULL,
+				GLITZ_CONTEXT_CURRENT);
+	glitz_program_map_fini (&drawable->base.backend->gl,
+				&drawable->thread_info->program_map);
+	glitz_agl_pop_current (abstract_drawable);
+    }
 
-  if (drawable->drawable || drawable->pbuffer) {
-    AGLContext context = aglGetCurrentContext ();
-    
-    if (context == drawable->context->context) { 
-      if (drawable->pbuffer) {
-        AGLPbuffer pbuffer;
-        GLuint unused;
-        
-        aglGetPBuffer (context, &pbuffer, &unused, &unused, &unused);
-        
-        if (pbuffer == drawable->pbuffer)
-          aglSetCurrentContext (NULL);
-      } else {
-        if (aglGetDrawable (context) == drawable->drawable)
-          aglSetCurrentContext (NULL);
-      }
+    if (drawable->drawable || drawable->pbuffer) {
+	AGLContext context = aglGetCurrentContext ();
+
+	if (context == drawable->context->context) {
+	    if (drawable->pbuffer) {
+		AGLPbuffer pbuffer;
+		GLuint unused;
+
+		aglGetPBuffer (context, &pbuffer, &unused, &unused, &unused);
+
+		if (pbuffer == drawable->pbuffer)
+		    aglSetCurrentContext (NULL);
+	    } else {
+		if (aglGetDrawable (context) == drawable->drawable)
+		    aglSetCurrentContext (NULL);
+	    }
+	}
+
+	if (drawable->pbuffer)
+	    glitz_agl_pbuffer_destroy (drawable->pbuffer);
     }
-    
-    if (drawable->pbuffer)
-      glitz_agl_pbuffer_destroy (drawable->pbuffer);
-  }
-  
-  free (drawable);
+
+    free (drawable);
 }
 
-void
+glitz_bool_t
 glitz_agl_swap_buffers (void *abstract_drawable)
 {
-  glitz_agl_drawable_t *drawable = (glitz_agl_drawable_t *) abstract_drawable;
+    glitz_agl_drawable_t *drawable = (glitz_agl_drawable_t *)
+	abstract_drawable;
 
-  glitz_agl_push_current (abstract_drawable, NULL, GLITZ_DRAWABLE_CURRENT);
-  aglSwapBuffers (drawable->context->context);
-  glitz_agl_pop_current (abstract_drawable);
+    glitz_agl_push_current (abstract_drawable, NULL, GLITZ_DRAWABLE_CURRENT);
+    aglSwapBuffers (drawable->context->context);
+    glitz_agl_pop_current (abstract_drawable);
+
+    return 1;
 }

Index: glitz_agl_extension.c
===================================================================
RCS file: /cvs/cairo/glitz/src/agl/glitz_agl_extension.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- glitz_agl_extension.c	25 Jan 2005 19:50:26 -0000	1.2
+++ glitz_agl_extension.c	14 Sep 2005 15:57:16 -0000	1.3
@@ -1,6 +1,6 @@
 /*
  * Copyright © 2004 David Reveman
- * 
+ *
  * Permission to use, copy, modify, distribute, and sell this software
  * and its documentation for any purpose is hereby granted without
  * fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
  * software for any purpose. It is provided "as is" without express or
  * implied warranty.
  *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
  * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
@@ -30,63 +30,65 @@
 #include "glitz_aglint.h"
 
 static glitz_extension_map agl_extensions[] = {
-  { 0.0, "GL_APPLE_pixel_buffer", GLITZ_AGL_FEATURE_PBUFFER_MASK },
-  { 0.0, "GL_ARB_multisample", GLITZ_AGL_FEATURE_MULTISAMPLE_MASK },
-  { 0.0, "GL_ARB_texture_rectangle",
-    GLITZ_AGL_FEATURE_TEXTURE_RECTANGLE_MASK },
-  { 0.0, "GL_EXT_texture_rectangle",
-    GLITZ_AGL_FEATURE_TEXTURE_RECTANGLE_MASK },
-  { 0.0, "GL_NV_texture_rectangle", GLITZ_AGL_FEATURE_TEXTURE_RECTANGLE_MASK },
-  { 0.0, NULL, 0 }
+    { 0.0, "GL_APPLE_pixel_buffer", GLITZ_AGL_FEATURE_PBUFFER_MASK },
+    { 0.0, "GL_ARB_multisample", GLITZ_AGL_FEATURE_MULTISAMPLE_MASK },
+    { 0.0, "GL_ARB_texture_rectangle",
+      GLITZ_AGL_FEATURE_TEXTURE_RECTANGLE_MASK },
+    { 0.0, "GL_EXT_texture_rectangle",
+      GLITZ_AGL_FEATURE_TEXTURE_RECTANGLE_MASK },
+    { 0.0, "GL_NV_texture_rectangle",
+      GLITZ_AGL_FEATURE_TEXTURE_RECTANGLE_MASK },
+    { 0.0, NULL, 0 }
 };
 
 glitz_status_t
 glitz_agl_query_extensions (glitz_agl_thread_info_t *thread_info)
 {
-  GLint attrib[] = {
-    AGL_RGBA,
-    AGL_NO_RECOVERY,
-    AGL_NONE
-  };
-  AGLPixelFormat pf;
-  AGLContext context;
+    GLint attrib[] = {
+	AGL_RGBA,
+	AGL_NO_RECOVERY,
+	AGL_NONE
+    };
+    AGLPixelFormat pf;
+    AGLContext context;
 
-  thread_info->agl_feature_mask = 0;
+    thread_info->agl_feature_mask = 0;
 
-  pf = aglChoosePixelFormat (NULL, 0, attrib);
-  context = aglCreateContext (pf, NULL);
-  
-  if (context) {
-    const char *gl_extensions_string;
+    pf = aglChoosePixelFormat (NULL, 0, attrib);
+    context = aglCreateContext (pf, NULL);
 
-    aglSetCurrentContext (context);
-  
-    gl_extensions_string = (const char *) glGetString (GL_EXTENSIONS);
+    if (context) {
+	const char *gl_extensions_string;
 
-    thread_info->agl_feature_mask =
-      glitz_extensions_query (0.0,
-                              gl_extensions_string,
-                              agl_extensions);
+	aglSetCurrentContext (context);
 
-    if (thread_info->agl_feature_mask & GLITZ_AGL_FEATURE_MULTISAMPLE_MASK) {
-      const char *vendor;
+	gl_extensions_string = (const char *) glGetString (GL_EXTENSIONS);
 
-      vendor = glGetString (GL_VENDOR);
-    
-      if (vendor) {
-        
-        /* NVIDIA's driver seem to support multisample with pbuffers */
-        if (!strncmp ("NVIDIA", vendor, 6))
-          thread_info->agl_feature_mask |=
-            GLITZ_AGL_FEATURE_PBUFFER_MULTISAMPLE_MASK;
-      }
-    }
+	thread_info->agl_feature_mask =
+	    glitz_extensions_query (0.0,
+				    gl_extensions_string,
+				    agl_extensions);
 
-    aglSetCurrentContext (NULL);
-    aglDestroyContext (context);
-  }
+	if (thread_info->agl_feature_mask & GLITZ_AGL_FEATURE_MULTISAMPLE_MASK)
+	{
+	    const char *vendor;
 
-  aglDestroyPixelFormat (pf);
+	    vendor = glGetString (GL_VENDOR);
 
-  return GLITZ_STATUS_SUCCESS;
+	    if (vendor) {
+
+		/* NVIDIA's driver seem to support multisample with pbuffers */
+		if (!strncmp ("NVIDIA", vendor, 6))
+		    thread_info->agl_feature_mask |=
+			GLITZ_AGL_FEATURE_PBUFFER_MULTISAMPLE_MASK;
+	    }
+	}
+
+	aglSetCurrentContext (NULL);
+	aglDestroyContext (context);
+    }
+
+    aglDestroyPixelFormat (pf);
+
+    return GLITZ_STATUS_SUCCESS;
 }

Index: glitz_agl_format.c
===================================================================
RCS file: /cvs/cairo/glitz/src/agl/glitz_agl_format.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- glitz_agl_format.c	25 Jan 2005 19:50:26 -0000	1.2
+++ glitz_agl_format.c	14 Sep 2005 15:57:16 -0000	1.3
@@ -1,6 +1,6 @@
 /*
  * Copyright © 2004 David Reveman
- * 
+ *
  * Permission to use, copy, modify, distribute, and sell this software
  * and its documentation for any purpose is hereby granted without
  * fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
  * software for any purpose. It is provided "as is" without express or
  * implied warranty.
  *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
  * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
@@ -33,301 +33,303 @@
 #include <string.h>
 
 static GLint _attribs[] = {
-  AGL_RGBA,
-  AGL_ALPHA_SIZE, 16,
-  AGL_RED_SIZE, 16,
-  AGL_NONE
+    AGL_RGBA,
+    AGL_ALPHA_SIZE, 16,
+    AGL_RED_SIZE, 16,
+    AGL_NONE
 };
 
 static GLint _db_attribs[] = {
-  AGL_RGBA,
-  AGL_DOUBLEBUFFER,
-  AGL_ALPHA_SIZE, 16,
-  AGL_RED_SIZE, 16,
-  AGL_NONE
+    AGL_RGBA,
+    AGL_DOUBLEBUFFER,
+    AGL_ALPHA_SIZE, 16,
+    AGL_RED_SIZE, 16,
+    AGL_NONE
 };
 
 static GLint _stencil_attribs[] = {
-  AGL_RGBA,
-  AGL_ALPHA_SIZE, 16,
-  AGL_RED_SIZE, 16,
-  AGL_DEPTH_SIZE, 8,
-  AGL_STENCIL_SIZE, 8,
-  AGL_NONE
+    AGL_RGBA,
+    AGL_ALPHA_SIZE, 16,
+    AGL_RED_SIZE, 16,
+    AGL_DEPTH_SIZE, 8,
+    AGL_STENCIL_SIZE, 8,
+    AGL_NONE
 };
 
 static GLint _db_stencil_attribs[] = {
-  AGL_RGBA,
-  AGL_DOUBLEBUFFER,
-  AGL_ALPHA_SIZE, 16,
-  AGL_RED_SIZE, 16,
-  AGL_STENCIL_SIZE, 8,
-  AGL_NONE
+    AGL_RGBA,
+    AGL_DOUBLEBUFFER,
+    AGL_ALPHA_SIZE, 16,
+    AGL_RED_SIZE, 16,
+    AGL_STENCIL_SIZE, 8,
+    AGL_NONE
 };
 
 static GLint _ms2_attribs[] = {
-  AGL_RGBA,
-  AGL_ALPHA_SIZE, 16,
-  AGL_RED_SIZE, 16,
-  AGL_STENCIL_SIZE, 8,
-  AGL_SAMPLE_BUFFERS_ARB, 1,
-  AGL_SAMPLES_ARB, 2,
-  AGL_NONE
+    AGL_RGBA,
+    AGL_ALPHA_SIZE, 16,
+    AGL_RED_SIZE, 16,
+    AGL_STENCIL_SIZE, 8,
+    AGL_SAMPLE_BUFFERS_ARB, 1,
+    AGL_SAMPLES_ARB, 2,
+    AGL_NONE
 };
 
 static GLint _db_ms2_attribs[] = {
-  AGL_RGBA,
-  AGL_DOUBLEBUFFER,
-  AGL_ALPHA_SIZE, 16,
-  AGL_RED_SIZE, 16,
-  AGL_STENCIL_SIZE, 8,
-  AGL_SAMPLE_BUFFERS_ARB, 1,
-  AGL_SAMPLES_ARB, 2,
-  AGL_NONE
+    AGL_RGBA,
+    AGL_DOUBLEBUFFER,
+    AGL_ALPHA_SIZE, 16,
+    AGL_RED_SIZE, 16,
+    AGL_STENCIL_SIZE, 8,
+    AGL_SAMPLE_BUFFERS_ARB, 1,
+    AGL_SAMPLES_ARB, 2,
+    AGL_NONE
 };
 
 static GLint _ms4_attribs[] = {
-  AGL_RGBA,
-  AGL_ALPHA_SIZE, 16,
-  AGL_RED_SIZE, 16,
-  AGL_STENCIL_SIZE, 8,
-  AGL_SAMPLE_BUFFERS_ARB, 1,
-  AGL_SAMPLES_ARB, 4,
-  AGL_NONE
+    AGL_RGBA,
+    AGL_ALPHA_SIZE, 16,
+    AGL_RED_SIZE, 16,
+    AGL_STENCIL_SIZE, 8,
+    AGL_SAMPLE_BUFFERS_ARB, 1,
+    AGL_SAMPLES_ARB, 4,
+    AGL_NONE
 };
 
 static GLint _db_ms4_attribs[] = {
-  AGL_RGBA,
-  AGL_DOUBLEBUFFER,
-  AGL_ALPHA_SIZE, 16,
-  AGL_RED_SIZE, 16,
-  AGL_STENCIL_SIZE, 8,
-  AGL_SAMPLE_BUFFERS_ARB, 1,
-  AGL_SAMPLES_ARB, 4,
-  AGL_NONE
+    AGL_RGBA,
+    AGL_DOUBLEBUFFER,
+    AGL_ALPHA_SIZE, 16,
+    AGL_RED_SIZE, 16,
+    AGL_STENCIL_SIZE, 8,
+    AGL_SAMPLE_BUFFERS_ARB, 1,
+    AGL_SAMPLES_ARB, 4,
+    AGL_NONE
 };
 
 static GLint _ms6_attribs[] = {
-  AGL_RGBA,
-  AGL_ALPHA_SIZE, 16,
-  AGL_RED_SIZE, 16,
-  AGL_STENCIL_SIZE, 8,
-  AGL_SAMPLE_BUFFERS_ARB, 1,
-  AGL_SAMPLES_ARB, 6,
-  AGL_NONE
+    AGL_RGBA,
+    AGL_ALPHA_SIZE, 16,
+    AGL_RED_SIZE, 16,
+    AGL_STENCIL_SIZE, 8,
+    AGL_SAMPLE_BUFFERS_ARB, 1,
+    AGL_SAMPLES_ARB, 6,
+    AGL_NONE
 };
 
 static GLint _db_ms6_attribs[] = {
-  AGL_RGBA,
-  AGL_DOUBLEBUFFER,
-  AGL_ALPHA_SIZE, 16,
-  AGL_RED_SIZE, 16,
-  AGL_STENCIL_SIZE, 8,
-  AGL_SAMPLE_BUFFERS_ARB, 1,
-  AGL_SAMPLES_ARB, 6,
-  AGL_NONE
+    AGL_RGBA,
+    AGL_DOUBLEBUFFER,
+    AGL_ALPHA_SIZE, 16,
+    AGL_RED_SIZE, 16,
+    AGL_STENCIL_SIZE, 8,
+    AGL_SAMPLE_BUFFERS_ARB, 1,
+    AGL_SAMPLES_ARB, 6,
+    AGL_NONE
 };
 
 static GLint *_attribs_list[] = {
-  _attribs,
-  _db_attribs,
-  _stencil_attribs,
-  _db_stencil_attribs,
-  _ms2_attribs,
-  _db_ms2_attribs,
-  _ms4_attribs,
-  _db_ms4_attribs,
-  _ms6_attribs,
-  _db_ms6_attribs
+    _attribs,
+    _db_attribs,
+    _stencil_attribs,
+    _db_stencil_attribs,
+    _ms2_attribs,
+    _db_ms2_attribs,
+    _ms4_attribs,
+    _db_ms4_attribs,
+    _ms6_attribs,
+    _db_ms6_attribs
 };
 
 static int
 _glitz_agl_format_compare (const void *elem1,
-                           const void *elem2)
+			   const void *elem2)
 {
-  int i, score[2];
-  glitz_drawable_format_t *format[2];
-  
-  format[0] = (glitz_drawable_format_t *) elem1;
-  format[1] = (glitz_drawable_format_t *) elem2;
-  i = score[0] = score[1] = 0;
+    int i, score[2];
+    glitz_drawable_format_t *format[2];
 
-  for (; i < 2; i++) {
-    if (format[i]->color.red_size) {
-      if (format[i]->color.red_size == 8)
-        score[i] += 5;
-      score[i] += 10;
-    }
+    format[0] = (glitz_drawable_format_t *) elem1;
+    format[1] = (glitz_drawable_format_t *) elem2;
+    i = score[0] = score[1] = 0;
 
-    if (format[i]->color.green_size) {
-      if (format[i]->color.green_size == 8)
-        score[i] += 5;
-      score[i] += 10;
-    }
-    
-    if (format[i]->color.alpha_size) {
-      if (format[i]->color.alpha_size == 8)
-        score[i] += 5;
-      score[i] += 10;
-    }
+    for (; i < 2; i++) {
+	if (format[i]->color.red_size) {
+	    if (format[i]->color.red_size == 8)
+		score[i] += 5;
+	    score[i] += 10;
+	}
 
-    if (format[i]->stencil_size)
-      score[i] += 5;
+	if (format[i]->color.green_size) {
+	    if (format[i]->color.green_size == 8)
+		score[i] += 5;
+	    score[i] += 10;
+	}
 
-    if (format[i]->depth_size)
-      score[i] += 5;
+	if (format[i]->color.alpha_size) {
+	    if (format[i]->color.alpha_size == 8)
+		score[i] += 5;
+	    score[i] += 10;
+	}
 
-    if (format[i]->doublebuffer)
-      score[i] += 10;
-    
-    if (format[i]->types.window)
-      score[i] += 10;
-    
-    if (format[i]->types.pbuffer)
-      score[i] += 10;
-    
-    if (format[i]->samples > 1) 
-      score[i] -= (20 - format[i]->samples);
-  }
-  
-  return score[1] - score[0];
+	if (format[i]->stencil_size)
+	    score[i] += 5;
+
+	if (format[i]->depth_size)
+	    score[i] += 5;
+
+	if (format[i]->doublebuffer)
+	    score[i] += 10;
+
+	if (format[i]->types.window)
+	    score[i] += 10;
+
+	if (format[i]->types.pbuffer)
+	    score[i] += 10;
+
+	if (format[i]->samples > 1)
+	    score[i] -= (20 - format[i]->samples);
+    }
+
+    return score[1] - score[0];
 }
 
 static void
 _glitz_add_format (glitz_agl_thread_info_t *thread_info,
-                   glitz_drawable_format_t *format,
-                   AGLPixelFormat          pixel_format)
+		   glitz_drawable_format_t *format,
+		   AGLPixelFormat          pixel_format)
 {
-  if (!glitz_drawable_format_find (thread_info->formats,
-                                   thread_info->n_formats,
-                                   GLITZ_DRAWABLE_FORMAT_ALL_EXCEPT_ID_MASK,
-                                   format, 0)) {
-    int n = thread_info->n_formats;
-      
-    thread_info->formats =
-      realloc (thread_info->formats,
-               sizeof (glitz_drawable_format_t) * (n + 1));
-    thread_info->pixel_formats =
-      realloc (thread_info->pixel_formats,
-               sizeof (AGLPixelFormat) * (n + 1));
+    if (!glitz_drawable_format_find (thread_info->formats,
+				     thread_info->n_formats,
+				     GLITZ_DRAWABLE_FORMAT_ALL_EXCEPT_ID_MASK,
+				     format, 0)) {
+	int n = thread_info->n_formats;
 
-    if (thread_info->formats && thread_info->pixel_formats) {
-      thread_info->formats[n] = *format;
-      thread_info->formats[n].id = n;
-      thread_info->pixel_formats[n] = pixel_format;
-      thread_info->n_formats++;
+	thread_info->formats =
+	    realloc (thread_info->formats,
+		     sizeof (glitz_drawable_format_t) * (n + 1));
+	thread_info->pixel_formats =
+	    realloc (thread_info->pixel_formats,
+		     sizeof (AGLPixelFormat) * (n + 1));
+
+	if (thread_info->formats && thread_info->pixel_formats) {
+	    thread_info->formats[n] = *format;
+	    thread_info->formats[n].id = n;
+	    thread_info->pixel_formats[n] = pixel_format;
+	    thread_info->n_formats++;
+	}
     }
-  }
 }
 
 void
 glitz_agl_query_formats (glitz_agl_thread_info_t *thread_info)
 {
-  glitz_drawable_format_t format;
-  AGLPixelFormat pixel_format, *new_pfs;
-  int n_attribs_list, i;
+    glitz_drawable_format_t format;
+    AGLPixelFormat pixel_format, *new_pfs;
+    int n_attribs_list, i;
 
-  format.types.window = 1;
-  format.id = 0;
+    format.types.window = 1;
+    format.id = 0;
 
-  n_attribs_list = sizeof (_attribs_list) / sizeof (GLint *);
+    n_attribs_list = sizeof (_attribs_list) / sizeof (GLint *);
 
-  for (i = 0; i < n_attribs_list; i++) {
-    GLint value;
-    
-    pixel_format = aglChoosePixelFormat (NULL, 0, _attribs_list[i]);
+    for (i = 0; i < n_attribs_list; i++) {
+	GLint value;
 
-    /* Stereo is not supported yet */
-    if (!(aglDescribePixelFormat (pixel_format, AGL_STEREO, &value)) ||
-        value) {
-      aglDestroyPixelFormat (pixel_format);
-      continue;
-    }
-    
-    aglDescribePixelFormat (pixel_format, AGL_DOUBLEBUFFER, &value);
-    format.doublebuffer = (value)? 1: 0;
-    
-    aglDescribePixelFormat (pixel_format, AGL_RED_SIZE, &value);
-    format.color.red_size = (unsigned short) value;
-    aglDescribePixelFormat (pixel_format, AGL_GREEN_SIZE, &value);
-    format.color.green_size = (unsigned short) value;
-    aglDescribePixelFormat (pixel_format, AGL_BLUE_SIZE, &value);
-    format.color.blue_size = (unsigned short) value;
-    aglDescribePixelFormat (pixel_format, AGL_ALPHA_SIZE, &value);
-    format.color.alpha_size = (unsigned short) value;
-    aglDescribePixelFormat (pixel_format, AGL_DEPTH_SIZE, &value);
-    format.depth_size = (unsigned short) value;
-    aglDescribePixelFormat (pixel_format, AGL_STENCIL_SIZE, &value);
-    format.stencil_size = (unsigned short) value;
+	pixel_format = aglChoosePixelFormat (NULL, 0, _attribs_list[i]);
 
-    if (thread_info->agl_feature_mask & GLITZ_AGL_FEATURE_MULTISAMPLE_MASK) {
-      aglDescribePixelFormat (pixel_format, AGL_SAMPLE_BUFFERS_ARB, &value);
-      if (value) {
-        aglDescribePixelFormat (pixel_format, AGL_SAMPLES_ARB, &value);
-        format.samples = (unsigned short) (value > 1)? value: 1;
-      } else
-        format.samples = 1;
-    } else
-      format.samples = 1;
+	/* Stereo is not supported yet */
+	if (!(aglDescribePixelFormat (pixel_format, AGL_STEREO, &value)) ||
+	    value) {
+	    aglDestroyPixelFormat (pixel_format);
+	    continue;
+	}
 
-    if (thread_info->agl_feature_mask & GLITZ_AGL_FEATURE_PBUFFER_MASK) {
-      if (format.color.red_size && format.color.green_size &&
-          format.color.blue_size && format.color.alpha_size &&
-          format.doublebuffer == 0 && format.stencil_size == 0 &&
-          format.depth_size == 0) {
-        
-        if (thread_info->agl_feature_mask &
-            GLITZ_AGL_FEATURE_PBUFFER_MULTISAMPLE_MASK)
-          format.types.pbuffer = 1;
-        else if (format.samples == 1)
-          format.types.pbuffer = 1;
-        else
-          format.types.pbuffer = 0;
-      } else
-        format.types.pbuffer = 0;
-    } else
-      format.types.pbuffer = 0;
+	aglDescribePixelFormat (pixel_format, AGL_DOUBLEBUFFER, &value);
+	format.doublebuffer = (value)? 1: 0;
 
-    if (format.color.red_size ||
-        format.color.green_size ||
-        format.color.blue_size ||
-        format.color.alpha_size)
-      _glitz_add_format (thread_info, &format, pixel_format);
-  }
+	aglDescribePixelFormat (pixel_format, AGL_RED_SIZE, &value);
+	format.color.red_size = (unsigned short) value;
+	aglDescribePixelFormat (pixel_format, AGL_GREEN_SIZE, &value);
+	format.color.green_size = (unsigned short) value;
+	aglDescribePixelFormat (pixel_format, AGL_BLUE_SIZE, &value);
+	format.color.blue_size = (unsigned short) value;
+	aglDescribePixelFormat (pixel_format, AGL_ALPHA_SIZE, &value);
+	format.color.alpha_size = (unsigned short) value;
+	aglDescribePixelFormat (pixel_format, AGL_DEPTH_SIZE, &value);
+	format.depth_size = (unsigned short) value;
+	aglDescribePixelFormat (pixel_format, AGL_STENCIL_SIZE, &value);
+	format.stencil_size = (unsigned short) value;
 
-  if (!thread_info->n_formats)
-    return;
+	if (thread_info->agl_feature_mask & GLITZ_AGL_FEATURE_MULTISAMPLE_MASK)
+	{
+	    aglDescribePixelFormat (pixel_format, AGL_SAMPLE_BUFFERS_ARB,
+				    &value);
+	    if (value) {
+		aglDescribePixelFormat (pixel_format, AGL_SAMPLES_ARB, &value);
+		format.samples = (unsigned short) (value > 1)? value: 1;
+	    } else
+		format.samples = 1;
+	} else
+	    format.samples = 1;
 
-  qsort (thread_info->formats, thread_info->n_formats,
-         sizeof (glitz_drawable_format_t), _glitz_agl_format_compare);
+	if (thread_info->agl_feature_mask & GLITZ_AGL_FEATURE_PBUFFER_MASK) {
+	    if (format.color.red_size && format.color.green_size &&
+		format.color.blue_size && format.color.alpha_size &&
+		format.doublebuffer == 0 && format.stencil_size == 0 &&
+		format.depth_size == 0) {
 
-  /*
-   * Update AGLPixelFormat list so that it matches the sorted format list.
-   */
-  new_pfs = malloc (sizeof (AGLPixelFormat) * thread_info->n_formats);
-  if (!new_pfs) {
-    thread_info->n_formats = 0;
-    return;
-  }
-  
-  for (i = 0; i < thread_info->n_formats; i++) {
-    new_pfs[i] = thread_info->pixel_formats[thread_info->formats[i].id];
-    thread_info->formats[i].id = i;
-  }
-  
-  free (thread_info->pixel_formats);
-  thread_info->pixel_formats = new_pfs;
+		if (thread_info->agl_feature_mask &
+		    GLITZ_AGL_FEATURE_PBUFFER_MULTISAMPLE_MASK)
+		    format.types.pbuffer = 1;
+		else if (format.samples == 1)
+		    format.types.pbuffer = 1;
+		else
+		    format.types.pbuffer = 0;
+	    } else
+		format.types.pbuffer = 0;
+	} else
+	    format.types.pbuffer = 0;
+
+	if (format.color.red_size ||
+	    format.color.green_size ||
+	    format.color.blue_size ||
+	    format.color.alpha_size)
+	    _glitz_add_format (thread_info, &format, pixel_format);
+    }
+
+    if (!thread_info->n_formats)
+	return;
+
+    qsort (thread_info->formats, thread_info->n_formats,
+	   sizeof (glitz_drawable_format_t), _glitz_agl_format_compare);
+
+    /*
+     * Update AGLPixelFormat list so that it matches the sorted format list.
+     */
+    new_pfs = malloc (sizeof (AGLPixelFormat) * thread_info->n_formats);
+    if (!new_pfs) {
+	thread_info->n_formats = 0;
+	return;
+    }
+
+    for (i = 0; i < thread_info->n_formats; i++) {
+	new_pfs[i] = thread_info->pixel_formats[thread_info->formats[i].id];
+	thread_info->formats[i].id = i;
+    }
+
+    free (thread_info->pixel_formats);
+    thread_info->pixel_formats = new_pfs;
 }
 
 glitz_drawable_format_t *
 glitz_agl_find_drawable_format (unsigned long                 mask,
-                                const glitz_drawable_format_t *templ,
-                                int                           count)
+				const glitz_drawable_format_t *templ,
+				int                           count)
 {
-  glitz_agl_thread_info_t *thread_info = glitz_agl_thread_info_get ();
+    glitz_agl_thread_info_t *thread_info = glitz_agl_thread_info_get ();
 
-  return glitz_drawable_format_find (thread_info->formats,
-                                     thread_info->n_formats,
-                                     mask, templ, count);
+    return glitz_drawable_format_find (thread_info->formats,
+				       thread_info->n_formats,
+				       mask, templ, count);
 }
 slim_hidden_def(glitz_agl_find_drawable_format);

Index: glitz_agl_info.c
===================================================================
RCS file: /cvs/cairo/glitz/src/agl/glitz_agl_info.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- glitz_agl_info.c	12 Apr 2005 14:54:56 -0000	1.3
+++ glitz_agl_info.c	14 Sep 2005 15:57:16 -0000	1.4
@@ -1,6 +1,6 @@
 /*
  * Copyright © 2004 David Reveman
- * 
+ *
  * Permission to use, copy, modify, distribute, and sell this software
  * and its documentation for any purpose is hereby granted without
  * fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
  * software for any purpose. It is provided "as is" without express or
  * implied warranty.
  *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
  * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
@@ -33,85 +33,97 @@
 
 glitz_gl_proc_address_list_t _glitz_agl_gl_proc_address = {
 
-  /* core */
-  (glitz_gl_enable_t) glEnable,
-  (glitz_gl_disable_t) glDisable,
-  (glitz_gl_get_error_t) glGetError,
-  (glitz_gl_get_string_t) glGetString,
-  (glitz_gl_enable_client_state_t) glEnableClientState,
-  (glitz_gl_disable_client_state_t) glDisableClientState,
-  (glitz_gl_vertex_pointer_t) glVertexPointer,
-  (glitz_gl_tex_coord_pointer_t) glTexCoordPointer,
-  (glitz_gl_draw_arrays_t) glDrawArrays,
-  (glitz_gl_tex_env_f_t) glTexEnvf,
-  (glitz_gl_tex_env_fv_t) glTexEnvfv,
-  (glitz_gl_tex_gen_i_t) glTexGeni,
-  (glitz_gl_tex_gen_fv_t) glTexGenfv,
-  (glitz_gl_color_4us_t) glColor4us,
-  (glitz_gl_color_4f_t) glColor4f,
-  (glitz_gl_scissor_t) glScissor,
-  (glitz_gl_blend_func_t) glBlendFunc,
-  (glitz_gl_clear_t) glClear,
-  (glitz_gl_clear_color_t) glClearColor,
-  (glitz_gl_clear_stencil_t) glClearStencil,
-  (glitz_gl_stencil_func_t) glStencilFunc,
-  (glitz_gl_stencil_op_t) glStencilOp,
-  (glitz_gl_push_attrib_t) glPushAttrib,
-  (glitz_gl_pop_attrib_t) glPopAttrib,
-  (glitz_gl_matrix_mode_t) glMatrixMode,
-  (glitz_gl_push_matrix_t) glPushMatrix,
-  (glitz_gl_pop_matrix_t) glPopMatrix,
-  (glitz_gl_load_identity_t) glLoadIdentity,
-  (glitz_gl_load_matrix_f_t) glLoadMatrixf,
-  (glitz_gl_depth_range_t) glDepthRange,
-  (glitz_gl_viewport_t) glViewport,
-  (glitz_gl_raster_pos_2f_t) glRasterPos2f,
-  (glitz_gl_bitmap_t) glBitmap,
-  (glitz_gl_read_buffer_t) glReadBuffer,
-  (glitz_gl_draw_buffer_t) glDrawBuffer,
-  (glitz_gl_copy_pixels_t) glCopyPixels,
-  (glitz_gl_flush_t) glFlush,
-  (glitz_gl_finish_t) glFinish,
-  (glitz_gl_pixel_store_i_t) glPixelStorei,
-  (glitz_gl_ortho_t) glOrtho,
-  (glitz_gl_scale_f_t) glScalef,
-  (glitz_gl_translate_f_t) glTranslatef,
-  (glitz_gl_hint_t) glHint,
-  (glitz_gl_depth_mask_t) glDepthMask,
-  (glitz_gl_polygon_mode_t) glPolygonMode,
-  (glitz_gl_shade_model_t) glShadeModel,
-  (glitz_gl_color_mask_t) glColorMask,
-  (glitz_gl_read_pixels_t) glReadPixels,
-  (glitz_gl_get_tex_image_t) glGetTexImage,
-  (glitz_gl_tex_sub_image_2d_t) glTexSubImage2D,
-  (glitz_gl_gen_textures_t) glGenTextures,
-  (glitz_gl_delete_textures_t) glDeleteTextures,
-  (glitz_gl_bind_texture_t) glBindTexture,
-  (glitz_gl_tex_image_2d_t) glTexImage2D,
-  (glitz_gl_tex_parameter_i_t) glTexParameteri,
-  (glitz_gl_get_tex_level_parameter_iv_t) glGetTexLevelParameteriv,
-  (glitz_gl_copy_tex_sub_image_2d_t) glCopyTexSubImage2D,
-  (glitz_gl_get_integer_v_t) glGetIntegerv,
+    /* core */
+    (glitz_gl_enable_t) glEnable,
+    (glitz_gl_disable_t) glDisable,
+    (glitz_gl_get_error_t) glGetError,
+    (glitz_gl_get_string_t) glGetString,
+    (glitz_gl_enable_client_state_t) glEnableClientState,
+    (glitz_gl_disable_client_state_t) glDisableClientState,
+    (glitz_gl_vertex_pointer_t) glVertexPointer,
+    (glitz_gl_tex_coord_pointer_t) glTexCoordPointer,
+    (glitz_gl_draw_arrays_t) glDrawArrays,
+    (glitz_gl_tex_env_f_t) glTexEnvf,
+    (glitz_gl_tex_env_fv_t) glTexEnvfv,
+    (glitz_gl_tex_gen_i_t) glTexGeni,
+    (glitz_gl_tex_gen_fv_t) glTexGenfv,
+    (glitz_gl_color_4us_t) glColor4us,
+    (glitz_gl_color_4f_t) glColor4f,
+    (glitz_gl_scissor_t) glScissor,
+    (glitz_gl_blend_func_t) glBlendFunc,
+    (glitz_gl_clear_t) glClear,
+    (glitz_gl_clear_color_t) glClearColor,
+    (glitz_gl_clear_stencil_t) glClearStencil,
+    (glitz_gl_stencil_func_t) glStencilFunc,
+    (glitz_gl_stencil_op_t) glStencilOp,
+    (glitz_gl_push_attrib_t) glPushAttrib,
+    (glitz_gl_pop_attrib_t) glPopAttrib,
+    (glitz_gl_matrix_mode_t) glMatrixMode,
+    (glitz_gl_push_matrix_t) glPushMatrix,
+    (glitz_gl_pop_matrix_t) glPopMatrix,
+    (glitz_gl_load_identity_t) glLoadIdentity,
+    (glitz_gl_load_matrix_f_t) glLoadMatrixf,
+    (glitz_gl_depth_range_t) glDepthRange,
+    (glitz_gl_viewport_t) glViewport,
+    (glitz_gl_raster_pos_2f_t) glRasterPos2f,
+    (glitz_gl_bitmap_t) glBitmap,
+    (glitz_gl_read_buffer_t) glReadBuffer,
+    (glitz_gl_draw_buffer_t) glDrawBuffer,
+    (glitz_gl_copy_pixels_t) glCopyPixels,
+    (glitz_gl_flush_t) glFlush,
+    (glitz_gl_finish_t) glFinish,
+    (glitz_gl_pixel_store_i_t) glPixelStorei,
+    (glitz_gl_ortho_t) glOrtho,
+    (glitz_gl_scale_f_t) glScalef,
+    (glitz_gl_translate_f_t) glTranslatef,
+    (glitz_gl_hint_t) glHint,
+    (glitz_gl_depth_mask_t) glDepthMask,
+    (glitz_gl_polygon_mode_t) glPolygonMode,
+    (glitz_gl_shade_model_t) glShadeModel,
+    (glitz_gl_color_mask_t) glColorMask,
+    (glitz_gl_read_pixels_t) glReadPixels,
+    (glitz_gl_get_tex_image_t) glGetTexImage,
+    (glitz_gl_tex_sub_image_2d_t) glTexSubImage2D,
+    (glitz_gl_gen_textures_t) glGenTextures,
+    (glitz_gl_delete_textures_t) glDeleteTextures,
+    (glitz_gl_bind_texture_t) glBindTexture,
+    (glitz_gl_tex_image_2d_t) glTexImage2D,
+    (glitz_gl_tex_parameter_i_t) glTexParameteri,
+    (glitz_gl_tex_parameter_fv_t) glTexParameterfv,
+    (glitz_gl_get_tex_level_parameter_iv_t) glGetTexLevelParameteriv,
+    (glitz_gl_copy_tex_sub_image_2d_t) glCopyTexSubImage2D,
+    (glitz_gl_get_integer_v_t) glGetIntegerv,
 
-  /* extensions */
-  (glitz_gl_blend_color_t) 0,
-  (glitz_gl_active_texture_t) 0,
-  (glitz_gl_client_active_texture_t) 0,
-  (glitz_gl_multi_draw_arrays_t) 0,
-  (glitz_gl_gen_programs_t) 0,
-  (glitz_gl_delete_programs_t) 0,
-  (glitz_gl_program_string_t) 0,
-  (glitz_gl_bind_program_t) 0,
-  (glitz_gl_program_local_param_4fv_t) 0,
-  (glitz_gl_get_program_iv_t) 0,
-  (glitz_gl_gen_buffers_t) 0,
-  (glitz_gl_delete_buffers_t) 0,
-  (glitz_gl_bind_buffer_t) 0,
-  (glitz_gl_buffer_data_t) 0,
-  (glitz_gl_buffer_sub_data_t) 0,
-  (glitz_gl_get_buffer_sub_data_t) 0,
-  (glitz_gl_map_buffer_t) 0,
-  (glitz_gl_unmap_buffer_t) 0
+    /* extensions */
+    (glitz_gl_blend_color_t) 0,
+    (glitz_gl_active_texture_t) 0,
+    (glitz_gl_client_active_texture_t) 0,
+    (glitz_gl_multi_draw_arrays_t) 0,
+    (glitz_gl_gen_programs_t) 0,
+    (glitz_gl_delete_programs_t) 0,
+    (glitz_gl_program_string_t) 0,
+    (glitz_gl_bind_program_t) 0,
+    (glitz_gl_program_local_param_4fv_t) 0,
+    (glitz_gl_get_program_iv_t) 0,
+    (glitz_gl_gen_buffers_t) 0,
+    (glitz_gl_delete_buffers_t) 0,
+    (glitz_gl_bind_buffer_t) 0,
+    (glitz_gl_buffer_data_t) 0,
+    (glitz_gl_buffer_sub_data_t) 0,
+    (glitz_gl_get_buffer_sub_data_t) 0,
+    (glitz_gl_map_buffer_t) 0,
+    (glitz_gl_unmap_buffer_t) 0,
+    (glitz_gl_gen_framebuffers_t) 0,
+    (glitz_gl_delete_framebuffers_t) 0,
+    (glitz_gl_bind_framebuffer_t) 0,
+    (glitz_gl_framebuffer_renderbuffer_t) 0,
+    (glitz_gl_framebuffer_texture_2d_t) 0,
+    (glitz_gl_check_framebuffer_status_t) 0,
+    (glitz_gl_gen_renderbuffers_t) 0,
+    (glitz_gl_delete_renderbuffers_t) 0,
+    (glitz_gl_bind_renderbuffer_t) 0,
+    (glitz_gl_renderbuffer_storage_t) 0,
+    (glitz_gl_get_renderbuffer_parameter_iv_t) 0
 };
 
 static void
@@ -132,79 +144,79 @@
 static void
 glitz_agl_thread_info_destroy (glitz_agl_thread_info_t *thread_info)
 {
-  pthread_setspecific (info_tsd, NULL);
-  
-  if (thread_info) {
-    glitz_agl_thread_info_fini (thread_info);
-    free (thread_info);
-  }
+    pthread_setspecific (info_tsd, NULL);
+
+    if (thread_info) {
+	glitz_agl_thread_info_fini (thread_info);
+	free (thread_info);
+    }
 }
 
 static void
 _tsd_destroy (void *p)
 {
-  if (p) {
-    glitz_agl_thread_info_fini ((glitz_agl_thread_info_t *) p);
-    free (p);
-  }
+    if (p) {
+	glitz_agl_thread_info_fini ((glitz_agl_thread_info_t *) p);
+	free (p);
+    }
 }
 
 glitz_agl_thread_info_t *
 glitz_agl_thread_info_get (void)
 {
-  glitz_agl_thread_info_t *thread_info;
-  void *p;
-  
-  if (!tsd_initialized) {
-    pthread_key_create (&info_tsd, _tsd_destroy);
-    tsd_initialized = 1;
-  }
-  
-  p = pthread_getspecific (info_tsd);
+    glitz_agl_thread_info_t *thread_info;
+    void *p;
 
-  if (p == NULL) {
-    thread_info = malloc (sizeof (glitz_agl_thread_info_t));
-    glitz_agl_thread_info_init (thread_info);
-  
-    pthread_setspecific (info_tsd, thread_info);
-  } else
-    thread_info = (glitz_agl_thread_info_t *) p;
-  
-  return thread_info;
+    if (!tsd_initialized) {
+	pthread_key_create (&info_tsd, _tsd_destroy);
+	tsd_initialized = 1;
+    }
+
+    p = pthread_getspecific (info_tsd);
+
+    if (p == NULL) {
+	thread_info = malloc (sizeof (glitz_agl_thread_info_t));
+	glitz_agl_thread_info_init (thread_info);
+
+	pthread_setspecific (info_tsd, thread_info);
+    } else
+	thread_info = (glitz_agl_thread_info_t *) p;
+
+    return thread_info;
 }
 
 #else
 
 /* not thread safe */
 static glitz_agl_thread_info_t _thread_info = {
-  0,
-  NULL,
-  NULL,
-  0,
-  NULL,
-  0,
-  { 0 },
-  0,
-  NULL,
-  0,
-  NULL,
-  { 0 }
+    0,
+    NULL,
+    NULL,
+    0,
+    NULL,
+    0,
+    { 0 },
+    0,
+    NULL,
+    0,
+    NULL,
+    { 0 }
 };
 
 static void
 glitz_agl_thread_info_destroy (glitz_agl_thread_info_t *thread_info)
 {
-  if (thread_info)
-    glitz_agl_thread_info_fini (thread_info);
+    if (thread_info)
+	glitz_agl_thread_info_fini (thread_info);
 }
 
 glitz_agl_thread_info_t *
 glitz_agl_thread_info_get (void)
 {
-  if (_thread_info.context_stack_size == 0)
-    glitz_agl_thread_info_init (&_thread_info);
-      
-  return &_thread_info;
+    if (_thread_info.context_stack_size == 0)
+	glitz_agl_thread_info_init (&_thread_info);
+
+    return &_thread_info;
 }
 
 #endif
@@ -212,58 +224,58 @@
 static void
 glitz_agl_thread_info_init (glitz_agl_thread_info_t *thread_info)
 {
-  thread_info->formats = NULL;
-  thread_info->pixel_formats = (AGLPixelFormat *) 0;
-  thread_info->n_formats = 0;
-  thread_info->contexts = NULL;
-  thread_info->n_contexts = 0;
+    thread_info->formats = NULL;
+    thread_info->pixel_formats = (AGLPixelFormat *) 0;
+    thread_info->n_formats = 0;
+    thread_info->contexts = NULL;
+    thread_info->n_contexts = 0;
 
-  thread_info->context_stack_size = 1;
-  thread_info->context_stack->surface = NULL;
-  thread_info->context_stack->constraint = GLITZ_NONE;
+    thread_info->context_stack_size = 1;
+    thread_info->context_stack->surface = NULL;
+    thread_info->context_stack->constraint = GLITZ_NONE;
 
-  thread_info->root_context = NULL;
+    thread_info->root_context = NULL;
 
-  thread_info->agl_feature_mask = 0;
+    thread_info->agl_feature_mask = 0;
 
-  thread_info->cctx = NULL;
+    thread_info->cctx = NULL;
 
-  glitz_program_map_init (&thread_info->program_map);
+    glitz_program_map_init (&thread_info->program_map);
 
-  if (!glitz_agl_query_extensions (thread_info))
-    glitz_agl_query_formats (thread_info);
+    if (!glitz_agl_query_extensions (thread_info))
+	glitz_agl_query_formats (thread_info);
 }
 
 static void
 glitz_agl_thread_info_fini (glitz_agl_thread_info_t *thread_info)
 {
-  int i;
+    int i;
 
-  for (i = 0; i < thread_info->n_contexts; i++)
-    glitz_agl_context_destroy (thread_info, thread_info->contexts[i]);
-  
-  for (i = 0; i < thread_info->n_formats; i++)
-    aglDestroyPixelFormat (thread_info->pixel_formats[i]);
-  
-  if (thread_info->formats)
-    free (thread_info->formats);
-  
-  if (thread_info->pixel_formats)
-    free (thread_info->pixel_formats);
+    for (i = 0; i < thread_info->n_contexts; i++)
+	glitz_agl_context_destroy (thread_info, thread_info->contexts[i]);
+
+    for (i = 0; i < thread_info->n_formats; i++)
+	aglDestroyPixelFormat (thread_info->pixel_formats[i]);
+
+    if (thread_info->formats)
+	free (thread_info->formats);
+
+    if (thread_info->pixel_formats)
+	free (thread_info->pixel_formats);
 }
 
 void
 glitz_agl_init (void)
 {
-  glitz_agl_thread_info_get ();
+    glitz_agl_thread_info_get ();
 }
 slim_hidden_def(glitz_agl_init);
 
 void
 glitz_agl_fini (void)
 {
-  glitz_agl_thread_info_t *info = glitz_agl_thread_info_get ();
+    glitz_agl_thread_info_t *info = glitz_agl_thread_info_get ();
 
-  glitz_agl_thread_info_destroy (info);
+    glitz_agl_thread_info_destroy (info);
 }
 slim_hidden_def(glitz_agl_fini);

Index: glitz_agl_pbuffer.c
===================================================================
RCS file: /cvs/cairo/glitz/src/agl/glitz_agl_pbuffer.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- glitz_agl_pbuffer.c	25 Jan 2005 19:50:26 -0000	1.2
+++ glitz_agl_pbuffer.c	14 Sep 2005 15:57:16 -0000	1.3
@@ -1,6 +1,6 @@
 /*
  * Copyright © 2004 David Reveman
- * 
+ *
  * Permission to use, copy, modify, distribute, and sell this software
  * and its documentation for any purpose is hereby granted without
  * fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
  * software for any purpose. It is provided "as is" without express or
  * implied warranty.
  *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
  * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
@@ -31,28 +31,28 @@
 
 AGLPbuffer
 glitz_agl_pbuffer_create (glitz_agl_thread_info_t *thread_info,
-                          int                     width,
-                          int                     height)
+			  int                     width,
+			  int                     height)
 {
-  AGLPbuffer pbuffer;
-  glitz_gl_enum_t target;
+    AGLPbuffer pbuffer;
+    glitz_gl_enum_t target;
 
-  if (!POWER_OF_TWO (width) || !POWER_OF_TWO (height)) {
-    if (thread_info->agl_feature_mask &
-        GLITZ_AGL_FEATURE_TEXTURE_RECTANGLE_MASK)
-      target = GLITZ_GL_TEXTURE_RECTANGLE;
-    else
-      return (AGLPbuffer) 0;
-  } else
-    target = GLITZ_GL_TEXTURE_2D;
+    if (!POWER_OF_TWO (width) || !POWER_OF_TWO (height)) {
+	if (thread_info->agl_feature_mask &
+	    GLITZ_AGL_FEATURE_TEXTURE_RECTANGLE_MASK)
+	    target = GLITZ_GL_TEXTURE_RECTANGLE;
+	else
+	    return (AGLPbuffer) 0;
+    } else
+	target = GLITZ_GL_TEXTURE_2D;
 
-  aglCreatePBuffer (width, height, target, GLITZ_GL_RGBA, 0, &pbuffer);
+    aglCreatePBuffer (width, height, target, GLITZ_GL_RGBA, 0, &pbuffer);
 
-  return pbuffer;
+    return pbuffer;
 }
 
-void 
+void
 glitz_agl_pbuffer_destroy (AGLPbuffer pbuffer)
 {
-  aglDestroyPBuffer (pbuffer);
+    aglDestroyPBuffer (pbuffer);
 }

Index: glitz_aglint.h
===================================================================
RCS file: /cvs/cairo/glitz/src/agl/glitz_aglint.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- glitz_aglint.h	12 Apr 2005 14:54:56 -0000	1.3
+++ glitz_aglint.h	14 Sep 2005 15:57:16 -0000	1.4
@@ -1,6 +1,6 @@
 /*
  * Copyright © 2004 David Reveman
- * 
+ *
  * Permission to use, copy, modify, distribute, and sell this software
  * and its documentation for any purpose is hereby granted without
  * fee, provided that the above copyright notice appear in all copies
@@ -12,11 +12,11 @@
  * software for any purpose. It is provided "as is" without express or
  * implied warranty.
  *
- * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 
+ * DAVID REVEMAN DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN
  * NO EVENT SHALL DAVID REVEMAN BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
- * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, 
+ * OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
  * NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
  * WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  *
@@ -43,47 +43,46 @@
 typedef struct _glitz_agl_drawable glitz_agl_drawable_t;
 
 typedef struct _glitz_agl_context_info_t {
-  glitz_agl_drawable_t *drawable;
-  glitz_surface_t      *surface;
-  glitz_constraint_t   constraint;
+    glitz_agl_drawable_t *drawable;
+    glitz_surface_t      *surface;
+    glitz_constraint_t   constraint;
 } glitz_agl_context_info_t;
 
 typedef struct _glitz_agl_context_t {
-  glitz_context_t   base;
-  AGLContext        context;
-  glitz_format_id_t id;
-  AGLPixelFormat    pixel_format;
-  glitz_bool_t      pbuffer;
-  glitz_backend_t   backend;
-  glitz_gl_int_t    max_viewport_dims[2];
-  glitz_gl_int_t    max_texture_2d_size;
-  glitz_gl_int_t    max_texture_rect_size;
-  glitz_bool_t      initialized;
+    glitz_context_t   base;
+    AGLContext        context;
+    glitz_format_id_t id;
+    AGLPixelFormat    pixel_format;
+    glitz_bool_t      pbuffer;
+    glitz_backend_t   backend;
+    glitz_bool_t      initialized;
 } glitz_agl_context_t;
 
 typedef struct _glitz_agl_thread_info_t {
-  int                      drawables;
-  glitz_drawable_format_t  *formats;
-  AGLPixelFormat           *pixel_formats;
-  int                      n_formats;
-  glitz_agl_context_t      **contexts;
-  int                      n_contexts;
-  glitz_agl_context_info_t context_stack[GLITZ_CONTEXT_STACK_SIZE];
-  int                      context_stack_size;
-  AGLContext               root_context;
-  unsigned long            agl_feature_mask;
-  glitz_context_t          *cctx;
-  glitz_program_map_t      program_map;
+    int                         drawables;
+    glitz_int_drawable_format_t *formats;
+    AGLPixelFormat              *pixel_formats;
+    int                         n_formats;
+    glitz_agl_context_t         **contexts;
+    int                         n_contexts;
+    glitz_agl_context_info_t    context_stack[GLITZ_CONTEXT_STACK_SIZE];
+    int                         context_stack_size;
+    AGLContext                  root_context;
+    unsigned long               agl_feature_mask;
+    glitz_context_t             *cctx;
+    glitz_program_map_t         program_map;
 } glitz_agl_thread_info_t;
 
 struct _glitz_agl_drawable {
-  glitz_drawable_t        base;
-  
-  glitz_agl_thread_info_t *thread_info;
-  glitz_agl_context_t     *context;
-  AGLDrawable             drawable;
-  AGLPbuffer              pbuffer;
-  WindowRef               window;
+    glitz_drawable_t        base;
+
+    glitz_agl_thread_info_t *thread_info;
+    glitz_agl_context_t     *context;
+    AGLDrawable             drawable;
+    AGLPbuffer              pbuffer;
+    WindowRef               window;
+    int                     width;
+    int                     height;
 };
 
 extern glitz_status_t __internal_linkage
@@ -94,33 +93,33 @@
 
 extern glitz_agl_context_t __internal_linkage *
 glitz_agl_context_get (glitz_agl_thread_info_t *thread_info,
-                       glitz_drawable_format_t *format);
+		       glitz_drawable_format_t *format);
 
 extern void __internal_linkage
 glitz_agl_context_destroy (glitz_agl_thread_info_t *thread_info,
-                           glitz_agl_context_t     *context);
+			   glitz_agl_context_t     *context);
 
 extern void __internal_linkage
 glitz_agl_query_formats (glitz_agl_thread_info_t *thread_info);
 
 extern AGLPbuffer __internal_linkage
 glitz_agl_pbuffer_create (glitz_agl_thread_info_t *thread_info,
-                          int                     width,
-                          int                     height);
+			  int                     width,
+			  int                     height);
 
 extern void __internal_linkage
 glitz_agl_pbuffer_destroy (AGLPbuffer pbuffer);
 
 extern glitz_drawable_t __internal_linkage *
 glitz_agl_create_pbuffer (void                    *abstract_templ,
-                          glitz_drawable_format_t *format,
-                          unsigned int            width,
-                          unsigned int            height);
+			  glitz_drawable_format_t *format,
+			  unsigned int            width,
+			  unsigned int            height);
 
-extern void __internal_linkage
+extern glitz_bool_t __internal_linkage
 glitz_agl_push_current (void               *abstract_drawable,
-                        glitz_surface_t    *surface,
-                        glitz_constraint_t constraint);
+			glitz_surface_t    *surface,
+			glitz_constraint_t constraint);
 
 extern glitz_surface_t __internal_linkage *
 glitz_agl_pop_current (void *abstract_drawable);
@@ -128,7 +127,7 @@
 extern void __internal_linkage
 glitz_agl_destroy (void *abstract_drawable);
 
-extern void __internal_linkage
+extern glitz_bool_t __internal_linkage
 glitz_agl_swap_buffers (void *abstract_drawable);
 
 /* Avoid unnecessary PLT entries.  */



More information about the cairo-commit mailing list