Browse Source

Fixed ES build without deprecated API.

pull/34/head
Vladimír Vondruš 13 years ago
parent
commit
f29ea2140f
  1. 7
      src/Plugins/TgaImageConverter/TgaImageConverter.cpp
  2. 7
      src/Plugins/TgaImporter/TgaImporter.cpp

7
src/Plugins/TgaImageConverter/TgaImageConverter.cpp

@ -33,7 +33,8 @@
#ifdef MAGNUM_TARGET_GLES
#include <algorithm>
#include <Swizzle.h>
#include "Math/Swizzle.h"
#include "Math/Vector4.h"
#endif
#include "TgaImporter/TgaHeader.h"
@ -84,11 +85,11 @@ Containers::Array<unsigned char> TgaImageConverter::doExportToData(const ImageRe
if(image.format() == ColorFormat::RGB) {
auto pixels = reinterpret_cast<Math::Vector3<UnsignedByte>*>(data.begin()+sizeof(TgaHeader));
std::transform(pixels, pixels + image.size().product(), pixels,
[](Math::Vector3<UnsignedByte> pixel) { return swizzle<'b', 'g', 'r'>(pixel); });
[](Math::Vector3<UnsignedByte> pixel) { return Math::swizzle<'b', 'g', 'r'>(pixel); });
} else if(image.format() == ColorFormat::RGBA) {
auto pixels = reinterpret_cast<Math::Vector4<UnsignedByte>*>(data.begin()+sizeof(TgaHeader));
std::transform(pixels, pixels + image.size().product(), pixels,
[](Math::Vector4<UnsignedByte> pixel) { return swizzle<'b', 'g', 'r', 'a'>(pixel); });
[](Math::Vector4<UnsignedByte> pixel) { return Math::swizzle<'b', 'g', 'r', 'a'>(pixel); });
}
#endif

7
src/Plugins/TgaImporter/TgaImporter.cpp

@ -33,9 +33,10 @@
#ifdef MAGNUM_TARGET_GLES
#include <algorithm>
#include "Math/Swizzle.h"
#include "Math/Vector4.h"
#include <Context.h>
#include <Extensions.h>
#include <Swizzle.h>
#endif
#include "TgaHeader.h"
@ -146,11 +147,11 @@ std::optional<ImageData2D> TgaImporter::doImage2D(UnsignedInt) {
if(format == ColorFormat::RGB) {
auto pixels = reinterpret_cast<Math::Vector3<UnsignedByte>*>(data);
std::transform(pixels, pixels + size.product(), pixels,
[](Math::Vector3<UnsignedByte> pixel) { return swizzle<'b', 'g', 'r'>(pixel); });
[](Math::Vector3<UnsignedByte> pixel) { return Math::swizzle<'b', 'g', 'r'>(pixel); });
} else if(format == ColorFormat::RGBA) {
auto pixels = reinterpret_cast<Math::Vector4<UnsignedByte>*>(data);
std::transform(pixels, pixels + size.product(), pixels,
[](Math::Vector4<UnsignedByte> pixel) { return swizzle<'b', 'g', 'r', 'a'>(pixel); });
[](Math::Vector4<UnsignedByte> pixel) { return Math::swizzle<'b', 'g', 'r', 'a'>(pixel); });
}
#endif

Loading…
Cancel
Save