From ae88ea44cfb5453896ed784fdebcb9d56657dfa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Sun, 15 Jan 2023 13:22:35 +0100 Subject: [PATCH] TgaImageConverter: move verbose output to the pixel format switch. So I don't need to duplicate it for the RLE branch. --- .../TgaImageConverter/TgaImageConverter.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/MagnumPlugins/TgaImageConverter/TgaImageConverter.cpp b/src/MagnumPlugins/TgaImageConverter/TgaImageConverter.cpp index 14fc26de0..1662c55bc 100644 --- a/src/MagnumPlugins/TgaImageConverter/TgaImageConverter.cpp +++ b/src/MagnumPlugins/TgaImageConverter/TgaImageConverter.cpp @@ -73,7 +73,13 @@ Containers::Optional> TgaImageConverter::doConvertToData header = {}; switch(image.format()) { case PixelFormat::RGB8Unorm: + if(flags() & ImageConverterFlag::Verbose) + Debug{} << "Trade::TgaImageConverter::convertToData(): converting from RGB to BGR"; + header.imageType = 2; + break; case PixelFormat::RGBA8Unorm: + if(flags() & ImageConverterFlag::Verbose) + Debug{} << "Trade::TgaImageConverter::convertToData(): converting from RGBA to BGRA"; header.imageType = 2; break; case PixelFormat::R8Unorm: @@ -93,13 +99,9 @@ Containers::Optional> TgaImageConverter::doConvertToData {std::size_t(image.size().y()), std::size_t(image.size().x()), pixelSize}}); if(image.format() == PixelFormat::RGB8Unorm) { - if(flags() & ImageConverterFlag::Verbose) - Debug{} << "Trade::TgaImageConverter::convertToData(): converting from RGB to BGR"; for(Vector3ub& pixel: Containers::arrayCast(pixels)) pixel = Math::gather<'b', 'g', 'r'>(pixel); } else if(image.format() == PixelFormat::RGBA8Unorm) { - if(flags() & ImageConverterFlag::Verbose) - Debug{} << "Trade::TgaImageConverter::convertToData(): converting from RGBA to BGRA"; for(Vector4ub& pixel: Containers::arrayCast(pixels)) pixel = Math::gather<'b', 'g', 'r', 'a'>(pixel); }