[Hdrflow-svn] SF.net SVN: hdrflow: [321] trunk/lib/openlibraries/src/openimagelib/plugins /tiff/tif
Status: Pre-Alpha
Brought to you by:
glslang
From: <gl...@us...> - 2007-09-29 20:54:23
|
Revision: 321 http://hdrflow.svn.sourceforge.net/hdrflow/?rev=321&view=rev Author: glslang Date: 2007-09-29 13:54:22 -0700 (Sat, 29 Sep 2007) Log Message: ----------- + fixes tiff reader (strips != 1) Modified Paths: -------------- trunk/lib/openlibraries/src/openimagelib/plugins/tiff/tiff_plugin.cpp Modified: trunk/lib/openlibraries/src/openimagelib/plugins/tiff/tiff_plugin.cpp =================================================================== --- trunk/lib/openlibraries/src/openimagelib/plugins/tiff/tiff_plugin.cpp 2007-09-29 12:49:48 UTC (rev 320) +++ trunk/lib/openlibraries/src/openimagelib/plugins/tiff/tiff_plugin.cpp 2007-09-29 20:54:22 UTC (rev 321) @@ -85,9 +85,6 @@ if( !im ) return il::image_type_ptr( ); - if( orientation == ORIENTATION_TOPLEFT ) - im->set_flipped( true ); - il::image_type::pointer data = im->data( ); int bytes_per_pixel = components * bpp / 8; @@ -126,14 +123,29 @@ if( is_float ) pitch *= sizeof( float ); - unsigned int rows; + unsigned int rows, strip_size; TIFFGetField( tif, TIFFTAG_ROWSPERSTRIP, &rows ); + strip_size = TIFFStripSize( tif ); + + typedef std::vector<unsigned char> buffer_t; + buffer_t buf( strip_size ); + + int linesize = strip_size / rows; + + tstrip_t nstrips = TIFFNumberOfStrips( tif ); + for( tstrip_t i = 0; i < nstrips; ++i ) + { + TIFFReadEncodedStrip( tif, i, &buf[ 0 ], strip_size ); + + buffer_t::pointer buf_data = &buf[ 0 ]; + + for( unsigned int j = 0; j < rows; ++j ) + { + memcpy( data, buf_data, linesize ); - unsigned int strip_size = TIFFStripSize( tif ); - for( int i = 0; i < height * depth; i += rows ) - { - tstrip_t strip = TIFFComputeStrip( tif, i, 0 ); - TIFFReadEncodedStrip( tif, strip, data + i * pitch, strip_size ); + buf_data += linesize; + data += pitch; + } } } @@ -149,7 +161,7 @@ virtual il::image_type_ptr load( const pl::string& uri ) { return load_tiff( uri ); } - virtual bool store( const pl::string& uri, il::image_type_ptr ) + virtual bool store( const pl::string&, il::image_type_ptr ) { return false; } }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |