Browse Source

TGAImporter: think about endianness!

pull/34/head
Vladimír Vondruš 15 years ago
parent
commit
8823b2cc72
  1. 6
      src/Plugins/TGAImporter/TGAImporter.cpp

6
src/Plugins/TGAImporter/TGAImporter.cpp

@ -15,6 +15,7 @@
#include "TGAImporter.h"
#include "Utility/Endianness.h"
#include "Math/Vector2.h"
#include "Image.h"
@ -32,8 +33,11 @@ bool TGAImporter::open(std::istream& in) {
Header header;
in.read(reinterpret_cast<char*>(&header), sizeof(Header));
ColorFormat colorFormat;
/* Convert to machine endian */
header.width = Endianness::littleEndian<unsigned short>(header.width);
header.height = Endianness::littleEndian<unsigned short>(header.height);
ColorFormat colorFormat;
switch(header.bpp) {
case 24:
colorFormat = ColorFormat::BGR;

Loading…
Cancel
Save