[quartz] Rename nquartz to quartz

This commit is contained in:
Vladimir Vukicevic 2007-02-20 12:15:35 -08:00 committed by Vladimir Vukicevic
parent 641f0919d5
commit 4c201723ce
11 changed files with 1842 additions and 2213 deletions

View file

@ -700,31 +700,17 @@ cleanup_cairo_glitz_wgl (void *closure)
#endif /* CAIRO_HAS_GLITZ_SURFACE */ #endif /* CAIRO_HAS_GLITZ_SURFACE */
#if 0 && CAIRO_HAS_QUARTZ_SURFACE #if CAIRO_HAS_QUARTZ_SURFACE
static cairo_surface_t *
create_quartz_surface (int width, int height, void **closure)
{
#error Not yet implemented
}
static void #include <cairo-quartz.h>
cleanup_quartz (void *closure)
{
#error Not yet implemented
}
#endif
#if CAIRO_HAS_NQUARTZ_SURFACE
#include <cairo-nquartz.h>
static cairo_surface_t * static cairo_surface_t *
create_nquartz_surface (const char *name, create_quartz_surface (const char *name,
cairo_content_t content, cairo_content_t content,
int width, int width,
int height, int height,
cairo_boilerplate_mode_t mode, cairo_boilerplate_mode_t mode,
void **closure) void **closure)
{ {
cairo_format_t format; cairo_format_t format;
@ -739,11 +725,11 @@ create_nquartz_surface (const char *name,
*closure = NULL; *closure = NULL;
return cairo_nquartz_surface_create (format, width, height); return cairo_quartz_surface_create (format, width, height);
} }
static void static void
cleanup_nquartz (void *closure) cleanup_quartz (void *closure)
{ {
/* nothing */ /* nothing */
} }
@ -1430,19 +1416,14 @@ cairo_boilerplate_target_t targets[] =
cleanup_cairo_glitz_wgl }, cleanup_cairo_glitz_wgl },
#endif #endif
#endif /* CAIRO_HAS_GLITZ_SURFACE */ #endif /* CAIRO_HAS_GLITZ_SURFACE */
#if 0 && CAIRO_HAS_QUARTZ_SURFACE #if CAIRO_HAS_QUARTZ_SURFACE
{ "quartz", CAIRO_SURFACE_TYPE_QUARTZ, CAIRO_CONTENT_COLOR_ALPHA, 0,
create_quartz_surface, cairo_surface_write_to_png,
cleanup_quartz },
{ "quartz", CAIRO_SURFACE_TYPE_QUARTZ, CAIRO_CONTENT_COLOR, 0, { "quartz", CAIRO_SURFACE_TYPE_QUARTZ, CAIRO_CONTENT_COLOR, 0,
create_quartz_surface, cairo_surface_write_to_png, create_quartz_surface, cairo_surface_write_to_png,
cleanup_quartz }, cleanup_quartz },
#endif #endif
#if CAIRO_HAS_NQUARTZ_SURFACE
{ "nquartz", CAIRO_SURFACE_TYPE_NQUARTZ, CAIRO_CONTENT_COLOR_ALPHA, 0,
create_nquartz_surface, cairo_surface_write_to_png,
cleanup_nquartz },
{ "nquartz", CAIRO_SURFACE_TYPE_NQUARTZ, CAIRO_CONTENT_COLOR, 0,
create_nquartz_surface, cairo_surface_write_to_png,
cleanup_nquartz },
#endif
#if CAIRO_HAS_WIN32_SURFACE #if CAIRO_HAS_WIN32_SURFACE
{ "win32", CAIRO_SURFACE_TYPE_WIN32, CAIRO_CONTENT_COLOR, 0, { "win32", CAIRO_SURFACE_TYPE_WIN32, CAIRO_CONTENT_COLOR, 0,
create_win32_surface, cairo_surface_write_to_png, cleanup_win32 }, create_win32_surface, cairo_surface_write_to_png, cleanup_win32 },

View file

