Added support for correct handling `Orientation' tag in gtTileContig. Should

be added in other gt* functions as well, but I have not images for testing
yet. Partially resolves http://bugzilla.remotesensing.org/show_bug.cgi?id=23
This commit is contained in:
Andrey Kiselev 2002-03-13 19:36:36 +00:00
parent ec61d2b61c
commit ce38c97afb

View File

@ -1,4 +1,4 @@
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_getimage.c,v 1.16 2001-12-15 15:11:22 warmerda Exp $ */
/* $Header: /cvs/maptools/cvsroot/libtiff/libtiff/tif_getimage.c,v 1.17 2002-03-13 19:36:36 dron Exp $ */
/*
* Copyright (c) 1991-1997 Sam Leffler
@ -473,7 +473,7 @@ gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
uint16 orientation;
uint32 col, row, y, rowstoread, ret = 1;
uint32 pos;
uint32 tw, th;
uint32 tw, th, tile_row_size;
u_char* buf;
int32 fromskew, toskew;
uint32 nrow;
@ -501,7 +501,35 @@ gtTileContig(TIFFRGBAImage* img, uint32* raster, uint32 w, uint32 h)
break;
}
pos = ((row+img->row_offset) % th) * TIFFTileRowSize(tif);
tile_row_size = TIFFTileRowSize(tif);
pos = ((row+img->row_offset) % th) * tile_row_size;
if(orientation == ORIENTATION_BOTLEFT)
/* Vertically mirror rows in tile according to `Orientation' tag */
{
u_char *wrk_line, *top_line, *bottom_line;
uint32 t_row;
wrk_line = (u_char*)_TIFFmalloc(tile_row_size);
if (wrk_line == 0)
{
TIFFError(TIFFFileName(tif), "No space for tile row buffer");
return (0);
}
for(t_row = 0; t_row < th / 2; t_row++)
{
top_line = buf + tile_row_size * t_row;
bottom_line = buf + tile_row_size * (th-t_row-1);
_TIFFmemcpy(wrk_line, top_line, tile_row_size);
_TIFFmemcpy(top_line, bottom_line, tile_row_size);
_TIFFmemcpy(bottom_line, wrk_line, tile_row_size);
}
_TIFFfree(wrk_line);
}
if (col + tw > w)
{