summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Larsson <alexl@redhat.com>2010-04-05 20:50:04 +0200
committerAlexander Larsson <alexl@redhat.com>2010-04-05 20:50:04 +0200
commit6de2fa5fe423a5ddec80fef78f6a9d84d7784ae8 (patch)
tree5ab17b28cd155e80ae6f3d1554a2b6008059ce51
parent650e8cfeb6c840a1db573d5b8cbaacbd047cd63b (diff)
Add copyrect
-rw-r--r--client.html16
-rw-r--r--daemon.c21
2 files changed, 37 insertions, 0 deletions
diff --git a/client.html b/client.html
index 6681ffe..e31422e 100644
--- a/client.html
+++ b/client.html
@@ -66,6 +66,22 @@ function handleLoad(event)
i = 0;
while (i < cmd.length) {
switch (cmd[i]) {
+ case 'b':
+ i++;
+ sx = base64_16(cmd, i);
+ i = i + 3;
+ sy = base64_16(cmd, i);
+ i = i + 3;
+ w = base64_16(cmd, i);
+ i = i + 3;
+ h = base64_16(cmd, i);
+ i = i + 3;
+ dx = base64_16(cmd, i);
+ i = i + 3;
+ dy = base64_16(cmd, i);
+ i = i + 3;
+ context.drawImage(canvas, sx, sy, w, h, dx, dy, w, h)
+
case 'r':
i++;
x = base64_16(cmd, i);
diff --git a/daemon.c b/daemon.c
index 26edf38..434515a 100644
--- a/daemon.c
+++ b/daemon.c
@@ -84,6 +84,24 @@ send_rect (GOutputStream *out, int x, int y, int w, int h)
}
static void
+send_copyrect (GOutputStream *out, int sx, int sy, int w, int h, int dx, int dy)
+{
+ char buf[19];
+
+ buf[0] = 'b';
+ base64_uint16(sx, &buf[1]);
+ base64_uint16(sy, &buf[4]);
+ base64_uint16(w, &buf[7]);
+ base64_uint16(h, &buf[10]);
+ base64_uint16(dx, &buf[13]);
+ base64_uint16(dy, &buf[16]);
+
+ g_output_stream_write_all (out, buf, 19,
+ NULL, NULL, NULL);
+}
+
+
+static void
send_boundary (GOutputStream *out)
{
char *boundary =
@@ -133,6 +151,9 @@ send_draw_ops (GOutputStream *out)
send_rect (cout, i*10, i*10, 15, 15);
send_rgba (cout, 0x80ff0000 + i * 32);
send_rect (cout, i*10 + 50, i*10, 15, 15);
+
+ send_copyrect (cout, 15, 15, 800, 40, 20, 15);
+
i ++;
flush (cout);