| 1 | Index: boost/gil/extension/io/formats/targa/read.hpp
|
|---|
| 2 | ===================================================================
|
|---|
| 3 | --- boost/gil/extension/io/formats/targa/read.hpp (revision 83843)
|
|---|
| 4 | +++ boost/gil/extension/io/formats/targa/read.hpp (working copy)
|
|---|
| 5 | @@ -127,7 +127,14 @@
|
|---|
| 6 | {
|
|---|
| 7 | this->_scanline_length = this->_info._width * ( this->_info._bits_per_pixel / 8 );
|
|---|
| 8 |
|
|---|
| 9 | - read_data< bgr8_view_t >( dst_view );
|
|---|
| 10 | + if( this->_info._descriptor & 0x20 )
|
|---|
| 11 | + {
|
|---|
| 12 | + read_data< bgr8_view_t >( flipped_up_down_view( dst_view ) );
|
|---|
| 13 | + }
|
|---|
| 14 | + else
|
|---|
| 15 | + {
|
|---|
| 16 | + read_data< bgr8_view_t >( dst_view );
|
|---|
| 17 | + }
|
|---|
| 18 |
|
|---|
| 19 | break;
|
|---|
| 20 | }
|
|---|
| 21 | @@ -135,7 +142,14 @@
|
|---|
| 22 | {
|
|---|
| 23 | this->_scanline_length = this->_info._width * ( this->_info._bits_per_pixel / 8 );
|
|---|
| 24 |
|
|---|
| 25 | - read_data< bgra8_view_t >( dst_view );
|
|---|
| 26 | + if( this->_info._descriptor & 0x20 )
|
|---|
| 27 | + {
|
|---|
| 28 | + read_data< bgra8_view_t >( flipped_up_down_view( dst_view ) );
|
|---|
| 29 | + }
|
|---|
| 30 | + else
|
|---|
| 31 | + {
|
|---|
| 32 | + read_data< bgra8_view_t >( dst_view );
|
|---|
| 33 | + }
|
|---|
| 34 |
|
|---|
| 35 | break;
|
|---|
| 36 | }
|
|---|
| 37 | @@ -164,12 +178,26 @@
|
|---|
| 38 | {
|
|---|
| 39 | case 24:
|
|---|
| 40 | {
|
|---|
| 41 | - read_rle_data< bgr8_view_t >( dst_view );
|
|---|
| 42 | + if( this->_info._descriptor & 0x20 )
|
|---|
| 43 | + {
|
|---|
| 44 | + read_rle_data< bgr8_view_t >( flipped_up_down_view( dst_view ) );
|
|---|
| 45 | + }
|
|---|
| 46 | + else
|
|---|
| 47 | + {
|
|---|
| 48 | + read_rle_data< bgr8_view_t >( dst_view );
|
|---|
| 49 | + }
|
|---|
| 50 | break;
|
|---|
| 51 | }
|
|---|
| 52 | case 32:
|
|---|
| 53 | {
|
|---|
| 54 | - read_rle_data< bgra8_view_t >( dst_view );
|
|---|
| 55 | + if( this->_info._descriptor & 0x20 )
|
|---|
| 56 | + {
|
|---|
| 57 | + read_rle_data< bgra8_view_t >( flipped_up_down_view( dst_view ) );
|
|---|
| 58 | + }
|
|---|
| 59 | + else
|
|---|
| 60 | + {
|
|---|
| 61 | + read_rle_data< bgra8_view_t >( dst_view );
|
|---|
| 62 | + }
|
|---|
| 63 | break;
|
|---|
| 64 | }
|
|---|
| 65 | default:
|
|---|
| 66 | Index: boost/gil/extension/io/formats/targa/reader_backend.hpp
|
|---|
| 67 | ===================================================================
|
|---|
| 68 | --- boost/gil/extension/io/formats/targa/reader_backend.hpp (revision 83843)
|
|---|
| 69 | +++ boost/gil/extension/io/formats/targa/reader_backend.hpp (working copy)
|
|---|
| 70 | @@ -94,8 +94,10 @@
|
|---|
| 71 | }
|
|---|
| 72 |
|
|---|
| 73 | _info._descriptor = _io_dev.read_uint8();
|
|---|
| 74 | - if( ( _info._bits_per_pixel == 24 && _info._descriptor != 0 )
|
|---|
| 75 | - || ( _info._bits_per_pixel == 32 && _info._descriptor != 8 )
|
|---|
| 76 | + targa_descriptor::type pixel_type = _info._descriptor & 0xdf;
|
|---|
| 77 | +
|
|---|
| 78 | + if( ( _info._bits_per_pixel == 24 && pixel_type != 0 )
|
|---|
| 79 | + || ( _info._bits_per_pixel == 32 && pixel_type != 8 )
|
|---|
| 80 | )
|
|---|
| 81 | {
|
|---|
| 82 | io_error( "Unsupported descriptor for targa file" );
|
|---|