summaryrefslogtreecommitdiff
path: root/display.js
diff options
context:
space:
mode:
authorAric Stewart <aric@codeweavers.com>2013-09-16 11:11:51 -0500
committerJeremy White <jwhite@codeweavers.com>2013-09-18 09:06:07 -0500
commitbb746a03de510251924c08725523d700142e26fd (patch)
treebeae2120dbd077baba2307b9473fe1c03e439ee3 /display.js
parent295073a95469e1f8633d5f70e6bad8be367b4635 (diff)
Implement handling of SPICE_MSG_DISPLAY_INVAL_LIST
Also converts the display cache from an array to an object. This is to help enforce proper sparceness of the data as well as make it easier to reliably fully delete a given cache entry without affecting access to the remaining entries.
Diffstat (limited to 'display.js')
-rw-r--r--display.js16
1 files changed, 13 insertions, 3 deletions
diff --git a/display.js b/display.js
index d0d0994..6d7dafc 100644
--- a/display.js
+++ b/display.js
@@ -527,6 +527,16 @@ SpiceDisplayConn.prototype.process_channel_message = function(msg)
this.streams[m.id] = undefined;
return true;
}
+ if (msg.type == SPICE_MSG_DISPLAY_INVAL_LIST)
+ {
+ var m = new SpiceMsgDisplayInvalList(msg.data);
+ var i;
+ DEBUG > 1 && console.log(this.type + ": MsgInvalList " + m.count + " items");
+ for (i = 0; i < m.count; i++)
+ if (this.cache[m.resources[i].id] != undefined)
+ delete this.cache[m.resources[i].id];
+ return true;
+ }
return false;
}
@@ -575,7 +585,7 @@ SpiceDisplayConn.prototype.draw_copy_helper = function(o)
if (o.descriptor && (o.descriptor.flags & SPICE_IMAGE_FLAGS_CACHE_ME))
{
if (! ("cache" in this))
- this.cache = [];
+ this.cache = {};
this.cache[o.descriptor.id] = o.image_data;
}
@@ -766,7 +776,7 @@ function handle_draw_jpeg_onload()
(this.o.descriptor.flags & SPICE_IMAGE_FLAGS_CACHE_ME))
{
if (! ("cache" in this.o.sc))
- this.o.sc.cache = [];
+ this.o.sc.cache = {};
this.o.sc.cache[this.o.descriptor.id] =
t.getImageData(0, 0,
@@ -786,7 +796,7 @@ function handle_draw_jpeg_onload()
(this.o.descriptor.flags & SPICE_IMAGE_FLAGS_CACHE_ME))
{
if (! ("cache" in this.o.sc))
- this.o.sc.cache = [];
+ this.o.sc.cache = {};
this.o.sc.cache[this.o.descriptor.id] =
context.getImageData(this.o.base.box.left, this.o.base.box.top,