@ -278,12 +278,6 @@ CAIRO_BACKEND_ENABLE(quartz, Quartz, quartz, QUARTZ_SURFACE, no, [
quartz_LIBS="-Xlinker -framework -Xlinker Carbon" quartz_LIBS="-Xlinker -framework -Xlinker Carbon"
]) ])
CAIRO_BACKEND_ENABLE(nquartz, NativeQuartz, nquartz, NQUARTZ_SURFACE, no, [
dnl There is no pkgconfig for quartz; lets do a header check
AC_CHECK_HEADER(Carbon/Carbon.h, , [use_nquartz="no (Carbon headers not found)"])
quartz_LIBS="-Xlinker -framework -Xlinker Carbon"
])
dnl =========================================================================== dnl ===========================================================================
AC_MSG_CHECKING([for native Win32]) AC_MSG_CHECKING([for native Win32])
@ -889,7 +883,6 @@ echo " image: yes (always builtin)"
echo " Xlib: $use_xlib" echo " Xlib: $use_xlib"
echo " Xlib Xrender: $use_xlib_xrender" echo " Xlib Xrender: $use_xlib_xrender"
echo " Quartz: $use_quartz" echo " Quartz: $use_quartz"
echo " Native Quartz: $use_nquartz"
echo " XCB: $use_xcb" echo " XCB: $use_xcb"
echo " Win32: $use_win32" echo " Win32: $use_win32"
echo " OS2: $use_os2" echo " OS2: $use_os2"

View file

@ -66,12 +66,6 @@ libcairo_quartz_sources = cairo-quartz-surface.c cairo-quartz-private.h
backend_pkgconfigs += cairo-quartz.pc backend_pkgconfigs += cairo-quartz.pc
endif endif
if CAIRO_HAS_NQUARTZ_SURFACE
libcairo_nquartz_headers = cairo-nquartz.h
libcairo_nquartz_sources = cairo-nquartz-surface.c cairo-quartz-private.h
backend_pkgconfigs += cairo-nquartz.pc
endif
if OS_WIN32 if OS_WIN32
export_symbols = -export-symbols cairo.def export_symbols = -export-symbols cairo.def
cairo_def_dependency = cairo.def cairo_def_dependency = cairo.def

View file

