Add testcase for PR42930.

2010-02-10  Sebastian Pop  <sebastian.pop@amd.com>

	* g++.dg/graphite/pr42930.C: New.

From-SVN: r156715
This commit is contained in:
Sebastian Pop 2010-02-11 19:43:05 +00:00 committed by Sebastian Pop
parent 141ecc2425
commit be1c3b28b2
2 changed files with 63 additions and 0 deletions

View File

@ -1,3 +1,11 @@
2010-02-10 Sebastian Pop <sebastian.pop@amd.com>
* graphite.c (graphite_transform_loops): Re-enable dbg_cnt.
2010-02-10 Sebastian Pop <sebastian.pop@amd.com>
* g++.dg/graphite/pr42930.C: New.
2010-02-10 Sebastian Pop <sebastian.pop@amd.com>
PR middle-end/42930

View File

@ -0,0 +1,55 @@
/* { dg-options "-O1 -floop-block" } */
typedef unsigned char byte;
typedef unsigned int uint;
typedef unsigned char uint8;
namespace Common {
class NonCopyable {
};
template<class In, class Out>
Out copy(In first, In last, Out dst) {
while (first != last)
*dst++ = *first++;
}
template<class T>
class Array {
uint _size;
T *_storage;
public:
Array<T>& operator=(const Array<T> &array) {
copy(array._storage, array._storage + _size, _storage);
}
};
}
namespace Graphics {
struct PixelFormat {
inline PixelFormat() {
}
inline PixelFormat(byte BytesPerPixel,
byte RBits, byte GBits, byte BBits, byte ABits,
byte RShift, byte GShift, byte BShift, byte AShift) {
}
};
};
namespace Cine {
static const Graphics::PixelFormat kLowPalFormat(2, 3, 3, 3, 0, 8, 4, 0, 0);
class Palette {
public:
struct Color {
uint8 r, g, b;
};
Palette(const Graphics::PixelFormat format = Graphics::PixelFormat(), const uint numColors = 0);
bool empty() const;
bool isValid() const;
Common::Array<Color> _colors;
};
class FWRenderer : public Common::NonCopyable {
Cine::Palette _activePal;
void drawCommand();
};
void FWRenderer::drawCommand() {
if (!_activePal.isValid() || _activePal.empty()) {
_activePal = Cine::Palette(kLowPalFormat, 16);
}
}
}