mask.buf = outlined.mask.buf; outlined.mask.buf = 0;
}
-rdr::U8* Cursor::getBitmap(Pixel* pix0, Pixel* pix1)
+rdr::U8* Cursor::getBitmap(Pixel* pix0, Pixel* pix1) const
{
bool gotPix0 = false;
bool gotPix1 = false;
{
}
-const rdr::U8* RenderedCursor::getBuffer(const Rect& _r, int* stride)
+const rdr::U8* RenderedCursor::getBuffer(const Rect& _r, int* stride) const
{
Rect r;
rdr::U8Array mask;
Point hotspot;
- int maskLen() { return (width() + 7) / 8 * height(); }
+ int maskLen() const { return (width() + 7) / 8 * height(); }
// setSize() resizes the cursor. The contents of the data and mask are
// undefined after this call.
// getBitmap() tests whether the cursor is monochrome, and if so returns a
// bitmap together with background and foreground colours. The size and
// layout of the bitmap are the same as the mask.
- rdr::U8* getBitmap(Pixel* pix0, Pixel* pix1);
+ rdr::U8* getBitmap(Pixel* pix0, Pixel* pix1) const;
// crop() crops the cursor down to the smallest possible size, based on the
// mask.
Rect getEffectiveRect() const { return buffer.getRect(offset); }
- virtual const rdr::U8* getBuffer(const Rect& r, int* stride);
+ virtual const rdr::U8* getBuffer(const Rect& r, int* stride) const;
void update(PixelBuffer* framebuffer, Cursor* cursor, const Point& pos);
void
-PixelBuffer::getImage(void* imageBuf, const Rect& r, int outStride) {
+PixelBuffer::getImage(void* imageBuf, const Rect& r, int outStride) const {
int inStride;
const U8* data = getBuffer(r, &inStride);
// We assume that the specified rectangle is pre-clipped to the buffer
}
void PixelBuffer::getImage(const PixelFormat& pf, void* imageBuf,
- const Rect& r, int stride)
+ const Rect& r, int stride) const
{
const rdr::U8* srcBuffer;
int srcStride;
{
}
+const rdr::U8* FullFramePixelBuffer::getBuffer(const Rect& r, int* stride_) const
+{
+ *stride_ = stride;
+ return &data[(r.tl.x + (r.tl.y * stride)) * format.bpp/8];
+}
+
// -=- Managed pixel buffer class
// Automatically allocates enough space for the specified format & area
// Get a pointer into the buffer
// The pointer is to the top-left pixel of the specified Rect.
// The buffer stride (in pixels) is returned.
- virtual const rdr::U8* getBuffer(const Rect& r, int* stride) = 0;
+ virtual const rdr::U8* getBuffer(const Rect& r, int* stride) const = 0;
// Get pixel data for a given part of the buffer
// Data is copied into the supplied buffer, with the specified
// stride. Try to avoid using this though as getBuffer() will in
// most cases avoid the extra memory copy.
- void getImage(void* imageBuf, const Rect& r, int stride=0);
+ void getImage(void* imageBuf, const Rect& r, int stride=0) const;
// Get pixel data in a given format
// Works just the same as getImage(), but guaranteed to be in a
// specific format.
void getImage(const PixelFormat& pf, void* imageBuf,
- const Rect& r, int stride=0);
+ const Rect& r, int stride=0) const;
///////////////////////////////////////////////
// Framebuffer update methods
// getBufferRW().
virtual void commitBufferRW(const Rect& r) = 0;
- // Default trivial handling of read-only access
- virtual const rdr::U8* getBuffer(const Rect& r, int* stride) {
- return getBufferRW(r, stride);
- }
-
///////////////////////////////////////////////
// Basic rendering operations
// These operations DO NOT clip to the pixelbuffer area, or trap overruns.
virtual ~FullFramePixelBuffer();
public:
+ virtual const rdr::U8* getBuffer(const Rect& r, int* stride) const;
virtual rdr::U8* getBufferRW(const Rect& r, int* stride);
virtual void commitBufferRW(const Rect& r);