@ -935,7 +935,7 @@ _cairo_atsui_font_old_show_glyphs (void *abstract_font,
CGFontRef cgFont; CGFontRef cgFont;
CGAffineTransform textTransform; CGAffineTransform textTransform;
if (!_cairo_surface_is_quartz (generic_surface)) if (cairo_surface_get_type (generic_surface) != CAIRO_SURFACE_TYPE_QUARTZ)
return CAIRO_INT_STATUS_UNSUPPORTED; return CAIRO_INT_STATUS_UNSUPPORTED;
/* Check if we can draw directly to the destination surface */ /* Check if we can draw directly to the destination surface */
@ -961,7 +961,7 @@ _cairo_atsui_font_old_show_glyphs (void *abstract_font,
CGContextTranslateCTM(drawingContext, 0, destImageSurface->height); CGContextTranslateCTM(drawingContext, 0, destImageSurface->height);
CGContextScaleCTM(drawingContext, 1.0f, -1.0f); CGContextScaleCTM(drawingContext, 1.0f, -1.0f);
} else { } else {
drawingContext = ((cairo_quartz_surface_t *)generic_surface)->context; drawingContext = ((cairo_quartz_surface_t *)generic_surface)->cgContext;
CGContextSaveGState (drawingContext); CGContextSaveGState (drawingContext);
} }
@ -992,35 +992,6 @@ _cairo_atsui_font_old_show_glyphs (void *abstract_font,
CGContextSetRGBFillColor(drawingContext, 0.0f, 0.0f, 0.0f, 0.0f); CGContextSetRGBFillColor(drawingContext, 0.0f, 0.0f, 0.0f, 0.0f);
} }
if (surface->clip_region) {
pixman_box16_t *boxes = pixman_region_rects (surface->clip_region);
int num_boxes = pixman_region_num_rects (surface->clip_region);
CGRect stack_rects[10];
CGRect *rects;
int i;
/* XXX: Return-value of malloc needs to be checked for
* NULL. Can someone fix this who is more familiar with
* the cleanup needed in this function?
*/
if (num_boxes > 10)
rects = malloc (sizeof (CGRect) * num_boxes);
else
rects = stack_rects;
for (i = 0; i < num_boxes; i++) {
rects[i].origin.x = boxes[i].x1;
rects[i].origin.y = boxes[i].y1;
rects[i].size.width = boxes[i].x2 - boxes[i].x1;
rects[i].size.height = boxes[i].y2 - boxes[i].y1;
}
CGContextClipToRects (drawingContext, rects, num_boxes);
if (rects != stack_rects)
free(rects);
}
/* TODO - bold and italic text /* TODO - bold and italic text
* *
* We could draw the text using ATSUI and get bold, italics * We could draw the text using ATSUI and get bold, italics

File diff suppressed because it is too large Load diff

View file

@ -1,80 +0,0 @@
/* cairo - a vector graphics library with display and print output
*
* Copyright © 2006 Mozilla Corporation
*
* This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public
* License version 2.1 as published by the Free Software Foundation
* (the "LGPL") or, at your option, under the terms of the Mozilla
* Public License Version 1.1 (the "MPL"). If you do not alter this
* notice, a recipient may use your version of this file under either
* the MPL or the LGPL.
*
* You should have received a copy of the LGPL along with this library
* in the file COPYING-LGPL-2.1; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
* You should have received a copy of the MPL along with this library
* in the file COPYING-MPL-1.1
*
* The contents of this file are subject to the Mozilla Public License
* Version 1.1 (the "License"); you may not use this file except in
* compliance with the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY
* OF ANY KIND, either express or implied. See the LGPL or the MPL for
* the specific language governing rights and limitations.
*
* The Original Code is the cairo graphics library.
*
* The Initial Developer of the Original Code is Mozilla Corporation.
*
* Contributor(s):
* Vladimir Vukicevic <vladimir@mozilla.com>
*/
#ifndef CAIRO_NQUARTZ_H
#define CAIRO_NQUARTZ_H
#include <cairo.h>
#if CAIRO_HAS_NQUARTZ_SURFACE
#include <Carbon/Carbon.h>
#include <AGL/agl.h>
CAIRO_BEGIN_DECLS
cairo_public cairo_surface_t *
cairo_nquartz_surface_create (cairo_format_t format,
unsigned int width,
unsigned int height);
#ifdef CAIRO_NQUARTZ_SUPPORT_AGL
cairo_public cairo_surface_t *
cairo_nquartz_surface_create_for_agl_context (AGLContext aglContext,
unsigned int width,
unsigned int height,
cairo_bool_t y_grows_down);
#endif
cairo_public cairo_surface_t *
cairo_nquartz_surface_create_for_cg_context (CGContextRef cgContext,
unsigned int width,
unsigned int height,
cairo_bool_t y_grows_down);
cairo_public cairo_bool_t
cairo_surface_is_nquartz (cairo_surface_t *surf);
cairo_public CGContextRef
cairo_nquartz_surface_get_cg_context (cairo_surface_t *surf);
CAIRO_END_DECLS
#else /* CAIRO_HAS_NQUARTZ_SURFACE */
# error Cairo was not compiled with support for the nquartz backend
#endif /* CAIRO_HAS_NQUARTZ_SURFACE */
#endif /* CAIRO_NQUARTZ_H */

View file

@ -39,20 +39,34 @@
#include <cairoint.h> #include <cairoint.h>
#include <cairo-quartz.h> #include <cairo-quartz.h>
typedef struct cairo_quartz_surface { #ifdef CAIRO_NQUARTZ_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; cairo_surface_t base;
CGContextRef context; void *imageData;
cairo_bool_t y_grows_down; CGContextRef cgContext;
CGAffineTransform cgContextBaseCTM;
cairo_rectangle_int16_t extents; cairo_rectangle_int16_t extents;
pixman_region16_t *clip_region; /* These are stored while drawing operations are in place, set up
} cairo_quartz_surface_t; * by nquartz_setup_source() and nquartz_finish_source()
*/
cairo_bool_t CGAffineTransform imageTransform;
_cairo_surface_is_quartz (cairo_surface_t *surface); CGImageRef sourceImage;
CGShadingRef sourceShading;
CGPatternRef sourcePattern;
nquartz_agl_context_type aglContext;
} cairo_nquartz_surface_t, cairo_quartz_surface_t;
cairo_bool_t cairo_bool_t
_cairo_scaled_font_is_atsui (cairo_scaled_font_t *sfont); _cairo_scaled_font_is_atsui (cairo_scaled_font_t *sfont);

File diff suppressed because it is too large Load diff

View file

