From c53cb1b004cce92c9ec27ca954103337b476be1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 2 Jul 2013 19:00:43 +0200 Subject: [PATCH] Adapted to Magnum changes. Image constructor parameter reordering. --- .../TgaImageConverter/Test/TgaImageConverterTest.cpp | 8 ++++---- src/Plugins/TgaImporter/TgaImporter.cpp | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Plugins/TgaImageConverter/Test/TgaImageConverterTest.cpp b/src/Plugins/TgaImageConverter/Test/TgaImageConverterTest.cpp index a4d72ca39..31bc57129 100644 --- a/src/Plugins/TgaImageConverter/Test/TgaImageConverterTest.cpp +++ b/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); diff --git a/src/Plugins/TgaImporter/TgaImporter.cpp b/src/Plugins/TgaImporter/TgaImporter.cpp index ef9a563a4..f7cf489af 100644 --- a/src/Plugins/TgaImporter/TgaImporter.cpp +++ b/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); } }}