58 unsigned ro,
unsigned go,
unsigned bo,
59 unsigned rw,
unsigned gw,
unsigned bw,
63 byte_order(_byte_order),
85 word |= p[
i] << (8 *
i);
88 word |= p[
i] << (8 * (length -
i - 1));
99 p[
i] = (word >> (8 *
i)) & 0xFF;
102 p[
i] = (word >> (8 * (length -
i - 1))) & 0xFF;
110 : pixels(width * height),
111 _width(width), _height(height)
117 : _width(0), _height(0)
148 pixels.resize(width * height);
161 static const Pixel black(0, 0, 0);
188 reinterpret_cast<const Bytef *>(
pixels.data()),
Pixel toPixel(uint32_t word) const
Get the Pixel representation of a color word.
const Pixel & pixel(unsigned x, unsigned y) const
Get a pixel from an (x, y) coordinate.
static const FrameBuffer dummy
Static "dummy" frame buffer.
Internal gem5 representation of a frame buffer.
void resize(unsigned width, unsigned height)
Resize the frame buffer.
uint32_t readWord(const uint8_t *p) const
Read a word of a given length and endianness from memory.
unsigned length
Bytes per pixel when stored in memory (including padding)
void copyIn(const uint8_t *fb, const PixelConverter &conv)
Fill the frame buffer with pixel data from an external buffer of the same width and height as this fr...
void copyOut(uint8_t *fb, const PixelConverter &conv) const
Store the contents of this frame buffer in an external buffer of the same width and height as this fr...
unsigned _width
Width in pixels.
void clear()
Fill the frame buffer with black pixels.
FrameBuffer()
Create an empty (0x0) frame buffer.
std::vector< Pixel > pixels
Frame buffer backing store.
Channel(unsigned offset, unsigned width)
static const PixelConverter rgb565_be
Predefined 16-bit RGB565 (red in least significant bits, big endian) conversion helper.
PixelConverter(unsigned length, unsigned ro, unsigned go, unsigned bo, unsigned rw, unsigned gw, unsigned bw, ByteOrder byte_order=LittleEndianByteOrder)
#define UNSERIALIZE_SCALAR(scalar)
#define SERIALIZE_CONTAINER(member)
ByteOrder byte_order
Byte order when stored to memory.
unsigned height() const
Frame buffer height in pixels.
static const PixelConverter rgba8888_le
Predefined 32-bit RGB (red in least significant bits, 8 bits/channel, little endian) conversion helpe...
void unserialize(CheckpointIn &cp) override
Unserialize an object.
#define UNSERIALIZE_CONTAINER(member)
#define SERIALIZE_SCALAR(scalar)
static const PixelConverter rgb565_le
Predefined 16-bit RGB565 (red in least significant bits, little endian) conversion helper...
std::ostream CheckpointOut
unsigned width() const
Frame buffer width in pixels.
uint64_t getHash() const
Create a hash of the image that can be used for quick comparisons.
void fill(const Pixel &pixel)
Fill the frame buffer with a single pixel value.
Configurable RGB pixel converter.
Internal gem5 representation of a Pixel.
unsigned _height
Height in pixels.
void writeWord(uint8_t *p, uint32_t word) const
Write a word of a given length and endianness to memory.
void serialize(CheckpointOut &cp) const override
Serialize an object.
static const PixelConverter rgba8888_be
Predefined 32-bit RGB (red in least significant bits, 8 bits/channel, big endian) conversion helper...
uint32_t fromPixel(const Pixel &pixel) const
Convert a Pixel into a color word.
unsigned area() const
Total number of pixels in frame buffer.