]> git.imager.perl.org - imager.git/blobdiff - tiff.c
Fixed missing myfree() in bmp.c.
[imager.git] / tiff.c
diff --git a/tiff.c b/tiff.c
index 2f576cf77c1ec097102752d319382573f2da40b6..a59b8a9a6d204a4e8f0a98bc35cb67b61c89fa2a 100644 (file)
--- a/tiff.c
+++ b/tiff.c
@@ -2,6 +2,7 @@
 #include "tiffio.h"
 #include "iolayer.h"
 
+
 /*
 =head1 NAME
 
@@ -25,11 +26,17 @@ memory mapped buffer.
 
 Some of these functions are internal.
 
-=over 4
+=over
 
 =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);
        }
       }
@@ -533,3 +548,17 @@ i_writetiff_wiol_faxable(i_img *im, io_glue *ig, int fine) {
   return 1;
 }
 
+
+/*
+=back
+
+=head1 AUTHOR
+
+Arnar M. Hrafnkelsson <addi@umich.edu>
+
+=head1 SEE ALSO
+
+Imager(3)
+
+=cut
+*/