[opengtl-commits] [364] correct position for bits swapping |
[ Thread Index |
Date Index
| More lists.tuxfamily.org/opengtl-commits Archives
]
Revision: 364
Author: cyrille
Date: 2008-09-03 23:19:16 +0200 (Wed, 03 Sep 2008)
Log Message:
-----------
correct position for bits swapping
Modified Paths:
--------------
trunk/OpenGTL/Extensions/PngDC/PngDC.cpp
Modified: trunk/OpenGTL/Extensions/PngDC/PngDC.cpp
===================================================================
--- trunk/OpenGTL/Extensions/PngDC/PngDC.cpp 2008-09-03 21:09:56 UTC (rev 363)
+++ trunk/OpenGTL/Extensions/PngDC/PngDC.cpp 2008-09-03 21:19:16 UTC (rev 364)
@@ -211,11 +211,6 @@
TELL_ERROR( "Unsupported bit depth: " + GTLCore::String::number( bit_depth ) );
}
-#ifndef WORDS_BIGENDIAN
- if (bit_depth > 8)
- png_set_swap(png_ptr);
-#endif
-
// Guess the color type
int color_type;
switch( _image->pixelDescription().channels() )
@@ -243,7 +238,13 @@
png_init_io(png_ptr, fp );
png_write_info(png_ptr, info_ptr);
+#ifndef WORDS_BIGENDIAN
+ if (bit_depth > 8)
+ png_set_swap(png_ptr);
+#endif
+
+
int pixel_size = (_image->pixelDescription().bitsSize() / 8);
png_bytep row_pointer = new png_byte[ pixel_size * _region.width() ];