[spice-HTML5][PATCH try 2] Handling cursor caching

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Vincent Desprez <vincent.desprez@xxxxxxxxxx>
---
 cursor.js |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/cursor.js b/cursor.js
index e3f6e0e..6f2f26a 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 == SPICE_CURSOR_FLAGS_NONE)
             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,15 @@ 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 == SPICE_CURSOR_FLAGS_FROM_CACHE)
+        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 == SPICE_CURSOR_FLAGS_CACHE_ME)
+        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;
-- 
1.7.10.4

Signed-off-by: Vincent Desprez <vincent.desprez@xxxxxxxxxx>
---
 cursor.js |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/cursor.js b/cursor.js
index e3f6e0e..6f2f26a 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 == SPICE_CURSOR_FLAGS_NONE) 
             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,15 @@ 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 == SPICE_CURSOR_FLAGS_FROM_CACHE)
+        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 == SPICE_CURSOR_FLAGS_CACHE_ME)
+        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;
-- 
1.7.10.4

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]