b=411224, r=vlad: 411224-cairo-upgrade-fixes.patch

This commit is contained in:
vladimir@pobox.com 2008-01-18 13:46:33 -08:00
Родитель 42e7c3d2c8
Коммит d04f711db3
13 изменённых файлов: 203 добавлений и 21 удалений

Просмотреть файл

@ -26,3 +26,7 @@ win32-logical-font-scale.patch: set CAIRO_WIN32_LOGICAL_FONT_SCALE to 1
nonfatal-assertions.patch: Make assertions non-fatal
endian.patch: include cairo-platform.h for endian macros
fixed-24-8.patch: Switch fixed point mode from 16.16 to 24.8
mac-runtime-linkage.patch: Do some runtime dlsym lookups instead of relying on gcc attributes

Просмотреть файл

@ -121,9 +121,10 @@ CSRCS = \
EXPORTS = cairo.h cairo-features.h cairo-platform.h cairo-deprecated.h cairo-rename.h
# cairo-type1-subset.c should be here, but it's only supported on freetype platforms
PSPDF_BASE_CSRCS = \
cairo-base85-stream.c \
cairo-type1-subset.c \
cairo-type1-fallback.c \
cairo-truetype-subset.c \
cairo-cff-subset.c \
@ -184,7 +185,7 @@ EXPORTS += cairo-xlib.h cairo-xlib-xrender.h
endif
ifdef MOZ_ENABLE_CAIRO_FT
CSRCS += cairo-ft-font.c
CSRCS += cairo-ft-font.c cairo-type1-subset.c
EXPORTS += cairo-ft.h
OS_INCLUDES += $(CAIRO_FT_CFLAGS)
endif

Просмотреть файл

@ -59,7 +59,7 @@ typedef cairo_int128_t cairo_fixed_96_32_t;
* making sure that you compute a double-to-fixed magic number.
* (see below).
*/
#define CAIRO_FIXED_FRAC_BITS 16
#define CAIRO_FIXED_FRAC_BITS 8
/* A signed type CAIRO_FIXED_BITS in size; the main fixed point type */
typedef int32_t cairo_fixed_t;

Просмотреть файл

