diff options
author | Vincent Desprez <vincent.desprez@gmail.com> | 2013-03-07 14:46:42 +0100 |
---|---|---|
committer | Pavel Grunt <pgrunt@redhat.com> | 2016-01-29 07:29:53 +0100 |
commit | d45d8633d40ac11393a29b3ed4f0c792906e2f28 (patch) | |
tree | a199f674cb9d9ef318129e9a9444101ea3ce7e6b | |
parent | ab73d009487c8afd4def39b54a422499b4c13c40 (diff) |
Handling cursor caching
Signed-off-by: Vincent Desprez <vincent.desprez@apwise.com>
-rw-r--r-- | cursor.js | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -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) @@ -115,9 +115,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"; var screen = document.getElementById(this.parent.screen_id); |