{
}
+
+void
+FrameBuffer::serialize(CheckpointOut &cp) const
+{
+ SERIALIZE_SCALAR(_width);
+ SERIALIZE_SCALAR(_height);
+ SERIALIZE_CONTAINER(pixels);
+}
+
+void
+FrameBuffer::unserialize(CheckpointIn &cp)
+{
+ UNSERIALIZE_SCALAR(_width);
+ UNSERIALIZE_SCALAR(_height);
+ UNSERIALIZE_CONTAINER(pixels);
+}
+
void
FrameBuffer::resize(unsigned width, unsigned height)
{
#include <cmath>
#include <cstdint>
+#include <string>
#include <vector>
+#include "base/compiler.hh"
+#include "base/cprintf.hh"
+#include "base/str.hh"
#include "base/types.hh"
+#include "sim/serialize.hh"
/**
* Internal gem5 representation of a Pixel.
lhs.padding == rhs.padding;
}
-
/**
* Configurable RGB pixel converter.
*
static const PixelConverter rgb565_be;
};
+inline bool
+to_number(const std::string &value, Pixel &retval)
+{
+ uint32_t num;
+ if (!to_number(value, num))
+ return false;
+
+ retval = PixelConverter::rgba8888_le.toPixel(num);
+ return true;
+}
+
+inline std::ostream &
+operator<<(std::ostream &os, const Pixel &pxl)
+{
+ os << csprintf("0x%.08x", PixelConverter::rgba8888_le.fromPixel(pxl));
+ return os;
+}
+
/**
* Internal gem5 representation of a frame buffer
*
* corner. The backing store is a linear vector of Pixels ordered left
* to right starting in the upper left corner.
*/
-class FrameBuffer
+class FrameBuffer : public Serializable
{
public:
/**
virtual ~FrameBuffer();
+ void serialize(CheckpointOut &cp) const M5_ATTR_OVERRIDE;
+ void unserialize(CheckpointIn &cp) M5_ATTR_OVERRIDE;
+
/**
* Resize the frame buffer.
*
#include <string>
#include <vector>
+#include "base/framebuffer.hh"
#include "base/inifile.hh"
#include "base/misc.hh"
#include "base/output.hh"
INSTANTIATE_PARAM_TEMPLATES(float)
INSTANTIATE_PARAM_TEMPLATES(double)
INSTANTIATE_PARAM_TEMPLATES(string)
+INSTANTIATE_PARAM_TEMPLATES(Pixel)
/////////////////////////////