Change fillRect() to take a buffer instead of a pixel
There has been some confusion if fillRect() should accept a buffer
or a pixel. This can cause misrendering if your data is not in the
native endian order. A buffer makes more sense here though, and
is what most of the callers are already assuming, so change the
API to follow that.
diff --git a/vncviewer/Viewport.cxx b/vncviewer/Viewport.cxx
index 3d0d688..ca65acd 100644
--- a/vncviewer/Viewport.cxx
+++ b/vncviewer/Viewport.cxx
@@ -281,6 +281,8 @@
const rdr::U8* data;
int stride;
+ const rdr::U8 black[4] = { 0, 0, 0, 0 };
+
// FIXME: Resize should probably be a feature of the pixel buffer itself
if ((w == frameBuffer->width()) && (h == frameBuffer->height()))
@@ -304,14 +306,14 @@
rect.setXYWH(frameBuffer->width(), 0,
newBuffer->width() - frameBuffer->width(),
newBuffer->height());
- newBuffer->fillRect(rect, 0);
+ newBuffer->fillRect(rect, black);
}
if (newBuffer->height() > frameBuffer->height()) {
rect.setXYWH(0, frameBuffer->height(),
newBuffer->width(),
newBuffer->height() - frameBuffer->height());
- newBuffer->fillRect(rect, 0);
+ newBuffer->fillRect(rect, black);
}
delete frameBuffer;