Browse Source

TgaImageConverter: move verbose output to the pixel format switch.

So I don't need to duplicate it for the RLE branch.
pull/601/head
Vladimír Vondruš 3 years ago
parent
commit
ae88ea44cf
  1. 10
      src/MagnumPlugins/TgaImageConverter/TgaImageConverter.cpp

10
src/MagnumPlugins/TgaImageConverter/TgaImageConverter.cpp

@ -73,7 +73,13 @@ Containers::Optional<Containers::Array<char>> TgaImageConverter::doConvertToData
header = {}; header = {};
switch(image.format()) { switch(image.format()) {
case PixelFormat::RGB8Unorm: case PixelFormat::RGB8Unorm:
if(flags() & ImageConverterFlag::Verbose)
Debug{} << "Trade::TgaImageConverter::convertToData(): converting from RGB to BGR";
header.imageType = 2;
break;
case PixelFormat::RGBA8Unorm: case PixelFormat::RGBA8Unorm:
if(flags() & ImageConverterFlag::Verbose)
Debug{} << "Trade::TgaImageConverter::convertToData(): converting from RGBA to BGRA";
header.imageType = 2; header.imageType = 2;
break; break;
case PixelFormat::R8Unorm: case PixelFormat::R8Unorm:
@ -93,13 +99,9 @@ Containers::Optional<Containers::Array<char>> TgaImageConverter::doConvertToData
{std::size_t(image.size().y()), std::size_t(image.size().x()), pixelSize}}); {std::size_t(image.size().y()), std::size_t(image.size().x()), pixelSize}});
if(image.format() == PixelFormat::RGB8Unorm) { if(image.format() == PixelFormat::RGB8Unorm) {
if(flags() & ImageConverterFlag::Verbose)
Debug{} << "Trade::TgaImageConverter::convertToData(): converting from RGB to BGR";
for(Vector3ub& pixel: Containers::arrayCast<Vector3ub>(pixels)) for(Vector3ub& pixel: Containers::arrayCast<Vector3ub>(pixels))
pixel = Math::gather<'b', 'g', 'r'>(pixel); pixel = Math::gather<'b', 'g', 'r'>(pixel);
} else if(image.format() == PixelFormat::RGBA8Unorm) { } else if(image.format() == PixelFormat::RGBA8Unorm) {
if(flags() & ImageConverterFlag::Verbose)
Debug{} << "Trade::TgaImageConverter::convertToData(): converting from RGBA to BGRA";
for(Vector4ub& pixel: Containers::arrayCast<Vector4ub>(pixels)) for(Vector4ub& pixel: Containers::arrayCast<Vector4ub>(pixels))
pixel = Math::gather<'b', 'g', 'r', 'a'>(pixel); pixel = Math::gather<'b', 'g', 'r', 'a'>(pixel);
} }

Loading…
Cancel
Save