diff options
author | Pierre Ossman <ossman@cendio.se> | 2016-12-05 16:58:19 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2017-02-24 13:16:42 +0100 |
commit | 24684e58f450d2653b1ab400396dbfb3034d90a9 (patch) | |
tree | 8d66285900d6e15e758c5cd767baed180dfd59aa /common/rfb | |
parent | 77ede0a01faa06d9d241da0c62a41d6b388a521c (diff) | |
download | tigervnc-24684e58f450d2653b1ab400396dbfb3034d90a9.tar.gz tigervnc-24684e58f450d2653b1ab400396dbfb3034d90a9.zip |
Only update rendered cursor when requested
Diffstat (limited to 'common/rfb')
-rw-r--r-- | common/rfb/VNCSConnectionST.cxx | 27 | ||||
-rw-r--r-- | common/rfb/VNCServerST.cxx | 25 | ||||
-rw-r--r-- | common/rfb/VNCServerST.h | 2 |
3 files changed, 26 insertions, 28 deletions
diff --git a/common/rfb/VNCSConnectionST.cxx b/common/rfb/VNCSConnectionST.cxx index 64adda1a..ea50f832 100644 --- a/common/rfb/VNCSConnectionST.cxx +++ b/common/rfb/VNCSConnectionST.cxx @@ -997,8 +997,7 @@ void VNCSConnectionST::writeDataUpdate() Region req; UpdateInfo ui; bool needNewUpdateInfo; - bool drawRenderedCursor; - RenderedCursor *cursor; + const RenderedCursor *cursor; updates.enable_copyrect(cp.useCopyRect); @@ -1064,21 +1063,21 @@ void VNCSConnectionST::writeDataUpdate() // with the update region, we need to draw the rendered cursor regardless of // whether it has changed. - drawRenderedCursor = false; + cursor = NULL; if (needRenderedCursor()) { Rect renderedCursorRect; + cursor = server->getRenderedCursor(); + renderedCursorRect - = server->renderedCursor.getEffectiveRect() - .intersect(req.get_bounding_rect()); + = cursor->getEffectiveRect().intersect(req.get_bounding_rect()); if (renderedCursorRect.is_empty()) { - drawRenderedCursor = false; - } else if (updateRenderedCursor) { - drawRenderedCursor = true; - } else if (!ui.changed.union_(ui.copied) + cursor = NULL; + } else if (!updateRenderedCursor && + ui.changed.union_(ui.copied) .intersect(renderedCursorRect).is_empty()) { - drawRenderedCursor = true; + cursor = NULL; } // We could remove the new cursor rect from updates here. It's not clear @@ -1086,7 +1085,7 @@ void VNCSConnectionST::writeDataUpdate() // the same bit of screen twice, but we have the overhead of a more complex // region. - //if (drawRenderedCursor) { + //if (cursor) { // updates.subtract(renderedCursorRect); // updates.getUpdateInfo(&ui, req); //} @@ -1095,13 +1094,9 @@ void VNCSConnectionST::writeDataUpdate() updateRenderedCursor = false; } - if (ui.is_empty() && !writer()->needFakeUpdate() && !drawRenderedCursor) + if (ui.is_empty() && !writer()->needFakeUpdate() && !cursor) return; - cursor = NULL; - if (drawRenderedCursor) - cursor = &server->renderedCursor; - writeRTTPing(); encodeManager.writeUpdate(ui, server->getPixelBuffer(), cursor); diff --git a/common/rfb/VNCServerST.cxx b/common/rfb/VNCServerST.cxx index e15cd701..80c79fc3 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-2016 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 @@ -621,12 +621,8 @@ bool VNCServerST::checkUpdate() Rect clippedCursorRect = cursor.getRect(cursorPos.subtract(cursor.hotspot)).intersect(pb->getRect()); - if (!renderedCursorInvalid && (toCheck.intersect(clippedCursorRect) - .is_empty())) { - renderCursor = false; - } else { - toCheck.assign_union(clippedCursorRect); - } + if (!toCheck.intersect(clippedCursorRect).is_empty()) + renderedCursorInvalid = true; } pb->grabRegion(toCheck); @@ -639,11 +635,6 @@ bool VNCServerST::checkUpdate() if (comparer->compare()) comparer->getUpdateInfo(&ui, pb->getRect()); - if (renderCursor) { - renderedCursor.update(pb, &cursor, cursorPos); - renderedCursorInvalid = false; - } - std::list<VNCSConnectionST*>::iterator ci, ci_next; for (ci = clients.begin(); ci != clients.end(); ci = ci_next) { ci_next = ci; ci_next++; @@ -656,6 +647,16 @@ bool VNCServerST::checkUpdate() return true; } +const RenderedCursor* VNCServerST::getRenderedCursor() +{ + if (renderedCursorInvalid) { + renderedCursor.update(pb, &cursor, cursorPos); + renderedCursorInvalid = false; + } + + return &renderedCursor; +} + void VNCServerST::getConnInfo(ListConnInfo * listConn) { listConn->Clear(); diff --git a/common/rfb/VNCServerST.h b/common/rfb/VNCServerST.h index 0ced12a4..1caea4e1 100644 --- a/common/rfb/VNCServerST.h +++ b/common/rfb/VNCServerST.h @@ -1,4 +1,5 @@ /* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved. + * Copyright 2009-2016 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 @@ -230,6 +231,7 @@ namespace rfb { bool checkDefer(); void tryUpdate(); bool checkUpdate(); + const RenderedCursor* getRenderedCursor(); void notifyScreenLayoutChange(VNCSConnectionST *requester); |