Mercurial > hg > orthanc
comparison 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 |
comparison
equal
deleted
inserted
replaced
637:900274ed996f | 639:51892be15618 |
---|---|
172 { | 172 { |
173 switch (format) | 173 switch (format) |
174 { | 174 { |
175 case PixelFormat_Grayscale16: | 175 case PixelFormat_Grayscale16: |
176 case PixelFormat_SignedGrayscale16: | 176 case PixelFormat_SignedGrayscale16: |
177 png_set_rows(pimpl_->png_, pimpl_->info_, &pimpl_->rows_[0]); | 177 { |
178 | 178 int transforms = 0; |
179 if (Toolbox::DetectEndianness() == Endianness_Little) | 179 if (Toolbox::DetectEndianness() == Endianness_Little) |
180 { | 180 { |
181 // Must swap the endianness!! | 181 transforms = PNG_TRANSFORM_SWAP_ENDIAN; |
182 png_write_png(pimpl_->png_, pimpl_->info_, PNG_TRANSFORM_SWAP_ENDIAN, NULL); | |
183 } | 182 } |
184 | 183 |
184 png_set_rows(pimpl_->png_, pimpl_->info_, &pimpl_->rows_[0]); | |
185 png_write_png(pimpl_->png_, pimpl_->info_, transforms, NULL); | |
186 | |
185 break; | 187 break; |
188 } | |
186 | 189 |
187 default: | 190 default: |
188 png_write_image(pimpl_->png_, &pimpl_->rows_[0]); | 191 png_write_image(pimpl_->png_, &pimpl_->rows_[0]); |
189 } | 192 } |
190 } | 193 } |