b=350765, rename cairo quartz2 to nquartz (with a whole bunch of bugfixes), r=me

This commit is contained in:
vladimir%pobox.com 2006-08-30 22:01:27 +00:00
parent 38f00a50f6
commit 079f0ade3d
12 changed files with 1219 additions and 1169 deletions

1423
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -7042,7 +7042,7 @@ if test "$MOZ_SVG" -o "$MOZ_ENABLE_CANVAS" -o "$MOZ_ENABLE_CAIRO_GFX" ; then
fi
if test "$MOZ_WIDGET_TOOLKIT" = "mac" -o "$MOZ_WIDGET_TOOLKIT" = "cocoa"; then
QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1"
QUARTZGL_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZGL_SURFACE 1"
NQUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_NQUARTZ_SURFACE 1"
ATSUI_FONT_FEATURE="#define CAIRO_HAS_ATSUI_FONT 1"
fi
if test "$MOZ_WIDGET_TOOLKIT" = "windows"; then
@ -7081,7 +7081,7 @@ if test "$MOZ_SVG" -o "$MOZ_ENABLE_CANVAS" -o "$MOZ_ENABLE_CAIRO_GFX" ; then
AC_SUBST(SVG_SURFACE_FEATURE)
AC_SUBST(XLIB_SURFACE_FEATURE)
AC_SUBST(QUARTZ_SURFACE_FEATURE)
AC_SUBST(QUARTZGL_SURFACE_FEATURE)
AC_SUBST(NQUARTZ_SURFACE_FEATURE)
AC_SUBST(XCB_SURFACE_FEATURE)
AC_SUBST(WIN32_SURFACE_FEATURE)
AC_SUBST(OS2_SURFACE_FEATURE)

View File

@ -121,8 +121,8 @@ CSRCS += cairo-quartz-surface.c cairo-atsui-font.c
EXPORTS += cairo-quartz.h cairo-atsui.h
ifdef MOZ_ENABLE_CAIRO_GFX
CSRCS += cairo-quartz2-surface.c
EXPORTS += cairo-quartz2.h
CSRCS += cairo-nquartz-surface.c
EXPORTS += cairo-nquartz.h
endif
endif

View File

@ -67,7 +67,7 @@
@QUARTZ_SURFACE_FEATURE@
@QUARTZGL_SURFACE_FEATURE@
@NQUARTZ_SURFACE_FEATURE@
@XCB_SURFACE_FEATURE@

View File

@ -33,12 +33,12 @@
* Vladimir Vukicevic <vladimir@mozilla.com>
*/
#ifndef CAIRO_QUARTZGL_H
#define CAIRO_QUARTZGL_H
#ifndef CAIRO_NQUARTZ_H
#define CAIRO_NQUARTZ_H
#include <cairo.h>
#if CAIRO_HAS_QUARTZGL_SURFACE
#if CAIRO_HAS_NQUARTZ_SURFACE
#include <Carbon/Carbon.h>
@ -47,32 +47,34 @@
CAIRO_BEGIN_DECLS
cairo_surface_t *
cairo_quartzgl_surface_create (cairo_format_t format,
unsigned int width,
unsigned int height,
cairo_bool_t y_grows_down);
cairo_nquartz_surface_create (cairo_format_t format,
unsigned int width,
unsigned int height);
#ifdef CAIRO_QUARTZ2_SUPPORT_AGL
#ifdef CAIRO_NQUARTZ_SUPPORT_AGL
cairo_surface_t *
cairo_quartzgl_surface_create_for_agl_context (AGLContext aglContext,
unsigned int width,
unsigned int height,
cairo_bool_t y_grows_down);
#endif
cairo_surface_t *
cairo_quartzgl_surface_create_for_cg_context (CGContextRef cgContext,
cairo_nquartz_surface_create_for_agl_context (AGLContext aglContext,
unsigned int width,
unsigned int height,
cairo_bool_t y_grows_down);
#endif
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_bool_t
cairo_surface_is_quartzgl (cairo_surface_t *surf);
cairo_surface_is_nquartz (cairo_surface_t *surf);
CGContextRef
cairo_nquartz_surface_get_cg_context (cairo_surface_t *surf);
CAIRO_END_DECLS
#else /* CAIRO_HAS_QUARTZGL_SURFACE */
# error Cairo was not compiled with support for the quartzgl backend
#endif /* CAIRO_HAS_QUARTZGL_SURFACE */
#else /* CAIRO_HAS_NQUARTZ_SURFACE */
# error Cairo was not compiled with support for the nquartz backend
#endif /* CAIRO_HAS_NQUARTZ_SURFACE */
#endif /* CAIRO_QUARTZGL_H */
#endif /* CAIRO_NQUARTZ_H */

View File

@ -1284,7 +1284,7 @@ typedef enum _cairo_surface_type {
CAIRO_SURFACE_TYPE_BEOS,
CAIRO_SURFACE_TYPE_DIRECTFB,
CAIRO_SURFACE_TYPE_SVG,
CAIRO_SURFACE_TYPE_QUARTZ2
CAIRO_SURFACE_TYPE_NQUARTZ
} cairo_surface_type_t;
cairo_public cairo_surface_type_t

View File

@ -136,6 +136,13 @@ public:
*y0 = mat.y0;
}
gfxFloat& xx() { return mat.xx; }
gfxFloat& xy() { return mat.xy; }
gfxFloat& yx() { return mat.yx; }
gfxFloat& yy() { return mat.yy; }
gfxFloat& x0() { return mat.x0; }
gfxFloat& y0() { return mat.y0; }
// matrix operations
/**
* Resets this matrix to the identity matrix.
@ -245,6 +252,11 @@ public:
return ((mat.xx != 1.0) || (mat.yy != 1.0) ||
(mat.xy != 0.0) || (mat.yx != 0.0));
}
bool HasNonTranslationOrFlip() const {
return ((mat.xx != 1.0) || ((mat.yy != 1.0) && (mat.yy != -1.0)) ||
(mat.xy != 0.0) || (mat.yx != 0.0));
}
};
#endif /* GFX_MATRIX_H */