@ -64,6 +64,10 @@
*/
#define MAX_OPEN_FACES 10
/* This is the maximum font size we allow to be passed to FT_Set_Char_Size
*/
#define MAX_FONT_SIZE 1000
/*
* The simple 2x2 matrix is converted into separate scale and shape
* factors so that hinting works right
@ -666,9 +670,18 @@ _cairo_ft_unscaled_font_set_scale (cairo_ft_unscaled_font_t *unscaled,
FT_Set_Transform(unscaled->face, &mat, NULL);
if ((unscaled->face->face_flags & FT_FACE_FLAG_SCALABLE) != 0) {
double x_scale = sf.x_scale;
double y_scale = sf.y_scale;
if (x_scale > MAX_FONT_SIZE) {
x_scale = MAX_FONT_SIZE;
}
if (y_scale > MAX_FONT_SIZE) {
y_scale = MAX_FONT_SIZE;
}
error = FT_Set_Char_Size (unscaled->face,
sf.x_scale * 64.0,
sf.y_scale * 64.0,
x_scale * 64.0,
y_scale * 64.0,
0, 0);
if (error)
return _cairo_error (CAIRO_STATUS_NO_MEMORY);

Просмотреть файл

@ -34,6 +34,8 @@
* Vladimir Vukicevic <vladimir@mozilla.com>
*/
#include <dlfcn.h>
#include "cairoint.h"
#include "cairo-quartz-private.h"
@ -100,11 +102,12 @@ CG_EXTERN void CGContextReplacePathWithStrokedPath (CGContextRef);
CG_EXTERN CGImageRef CGBitmapContextCreateImage (CGContextRef);
#endif
/* missing in 10.3.9 */
extern void CGContextClipToMask (CGContextRef, CGRect, CGImageRef) __attribute__((weak_import));
/* Only present in 10.4+ */
static void (*CGContextClipToMaskPtr) (CGContextRef, CGRect, CGImageRef) = NULL;
/* Only present in 10.5+ */
static void (*CGContextDrawTiledImagePtr) (CGContextRef, CGRect, CGImageRef) = NULL;
/* 10.5-only optimization */
extern void CGContextDrawTiledImage (CGContextRef, CGRect, CGImageRef) __attribute__((weak_import));
static cairo_bool_t _cairo_quartz_symbol_lookup_done = FALSE;
/*
* Utility functions
@ -119,6 +122,18 @@ _cairo_quartz_surface_create_internal (CGContextRef cgContext,
unsigned int width,
unsigned int height);
/* Load all extra symbols */
static void quartz_ensure_symbols()
{
if (_cairo_quartz_symbol_lookup_done)
return;
CGContextClipToMaskPtr = dlsym(RTLD_DEFAULT, "CGContextClipToMask");
CGContextDrawTiledImagePtr = dlsym(RTLD_DEFAULT, "CGContextDrawTiledImage");
_cairo_quartz_symbol_lookup_done = TRUE;
}
/* CoreGraphics limitation with flipped CTM surfaces: height must be less than signed 16-bit max */
#define CG_MAX_HEIGHT SHRT_MAX
@ -761,7 +776,7 @@ _cairo_quartz_setup_source (cairo_quartz_surface_t *surface,
return _cairo_quartz_setup_radial_source (surface, rpat);
} else if (source->type == CAIRO_PATTERN_TYPE_SURFACE &&
(source->extend == CAIRO_EXTEND_NONE || (CGContextDrawTiledImage && source->extend == CAIRO_EXTEND_REPEAT)))
(source->extend == CAIRO_EXTEND_NONE || (CGContextDrawTiledImagePtr && source->extend == CAIRO_EXTEND_REPEAT)))
{
cairo_surface_pattern_t *spat = (cairo_surface_pattern_t *) source;
cairo_surface_t *pat_surf = spat->surface;
@ -1298,7 +1313,7 @@ _cairo_quartz_surface_paint (void *abstract_surface,
if (action == DO_IMAGE)
CGContextDrawImage (surface->cgContext, surface->sourceImageRect, surface->sourceImage);
else
CGContextDrawTiledImage (surface->cgContext, surface->sourceImageRect, surface->sourceImage);
CGContextDrawTiledImagePtr (surface->cgContext, surface->sourceImageRect, surface->sourceImage);
CGContextRestoreGState (surface->cgContext);
} else if (action != DO_NOTHING) {
rv = CAIRO_INT_STATUS_UNSUPPORTED;
@ -1388,7 +1403,7 @@ _cairo_quartz_surface_fill (void *abstract_surface,
if (action == DO_IMAGE)
CGContextDrawImage (surface->cgContext, surface->sourceImageRect, surface->sourceImage);
else
CGContextDrawTiledImage (surface->cgContext, surface->sourceImageRect, surface->sourceImage);
CGContextDrawTiledImagePtr (surface->cgContext, surface->sourceImageRect, surface->sourceImage);
} else if (action != DO_NOTHING) {
rv = CAIRO_INT_STATUS_UNSUPPORTED;
}
@ -1496,7 +1511,7 @@ _cairo_quartz_surface_stroke (void *abstract_surface,
if (action == DO_IMAGE)
CGContextDrawImage (surface->cgContext, surface->sourceImageRect, surface->sourceImage);
else
CGContextDrawTiledImage (surface->cgContext, surface->sourceImageRect, surface->sourceImage);
CGContextDrawTiledImagePtr (surface->cgContext, surface->sourceImageRect, surface->sourceImage);
} else if (action == DO_SHADING) {
CGContextReplacePathWithStrokedPath (surface->cgContext);
CGContextClip (surface->cgContext);
@ -1655,7 +1670,7 @@ _cairo_quartz_surface_show_glyphs (void *abstract_surface,
if (action == DO_IMAGE)
CGContextDrawImage (surface->cgContext, surface->sourceImageRect, surface->sourceImage);
else
CGContextDrawTiledImage (surface->cgContext, surface->sourceImageRect, surface->sourceImage);
CGContextDrawTiledImagePtr (surface->cgContext, surface->sourceImageRect, surface->sourceImage);
} else if (action == DO_SHADING) {
CGContextDrawShading (surface->cgContext, surface->sourceShading);
}
@ -1710,7 +1725,7 @@ _cairo_quartz_surface_mask_with_surface (cairo_quartz_surface_t *surface,
rect = CGRectMake (-mask->base.matrix.x0, -mask->base.matrix.y0, extents.width, extents.height);
CGContextSaveGState (surface->cgContext);
CGContextClipToMask (surface->cgContext, rect, img);
CGContextClipToMaskPtr (surface->cgContext, rect, img);
status = _cairo_quartz_surface_paint (surface, op, source);
CGContextRestoreGState (surface->cgContext);
@ -1739,7 +1754,7 @@ _cairo_quartz_surface_mask (void *abstract_surface,
cairo_solid_pattern_t *solid_mask = (cairo_solid_pattern_t *) mask;
CGContextSetAlpha (surface->cgContext, solid_mask->color.alpha);
} else if (CGContextClipToMask &&
} else if (CGContextClipToMaskPtr &&
mask->type == CAIRO_PATTERN_TYPE_SURFACE &&
mask->extend == CAIRO_EXTEND_NONE) {
return _cairo_quartz_surface_mask_with_surface (surface, op, source, (cairo_surface_pattern_t *) mask);
@ -1863,6 +1878,8 @@ _cairo_quartz_surface_create_internal (CGContextRef cgContext,
{
cairo_quartz_surface_t *surface;
quartz_ensure_symbols();
/* Init the base surface */
surface = malloc(sizeof(cairo_quartz_surface_t));
if (surface == NULL) {

Просмотреть файл

@ -152,11 +152,16 @@
#define cairo_pdf_surface_set_size _moz_cairo_pdf_surface_set_size
#define cairo_pop_group _moz_cairo_pop_group
#define cairo_pop_group_to_source _moz_cairo_pop_group_to_source
#define cairo_ps_get_levels _moz_cairo_ps_get_levels
#define cairo_ps_level_to_string _moz_cairo_ps_level_to_string
#define cairo_ps_surface_create _moz_cairo_ps_surface_create
#define cairo_ps_surface_create_for_stream _moz_cairo_ps_surface_create_for_stream
#define cairo_ps_surface_dsc_begin_page_setup _moz_cairo_ps_surface_dsc_begin_page_setup
#define cairo_ps_surface_dsc_begin_setup _moz_cairo_ps_surface_dsc_begin_setup
#define cairo_ps_surface_dsc_comment _moz_cairo_ps_surface_dsc_comment
#define cairo_ps_surface_get_eps _moz_cairo_ps_surface_get_eps
#define cairo_ps_surface_restrict_to_level _moz_cairo_ps_surface_restrict_to_level
#define cairo_ps_surface_set_eps _moz_cairo_ps_surface_set_eps
#define cairo_ps_surface_set_size _moz_cairo_ps_surface_set_size
#define cairo_push_group _moz_cairo_push_group
#define cairo_push_group_with_content _moz_cairo_push_group_with_content
@ -256,6 +261,7 @@
#define cairo_win32_font_face_create_for_hfont _moz_cairo_win32_font_face_create_for_hfont
#define cairo_win32_font_face_create_for_logfontw _moz_cairo_win32_font_face_create_for_logfontw
#define cairo_win32_font_face_create_for_logfontw_hfont _moz_cairo_win32_font_face_create_for_logfontw_hfont
#define cairo_win32_printing_surface_create _moz_cairo_win32_printing_surface_create
#define cairo_win32_scaled_font_done_font _moz_cairo_win32_scaled_font_done_font
#define cairo_win32_scaled_font_get_device_to_logical _moz_cairo_win32_scaled_font_get_device_to_logical
#define cairo_win32_scaled_font_get_logical_to_device _moz_cairo_win32_scaled_font_get_logical_to_device

Просмотреть файл

@ -46,7 +46,7 @@
#define SB_NONE 0
#endif
#define WIN32_FONT_LOGICAL_SCALE 32
#define WIN32_FONT_LOGICAL_SCALE 1
typedef struct _cairo_win32_surface {
cairo_surface_t base;

Просмотреть файл

@ -105,6 +105,13 @@ _cairo_win32_tmpfile (void);
#define M_PI 3.14159265358979323846
#endif
#ifndef NDEBUG
#undef assert
#define assert(expr) \
do { if (!(expr)) fprintf(stderr, "Assertion failed at %s:%d: %s\n", \
__FILE__, __LINE__, #expr); } while (0)
#endif
#undef ARRAY_LENGTH
#define ARRAY_LENGTH(__array) ((int) (sizeof (__array) / sizeof (__array[0])))

Просмотреть файл

@ -0,0 +1,12 @@
diff --git a/gfx/cairo/cairo/src/cairo-fixed-private.h b/gfx/cairo/cairo/src/cairo-fixed-private.h
--- a/cairo/src/cairo-fixed-private.h
+++ b/cairo/src/cairo-fixed-private.h
@@ -59,7 +59,7 @@ typedef cairo_int128_t cairo_fixed_96_32
* making sure that you compute a double-to-fixed magic number.
* (see below).
*/
-#define CAIRO_FIXED_FRAC_BITS 16
+#define CAIRO_FIXED_FRAC_BITS 8
/* A signed type CAIRO_FIXED_BITS in size; the main fixed point type */
typedef int32_t cairo_fixed_t;

Просмотреть файл

@ -5,6 +5,8 @@
#ifndef PIXMAN_PRIVATE_H
#define PIXMAN_PRIVATE_H
#include "cairo-platform.h"
#include "pixman.h"
#include <time.h>

Просмотреть файл

@ -0,0 +1,120 @@
diff --git a/gfx/cairo/cairo/src/cairo-quartz-surface.c b/gfx/cairo/cairo/src/cairo-quartz-surface.c
--- a/gfx/cairo/cairo/src/cairo-quartz-surface.c
+++ b/gfx/cairo/cairo/src/cairo-quartz-surface.c
@@ -33,6 +33,8 @@
* Contributor(s):
* Vladimir Vukicevic <vladimir@mozilla.com>
*/
+
+#include <dlfcn.h>
#include "cairoint.h"
@@ -100,11 +102,12 @@ CG_EXTERN CGImageRef CGBitmapContextCrea
CG_EXTERN CGImageRef CGBitmapContextCreateImage (CGContextRef);
#endif
-/* missing in 10.3.9 */
-extern void CGContextClipToMask (CGContextRef, CGRect, CGImageRef) __attribute__((weak_import));
+/* Only present in 10.4+ */
+static void (*CGContextClipToMaskPtr) (CGContextRef, CGRect, CGImageRef) = NULL;
+/* Only present in 10.5+ */
+static void (*CGContextDrawTiledImagePtr) (CGContextRef, CGRect, CGImageRef) = NULL;
-/* 10.5-only optimization */
-extern void CGContextDrawTiledImage (CGContextRef, CGRect, CGImageRef) __attribute__((weak_import));
+static cairo_bool_t _cairo_quartz_symbol_lookup_done = FALSE;
/*
* Utility functions
@@ -118,6 +121,18 @@ _cairo_quartz_surface_create_internal (C
cairo_content_t content,
unsigned int width,
unsigned int height);
+
+/* Load all extra symbols */
+static void quartz_ensure_symbols()
+{
+ if (_cairo_quartz_symbol_lookup_done)
+ return;
+
+ CGContextClipToMaskPtr = dlsym(RTLD_DEFAULT, "CGContextClipToMask");
+ CGContextDrawTiledImagePtr = dlsym(RTLD_DEFAULT, "CGContextDrawTiledImage");
+
+ _cairo_quartz_symbol_lookup_done = TRUE;
+}
/* CoreGraphics limitation with flipped CTM surfaces: height must be less than signed 16-bit max */
@@ -761,7 +776,7 @@ _cairo_quartz_setup_source (cairo_quartz
return _cairo_quartz_setup_radial_source (surface, rpat);
} else if (source->type == CAIRO_PATTERN_TYPE_SURFACE &&
- (source->extend == CAIRO_EXTEND_NONE || (CGContextDrawTiledImage && source->extend == CAIRO_EXTEND_REPEAT)))
+ (source->extend == CAIRO_EXTEND_NONE || (CGContextDrawTiledImagePtr && source->extend == CAIRO_EXTEND_REPEAT)))
{
cairo_surface_pattern_t *spat = (cairo_surface_pattern_t *) source;
cairo_surface_t *pat_surf = spat->surface;
@@ -1298,7 +1313,7 @@ _cairo_quartz_surface_paint (void *abstr
if (action == DO_IMAGE)
CGContextDrawImage (surface->cgContext, surface->sourceImageRect, surface->sourceImage);
else
- CGContextDrawTiledImage (surface->cgContext, surface->sourceImageRect, surface->sourceImage);
+ CGContextDrawTiledImagePtr (surface->cgContext, surface->sourceImageRect, surface->sourceImage);
CGContextRestoreGState (surface->cgContext);
} else if (action != DO_NOTHING) {
rv = CAIRO_INT_STATUS_UNSUPPORTED;
@@ -1388,7 +1403,7 @@ _cairo_quartz_surface_fill (void *abstra
if (action == DO_IMAGE)
CGContextDrawImage (surface->cgContext, surface->sourceImageRect, surface->sourceImage);
else
- CGContextDrawTiledImage (surface->cgContext, surface->sourceImageRect, surface->sourceImage);
+ CGContextDrawTiledImagePtr (surface->cgContext, surface->sourceImageRect, surface->sourceImage);
} else if (action != DO_NOTHING) {
rv = CAIRO_INT_STATUS_UNSUPPORTED;
}
@@ -1496,7 +1511,7 @@ _cairo_quartz_surface_stroke (void *abst
if (action == DO_IMAGE)
CGContextDrawImage (surface->cgContext, surface->sourceImageRect, surface->sourceImage);
else
- CGContextDrawTiledImage (surface->cgContext, surface->sourceImageRect, surface->sourceImage);
+ CGContextDrawTiledImagePtr (surface->cgContext, surface->sourceImageRect, surface->sourceImage);
} else if (action == DO_SHADING) {
CGContextReplacePathWithStrokedPath (surface->cgContext);
CGContextClip (surface->cgContext);
@@ -1655,7 +1670,7 @@ _cairo_quartz_surface_show_glyphs (void
if (action == DO_IMAGE)
CGContextDrawImage (surface->cgContext, surface->sourceImageRect, surface->sourceImage);
else
- CGContextDrawTiledImage (surface->cgContext, surface->sourceImageRect, surface->sourceImage);
+ CGContextDrawTiledImagePtr (surface->cgContext, surface->sourceImageRect, surface->sourceImage);
} else if (action == DO_SHADING) {
CGContextDrawShading (surface->cgContext, surface->sourceShading);
}
@@ -1710,7 +1725,7 @@ _cairo_quartz_surface_mask_with_surface
rect = CGRectMake (-mask->base.matrix.x0, -mask->base.matrix.y0, extents.width, extents.height);
CGContextSaveGState (surface->cgContext);
- CGContextClipToMask (surface->cgContext, rect, img);
+ CGContextClipToMaskPtr (surface->cgContext, rect, img);
status = _cairo_quartz_surface_paint (surface, op, source);
CGContextRestoreGState (surface->cgContext);
@@ -1739,7 +1754,7 @@ _cairo_quartz_surface_mask (void *abstra
cairo_solid_pattern_t *solid_mask = (cairo_solid_pattern_t *) mask;
CGContextSetAlpha (surface->cgContext, solid_mask->color.alpha);
- } else if (CGContextClipToMask &&
+ } else if (CGContextClipToMaskPtr &&
mask->type == CAIRO_PATTERN_TYPE_SURFACE &&
mask->extend == CAIRO_EXTEND_NONE) {
return _cairo_quartz_surface_mask_with_surface (surface, op, source, (cairo_surface_pattern_t *) mask);
@@ -1862,6 +1877,8 @@ _cairo_quartz_surface_create_internal (C
unsigned int height)
{
cairo_quartz_surface_t *surface;
+
+ quartz_ensure_symbols();
/* Init the base surface */
surface = malloc(sizeof(cairo_quartz_surface_t));

Просмотреть файл

@ -1,7 +1,7 @@
diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c
index 59a5acb..8851387 100644
--- a/src/cairo-ft-font.c
+++ b/src/cairo-ft-font.c
--- a/cairo/src/cairo-ft-font.c
+++ b/cairo/src/cairo-ft-font.c
@@ -62,6 +62,10 @@
*/
#define MAX_OPEN_FACES 10

Просмотреть файл

@ -1,6 +1,6 @@
diff -r b79d47dad1ea gfx/cairo/cairo/src/cairoint.h
--- a/gfx/cairo/cairo/src/cairoint.h Fri Jun 08 18:09:53 2007 -0700
+++ b/gfx/cairo/cairo/src/cairoint.h Fri Jun 29 09:18:02 2007 +0200
--- a/cairo/src/cairoint.h Fri Jun 08 18:09:53 2007 -0700
+++ b/cairo/src/cairoint.h Fri Jun 29 09:18:02 2007 +0200
@@ -159,6 +159,13 @@ CAIRO_BEGIN_DECLS
#ifndef M_PI