summaryrefslogtreecommitdiff
path: root/gdk/broadway/broadway.js
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2017-11-18 17:36:38 +0100
committerAlexander Larsson <alexl@redhat.com>2017-11-23 10:46:47 +0100
commita4636a06a72eb30681d1625048d7a45fc6ca129e (patch)
treee5780ab71dbcebcc1d7997ea60138fe341c79f83 /gdk/broadway/broadway.js
parentef79621c44aaf2b71542d177ca7ee5099ef5c593 (diff)
downloadgtk+-a4636a06a72eb30681d1625048d7a45fc6ca129e.tar.gz
broadway: Actually upload textures to client
Diffstat (limited to 'gdk/broadway/broadway.js')
-rw-r--r--gdk/broadway/broadway.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/gdk/broadway/broadway.js b/gdk/broadway/broadway.js
index b134d85faa..12578d78ae 100644
--- a/gdk/broadway/broadway.js
+++ b/gdk/broadway/broadway.js
@@ -99,6 +99,7 @@ var lastTimeStamp = 0;
var realWindowWithMouse = 0;
var windowWithMouse = 0;
var surfaces = {};
+var textures = {};
var stackingOrder = [];
var outstandingCommands = new Array();
var inputSocket = null;
@@ -528,6 +529,20 @@ function cmdPutBuffer(id, w, h, compressed)
surface.imageData = imageData;
}
+function cmdUploadTexture(id, data)
+{
+ var blob = new Blob([data],{type: "image/png"});
+ var url = window.URL.createObjectURL(blob);
+ textures[id] = url;
+}
+
+function cmdReleaseTexture(id)
+{
+ var url = textures[id];
+ window.URL.revokeObjectURL(url);
+ delete textures[id];
+}
+
function cmdGrabPointer(id, ownerEvents)
{
doGrab(id, ownerEvents, false);
@@ -624,6 +639,17 @@ function handleCommands(cmd)
cmdPutBuffer(id, w, h, data);
break;
+ case 't': // Upload texture
+ id = cmd.get_32();
+ var data = cmd.get_data();
+ cmdUploadTexture(id, data);
+ break;
+
+ case 'T': // Upload texture
+ id = cmd.get_32();
+ cmdReleaseTexture(id);
+ break;
+
case 'g': // Grab
id = cmd.get_16();
var ownerEvents = cmd.get_bool ();