From d2686aa9515d94b56a78c59a4603dd8c44035837 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 18 May 2002 14:56:20 +0000 Subject: [PATCH] Check for endianness. * configure.in: Check for endianness. * io-tiff.c (tiff_image_parse): fix packing order on bigendian systems. (#81702) --- ChangeLog | 4 ++++ ChangeLog.pre-2-10 | 4 ++++ ChangeLog.pre-2-2 | 4 ++++ ChangeLog.pre-2-4 | 4 ++++ ChangeLog.pre-2-6 | 4 ++++ ChangeLog.pre-2-8 | 4 ++++ gdk-pixbuf/ChangeLog | 5 +++++ gdk-pixbuf/io-tiff.c | 15 +++++++++++++++ 8 files changed, 44 insertions(+) diff --git a/ChangeLog b/ChangeLog index c9d4881e1d..2516156ebb 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2002-05-18 Matthias Clasen + + * configure.in: Check for endianness. Sorry about REBUILD_PNGS... + Fri May 17 16:05:34 2002 Owen Taylor * configure.in (REBUILD_PNGS): Re-add REBUILD_PNGS diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index c9d4881e1d..2516156ebb 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,7 @@ +2002-05-18 Matthias Clasen + + * configure.in: Check for endianness. Sorry about REBUILD_PNGS... + Fri May 17 16:05:34 2002 Owen Taylor * configure.in (REBUILD_PNGS): Re-add REBUILD_PNGS diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2 index c9d4881e1d..2516156ebb 100644 --- a/ChangeLog.pre-2-2 +++ b/ChangeLog.pre-2-2 @@ -1,3 +1,7 @@ +2002-05-18 Matthias Clasen + + * configure.in: Check for endianness. Sorry about REBUILD_PNGS... + Fri May 17 16:05:34 2002 Owen Taylor * configure.in (REBUILD_PNGS): Re-add REBUILD_PNGS diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4 index c9d4881e1d..2516156ebb 100644 --- a/ChangeLog.pre-2-4 +++ b/ChangeLog.pre-2-4 @@ -1,3 +1,7 @@ +2002-05-18 Matthias Clasen + + * configure.in: Check for endianness. Sorry about REBUILD_PNGS... + Fri May 17 16:05:34 2002 Owen Taylor * configure.in (REBUILD_PNGS): Re-add REBUILD_PNGS diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index c9d4881e1d..2516156ebb 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,7 @@ +2002-05-18 Matthias Clasen + + * configure.in: Check for endianness. Sorry about REBUILD_PNGS... + Fri May 17 16:05:34 2002 Owen Taylor * configure.in (REBUILD_PNGS): Re-add REBUILD_PNGS diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index c9d4881e1d..2516156ebb 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,7 @@ +2002-05-18 Matthias Clasen + + * configure.in: Check for endianness. Sorry about REBUILD_PNGS... + Fri May 17 16:05:34 2002 Owen Taylor * configure.in (REBUILD_PNGS): Re-add REBUILD_PNGS diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog index dd0855847e..cc1aabe501 100644 --- a/gdk-pixbuf/ChangeLog +++ b/gdk-pixbuf/ChangeLog @@ -1,3 +1,8 @@ +2002-05-18 Matthias Clasen + + * io-tiff.c (tiff_image_parse): fix packing order on bigendian + systems. (#81702) + Thu May 16 15:17:30 2002 Owen Taylor * pixops/pixops.c: Patch from Matthias Clasen to fix some typos diff --git a/gdk-pixbuf/io-tiff.c b/gdk-pixbuf/io-tiff.c index 13a491235a..a8365fa961 100644 --- a/gdk-pixbuf/io-tiff.c +++ b/gdk-pixbuf/io-tiff.c @@ -268,6 +268,21 @@ tiff_image_parse (TIFF *tiff, TiffContext *context, GError **error) TIFFRGBAImageGet (&img, (uint32 *)pixels, width, height); TIFFRGBAImageEnd (&img); +#ifdef WORDS_BIGENDIAN +/* Turns out that the packing used by TIFFRGBAImage depends on the host byte order... */ + while (pixels < pixbuf->pixels + bytes) { + uint32 pixel = *(uint32 *)pixels; + int r = TIFFGetR(pixel); + int g = TIFFGetG(pixel); + int b = TIFFGetB(pixel); + int a = TIFFGetA(pixel); + *pixels++ = r; + *pixels++ = g; + *pixels++ = b; + *pixels++ = a; + } +#endif + G_UNLOCK (tiff_loader); if (context) (* context->update_func) (pixbuf, 0, 0, width, height, context->user_data);