[Spice-devel] [PATCH spice-html5] handling cursor caching

Vincent Desprez vincent.desprez at apwise.com
Wed Mar 6 02:46:19 PST 2013


A very small patch to handle cursor caching in spice-html. Indeed until now
the cursor shape wasn't cached so it appeared correctly only once.
Independently from that I didn’t see my latest contribution to spice-html5
from January 22 in the git repository (
http://cgit.freedesktop.org/spice/spice-html5/, correct?). Did I something
wrong?

Cheers,
Vincent


Signed-off-by: Vincent Desprez <vincent.desprez at apwise.com>
---
 cursor.js |   13 +++++++++++--
 1 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/cursor.js b/cursor.js
index e3f6e0e..fc8abe7 100644
--- a/cursor.js
+++ b/cursor.js
@@ -59,7 +59,7 @@ SpiceCursorConn.prototype.process_channel_message =
function(msg)
             return true;
         }

-        if (cursor_set.flags > 0)
+        if (cursor_set.flags == 1)
             this.log_warn("FIXME: No support for cursor flags " +
cursor_set.flags);

         if (cursor_set.cursor.header.type != SPICE_CURSOR_TYPE_ALPHA)
@@ -83,9 +83,18 @@ SpiceCursorConn.prototype.process_channel_message =
function(msg)
     return false;
 }

+
+SpiceCursorConn.cursor_cache = [];
 SpiceCursorConn.prototype.set_cursor = function(cursor)
 {
-    var pngstr = create_rgba_png(cursor.header.height,
cursor.header.width, cursor.data);
+    if (cursor.flags == 4)
+        var pngstr = SpiceCursorConn.cursor_cache[cursor.header.unique[0]];
+    else
+        var pngstr = create_rgba_png(cursor.header.height,
cursor.header.width, cursor.data);
+
+    if (cursor.flags == 2)
+        SpiceCursorConn.cursor_cache[cursor.header.unique[0]] = pngstr;
+
     var curstr = 'url(data:image/png,' + pngstr + ') ' +
         cursor.header.hot_spot_x + ' ' + cursor.header.hot_spot_y + ",
default";
     document.getElementById(this.parent.screen_id).style.cursor = curstr;
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/spice-devel/attachments/20130306/b0cc22de/attachment.html>


More information about the Spice-devel mailing list