# ChangeLog for x11-libs/cairo
# Copyright 2000-2005 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/x11-libs/cairo/ChangeLog,v 1.44 2005/08/31 07:57:02 leonardop Exp $
+# $Header: /var/cvsroot/gentoo-x86/x11-libs/cairo/ChangeLog,v 1.45 2005/09/02 15:58:45 leonardop Exp $
+
+*cairo-1.0.0-r2 (02 Sep 2005)
+
+ 02 Sep 2005; Leonardo Boshell <leonardop@gentoo.org>
+ +files/cairo-1.0.0-display_endianness.patch,
+ +files/cairo-1.0.0-tests.patch, -cairo-1.0.0-r1.ebuild,
+ +cairo-1.0.0-r2.ebuild:
+ Added a couple of patches from upstream's CVS repository to fix some tests
+ on amd64 and fix a problem with remote displays that don't match the local
+ endianness.
*cairo-1.0.0-r1 (31 Aug 2005)
-MD5 809a14c91d998b328a0233b78e2cb06c ChangeLog 6507
-MD5 774122d09bbd9129ec9c080c87023dcd cairo-1.0.0-r1.ebuild 1527
+MD5 5be0303751321614c8830efa35d14e32 ChangeLog 6893
MD5 3a4cce771cdc4714c6931467622c9ddc cairo-0.1.23-r1.ebuild 757
MD5 4db2c222787dd6470523acdfe996891e cairo-0.2.0-r1.ebuild 900
+MD5 733dbbe8cf224d65572a8b1b31d6e1d7 cairo-1.0.0-r2.ebuild 1857
MD5 627da87d1d67830749f3dafde81804ca cairo-0.3.0.ebuild 843
MD5 ea284a6e24864155e0176859cbddf1b3 metadata.xml 335
MD5 c307699f3bb9e8e6f81b2aba114c1ea2 cairo-0.3.0-r2.ebuild 998
MD5 1d2ad415e2e6db1a58640bb93b15a34f cairo-0.4.0.ebuild 994
-MD5 2d06b8355150f68fc54350a976a5e668 files/digest-cairo-1.0.0-r1 64
MD5 b5edc8c1ed78cd07fdeef82c1933b436 files/cairo-1.0.0-omit_frame_pointer_fix.patch 2064
+MD5 cb629cb476b36f504e626e651adad5c2 files/cairo-1.0.0-tests.patch 6148
MD5 8045b9ac7481eb952f3c2fdfda944c65 files/digest-cairo-0.1.23-r1 64
MD5 ee0e0ddbf61c280106ae3683503054a8 files/digest-cairo-0.2.0-r1 63
MD5 2a0e4de10c4b8aacdb9b5991825b30d5 files/digest-cairo-0.3.0 63
+MD5 8d14c810af91228a252e7b845efb3353 files/cairo-1.0.0-display_endianness.patch 5142
MD5 4df3bcd9171f83ca24b03ab0f8eefb24 files/cairo-0.3.0-header-fix.diff 697
MD5 1ecec7f667ad4b91d876db0efdf4a261 files/cairo-0.4.0-makefile.patch 1553
MD5 2a0e4de10c4b8aacdb9b5991825b30d5 files/digest-cairo-0.3.0-r2 63
MD5 f84da26023eb9d5a29079fbccc555523 files/digest-cairo-0.4.0 63
+MD5 2d06b8355150f68fc54350a976a5e668 files/digest-cairo-1.0.0-r2 64
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/x11-libs/cairo/cairo-1.0.0-r1.ebuild,v 1.1 2005/08/31 07:57:02 leonardop Exp $
+# $Header: /var/cvsroot/gentoo-x86/x11-libs/cairo/cairo-1.0.0-r2.ebuild,v 1.1 2005/09/02 15:58:45 leonardop Exp $
inherit eutils
DEPEND="${RDEPEND}
>=dev-util/pkgconfig-0.9
- doc? ( >=dev-util/gtk-doc-1.3
+ doc? (
+ >=dev-util/gtk-doc-1.3
~app-text/docbook-xml-dtd-4.2 )"
# Fix segmentation fault when compiling with -fomit-frame-pointer.
# See bug #104265.
epatch ${FILESDIR}/${P}-omit_frame_pointer_fix.patch
+
+ # Upstream patch to correctly handle displays which don't match the local
+ # endianness. https://bugs.freedesktop.org/show_bug.cgi?id=4321
+ epatch ${FILESDIR}/${P}-display_endianness.patch
+
+ # Fix some tests that were failing on amd64.
+ # https://bugs.freedesktop.org/show_bug.cgi?id=4245
+ epatch ${FILESDIR}/${P}-tests.patch
}
src_compile() {
--- /dev/null
+diff -NurdB cairo-1.0.0/src/cairo-xlib-surface.c cairo-1.0.0-patched/src/cairo-xlib-surface.c
+--- cairo-1.0.0/src/cairo-xlib-surface.c 2005-08-24 00:42:19.000000000 -0500
++++ cairo-1.0.0-patched/src/cairo-xlib-surface.c 2005-09-02 10:12:59.000000000 -0500
+@@ -60,6 +60,9 @@
+ static cairo_bool_t
+ _cairo_surface_is_xlib (cairo_surface_t *surface);
+
++static cairo_bool_t
++_native_byte_order_lsb (void);
++
+ /*
+ * Instead of taking two round trips for each blending request,
+ * assume that if a particular drawable fails GetImage that it will
+@@ -302,6 +305,116 @@
+ return False;
+ }
+
++static void
++_swap_ximage_2bytes (XImage *ximage)
++{
++ int i, j;
++ char *line = ximage->data;
++
++ for (j = ximage->height; j; j--) {
++ uint16_t *p = (uint16_t *)line;
++ for (i = ximage->width; i; i--) {
++ *p = (((*p & 0x00ff) << 8) |
++ ((*p) >> 8));
++ p++;
++ }
++
++ line += ximage->bytes_per_line;
++ }
++}
++
++static void
++_swap_ximage_4bytes (XImage *ximage)
++{
++ int i, j;
++ char *line = ximage->data;
++
++ for (j = ximage->height; j; j--) {
++ uint32_t *p = (uint32_t *)line;
++ for (i = ximage->width; i; i--) {
++ *p = (((*p & 0x000000ff) << 24) |
++ ((*p & 0x0000ff00) << 8) |
++ ((*p & 0x00ff0000) >> 8) |
++ ((*p) >> 24));
++ p++;
++ }
++
++ line += ximage->bytes_per_line;
++ }
++}
++
++static void
++_swap_ximage_bits (XImage *ximage)
++{
++ int i, j;
++ char *line = ximage->data;
++ int unit = ximage->bitmap_unit;
++ int line_bytes = ((ximage->width + unit - 1) & ~(unit - 1)) / 8;
++
++ for (j = ximage->height; j; j--) {
++ char *p = line;
++
++ for (i = line_bytes; i; i--) {
++ char b = *p;
++ b = ((b << 1) & 0xaa) | ((b >> 1) & 0x55);
++ b = ((b << 2) & 0xcc) | ((b >> 2) & 0x33);
++ b = ((b << 4) & 0xf0) | ((b >> 4) & 0x0f);
++ *p = b;
++
++ p++;
++ }
++
++ line += ximage->bytes_per_line;
++ }
++}
++
++static void
++_swap_ximage_to_native (XImage *ximage)
++{
++ int unit_bytes = 0;
++ int native_byte_order = _native_byte_order_lsb () ? LSBFirst : MSBFirst;
++
++ if (ximage->bits_per_pixel == 1 &&
++ ximage->bitmap_bit_order != native_byte_order) {
++ _swap_ximage_bits (ximage);
++ if (ximage->bitmap_bit_order == ximage->byte_order)
++ return;
++ }
++
++ if (ximage->byte_order == native_byte_order)
++ return;
++
++ switch (ximage->bits_per_pixel) {
++ case 1:
++ unit_bytes = ximage->bitmap_unit / 8;
++ break;
++ case 8:
++ case 16:
++ case 32:
++ unit_bytes = ximage->bits_per_pixel / 8;
++ break;
++ default:
++ /* This could be hit on some uncommon but possible cases,
++ * such as bpp=4. These are cases that libpixman can't deal
++ * with in any case.
++ */
++ ASSERT_NOT_REACHED;
++ }
++
++ switch (unit_bytes) {
++ case 1:
++ return;
++ case 2:
++ _swap_ximage_2bytes (ximage);
++ break;
++ case 4:
++ _swap_ximage_4bytes (ximage);
++ break;
++ default:
++ ASSERT_NOT_REACHED;
++ }
++}
++
+ static cairo_status_t
+ _get_image_surface (cairo_xlib_surface_t *surface,
+ cairo_rectangle_t *interest_rect,
+@@ -405,6 +518,8 @@
+ }
+ if (!ximage)
+ return CAIRO_STATUS_NO_MEMORY;
++
++ _swap_ximage_to_native (ximage);
+
+ /*
+ * Compute the pixel format masks from either a visual or a
+@@ -545,40 +660,35 @@
+ int dst_x,
+ int dst_y)
+ {
+- XImage *ximage;
+- unsigned bitmap_pad;
+-
+- /* XXX this is wrong */
+- if (image->depth > 16)
+- bitmap_pad = 32;
+- else if (image->depth > 8)
+- bitmap_pad = 16;
+- else
+- bitmap_pad = 8;
+-
+- ximage = XCreateImage (surface->dpy,
+- DefaultVisual(surface->dpy, DefaultScreen(surface->dpy)),
+- image->depth,
+- ZPixmap,
+- 0,
+- (char *) image->data,
+- image->width,
+- image->height,
+- bitmap_pad,
+- image->stride);
+- if (ximage == NULL)
+- return CAIRO_STATUS_NO_MEMORY;
++ XImage ximage;
++ int bpp, alpha, red, green, blue;
++ int native_byte_order = _native_byte_order_lsb () ? LSBFirst : MSBFirst;
++
++ pixman_format_get_masks (pixman_image_get_format (image->pixman_image),
++ &bpp, &alpha, &red, &green, &blue);
++
++ ximage.width = image->width;
++ ximage.height = image->height;
++ ximage.format = ZPixmap;
++ ximage.data = (char *)image->data;
++ ximage.byte_order = native_byte_order;
++ ximage.bitmap_unit = 32; /* always for libpixman */
++ ximage.bitmap_bit_order = native_byte_order;
++ ximage.bitmap_pad = 32; /* always for libpixman */
++ ximage.depth = image->depth;
++ ximage.bytes_per_line = image->stride;
++ ximage.bits_per_pixel = bpp;
++ ximage.red_mask = red;
++ ximage.green_mask = green;
++ ximage.blue_mask = blue;
+
++ XInitImage (&ximage);
++
+ _cairo_xlib_surface_ensure_gc (surface);
+ XPutImage(surface->dpy, surface->drawable, surface->gc,
+- ximage, 0, 0, dst_x, dst_y,
++ &ximage, 0, 0, dst_x, dst_y,
+ image->width, image->height);
+
+- /* Foolish XDestroyImage thinks it can free my data, but I won't
+- stand for it. */
+- ximage->data = NULL;
+- XDestroyImage (ximage);
+-
+ return CAIRO_STATUS_SUCCESS;
+
+ }
--- /dev/null
+diff -NurdB cairo-1.0.0/test/cairo-test.c cairo-1.0.0-patched/test/cairo-test.c
+--- cairo-1.0.0/test/cairo-test.c 2005-08-23 16:01:54.000000000 -0500
++++ cairo-1.0.0-patched/test/cairo-test.c 2005-09-02 10:18:45.000000000 -0500
+@@ -382,6 +382,8 @@
+ return NULL;
+ }
+
++ XSynchronize (xtc->dpy, 1);
++
+ /* XXX: Currently we don't do any xlib testing when the X server
+ * doesn't have the Render extension. We could do better here,
+ * (perhaps by converting the tests from ARGB32 to RGB24). One
+diff -NurdB cairo-1.0.0/test/cairo-test.h cairo-1.0.0-patched/test/cairo-test.h
+--- cairo-1.0.0/test/cairo-test.h 2005-08-04 14:28:52.000000000 -0500
++++ cairo-1.0.0-patched/test/cairo-test.h 2005-09-02 10:20:06.000000000 -0500
+@@ -26,10 +26,36 @@
+ #ifndef _CAIRO_TEST_H_
+ #define _CAIRO_TEST_H_
+
++#if HAVE_CONFIG_H
++#include "config.h"
++#endif
++
+ #include <math.h>
+ #include <cairo.h>
+ #include <cairo-debug.h>
+
++#if HAVE_STDINT_H
++# include <stdint.h>
++#elif HAVE_INTTYPES_H
++# include <inttypes.h>
++#elif HAVE_SYS_INT_TYPES_H
++# include <sys/int_types.h>
++#elif defined(_MSC_VER)
++typedef __int8 int8_t;
++typedef unsigned __int8 uint8_t;
++typedef __int16 int16_t;
++typedef unsigned __int16 uint16_t;
++typedef __int32 int32_t;
++typedef unsigned __int32 uint32_t;
++typedef __int64 int64_t;
++typedef unsigned __int64 uint64_t;
++# ifndef HAVE_UINT64_T
++# define HAVE_UINT64_T 1
++# endif
++#else
++#error Cannot find definitions for fixed-width integral types (uint8_t, uint32_t, \etc.)
++#endif
++
+ typedef enum cairo_test_status {
+ CAIRO_TEST_SUCCESS = 0,
+ CAIRO_TEST_FAILURE,
+diff -NurdB cairo-1.0.0/test/filter-nearest-offset.c cairo-1.0.0-patched/test/filter-nearest-offset.c
+--- cairo-1.0.0/test/filter-nearest-offset.c 2005-08-17 11:49:22.000000000 -0500
++++ cairo-1.0.0-patched/test/filter-nearest-offset.c 2005-09-02 10:20:37.000000000 -0500
+@@ -44,7 +44,7 @@
+ draw (cairo_t *cr, int width, int height)
+ {
+ cairo_surface_t *surface;
+- unsigned long data[STAMP_WIDTH * STAMP_HEIGHT] = {
++ uint32_t data[STAMP_WIDTH * STAMP_HEIGHT] = {
+ 0xffffffff, 0xffffffff, 0xffff0000, 0xffff0000,
+ 0xffffffff, 0xffffffff, 0xffff0000, 0xffff0000,
+
+diff -NurdB cairo-1.0.0/test/mask-ctm.c cairo-1.0.0-patched/test/mask-ctm.c
+--- cairo-1.0.0/test/mask-ctm.c 2005-07-28 17:55:01.000000000 -0500
++++ cairo-1.0.0-patched/test/mask-ctm.c 2005-09-02 10:21:12.000000000 -0500
+@@ -36,7 +36,7 @@
+ {
+ cairo_surface_t *mask_surface;
+ cairo_pattern_t *mask;
+- unsigned long data[] = {
++ uint32_t data[] = {
+ 0x80000000, 0x80000000,
+ 0x80000000, 0x80000000,
+ };
+diff -NurdB cairo-1.0.0/test/mask-surface-ctm.c cairo-1.0.0-patched/test/mask-surface-ctm.c
+--- cairo-1.0.0/test/mask-surface-ctm.c 2005-07-28 17:55:01.000000000 -0500
++++ cairo-1.0.0-patched/test/mask-surface-ctm.c 2005-09-02 10:21:50.000000000 -0500
+@@ -35,7 +35,7 @@
+ draw (cairo_t *cr, int width, int height)
+ {
+ cairo_surface_t *mask;
+- unsigned long data[] = {
++ uint32_t data[] = {
+ 0x80000000, 0x80000000,
+ 0x80000000, 0x80000000,
+ };
+diff -NurdB cairo-1.0.0/test/move-to-show-surface.c cairo-1.0.0-patched/test/move-to-show-surface.c
+--- cairo-1.0.0/test/move-to-show-surface.c 2005-05-06 23:55:34.000000000 -0500
++++ cairo-1.0.0-patched/test/move-to-show-surface.c 2005-09-02 10:22:26.000000000 -0500
+@@ -55,7 +55,7 @@
+ draw (cairo_t *cr, int width, int height)
+ {
+ cairo_surface_t *surface;
+- unsigned long colors[4] = {
++ uint32_t colors[4] = {
+ 0xffffffff, 0xffff0000,
+ 0xff00ff00, 0xff0000ff
+ };
+diff -NurdB cairo-1.0.0/test/paint-with-alpha.c cairo-1.0.0-patched/test/paint-with-alpha.c
+--- cairo-1.0.0/test/paint-with-alpha.c 2005-05-12 12:35:02.000000000 -0500
++++ cairo-1.0.0-patched/test/paint-with-alpha.c 2005-09-02 10:22:55.000000000 -0500
+@@ -35,7 +35,7 @@
+ draw (cairo_t *cr, int width, int height)
+ {
+ cairo_surface_t *surface;
+- unsigned long data[16] = {
++ uint32_t data[16] = {
+ 0xffffffff, 0xffffffff, 0xffff0000, 0xffff0000,
+ 0xffffffff, 0xffffffff, 0xffff0000, 0xffff0000,
+
+diff -NurdB cairo-1.0.0/test/scale-source-surface-paint.c cairo-1.0.0-patched/test/scale-source-surface-paint.c
+--- cairo-1.0.0/test/scale-source-surface-paint.c 2005-05-06 23:55:35.000000000 -0500
++++ cairo-1.0.0-patched/test/scale-source-surface-paint.c 2005-09-02 10:23:25.000000000 -0500
+@@ -35,7 +35,7 @@
+ draw (cairo_t *cr, int width, int height)
+ {
+ cairo_surface_t *surface;
+- unsigned long data[16] = {
++ uint32_t data[16] = {
+ 0xffffffff, 0xffffffff, 0xffff0000, 0xffff0000,
+ 0xffffffff, 0xffffffff, 0xffff0000, 0xffff0000,
+
+diff -NurdB cairo-1.0.0/test/set-source.c cairo-1.0.0-patched/test/set-source.c
+--- cairo-1.0.0/test/set-source.c 2005-05-06 23:55:35.000000000 -0500
++++ cairo-1.0.0-patched/test/set-source.c 2005-09-02 10:23:59.000000000 -0500
+@@ -37,7 +37,7 @@
+ int i;
+ /* This color value might need to change in the future when we fix
+ * the rounding in cairo-color.c */
+- unsigned long color = 0x7f19334C;
++ uint32_t color = 0x7f19334C;
+ cairo_surface_t *surface;
+ cairo_pattern_t *pattern;
+
+diff -NurdB cairo-1.0.0/test/source-surface-scale-paint.c cairo-1.0.0-patched/test/source-surface-scale-paint.c
+--- cairo-1.0.0/test/source-surface-scale-paint.c 2005-08-04 14:28:52.000000000 -0500
++++ cairo-1.0.0-patched/test/source-surface-scale-paint.c 2005-09-02 10:24:35.000000000 -0500
+@@ -35,7 +35,7 @@
+ draw (cairo_t *cr, int width, int height)
+ {
+ cairo_surface_t *surface;
+- unsigned long data[16] = {
++ uint32_t data[16] = {
+ 0xffffffff, 0xffffffff, 0xffff0000, 0xffff0000,
+ 0xffffffff, 0xffffffff, 0xffff0000, 0xffff0000,
+
+diff -NurdB cairo-1.0.0/test/translate-show-surface.c cairo-1.0.0-patched/test/translate-show-surface.c
+--- cairo-1.0.0/test/translate-show-surface.c 2005-05-06 23:55:35.000000000 -0500
++++ cairo-1.0.0-patched/test/translate-show-surface.c 2005-09-02 10:24:59.000000000 -0500
+@@ -53,7 +53,7 @@
+ draw (cairo_t *cr, int width, int height)
+ {
+ cairo_surface_t *surface;
+- unsigned long colors[4] = {
++ uint32_t colors[4] = {
+ 0xffffffff, 0xffff0000,
+ 0xff00ff00, 0xff0000ff
+ };