diff options
author | Alexander Larsson <alexl@redhat.com> | 2010-04-07 22:55:31 +0200 |
---|---|---|
committer | Alexander Larsson <alexl@redhat.com> | 2010-04-07 22:55:31 +0200 |
commit | de25b3c8ef93a2502d8b3d40282b0bc63e0b1bfa (patch) | |
tree | 79a39fc5a7c65149bc445d032f77a00738bf1b4c /daemon.c | |
parent | 3c1b7aa17710264331617fcb5d1f470ff97f3d64 (diff) |
Use the new ops
Diffstat (limited to 'daemon.c')
-rw-r--r-- | daemon.c | 64 |
1 files changed, 64 insertions, 0 deletions
@@ -100,6 +100,62 @@ send_copyrect (GOutputStream *out, int sx, int sy, int w, int h, int dx, int dy NULL, NULL, NULL); } +static void +send_blit (GOutputStream *out, int source_surface, int sx, int sy, int w, int h, int dx, int dy) +{ + char buf[22]; + + buf[0] = 'B'; + base64_uint16(source_surface, &buf[1]); + base64_uint16(sx, &buf[4]); + base64_uint16(sy, &buf[7]); + base64_uint16(w, &buf[10]); + base64_uint16(h, &buf[13]); + base64_uint16(dx, &buf[16]); + base64_uint16(dy, &buf[19]); + + g_output_stream_write_all (out, buf, 22, + NULL, NULL, NULL); +} + +static void +send_new_surface(GOutputStream *out, int id, int w, int h) +{ + char buf[10]; + + buf[0] = 's'; + base64_uint16(id, &buf[1]); + base64_uint16(w, &buf[4]); + base64_uint16(h, &buf[7]); + + g_output_stream_write_all (out, buf, 10, + NULL, NULL, NULL); +} + +static void +send_select_surface(GOutputStream *out, int id) +{ + char buf[4]; + + buf[0] = 'a'; + base64_uint16(id, &buf[1]); + + g_output_stream_write_all (out, buf, 4, + NULL, NULL, NULL); +} + +static void +send_destroy_surface(GOutputStream *out, int id) +{ + char buf[4]; + + buf[0] = 'd'; + base64_uint16(id, &buf[1]); + + g_output_stream_write_all (out, buf, 4, + NULL, NULL, NULL); +} + /* Table of CRCs of all 8-bit messages. */ static unsigned long crc_table[256]; @@ -340,6 +396,12 @@ send_draw_ops (GOutputStream *out) i = 0; + send_new_surface(cout, 1, 50, 50); + send_select_surface(cout, 1); + send_rgb (cout, 0x00ff00); + send_rect (cout, 0, 0, 25, 25); + send_select_surface(cout, 0); + while (1) { send_rgb (cout, 0xff0000 + i * 32); @@ -349,6 +411,8 @@ send_draw_ops (GOutputStream *out) send_copyrect (cout, 15, 15, 800, 40, 20, 15); + send_blit (cout, 1, 0, 0, 50, 50, 200, 200); + send_image_rgb (cout, 30, 30, 2, 2, 2, pixel); |