View File

@ -46,11 +46,10 @@
class THEBES_API gfxQuartzSurface : public gfxASurface {
public:
gfxQuartzSurface(gfxImageFormat format,
int width, int height,
PRBool y_grows_down = PR_TRUE);
int width, int height);
gfxQuartzSurface(CGContextRef context,
int width, int height,
PRBool y_grows_down = PR_TRUE);
PRBool y_grows_down);
gfxQuartzSurface(cairo_surface_t *csurf);
virtual ~gfxQuartzSurface();

View File

@ -86,7 +86,7 @@ CPPSRCS += gfxQuartzSurface.cpp gfxPlatformMac.cpp gfxAtsuiFonts.cpp
CMMSRCS = gfxQuartzFontCache.mm
# Always link with OpenGL/AGL
EXTRA_DSO_LDOPTS += -framework OpenGL -framework AGL -framework Cocoa
EXTRA_DSO_LDOPTS += -framework OpenGL -framework AGL -framework Cocoa -framework QuickTime
endif
ifdef MOZ_ENABLE_GLITZ

View File

@ -50,7 +50,7 @@
#include "gfxXlibSurface.h"
#endif
#ifdef CAIRO_HAS_QUARTZGL_SURFACE
#ifdef CAIRO_HAS_NQUARTZ_SURFACE
#include "gfxQuartzSurface.h"
#endif
@ -97,8 +97,8 @@ gfxASurface::Wrap (cairo_surface_t *csurf)
result = new gfxXlibSurface(csurf);
}
#endif
#ifdef CAIRO_HAS_QUARTZGL_SURFACE
else if (stype == CAIRO_SURFACE_TYPE_QUARTZ2) {
#ifdef CAIRO_HAS_NQUARTZ_SURFACE
else if (stype == CAIRO_SURFACE_TYPE_NQUARTZ) {
result = new gfxQuartzSurface(csurf);
}
#endif

View File

@ -37,17 +37,18 @@
#include "gfxQuartzSurface.h"
#include "cairo-quartz2.h"
#include "cairo-nquartz.h"
gfxQuartzSurface::gfxQuartzSurface(gfxImageFormat format,
int width, int height,
PRBool y_grows_down)
int width, int height)
: mWidth(width), mHeight(height)
{
mCGContext = nsnull;
cairo_surface_t *surf = cairo_nquartz_surface_create
((cairo_format_t) format, width, height);
cairo_surface_t *surf = cairo_quartzgl_surface_create
((cairo_format_t) format, width, height, y_grows_down);
mCGContext = cairo_nquartz_surface_get_cg_context (surf);
CGContextRetain(mCGContext);
Init(surf);
}
@ -57,23 +58,27 @@ gfxQuartzSurface::gfxQuartzSurface(CGContextRef context,
PRBool y_grows_down)
: mCGContext(context), mWidth(width), mHeight(height)
{
cairo_surface_t *surf = cairo_quartzgl_surface_create_for_cg_context
cairo_surface_t *surf = cairo_nquartz_surface_create_for_cg_context
(context, width, height, y_grows_down);
//printf ("+++ gfxQuartzSurface[%p] %p %d %d -> %p\n", this, context, width, height, surf);
CGContextRetain(mCGContext);
Init(surf);
}
gfxQuartzSurface::gfxQuartzSurface(cairo_surface_t *csurf)
{
mWidth = -1;
mHeight = -1;
mCGContext = nsnull;
mWidth = 0;
mHeight = 0;
mCGContext = cairo_nquartz_surface_get_cg_context (csurf);
CGContextRetain (mCGContext);
Init(csurf, PR_TRUE);
}
gfxQuartzSurface::~gfxQuartzSurface()
{
//printf ("--- ~gfxQuartzSurface[%p] %p %p\n", this, CairoSurface(), mCGContext);
Destroy();
CGContextRelease(mCGContext);
}