[cairo-commit] 2 commits - src/cairo-quartz.h src/cairo-quartz-private.h src/cairo-quartz-surface.c

Vladimir Vukicevic vladimir at kemper.freedesktop.org
Tue Feb 20 16:19:33 PST 2007


 src/cairo-quartz-private.h |   10 ---
 src/cairo-quartz-surface.c |  114 ++-------------------------------------------
 src/cairo-quartz.h         |   13 -----
 3 files changed, 8 insertions(+), 129 deletions(-)

New commits:
diff-tree 363b1a40b5719582c670bdb9e7cd8087bcbf9666 (from e4a1410514471c2cb290d691ca77c4ab24a6541c)
Author: Vladimir Vukicevic <vladimir at pobox.com>
Date:   Tue Feb 20 16:18:27 2007 -0800

    [quartz] Remove (disabled) support for rendering via AGL/CGGL

diff --git a/src/cairo-quartz-private.h b/src/cairo-quartz-private.h
index 862554f..1000e73 100644
--- a/src/cairo-quartz-private.h
+++ b/src/cairo-quartz-private.h
@@ -41,15 +41,6 @@
 #include <cairoint.h>
 #include <cairo-quartz.h>
 
-#ifdef CAIRO_QUARTZ_SUPPORT_AGL
-#include <AGL/agl.h>
-#include <OpenGL/gl.h>
-
-typedef AGLContext nquartz_agl_context_type;
-#else
-typedef void* nquartz_agl_context_type;
-#endif
-
 typedef struct cairo_nquartz_surface {
     cairo_surface_t base;
 
@@ -67,7 +58,6 @@ typedef struct cairo_nquartz_surface {
     CGImageRef sourceImage;
     CGShadingRef sourceShading;
     CGPatternRef sourcePattern;
-    nquartz_agl_context_type aglContext;
 } cairo_nquartz_surface_t, cairo_quartz_surface_t;
 
 cairo_bool_t
diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c
index a9a6139..04710f1 100644
--- a/src/cairo-quartz-surface.c
+++ b/src/cairo-quartz-surface.c
@@ -36,11 +36,6 @@
 
 #include <Carbon/Carbon.h>
 
-/* Support rendering to an OpenGL AGL context using CGGLContextCreate;
- * Apple has deprecated CGGLContext, so CAIRO_QUARTZ_SUPPORT_AGL is
- * not defined by default.
- */
-
 #include "cairoint.h"
 #include "cairo-private.h"
 
@@ -762,61 +757,7 @@ _cairo_nquartz_get_image (cairo_nquartz_
     unsigned char *imageData;
     cairo_image_surface_t *isurf;
 
-    /* If we weren't constructed with an AGL Context
-     * or a CCGBitmapContext, then we have no way
-     * of doing this
-     */
-#ifdef CAIRO_QUARTZ_SUPPORT_AGL
-    if (surface->aglContext) {
-	AGLContext oldContext;
-	cairo_format_masks_t masks = { 32, 0xff << 24, 0xff << 16, 0xff << 8, 0xff << 0 };
-	unsigned int i;
-
-	oldContext = aglGetCurrentContext();
-	if (oldContext != surface->aglContext)
-	    aglSetCurrentContext(surface->aglContext);
-
-	imageData = (unsigned char *) malloc (surface->extents.width * surface->extents.height * 4);
-	if (!imageData)
-	    return CAIRO_STATUS_NO_MEMORY;
-
-	glReadBuffer (GL_FRONT);
-	glReadPixels (0, 0, surface->extents.width, surface->extents.height,
-		      GL_BGRA, GL_UNSIGNED_INT_8_8_8_8_REV,
-		      imageData);
-
-	/* swap lines */
-	/* XXX find some fast code to do this */
-	unsigned int lineSize = surface->extents.width * 4;
-	unsigned char *tmpLine = malloc(lineSize);
-	for (i = 0; i < surface->extents.height / 2; i++) {
-	    unsigned char *l0 = imageData + lineSize * i;
-	    unsigned char *l1 = imageData + (lineSize * (surface->extents.height - i - 1));
-	    memcpy (tmpLine, l0, lineSize);
-	    memcpy (l0, l1, lineSize);
-	    memcpy (l1, tmpLine, lineSize);
-	}
-	free (tmpLine);
-
-	if (oldContext && oldContext != surface->aglContext)
-	    aglSetCurrentContext(oldContext);
-
-	isurf = (cairo_image_surface_t *)_cairo_image_surface_create_with_masks
-	    (imageData,
-	     &masks,
-	     surface->extents.width,
-	     surface->extents.height,
-	     surface->extents.width * 4);
-
-	if (data_out)
-	    *data_out = imageData;
-	else
-	    _cairo_image_surface_assume_ownership_of_data (isurf);
-#else
-    /* no AGL */
-    if (0) {
-#endif
-    } else if (CGBitmapContextGetBitsPerPixel(surface->cgContext) != 0) {
+    if (CGBitmapContextGetBitsPerPixel(surface->cgContext) != 0) {
 	unsigned int stride;
 	unsigned int bitinfo;
 	unsigned int bpc, bpp;
@@ -898,11 +839,6 @@ _cairo_nquartz_surface_finish (void *abs
 
     ND((stderr, "_cairo_nquartz_surface_finish[%p] cgc: %p\n", surface, surface->cgContext));
 
-#ifdef CAIRO_QUARTZ_SUPPORT_AGL
-    if (surface->aglContext)
-	aglSetCurrentContext(surface->aglContext);
-#endif
-
     CGContextFlush (surface->cgContext);
 
     /* Restore our saved gstate that we use to reset clipping */
@@ -912,13 +848,6 @@ _cairo_nquartz_surface_finish (void *abs
 
     surface->cgContext = NULL;
 
-#ifdef CAIRO_QUARTZ_SUPPORT_AGL
-    if (surface->aglContext)
-	glFlush();
-
-    surface->aglContext = NULL;
-#endif
-
     if (surface->imageData) {
 	free (surface->imageData);
 	surface->imageData = NULL;
@@ -1533,7 +1462,6 @@ static const struct _cairo_surface_backe
 
 static cairo_nquartz_surface_t *
 _cairo_nquartz_surface_create_internal (CGContextRef cgContext,
-					nquartz_agl_context_type aglContext,
 					cairo_content_t content,
 					unsigned int width,
 					unsigned int height)
@@ -1562,7 +1490,6 @@ _cairo_nquartz_surface_create_internal (
      */
     CGContextSaveGState (cgContext);
 
-    surface->aglContext = aglContext;
     surface->cgContext = cgContext;
     surface->cgContextBaseCTM = CGContextGetCTM (cgContext);
 
@@ -1571,33 +1498,6 @@ _cairo_nquartz_surface_create_internal (
     return surface;
 }
 					 
-#ifdef CAIRO_QUARTZ_SUPPORT_AGL
-cairo_surface_t *
-cairo_quartz_surface_create_for_agl_context (AGLContext aglContext,
-					     unsigned int width,
-					     unsigned int height)
-{
-    cairo_nquartz_surface_t *surf;
-    CGSize sz;
-
-    /* Make our CGContext from the AGL context */
-    sz.width = width;
-    sz.height = height;
-
-    CGContextRef cgc = CGGLContextCreate (aglContext, sz, NULL /* device RGB colorspace */);
-
-    surf = _cairo_nquartz_surface_create_internal (cgc, aglContext, CAIRO_CONTENT_COLOR_ALPHA,
-						   width, height);
-    if (!surf) {
-	CGContextRelease (cgc);
-	// create_internal will have set an error
-	return (cairo_surface_t*) &_cairo_surface_nil;
-    }
-
-    return (cairo_surface_t *) surf;
-}
-#endif
-
 /**
  * cairo_quartz_surface_create_for_cg_context
  * @cgContext: the existing CGContext for which to create the surface
@@ -1636,7 +1536,7 @@ cairo_quartz_surface_create_for_cg_conte
 
     CGContextRetain (cgContext);
 
-    surf = _cairo_nquartz_surface_create_internal (cgContext, NULL, CAIRO_CONTENT_COLOR_ALPHA,
+    surf = _cairo_nquartz_surface_create_internal (cgContext, CAIRO_CONTENT_COLOR_ALPHA,
 						   width, height);
     if (!surf) {
 	CGContextRelease (cgContext);
@@ -1730,7 +1630,7 @@ cairo_quartz_surface_create (cairo_forma
     CGContextTranslateCTM (cgc, 0.0, height);
     CGContextScaleCTM (cgc, 1.0, -1.0);
 
-    surf = _cairo_nquartz_surface_create_internal (cgc, NULL, _cairo_content_from_format (format),
+    surf = _cairo_nquartz_surface_create_internal (cgc, _cairo_content_from_format (format),
 						   width, height);
     if (!surf) {
 	CGContextRelease (cgc);
diff --git a/src/cairo-quartz.h b/src/cairo-quartz.h
index 3fc4f53..5d78d39 100644
--- a/src/cairo-quartz.h
+++ b/src/cairo-quartz.h
@@ -42,10 +42,6 @@
 
 #include <Carbon/Carbon.h>
 
-#ifdef CAIRO_QUARTZ_SUPPORT_AGL
-#include <AGL/agl.h>
-#endif
-
 CAIRO_BEGIN_DECLS
 
 cairo_public cairo_surface_t *
@@ -53,13 +49,6 @@ cairo_quartz_surface_create (cairo_forma
                              unsigned int width,
                              unsigned int height);
 
-#ifdef CAIRO_QUARTZ_SUPPORT_AGL
-cairo_public cairo_surface_t *
-cairo_quartz_surface_create_for_agl_context (AGLContext aglContext,
-                                             unsigned int width,
-                                             unsigned int height);
-#endif
-
 cairo_public cairo_surface_t *
 cairo_quartz_surface_create_for_cg_context (CGContextRef cgContext,
                                             unsigned int width,
diff-tree e4a1410514471c2cb290d691ca77c4ab24a6541c (from 28c1e46b8e082f65fc94c984ea3b66df5adaa529)
Author: Vladimir Vukicevic <vladimir at pobox.com>
Date:   Tue Feb 20 16:16:18 2007 -0800

    [quartz] Rename public function parameter from surf -> surface

diff --git a/src/cairo-quartz-surface.c b/src/cairo-quartz-surface.c
index 2f86203..a9a6139 100644
--- a/src/cairo-quartz-surface.c
+++ b/src/cairo-quartz-surface.c
@@ -1745,7 +1745,7 @@ cairo_quartz_surface_create (cairo_forma
 
 /**
  * cairo_quartz_surface_get_cg_context
- * @surf: the Cairo Quartz surface
+ * @surface: the Cairo Quartz surface
  *
  * Returns the CGContextRef that the given Quartz surface is backed
  * by.
@@ -1755,11 +1755,11 @@ cairo_quartz_surface_create (cairo_forma
  * Since: 1.4
  **/
 CGContextRef
-cairo_quartz_surface_get_cg_context (cairo_surface_t *surf)
+cairo_quartz_surface_get_cg_context (cairo_surface_t *surface)
 {
-    cairo_nquartz_surface_t *nquartz = (cairo_nquartz_surface_t*)surf;
+    cairo_nquartz_surface_t *nquartz = (cairo_nquartz_surface_t*)surface;
 
-    if (cairo_surface_get_type(surf) != CAIRO_SURFACE_TYPE_QUARTZ)
+    if (cairo_surface_get_type(surface) != CAIRO_SURFACE_TYPE_QUARTZ)
 	return NULL;
 
     return nquartz->cgContext;
diff --git a/src/cairo-quartz.h b/src/cairo-quartz.h
index e4bed43..3fc4f53 100644
--- a/src/cairo-quartz.h
+++ b/src/cairo-quartz.h
@@ -66,7 +66,7 @@ cairo_quartz_surface_create_for_cg_conte
                                             unsigned int height);
 
 cairo_public CGContextRef
-cairo_quartz_surface_get_cg_context (cairo_surface_t *surf);
+cairo_quartz_surface_get_cg_context (cairo_surface_t *surface);
 
 CAIRO_END_DECLS
 


More information about the cairo-commit mailing list