Add helper class for a rendered cursor
Add a magical cursor framebuffer class for handling when you
want to render the cursor on the server side. Keeps the cursor
specific magic in one contained place.
diff --git a/common/rfb/VNCServerST.cxx b/common/rfb/VNCServerST.cxx
index f1e378e..27eb605 100644
--- a/common/rfb/VNCServerST.cxx
+++ b/common/rfb/VNCServerST.cxx
@@ -294,7 +294,7 @@
comparer = new ComparingUpdateTracker(pb);
cursor.setPF(pb->getPF());
- renderedCursor.setPF(pb->getPF());
+ renderedCursorInvalid = true;
// Make sure that we have at least one screen
if (screenLayout.num_screens() == 0)
@@ -598,15 +598,12 @@
if (renderCursor) {
Rect clippedCursorRect
- = cursor.getRect(cursorTL()).intersect(pb->getRect());
+ = cursor.getRect(cursorPos.subtract(cursor.hotspot)).intersect(pb->getRect());
if (!renderedCursorInvalid && (toCheck.intersect(clippedCursorRect)
.is_empty())) {
renderCursor = false;
} else {
- renderedCursorTL = clippedCursorRect.tl;
- renderedCursor.setSize(clippedCursorRect.width(),
- clippedCursorRect.height());
toCheck.assign_union(clippedCursorRect);
}
}
@@ -622,17 +619,7 @@
comparer->getUpdateInfo(&ui, pb->getRect());
if (renderCursor) {
- const rdr::U8* buffer;
- int stride;
-
- buffer = pb->getBuffer(renderedCursor.getRect(renderedCursorTL), &stride);
- renderedCursor.imageRect(renderedCursor.getRect(), buffer, stride);
-
- buffer = cursor.getBuffer(cursor.getRect(), &stride);
- renderedCursor.maskRect(cursor.getRect(cursorTL()
- .subtract(renderedCursorTL)),
- buffer, cursor.mask.buf);
-
+ renderedCursor.update(pb, &cursor, cursorPos);
renderedCursorInvalid = false;
}