b=419715, minor cairo upgrade to un-roll-back regressions and add fixes from upstream ; r=me

This commit is contained in:
vladimir@pobox.com 2008-04-08 13:11:21 -07:00
parent 2d0e3b6a04
commit 7e9ef5c071
8 changed files with 76 additions and 220 deletions

View File

@ -7,7 +7,7 @@ http://www.cairographics.org/.
VERSIONS:
cairo (1.6.x - 1.5.18-3-g3d22902)
cairo (1.6.x - 1.5.20-1-gc7cd5b3)
pixman (0.10.x - pixman-0.10.0-8-g0b207ae)
glitz 0.5.2 (cvs - 2006-01-10)
@ -27,8 +27,6 @@ nonfatal-assertions.patch: Make assertions non-fatal
buggy-repeat.patch: Unconditionally turn on buggy-repeat handling to bandaid bug 413583.
rollback-731e121.patch: roll back 731e121; causes bugs
==== pixman patches ====
endian.patch: include cairo-platform.h for endian macros

View File

@ -125,8 +125,13 @@ _cairo_hull_vertex_compare (const void *av, const void *bv)
static int
_cairo_hull_prev_valid (cairo_hull_t *hull, int num_hull, int index)
{
/* hull[0] is always valid, and we never need to wraparound, (if
* we are passed an index of 0 here, then the calling loop is just
* about to terminate). */
if (index == 0)
return 0;
do {
/* hull[0] is always valid, so don't test and wraparound */
index--;
} while (hull[index].discard);

View File

@ -212,9 +212,9 @@ _cairo_pdf_surface_update_object (cairo_pdf_surface_t *surface,
}
static void
cairo_pdf_surface_set_size_internal (cairo_pdf_surface_t *surface,
double width,
double height)
_cairo_pdf_surface_set_size_internal (cairo_pdf_surface_t *surface,
double width,
double height)
{
surface->width = width;
surface->height = height;
@ -454,9 +454,9 @@ cairo_pdf_surface_set_size (cairo_surface_t *surface,
return;
}
cairo_pdf_surface_set_size_internal (pdf_surface,
width_in_points,
height_in_points);
_cairo_pdf_surface_set_size_internal (pdf_surface,
width_in_points,
height_in_points);
status = _cairo_paginated_surface_set_size (pdf_surface->paginated_surface,
width_in_points,
height_in_points);
@ -1507,9 +1507,9 @@ _cairo_pdf_surface_emit_meta_surface (cairo_pdf_surface_t *surface,
old_height = surface->height;
old_paginated_mode = surface->paginated_mode;
old_clip = _cairo_surface_get_clip (&surface->base);
cairo_pdf_surface_set_size_internal (surface,
meta_extents.width,
meta_extents.height);
_cairo_pdf_surface_set_size_internal (surface,
meta_extents.width,
meta_extents.height);
/* Patterns are emitted after fallback images. The paginated mode
* needs to be set to _RENDER while the meta surface is replayed
* back to this surface.
@ -1542,9 +1542,9 @@ _cairo_pdf_surface_emit_meta_surface (cairo_pdf_surface_t *surface,
status = _cairo_pdf_surface_close_content_stream (surface);
CLEANUP_GROUP:
cairo_pdf_surface_set_size_internal (surface,
old_width,
old_height);
_cairo_pdf_surface_set_size_internal (surface,
old_width,
old_height);
surface->paginated_mode = old_paginated_mode;
status2 = _cairo_surface_set_clip (&surface->base, old_clip);
if (status == CAIRO_STATUS_SUCCESS)
@ -2519,9 +2519,9 @@ _cairo_pdf_surface_emit_pattern (cairo_pdf_surface_t *surface, cairo_pdf_pattern
old_width = surface->width;
old_height = surface->height;
cairo_pdf_surface_set_size_internal (surface,
pdf_pattern->width,
pdf_pattern->height);
_cairo_pdf_surface_set_size_internal (surface,
pdf_pattern->width,
pdf_pattern->height);
switch (pdf_pattern->pattern->type) {
case CAIRO_PATTERN_TYPE_SOLID:
@ -2547,9 +2547,9 @@ _cairo_pdf_surface_emit_pattern (cairo_pdf_surface_t *surface, cairo_pdf_pattern
break;
}
cairo_pdf_surface_set_size_internal (surface,
old_width,
old_height);
_cairo_pdf_surface_set_size_internal (surface,
old_width,
old_height);
return status;
}
@ -3831,9 +3831,9 @@ _cairo_pdf_surface_write_smask_group (cairo_pdf_surface_t *surface,
old_width = surface->width;
old_height = surface->height;
cairo_pdf_surface_set_size_internal (surface,
group->width,
group->height);
_cairo_pdf_surface_set_size_internal (surface,
group->width,
group->height);
/* _mask is a special case that requires two groups - source
* and mask as well as a smask and gstate dictionary */
if (group->operation == PDF_MASK)
@ -3884,9 +3884,9 @@ _cairo_pdf_surface_write_smask_group (cairo_pdf_surface_t *surface,
_cairo_pdf_surface_unselect_pattern (surface);
status = _cairo_pdf_surface_close_group (surface, NULL);
cairo_pdf_surface_set_size_internal (surface,
old_width,
old_height);
_cairo_pdf_surface_set_size_internal (surface,
old_width,
old_height);
return status;
}

View File

@ -285,6 +285,12 @@ cairo_surface_write_to_png (cairo_surface_t *surface,
FILE *fp;
cairo_status_t status;
if (surface->status)
return surface->status;
if (surface->finished)
return _cairo_error (CAIRO_STATUS_SURFACE_FINISHED);
fp = fopen (filename, "wb");
if (fp == NULL) {
switch (errno) {

View File

@ -135,6 +135,9 @@ _cairo_svg_document_finish (cairo_svg_document_t *document);
static cairo_svg_document_t *
_cairo_svg_document_reference (cairo_svg_document_t *document);
static unsigned int
_cairo_svg_document_allocate_mask_id (cairo_svg_document_t *document);
static cairo_surface_t *
_cairo_svg_surface_create_for_document (cairo_svg_document_t *document,
cairo_content_t content,
@ -2036,6 +2039,7 @@ _cairo_svg_surface_mask (void *abstract_surface,
cairo_output_stream_t *mask_stream;
char buffer[64];
cairo_bool_t discard_filter = FALSE;
unsigned int mask_id;
if (surface->paginated_mode == CAIRO_PAGINATED_MODE_ANALYZE)
return _cairo_svg_surface_analyze_operation (surface, op, source);
@ -2059,10 +2063,12 @@ _cairo_svg_surface_mask (void *abstract_surface,
if (_cairo_output_stream_get_status (mask_stream))
return _cairo_output_stream_destroy (mask_stream);
mask_id = _cairo_svg_document_allocate_mask_id (document);
_cairo_output_stream_printf (mask_stream,
"<mask id=\"mask%d\">\n"
"%s",
document->mask_id,
mask_id,
discard_filter ? "" : " <g filter=\"url(#alpha)\">\n");
status = _cairo_svg_surface_emit_paint (mask_stream, surface, op, mask, NULL);
if (status) {
@ -2082,13 +2088,11 @@ _cairo_svg_surface_mask (void *abstract_surface,
return status;
snprintf (buffer, sizeof buffer, "mask=\"url(#mask%d)\"",
document->mask_id);
mask_id);
status = _cairo_svg_surface_emit_paint (surface->xml_node, surface, op, source, buffer);
if (status)
return status;
document->mask_id++;
return CAIRO_STATUS_SUCCESS;
}
@ -2378,6 +2382,12 @@ _cairo_svg_document_reference (cairo_svg_document_t *document)
return document;
}
static unsigned int
_cairo_svg_document_allocate_mask_id (cairo_svg_document_t *document)
{
return document->mask_id++;
}
static cairo_status_t
_cairo_svg_document_destroy (cairo_svg_document_t *document)
{

View File

@ -48,6 +48,16 @@
typedef int (*cairo_xlib_error_func_t) (Display *display,
XErrorEvent *event);
static cairo_surface_t *
_cairo_xlib_surface_create_internal (Display *dpy,
Drawable drawable,
Screen *screen,
Visual *visual,
XRenderPictFormat *xrender_format,
int width,
int height,
int depth);
static cairo_status_t
_cairo_xlib_surface_ensure_gc (cairo_xlib_surface_t *surface);
@ -71,10 +81,6 @@ _cairo_xlib_surface_show_glyphs (void *abstract_dst,
int num_glyphs,
cairo_scaled_font_t *scaled_font);
#if CAIRO_HAS_XLIB_XRENDER_SURFACE
slim_hidden_proto (cairo_xlib_surface_create_with_xrender_format);
#endif
/*
* Instead of taking two round trips for each blending request,
* assume that if a particular drawable fails GetImage that it will
@ -111,22 +117,6 @@ static const XTransform identity = { {
#define CAIRO_SURFACE_RENDER_HAS_PICTURE_TRANSFORM(surface) CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 6)
#define CAIRO_SURFACE_RENDER_HAS_FILTERS(surface) CAIRO_SURFACE_RENDER_AT_LEAST((surface), 0, 6)
static int
_CAIRO_FORMAT_DEPTH (cairo_format_t format)
{
switch (format) {
case CAIRO_FORMAT_A1:
return 1;
case CAIRO_FORMAT_A8:
return 8;
case CAIRO_FORMAT_RGB24:
return 24;
case CAIRO_FORMAT_ARGB32:
default:
return 32;
}
}
static XRenderPictFormat *
_CAIRO_FORMAT_TO_XRENDER_FORMAT(Display *dpy, cairo_format_t format)
{
@ -155,7 +145,6 @@ _cairo_xlib_surface_create_similar_with_format (void *abstract_src,
Display *dpy = src->dpy;
Pixmap pix;
cairo_xlib_surface_t *surface;
int depth = _CAIRO_FORMAT_DEPTH (format);
XRenderPictFormat *xrender_format = _CAIRO_FORMAT_TO_XRENDER_FORMAT (dpy,
format);
@ -164,18 +153,19 @@ _cairo_xlib_surface_create_similar_with_format (void *abstract_src,
* using image surfaces for all temporary operations, so return NULL
* and let the fallback code happen.
*/
if (!CAIRO_SURFACE_RENDER_HAS_COMPOSITE(src)) {
if (xrender_format == NULL || ! CAIRO_SURFACE_RENDER_HAS_COMPOSITE (src))
return NULL;
}
pix = XCreatePixmap (dpy, src->drawable,
width <= 0 ? 1 : width, height <= 0 ? 1 : height,
depth);
xrender_format->depth);
surface = (cairo_xlib_surface_t *)
cairo_xlib_surface_create_with_xrender_format (dpy, pix, src->screen,
xrender_format,
width, height);
_cairo_xlib_surface_create_internal (dpy, pix,
src->screen, NULL,
xrender_format,
width, height,
xrender_format->depth);
if (surface->base.status) {
XFreePixmap (dpy, pix);
return &surface->base;
@ -251,10 +241,11 @@ _cairo_xlib_surface_create_similar (void *abstract_src,
xrender_format->depth);
surface = (cairo_xlib_surface_t *)
cairo_xlib_surface_create_with_xrender_format (src->dpy, pix,
src->screen,
xrender_format,
width, height);
_cairo_xlib_surface_create_internal (src->dpy, pix,
src->screen, src->visual,
xrender_format,
width, height,
xrender_format->depth);
if (surface->base.status != CAIRO_STATUS_SUCCESS) {
XFreePixmap (src->dpy, pix);
return &surface->base;
@ -1071,6 +1062,9 @@ _cairo_xlib_surface_clone_similar (void *abstract_surface,
clone = (cairo_xlib_surface_t *)
_cairo_xlib_surface_create_similar_with_format (surface, image_src->format,
image_src->width, image_src->height);
if (clone == NULL)
return CAIRO_INT_STATUS_UNSUPPORTED;
if (clone->base.status)
return clone->base.status;
@ -2392,7 +2386,6 @@ cairo_xlib_surface_create_with_xrender_format (Display *dpy,
return _cairo_xlib_surface_create_internal (dpy, drawable, screen,
NULL, format, width, height, 0);
}
slim_hidden_def (cairo_xlib_surface_create_with_xrender_format);
/**
* cairo_xlib_surface_get_xrender_format:

View File

@ -1,32 +0,0 @@
diff --git a/gfx/cairo/cairo/src/cairo-pattern.c b/gfx/cairo/cairo/src/cairo-pattern.c
--- a/gfx/cairo/cairo/src/cairo-pattern.c
+++ b/gfx/cairo/cairo/src/cairo-pattern.c
@@ -1994,28 +1994,6 @@
x2 = x1 + surface_extents.width;
y2 = y1 + surface_extents.height;
- /* The filter can effectively enlarge the extents of the
- * pattern, so extend as necessary. Note: We aren't doing any
- * backend-specific querying of filter box sizes at this time,
- * (since currently no specific backends that could do custom
- * filters are calling _cairo_pattern_get_extents). */
- switch (pattern->filter) {
- case CAIRO_FILTER_GOOD:
- case CAIRO_FILTER_BEST:
- case CAIRO_FILTER_BILINEAR:
- x1 -= 0.5;
- y1 -= 0.5;
- x2 += 0.5;
- y2 += 0.5;
- break;
- case CAIRO_FILTER_FAST:
- case CAIRO_FILTER_NEAREST:
- case CAIRO_FILTER_GAUSSIAN:
- default:
- /* Nothing to do */
- break;
- }
-
imatrix = pattern->matrix;
status = cairo_matrix_invert (&imatrix);
/* cairo_pattern_set_matrix ensures the matrix is invertible */

View File

@ -1,124 +0,0 @@
Index: cairo-xlib-surface.c
===================================================================
RCS file: /cvsroot/mozilla/gfx/cairo/cairo/src/cairo-xlib-surface.c,v
retrieving revision 1.41
diff -u -p -8 -r1.41 cairo-xlib-surface.c
--- cairo-xlib-surface.c 7 Apr 2008 05:09:45 -0000 1.41
+++ cairo-xlib-surface.c 7 Apr 2008 09:16:50 -0000
@@ -43,26 +43,16 @@
#include "cairo-clip-private.h"
#include <X11/Xutil.h> /* for XDestroyImage */
/* Xlib doesn't define a typedef, so define one ourselves */
typedef int (*cairo_xlib_error_func_t) (Display *display,
XErrorEvent *event);
-static cairo_surface_t *
-_cairo_xlib_surface_create_internal (Display *dpy,
- Drawable drawable,
- Screen *screen,
- Visual *visual,
- XRenderPictFormat *xrender_format,
- int width,
- int height,
- int depth);
-
static cairo_status_t
_cairo_xlib_surface_ensure_gc (cairo_xlib_surface_t *surface);
static void
_cairo_xlib_surface_ensure_src_picture (cairo_xlib_surface_t *surface);
static void
_cairo_xlib_surface_ensure_dst_picture (cairo_xlib_surface_t *surface);
@@ -76,16 +66,20 @@ _native_byte_order_lsb (void);
static cairo_int_status_t
_cairo_xlib_surface_show_glyphs (void *abstract_dst,
cairo_operator_t op,
cairo_pattern_t *src_pattern,
cairo_glyph_t *glyphs,
int num_glyphs,
cairo_scaled_font_t *scaled_font);
+#if CAIRO_HAS_XLIB_XRENDER_SURFACE
+slim_hidden_proto (cairo_xlib_surface_create_with_xrender_format);
+#endif
+
/*
* Instead of taking two round trips for each blending request,
* assume that if a particular drawable fails GetImage that it will
* fail for a "while"; use temporary pixmaps to avoid the errors
*/
#define CAIRO_ASSUME_PIXMAP 20
@@ -174,21 +168,19 @@ _cairo_xlib_surface_create_similar_with_
return NULL;
}
pix = XCreatePixmap (dpy, src->drawable,
width <= 0 ? 1 : width, height <= 0 ? 1 : height,
depth);
surface = (cairo_xlib_surface_t *)
- _cairo_xlib_surface_create_internal (dpy, pix,
- src->screen, src->visual,
- xrender_format,
- width, height,
- depth);
+ cairo_xlib_surface_create_with_xrender_format (dpy, pix, src->screen,
+ xrender_format,
+ width, height);
if (surface->base.status) {
XFreePixmap (dpy, pix);
return &surface->base;
}
surface->owns_pixmap = TRUE;
return &surface->base;
@@ -254,21 +246,20 @@ _cairo_xlib_surface_create_similar (void
/* We've got a compatible XRenderFormat now, which means the
* similar surface will match the existing surface as closely in
* visual/depth etc. as possible. */
pix = XCreatePixmap (src->dpy, src->drawable,
width <= 0 ? 1 : width, height <= 0 ? 1 : height,
xrender_format->depth);
surface = (cairo_xlib_surface_t *)
- _cairo_xlib_surface_create_internal (src->dpy, pix,
- src->screen, src->visual,
- xrender_format,
- width, height,
- xrender_format->depth);
+ cairo_xlib_surface_create_with_xrender_format (src->dpy, pix,
+ src->screen,
+ xrender_format,
+ width, height);
if (surface->base.status != CAIRO_STATUS_SUCCESS) {
XFreePixmap (src->dpy, pix);
return &surface->base;
}
surface->owns_pixmap = TRUE;
return &surface->base;
@@ -2396,16 +2387,17 @@ cairo_xlib_surface_create_with_xrender_f
Screen *screen,
XRenderPictFormat *format,
int width,
int height)
{
return _cairo_xlib_surface_create_internal (dpy, drawable, screen,
NULL, format, width, height, 0);
}
+slim_hidden_def (cairo_xlib_surface_create_with_xrender_format);
/**
* cairo_xlib_surface_get_xrender_format:
* @surface: an xlib surface
*
* Gets the X Render picture format that @surface uses for rendering with the
* X Render extension. If the surface was created by
* cairo_xlib_surface_create_with_xrender_format() originally, the return