]> git.imager.perl.org - imager.git/commitdiff
Fixed an endianness bug in tiff reading and switched the inclusion order for
authorArnar Mar Hrafnkelsson <addi@cpan.org>
Tue, 30 Oct 2001 08:32:11 +0000 (08:32 +0000)
committerArnar Mar Hrafnkelsson <addi@cpan.org>
Tue, 30 Oct 2001 08:32:11 +0000 (08:32 +0000)
freetype2 so that it is searched before /usr/local/include

Makefile.PL
t/t106tiff.t
tiff.c

index e45844e30803c425918ab64bc3f9af0f803fc518..e5c093c8f1e82f27a0757a4349b9e91c4f7e3a09 100644 (file)
@@ -263,7 +263,7 @@ sub pathcheck {
 sub init {
 
   @definc{'/usr/include'}=();
-  @incs=(qw(/usr/include /usr/local/include /usr/include/freetype /usr/local/include/freetype /usr/include/freetype2 /usr/local/include/freetype2), split /:/, $INCPATH );
+  @incs=(qw(/usr/include /usr/include/freetype2 /usr/local/include/freetype2 /usr/local/include /usr/include/freetype /usr/local/include/freetype), split /:/, $INCPATH );
   @libs=(split(/ /, $Config{'libpth'}), split(/:/, $LIBPATH) );
   if ($^O =~ /win32/i && $Config{cc} =~ /\bcl\b/i) {
     push(@incs, split /;/, $ENV{INCLUDE}) if exists $ENV{INCLUDE};
index c5a6e6cbc9468ec0f4feb5170ee2ddbeaefb1757..a76dd6bd1fdb7b159b7a64d2fce4d224f25130b4 100644 (file)
@@ -30,7 +30,7 @@ if (!i_has_format("tiff")) {
   Imager::i_tags_add($img, "i_yres", 0, undef, 250);
   # resolutionunit is centimeters
   Imager::i_tags_add($img, "tiff_resolutionunit", 0, undef, 3);
-  open(FH,">testout/t106.tiff") || die "cannot open testout/t10.tiff for writing\n";
+  open(FH,">testout/t106.tiff") || die "cannot open testout/t106.tiff for writing\n";
   binmode(FH); 
   my $IO = Imager::io_new_fd(fileno(FH));
   i_writetiff_wiol($img, $IO);
diff --git a/tiff.c b/tiff.c
index 45b131a5b48980fba0a1f0032098a9f3f795e240..a59b8a9a6d204a4e8f0a98bc35cb67b61c89fa2a 100644 (file)
--- a/tiff.c
+++ b/tiff.c
@@ -2,6 +2,7 @@
 #include "tiffio.h"
 #include "iolayer.h"
 
+
 /*
 =head1 NAME
 
@@ -30,6 +31,12 @@ Some of these functions are internal.
 =cut
 */
 
+
+#define byteswap_macro(x) \
+     ((((x) & 0xff000000) >> 24) | (((x) & 0x00ff0000) >>  8) |     \
+      (((x) & 0x0000ff00) <<  8) | (((x) & 0x000000ff) << 24))
+
+
 /*
 =item comp_seek(h, o, w)
 
@@ -160,8 +167,12 @@ i_readtiff_wiol(io_glue *ig, int length) {
        newcols = (col+tile_width  > width ) ? width-row  : tile_width;
        for( i_row = 0; i_row < tile_height; i_row++ ) {
          for(x = 0; x < newcols; x++) {
-           i_color val;               /* FIXME: Make sure this works everywhere */
-           val.ui = raster[x+tile_width*(tile_height-i_row-1)];
+           i_color val;
+           uint32 temp = raster[x+tile_width*(tile_height-i_row-1)];
+           val.rgba.r = TIFFGetR(temp);
+           val.rgba.g = TIFFGetG(temp);
+           val.rgba.b = TIFFGetB(temp);
+           val.rgba.a = TIFFGetA(temp);
            i_ppix(im, col+x, row+i_row, &val);
          }
        }
@@ -192,8 +203,12 @@ i_readtiff_wiol(io_glue *ig, int length) {
       for( i_row = 0; i_row < newrows; i_row++ ) { 
        uint32 x;
        for(x = 0; x<width; x++) {
-         i_color val;               /* FIXME: Make sure this works everywhere */
-         val.ui = raster[x+width*(newrows-i_row-1)];
+         i_color val;
+         uint32 temp = raster[x+width*(newrows-i_row-1)];
+         val.rgba.r = TIFFGetR(temp);
+         val.rgba.g = TIFFGetG(temp);
+         val.rgba.b = TIFFGetB(temp);
+         val.rgba.a = TIFFGetA(temp);
          i_ppix(im, x, i_row+row, &val);
        }
       }