changeset 2194:9063024ebc5a

better fix for big-endian architectures
author Vladimir Nadvornik <nadvornik@suse.cz>
date Sun, 23 Sep 2012 11:19:36 +0200
parents 9b610eb8a8d3
children 0cdbe938b525 59b559f747a7 2d9042b24d0b
files src/image_load_tiff.c
diffstat 1 files changed, 9 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/image_load_tiff.c	Tue Sep 04 15:05:41 2012 +0200
+++ b/src/image_load_tiff.c	Sun Sep 23 11:19:36 2012 +0200
@@ -295,18 +295,21 @@
 		/* Turns out that the packing used by TIFFRGBAImage depends on
 		 * the host byte order...
 		 */
-		while (pixels < lt->pixbuf->pixels + bytes)
+		{
+		guchar *ptr = pixels;
+		while (ptr < pixels + bytes)
 			{
-			uint32 pixel = *(uint32 *)pixels;
+			uint32 pixel = *(uint32 *)ptr;
 			int r = TIFFGetR(pixel);
 			int g = TIFFGetG(pixel);
 			int b = TIFFGetB(pixel);
 			int a = TIFFGetA(pixel);
-			*pixels++ = r;
-			*pixels++ = g;
-			*pixels++ = b;
-			*pixels++ = a;
+			*ptr++ = r;
+			*ptr++ = g;
+			*ptr++ = b;
+			*ptr++ = a;
 			}
+		}
 #endif
 
 		lt->area_updated_cb(loader, 0, 0, width, height, lt->data);