Browse Source

Adapted to Magnum changes.

Image constructor parameter reordering.
pull/34/head
Vladimír Vondruš 13 years ago
parent
commit
c53cb1b004
  1. 8
      src/Plugins/TgaImageConverter/Test/TgaImageConverterTest.cpp
  2. 10
      src/Plugins/TgaImporter/TgaImporter.cpp

8
src/Plugins/TgaImageConverter/Test/TgaImageConverterTest.cpp

@ -49,9 +49,9 @@ class TgaImageConverterTest: public TestSuite::Tester {
namespace {
#ifndef MAGNUM_TARGET_GLES
const Image2D original({2, 3}, ImageFormat::BGR, ImageType::UnsignedByte, new char[18]
const Image2D original(ImageFormat::BGR, ImageType::UnsignedByte, {2, 3}, new char[18]
#else
const Image2D original({2, 3}, ImageFormat::RGB, ImageType::UnsignedByte, new char[18]
const Image2D original(ImageFormat::RGB, ImageType::UnsignedByte, {2, 3}, new char[18]
#endif
{
1, 2, 3, 2, 3, 4,
@ -68,7 +68,7 @@ TgaImageConverterTest::TgaImageConverterTest() {
}
void TgaImageConverterTest::wrongFormat() {
Image2D image({}, ImageFormat::RG, ImageType::UnsignedByte, nullptr);
Image2D image(ImageFormat::RG, ImageType::UnsignedByte, {}, nullptr);
std::ostringstream out;
Error::setOutput(&out);
@ -79,7 +79,7 @@ void TgaImageConverterTest::wrongFormat() {
}
void TgaImageConverterTest::wrongType() {
Image2D image({}, ImageFormat::Red, ImageType::Float, nullptr);
Image2D image(ImageFormat::Red, ImageType::Float, {}, nullptr);
std::ostringstream out;
Error::setOutput(&out);

10
src/Plugins/TgaImporter/TgaImporter.cpp

@ -129,11 +129,11 @@ ImageData2D* TgaImporter::doImage2D(UnsignedInt) {
return nullptr;
}
std::size_t size = header.width*header.height*header.bpp/8;
char* buffer = new char[size];
in->read(buffer, size);
const std::size_t dataSize = header.width*header.height*header.bpp/8;
char* const data = new char[dataSize];
in->read(data, dataSize);
Vector2i dimensions(header.width, header.height);
Vector2i size(header.width, header.height);
#ifdef MAGNUM_TARGET_GLES
if(format == ImageFormat::RGB) {
@ -147,7 +147,7 @@ ImageData2D* TgaImporter::doImage2D(UnsignedInt) {
}
#endif
return new ImageData2D(dimensions, format, ImageType::UnsignedByte, buffer);
return new ImageData2D(format, ImageType::UnsignedByte, size, data);
}
}}

Loading…
Cancel
Save