aboutsummaryrefslogtreecommitdiffstats
path: root/common
diff options
context:
space:
mode:
authorPierre Ossman <ossman@cendio.se>2017-01-20 15:58:44 +0100
committerPierre Ossman <ossman@cendio.se>2017-01-20 15:58:44 +0100
commit1391fc4bd5a409e17dfd76251ed4bf37b7951fc0 (patch)
tree243623eff1189d2a8034a6fceba3b123daff50ee /common
parent99871831d057337477d406fd48050286fa9833f9 (diff)
downloadtigervnc-1391fc4bd5a409e17dfd76251ed4bf37b7951fc0.tar.gz
tigervnc-1391fc4bd5a409e17dfd76251ed4bf37b7951fc0.zip
Crop cursor before calling maskRect()
We can no longer assume maskRect() will tolerate uncropped data.
Diffstat (limited to 'common')
-rw-r--r--common/rfb/Cursor.cxx10
1 files changed, 6 insertions, 4 deletions
diff --git a/common/rfb/Cursor.cxx b/common/rfb/Cursor.cxx
index 3bb8e0f6..e226118c 100644
--- a/common/rfb/Cursor.cxx
+++ b/common/rfb/Cursor.cxx
@@ -198,7 +198,7 @@ const rdr::U8* RenderedCursor::getBuffer(const Rect& _r, int* stride) const
void RenderedCursor::update(PixelBuffer* framebuffer,
Cursor* cursor, const Point& pos)
{
- Point rawOffset;
+ Point rawOffset, diff;
Rect clippedRect;
const rdr::U8* data;
@@ -224,7 +224,9 @@ void RenderedCursor::update(PixelBuffer* framebuffer,
data = framebuffer->getBuffer(buffer.getRect(offset), &stride);
buffer.imageRect(buffer.getRect(), data, stride);
- data = cursor->getBuffer(cursor->getRect(), &stride);
- buffer.maskRect(cursor->getRect(rawOffset.subtract(offset)),
- data, cursor->mask.buf);
+ diff = offset.subtract(rawOffset);
+ data = cursor->getBuffer(buffer.getRect(diff), &stride);
+
+ buffer.maskRect(buffer.getRect(), data, cursor->mask.buf, diff,
+ stride, (cursor->width() + 7) / 8);
}