| 1 |
/* { dg-options "-O1 -floop-block -Wno-return-type" } */ |
| 2 |
|
| 3 |
typedef unsigned char byte; |
| 4 |
typedef unsigned int uint; |
| 5 |
typedef unsigned char uint8; |
| 6 |
namespace Common { |
| 7 |
class NonCopyable { |
| 8 |
}; |
| 9 |
template<class In, class Out> |
| 10 |
Out copy(In first, In last, Out dst) { |
| 11 |
while (first != last) |
| 12 |
*dst++ = *first++; |
| 13 |
} |
| 14 |
template<class T> |
| 15 |
class Array { |
| 16 |
uint _size; |
| 17 |
T *_storage; |
| 18 |
public: |
| 19 |
Array<T>& operator=(const Array<T> &array) { |
| 20 |
copy(array._storage, array._storage + _size, _storage); |
| 21 |
} |
| 22 |
}; |
| 23 |
} |
| 24 |
namespace Graphics { |
| 25 |
struct PixelFormat { |
| 26 |
inline PixelFormat() { |
| 27 |
} |
| 28 |
inline PixelFormat(byte BytesPerPixel, |
| 29 |
byte RBits, byte GBits, byte BBits, byte ABits, |
| 30 |
byte RShift, byte GShift, byte BShift, byte AShift) { |
| 31 |
} |
| 32 |
}; |
| 33 |
}; |
| 34 |
namespace Cine { |
| 35 |
static const Graphics::PixelFormat kLowPalFormat(2, 3, 3, 3, 0, 8, 4, 0, 0); |
| 36 |
class Palette { |
| 37 |
public: |
| 38 |
struct Color { |
| 39 |
uint8 r, g, b; |
| 40 |
}; |
| 41 |
Palette(const Graphics::PixelFormat format = Graphics::PixelFormat(), const uint numColors = 0); |
| 42 |
bool empty() const; |
| 43 |
bool isValid() const; |
| 44 |
Common::Array<Color> _colors; |
| 45 |
}; |
| 46 |
class FWRenderer : public Common::NonCopyable { |
| 47 |
Cine::Palette _activePal; |
| 48 |
void drawCommand(); |
| 49 |
}; |
| 50 |
void FWRenderer::drawCommand() { |
| 51 |
if (!_activePal.isValid() || _activePal.empty()) { |
| 52 |
_activePal = Cine::Palette(kLowPalFormat, 16); |
| 53 |
} |
| 54 |
} |
| 55 |
} |