@ -1,6 +1,6 @@
/* cairo - a vector graphics library with display and print output /* cairo - a vector graphics library with display and print output
* *
* Copyright © 2002 University of Southern California * Copyright © 2006, 2007 Mozilla Corporation
* *
* This library is free software; you can redistribute it and/or * This library is free software; you can redistribute it and/or
* modify it either under the terms of the GNU Lesser General Public * modify it either under the terms of the GNU Lesser General Public
@ -27,15 +27,14 @@
* *
* The Original Code is the cairo graphics library. * The Original Code is the cairo graphics library.
* *
* The Initial Developer of the Original Code is University of Southern * The Initial Developer of the Original Code is Mozilla Corporation.
* California.
* *
* Contributor(s): * Contributor(s):
* Carl D. Worth <cworth@cworth.org> * Vladimir Vukicevic <vladimir@mozilla.com>
*/ */
#ifndef CAIRO_QUARTZ_H #ifndef CAIRO_NQUARTZ_H
#define CAIRO_QUARTZ_H #define CAIRO_NQUARTZ_H
#include <cairo.h> #include <cairo.h>
@ -43,13 +42,31 @@
#include <Carbon/Carbon.h> #include <Carbon/Carbon.h>
#ifdef CAIRO_NQUARTZ_SUPPORT_AGL
#include <AGL/agl.h>
#endif
CAIRO_BEGIN_DECLS CAIRO_BEGIN_DECLS
cairo_public cairo_surface_t * cairo_public cairo_surface_t *
cairo_quartz_surface_create (CGContextRef context, cairo_quartz_surface_create (cairo_format_t format,
int width, unsigned int width,
int height, unsigned int height);
cairo_bool_t y_grows_down);
#ifdef CAIRO_NQUARTZ_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,
unsigned int height);
cairo_public CGContextRef
cairo_quartz_surface_get_cg_context (cairo_surface_t *surf);
CAIRO_END_DECLS CAIRO_END_DECLS
@ -57,4 +74,4 @@ CAIRO_END_DECLS
# error Cairo was not compiled with support for the quartz backend # error Cairo was not compiled with support for the quartz backend
#endif /* CAIRO_HAS_QUARTZ_SURFACE */ #endif /* CAIRO_HAS_QUARTZ_SURFACE */
#endif /* CAIRO_QUARTZ_H */ #endif /* CAIRO_NQUARTZ_H */

View file

@ -1321,7 +1321,6 @@ typedef enum _cairo_surface_type {
CAIRO_SURFACE_TYPE_BEOS, CAIRO_SURFACE_TYPE_BEOS,
CAIRO_SURFACE_TYPE_DIRECTFB, CAIRO_SURFACE_TYPE_DIRECTFB,
CAIRO_SURFACE_TYPE_SVG, CAIRO_SURFACE_TYPE_SVG,
CAIRO_SURFACE_TYPE_NQUARTZ,
CAIRO_SURFACE_TYPE_OS2 CAIRO_SURFACE_TYPE_OS2
} cairo_surface_type_t; } cairo_surface_type_t;

View file

@ -135,16 +135,15 @@ draw (cairo_t *cr, int width, int height)
case CAIRO_SURFACE_TYPE_XLIB: case CAIRO_SURFACE_TYPE_XLIB:
case CAIRO_SURFACE_TYPE_XCB: case CAIRO_SURFACE_TYPE_XCB:
case CAIRO_SURFACE_TYPE_GLITZ: case CAIRO_SURFACE_TYPE_GLITZ:
case CAIRO_SURFACE_TYPE_QUARTZ:
case CAIRO_SURFACE_TYPE_WIN32: case CAIRO_SURFACE_TYPE_WIN32:
case CAIRO_SURFACE_TYPE_BEOS: case CAIRO_SURFACE_TYPE_BEOS:
case CAIRO_SURFACE_TYPE_DIRECTFB: case CAIRO_SURFACE_TYPE_DIRECTFB:
uses_clip_rects = TRUE; uses_clip_rects = TRUE;
break; break;
case CAIRO_SURFACE_TYPE_QUARTZ:
case CAIRO_SURFACE_TYPE_PDF: case CAIRO_SURFACE_TYPE_PDF:
case CAIRO_SURFACE_TYPE_PS: case CAIRO_SURFACE_TYPE_PS:
case CAIRO_SURFACE_TYPE_SVG: case CAIRO_SURFACE_TYPE_SVG:
case CAIRO_SURFACE_TYPE_NQUARTZ:
case CAIRO_SURFACE_TYPE_OS2: case CAIRO_SURFACE_TYPE_OS2:
default: default:
uses_clip_rects = FALSE; uses_clip_rects = FALSE;