Change cursor API to use RGBA data
This will allow us to use better formats that preserve the entire
alpha channel.
diff --git a/common/rfb/VNCServerST.cxx b/common/rfb/VNCServerST.cxx
index e15cd70..81eed37 100644
--- a/common/rfb/VNCServerST.cxx
+++ b/common/rfb/VNCServerST.cxx
@@ -1,5 +1,5 @@
/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- * Copyright 2009-2014 Pierre Ossman for Cendio AB
+ * Copyright 2009-2017 Pierre Ossman for Cendio AB
*
* This is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -82,6 +82,7 @@
: blHosts(&blacklist), desktop(desktop_), desktopStarted(false),
blockCounter(0), pb(0),
name(strDup(name_)), pointerClient(0), comparer(0),
+ cursor(new Cursor(0, 0, Point(), NULL)),
renderedCursorInvalid(false),
queryConnectionHandler(0), keyRemapper(&KeyRemapper::defInstance),
lastConnectionTime(0), disableclients(false),
@@ -113,6 +114,8 @@
if (comparer)
comparer->logStats();
delete comparer;
+
+ delete cursor;
}
@@ -314,7 +317,6 @@
}
comparer = new ComparingUpdateTracker(pb);
- cursor.setPF(pb->getPF());
renderedCursorInvalid = true;
// Make sure that we have at least one screen
@@ -430,14 +432,11 @@
}
void VNCServerST::setCursor(int width, int height, const Point& newHotspot,
- const void* data, const void* mask)
+ const rdr::U8* data)
{
- cursor.hotspot = newHotspot;
- cursor.setSize(width, height);
- cursor.imageRect(cursor.getRect(), data);
- memcpy(cursor.mask.buf, mask, cursor.maskLen());
-
- cursor.crop();
+ delete cursor;
+ cursor = new Cursor(width, height, newHotspot, data);
+ cursor->crop();
renderedCursorInvalid = true;
@@ -618,8 +617,9 @@
Region toCheck = ui.changed.union_(ui.copied);
if (renderCursor) {
- Rect clippedCursorRect
- = cursor.getRect(cursorPos.subtract(cursor.hotspot)).intersect(pb->getRect());
+ Rect clippedCursorRect = Rect(0, 0, cursor->width(), cursor->height())
+ .translate(cursorPos.subtract(cursor->hotspot()))
+ .intersect(pb->getRect());
if (!renderedCursorInvalid && (toCheck.intersect(clippedCursorRect)
.is_empty())) {
@@ -640,7 +640,7 @@
comparer->getUpdateInfo(&ui, pb->getRect());
if (renderCursor) {
- renderedCursor.update(pb, &cursor, cursorPos);
+ renderedCursor.update(pb, cursor, cursorPos);
renderedCursorInvalid = false;
}