From c6653b6fd7b4b4fcecfccc56f9038e5d04186d41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Fri, 5 Jul 2013 18:31:01 +0200 Subject: [PATCH] GCC 4.4 compatibility: no lambda functions. --- src/Plugins/TgaImporter/TgaImporter.cpp | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Plugins/TgaImporter/TgaImporter.cpp b/src/Plugins/TgaImporter/TgaImporter.cpp index 12aeac28f..b858bc20b 100644 --- a/src/Plugins/TgaImporter/TgaImporter.cpp +++ b/src/Plugins/TgaImporter/TgaImporter.cpp @@ -42,6 +42,16 @@ namespace Magnum { namespace Trade { +namespace { + constexpr Math::Vector3 bgr(const Math::Vector3& vec) { + return swizzle<'b', 'g', 'r'>(vec); + } + + constexpr Math::Vector4 bgra(const Math::Vector4& vec) { + return swizzle<'b', 'g', 'r', 'a'>(vec); + } +} + TgaImporter::TgaImporter(): in(nullptr) {} TgaImporter::TgaImporter(PluginManager::AbstractManager* manager, std::string plugin): AbstractImporter(manager, std::move(plugin)), in(nullptr) {} @@ -145,12 +155,10 @@ ImageData2D* TgaImporter::doImage2D(UnsignedInt) { #ifdef MAGNUM_TARGET_GLES if(format == ImageFormat::RGB) { auto pixels = reinterpret_cast*>(data); - std::transform(pixels, pixels + size.product(), pixels, - [](Math::Vector3 pixel) { return swizzle<'b', 'g', 'r'>(pixel); }); + std::transform(pixels, pixels + size.product(), pixels, bgr); } else if(format == ImageFormat::RGBA) { auto pixels = reinterpret_cast*>(data); - std::transform(pixels, pixels + size.product(), pixels, - [](Math::Vector4 pixel) { return swizzle<'b', 'g', 'r', 'a'>(pixel); }); + std::transform(pixels, pixels + size.product(), pixels, bgra); } #endif