diff options
author | wiz <wiz@pkgsrc.org> | 2007-06-08 07:20:52 +0000 |
---|---|---|
committer | wiz <wiz@pkgsrc.org> | 2007-06-08 07:20:52 +0000 |
commit | cf92177d0e12ce9ab03890b7efd750eaa480ca1a (patch) | |
tree | 8c491cd8417b354b91c44976920b02738220e3df /graphics/cairo/patches/patch-ae | |
parent | 5487c7626bc1704a9b2d17017d1356e5fc26f1ae (diff) | |
download | pkgsrc-cf92177d0e12ce9ab03890b7efd750eaa480ca1a.tar.gz |
Update to 1.4.6:
Release 1.4.6 (2007-05-01 Carl Worth <cworth@cworth.org>)
=========================================================
This is the third update in cairo's stable 1.4 series. It comes a
little less than three weeks since the 1.4.4 release. This release
fixes the broken mutex initialization that made cairo 1.4.4 unusable
on win32, OS/2, and BeOS systems. This release also adds significant
improvements to cairo's PDF backend, (native gradients!), and a couple
of performance optimizations, (one of which is very significant for
users of the xlib backend).
Release 1.4.4 (2007-04-13 Carl Worth <cworth@cworth.org>)
=========================================================
This is the second update release in cairo's stable 1.4 series. It
comes just less than a month after 1.4.2. The changes since 1.4.2
consist primarily of bug fixes, but also include at least one
optimization. See below for details.
There have been lots of individuals doing lots of great work on cairo,
but two efforts during the 1.4.4 series deserve particular mention:
Internal cleanup of error handling, (Chris Wilson)
--------------------------------------------------
Chris contributed a tremendous series of patches (74 patches!) to
improve cairo's handling of out-of-memory and other errors. He began
by adding gcc's warn_unused_attribute to as many functions as
possible, and then launched into the ambitious efforts of adding
correct code to quiet the dozens of resulting warnings.
Chris also wrote a custom valgrind skin to systematically inject
malloc failures into cairo, and did all the work necessary to verify
that cairo's performance test suite runs to completion without
crashing.
The end result is a much more robust implementation. Previously, many
error conditions would have gone unnoticed and would have led to
assertion failures, segmentation faults, or other harder-to-diagnose
problems. Now, more than ever, cairo should cleanly let the user know
of problems through cairo_status and other similar status
functions. Well done, Chris!
More malloc reduction, (Mathias Hasselmann)
-------------------------------------------
After 1.4.0, Behdad launched an effort to chase down excessive calls
to malloc within the implementation of cairo. He fixed a lot of
malloc-happy objects for 1.4.2, but one of the worst offenders,
(pixman regions), was left around. Mathias contributed an excellent
series of 15 patches to finish off this effort.
The end result is a cairo that calls malloc much less often than it
did before. Compared to 1.4.2, 55% of the calls to malloc have been
eliminate, (and 60% have been eliminated compared to 1.4.0). Well
done, Mathias!
Diffstat (limited to 'graphics/cairo/patches/patch-ae')
-rw-r--r-- | graphics/cairo/patches/patch-ae | 128 |
1 files changed, 64 insertions, 64 deletions
diff --git a/graphics/cairo/patches/patch-ae b/graphics/cairo/patches/patch-ae index 18cdf7d1a79..6f61050e321 100644 --- a/graphics/cairo/patches/patch-ae +++ b/graphics/cairo/patches/patch-ae @@ -1,40 +1,40 @@ -$NetBSD: patch-ae,v 1.6 2007/03/20 15:29:22 drochner Exp $ +$NetBSD: patch-ae,v 1.7 2007/06/08 07:20:53 wiz Exp $ Fixes cairo on 8-bit pseudo color and other 8-bit displays. See https://bugs.freedesktop.org/show_bug.cgi?id=4945 ---- src/cairo-xlib-surface.c.orig 2007-03-02 01:04:59.000000000 +0000 -+++ src/cairo-xlib-surface.c -@@ -82,6 +82,8 @@ _cairo_xlib_surface_show_glyphs (void +--- src/cairo-xlib-surface-private.h-orig 2007-05-02 14:43:14.184165000 +0800 ++++ src/cairo-xlib-surface-private.h 2007-05-02 14:50:38.143706000 +0800 +@@ -39,6 +39,14 @@ - #define CAIRO_ASSUME_PIXMAP 20 + typedef struct _cairo_xlib_surface cairo_xlib_surface_t; -+struct clut_r3g3b2; ++struct clut_r3g3b2 { ++ struct clut_r3g3b2 *next; ++ Display *dpy; ++ Colormap cmap; ++ uint32_t clut[256]; ++ unsigned char ilut[256]; ++}; + struct _cairo_xlib_surface { cairo_surface_t base; -@@ -127,6 +129,8 @@ struct _cairo_xlib_surface { - int num_clip_rects; - - XRenderPictFormat *xrender_format; +@@ -88,6 +96,8 @@ struct _cairo_xlib_surface { + cairo_filter_t filter; + int repeat; + XTransform xtransform; + + struct clut_r3g3b2 *clut; }; - #define CAIRO_SURFACE_RENDER_AT_LEAST(surface, major, minor) \ -@@ -503,6 +507,82 @@ _swap_ximage_to_native (XImage *ximage) + #endif /* CAIRO_XLIB_SURFACE_PRIVATE_H */ +--- src/cairo-xlib-surface.c-orig 2007-05-02 14:55:09.281677000 +0800 ++++ src/cairo-xlib-surface.c 2007-05-02 14:53:31.401179000 +0800 +@@ -446,6 +446,74 @@ _swap_ximage_to_native (XImage *ximage) } } -+struct clut_r3g3b2 { -+ struct clut_r3g3b2 *next; -+ Display *dpy; -+ Colormap cmap; -+ uint32_t clut[256]; -+ unsigned char ilut[256]; -+}; -+ +static struct clut_r3g3b2 * _get_clut_r3g3b2(Display *dpy, Colormap cmap) { + static struct clut_r3g3b2 *first = NULL; + int i,j, min, d; @@ -106,12 +106,11 @@ See https://bugs.freedesktop.org/show_bug.cgi?id=4945 static cairo_status_t _get_image_surface (cairo_xlib_surface_t *surface, cairo_rectangle_int16_t *interest_rect, -@@ -656,6 +736,35 @@ _get_image_surface (cairo_xlib_surface_t +@@ -607,6 +675,36 @@ _get_image_surface (cairo_xlib_surface_t } else { -+ -+ if(surface->clut != NULL) { ++ if (surface->clut != NULL) { + + /* + * Otherwise, we construct a buffer containing RGB24 data @@ -122,7 +121,7 @@ See https://bugs.freedesktop.org/show_bug.cgi?id=4945 + int i,j; + + data = (uint32_t*)malloc(ximage->height * ximage->width * 4); -+ if(data == NULL) { ++ if (data == NULL) { + printf("Cannot allocate RGB buffer\n"); + goto FAIL; + } @@ -130,19 +129,21 @@ See https://bugs.freedesktop.org/show_bug.cgi?id=4945 + clut = surface->clut->clut; + src8 = (uint8_t*) ximage->data; + dst = data; -+ for(j = 0; j < ximage->height; j++) { -+ for(i = 0; i < ximage->width; i++) ++ for (j = 0; j < ximage->height; j++) { ++ for (i = 0; i < ximage->width; i++) + *dst++ = clut[src8[i]]; + src8 += ximage->bytes_per_line; + } + free(ximage->data); + image = (cairo_image_surface_t*) -+ cairo_image_surface_create_for_data((unsigned char *)data, CAIRO_FORMAT_RGB24, ximage->width, ximage->height, ximage->width*4); ++ cairo_image_surface_create_for_data ((unsigned char *)data, ++ CAIRO_FORMAT_RGB24, ximage->width, ximage->height, ++ ximage->width*4); + } else { /* * XXX This can't work. We must convert the data to one of the * supported pixman formats. Pixman needs another function -@@ -668,6 +777,8 @@ _get_image_surface (cairo_xlib_surface_t +@@ -619,6 +717,8 @@ _get_image_surface (cairo_xlib_surface_t ximage->width, ximage->height, ximage->bytes_per_line); @@ -151,11 +152,10 @@ See https://bugs.freedesktop.org/show_bug.cgi?id=4945 if (image->base.status) goto FAIL; } -@@ -742,6 +853,32 @@ _cairo_xlib_surface_ensure_gc (cairo_xli - _cairo_xlib_surface_set_gc_clip_rects (surface); +@@ -698,6 +798,31 @@ _cairo_xlib_surface_ensure_gc (cairo_xli + return CAIRO_STATUS_SUCCESS; } -+ +static int +_make_space_for(unsigned char ** buf, int *size, int *stride, int width, int height, int Bpp) +{ @@ -184,48 +184,48 @@ See https://bugs.freedesktop.org/show_bug.cgi?id=4945 static cairo_status_t _draw_image_surface (cairo_xlib_surface_t *surface, cairo_image_surface_t *image, -@@ -754,21 +891,54 @@ _draw_image_surface (cairo_xlib_surface_ +@@ -710,22 +835,54 @@ _draw_image_surface (cairo_xlib_surface_ { XImage ximage; unsigned int bpp, alpha, red, green, blue; + unsigned int depth = image->depth; + unsigned int stride = image->stride; int native_byte_order = _native_byte_order_lsb () ? LSBFirst : MSBFirst; + cairo_status_t status; pixman_format_get_masks (pixman_image_get_format (image->pixman_image), &bpp, &alpha, &red, &green, &blue); ++ if (surface->clut != NULL) { ++ static unsigned char *buf = NULL; ++ static int size = 0; ++ int i, j; ++ unsigned char *data, *ilut; ++ uint32_t *src; ++ uint8_t *dst8; + -+ if(surface->clut != NULL) { -+ static unsigned char *buf = NULL; -+ static int size = 0; -+ int i, j; -+ unsigned char *data, *ilut; -+ uint32_t *src; -+ uint8_t *dst8; -+ -+ if (_make_space_for(&buf, &size, &stride, image->width, image->height, 1)) ++ if (_make_space_for(&buf, &size, &stride, image->width, image->height, 1)) + return CAIRO_STATUS_NO_MEMORY; -+ data = buf; -+ src = (uint32_t*)image->data; -+ ilut = surface->clut->ilut; -+ for(j=0;j<image->height;j++) { ++ data = buf; ++ src = (uint32_t*)image->data; ++ ilut = surface->clut->ilut; ++ for (j=0;j<image->height;j++) { + dst8 = data + j * stride; -+ for(i=0;i<image->width;i++) { -+ dst8[i] = ilut[ ((*src >> 16) & 0xe0) | -+ ((*src >> 11) & 0x1c) | -+ ((*src >> 6) & 0x03) ]; -+ src++; ++ for (i=0;i<image->width;i++) { ++ dst8[i] = ilut[ ((*src >> 16) & 0xe0) | ++ ((*src >> 11) & 0x1c) | ++ ((*src >> 6) & 0x03) ]; ++ src++; + } -+ } -+ alpha = red = green = blue = 0; -+ depth = bpp = 8; -+ ximage.data = data; ++ } ++ alpha = red = green = blue = 0; ++ depth = bpp = 8; ++ ximage.data = data; + + } else { -+ ximage.data = (char *)image->data; ++ ximage.data = (char *)image->data; + } -+ ++ ximage.width = image->width; ximage.height = image->height; ximage.format = ZPixmap; @@ -242,17 +242,17 @@ See https://bugs.freedesktop.org/show_bug.cgi?id=4945 ximage.bits_per_pixel = bpp; ximage.red_mask = red; ximage.green_mask = green; -@@ -1899,7 +2069,13 @@ _cairo_xlib_surface_create_internal (Dis +@@ -1885,6 +2042,13 @@ _cairo_xlib_surface_create_internal (Dis surface->have_clip_rects = FALSE; - surface->clip_rects = NULL; + surface->clip_rects = surface->embedded_clip_rects; surface->num_clip_rects = 0; + surface->clut = NULL; - -+ if (xrender_format == NULL && -+ (visual->class == PseudoColor || visual->class == StaticColor)) { -+ surface->clut = _get_clut_r3g3b2(dpy, -+ DefaultColormapOfScreen(surface->screen)); ++ ++ if (xrender_format == NULL && ++ (visual->class == PseudoColor || visual->class == StaticColor)) { ++ surface->clut = _get_clut_r3g3b2(dpy, ++ DefaultColormapOfScreen(surface->screen)); + } + return (cairo_surface_t *) surface; } - |