From 7b639accc1cd0c444594dfb9b6d32e65d7133032 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Mon, 28 Mar 2016 05:16:02 +0000 Subject: [PATCH] etcpak: Replace use of std::array (which seems not to exist under all compilers) with simple custom class. git-svn-id: https://svn.eduke32.com/eduke32@5687 1a8010ca-5511-0410-912e-c29ae57300e0 --- .../source/android/etcpak/ProcessRGB.cpp | 44 ++++++++++++++++--- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/polymer/eduke32/source/android/etcpak/ProcessRGB.cpp b/polymer/eduke32/source/android/etcpak/ProcessRGB.cpp index 0e0cf17f5..f89dae559 100644 --- a/polymer/eduke32/source/android/etcpak/ProcessRGB.cpp +++ b/polymer/eduke32/source/android/etcpak/ProcessRGB.cpp @@ -1,4 +1,3 @@ -#include #include #include @@ -17,7 +16,28 @@ static inline uint32 byteswap(uint32 l) return ((l >> 8u) & 0xff00u) | ((l & 0xff00u) << 8u) | (l << 24u) | (l >> 24u); } -typedef std::array v4i; +template +struct simple_array +{ + simple_array() + { + memset(data, 0, sizeof(data)); + } + + T operator [](int i) const + { + return data[i]; + } + T & operator [](int i) + { + return data[i]; + } + +protected: + T data[size]; +}; + +typedef simple_array v4i; void Average( const uint8* data, v4i* a ) { @@ -41,10 +61,22 @@ void Average( const uint8* data, v4i* a ) } } - a[0] = v4i{ uint16( (r[2] + r[3] + 4) / 8 ), uint16( (g[2] + g[3] + 4) / 8 ), uint16( (b[2] + b[3] + 4) / 8 ), 0}; - a[1] = v4i{ uint16( (r[0] + r[1] + 4) / 8 ), uint16( (g[0] + g[1] + 4) / 8 ), uint16( (b[0] + b[1] + 4) / 8 ), 0}; - a[2] = v4i{ uint16( (r[1] + r[3] + 4) / 8 ), uint16( (g[1] + g[3] + 4) / 8 ), uint16( (b[1] + b[3] + 4) / 8 ), 0}; - a[3] = v4i{ uint16( (r[0] + r[2] + 4) / 8 ), uint16( (g[0] + g[2] + 4) / 8 ), uint16( (b[0] + b[2] + 4) / 8 ), 0}; + a[0][0] = uint16( (r[2] + r[3] + 4) / 8 ); + a[0][1] = uint16( (g[2] + g[3] + 4) / 8 ); + a[0][2] = uint16( (b[2] + b[3] + 4) / 8 ); + a[0][3] = 0; + a[1][0] = uint16( (r[0] + r[1] + 4) / 8 ); + a[1][1] = uint16( (g[0] + g[1] + 4) / 8 ); + a[1][2] = uint16( (b[0] + b[1] + 4) / 8 ); + a[1][3] = 0; + a[2][0] = uint16( (r[1] + r[3] + 4) / 8 ); + a[2][1] = uint16( (g[1] + g[3] + 4) / 8 ); + a[2][2] = uint16( (b[1] + b[3] + 4) / 8 ); + a[2][3] = 0; + a[3][0] = uint16( (r[0] + r[2] + 4) / 8 ); + a[3][1] = uint16( (g[0] + g[2] + 4) / 8 ); + a[3][2] = uint16( (b[0] + b[2] + 4) / 8 ); + a[3][3] = 0; } void CalcErrorBlock( const uint8* data, uint err[4][4] )