Mercurial > hg > orthanc
diff Core/FileFormats/PngWriter.cpp @ 639:51892be15618
fix for big endian architectures
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 29 Oct 2013 15:56:29 +0000 |
parents | 7a966b440f19 |
children | 08eca5d86aad |
line wrap: on
line diff
--- a/Core/FileFormats/PngWriter.cpp Tue Oct 29 14:28:49 2013 +0000 +++ b/Core/FileFormats/PngWriter.cpp Tue Oct 29 15:56:29 2013 +0000 @@ -174,15 +174,18 @@ { case PixelFormat_Grayscale16: case PixelFormat_SignedGrayscale16: - png_set_rows(pimpl_->png_, pimpl_->info_, &pimpl_->rows_[0]); - + { + int transforms = 0; if (Toolbox::DetectEndianness() == Endianness_Little) { - // Must swap the endianness!! - png_write_png(pimpl_->png_, pimpl_->info_, PNG_TRANSFORM_SWAP_ENDIAN, NULL); + transforms = PNG_TRANSFORM_SWAP_ENDIAN; } + png_set_rows(pimpl_->png_, pimpl_->info_, &pimpl_->rows_[0]); + png_write_png(pimpl_->png_, pimpl_->info_, transforms, NULL); + break; + } default: png_write_image(pimpl_->png_, &pimpl_->rows_[0]);