summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlon Levy <alevy@redhat.com>2012-04-19 13:48:42 +0300
committerYonit Halperin <yhalperi@redhat.com>2012-05-03 13:09:51 +0300
commit8778b8eb2c026dcbeef96e28ca64c29b4f0f8888 (patch)
tree1df58855b616f107fb0a74f3b1d6e6d94220f67c
parent76fd64ad96aed9d7e567eb5e447a5d83181743f2 (diff)
downloadspice-8778b8eb2c026dcbeef96e28ca64c29b4f0f8888.tar.gz
spice-8778b8eb2c026dcbeef96e28ca64c29b4f0f8888.tar.xz
spice-8778b8eb2c026dcbeef96e28ca64c29b4f0f8888.zip
server/tests: add SIMPLE_DRAW_SOLID and SIMPLE_DRAW_BITMAP
-rw-r--r--server/tests/test_display_base.c43
-rw-r--r--server/tests/test_display_base.h2
2 files changed, 39 insertions, 6 deletions
diff --git a/server/tests/test_display_base.c b/server/tests/test_display_base.c
index 49b79734..86a7e490 100644
--- a/server/tests/test_display_base.c
+++ b/server/tests/test_display_base.c
@@ -191,6 +191,27 @@ SimpleSpiceUpdate *test_spice_create_update_from_bitmap(uint32_t surface_id,
return update;
}
+static SimpleSpiceUpdate *test_spice_create_update_solid(uint32_t surface_id, QXLRect bbox, uint32_t color)
+{
+ uint8_t *bitmap;
+ uint32_t *dst;
+ uint32_t bw;
+ uint32_t bh;
+ int i;
+
+ bw = bbox.right - bbox.left;
+ bh = bbox.bottom - bbox.top;
+
+ bitmap = malloc(bw * bh * 4);
+ dst = (uint32_t *)bitmap;
+
+ for (i = 0 ; i < bh * bw ; ++i, ++dst) {
+ *dst = color;
+ }
+
+ return test_spice_create_update_from_bitmap(surface_id, bbox, bitmap);
+}
+
static SimpleSpiceUpdate *test_spice_create_update_draw(uint32_t surface_id, int t)
{
int top, left;
@@ -468,6 +489,8 @@ static void produce_command(void)
/* Drawing commands, they all push a command to the command ring */
case SIMPLE_COPY_BITS:
+ case SIMPLE_DRAW_SOLID:
+ case SIMPLE_DRAW_BITMAP:
case SIMPLE_DRAW: {
SimpleSpiceUpdate *update;
@@ -481,12 +504,20 @@ static void produce_command(void)
}
switch (command->command) {
- case SIMPLE_COPY_BITS:
- update = test_spice_create_update_copy_bits(0);
- break;
- case SIMPLE_DRAW:
- update = test_spice_create_update_draw(0, path.t);
- break;
+ case SIMPLE_COPY_BITS:
+ update = test_spice_create_update_copy_bits(0);
+ break;
+ case SIMPLE_DRAW:
+ update = test_spice_create_update_draw(0, path.t);
+ break;
+ case SIMPLE_DRAW_BITMAP:
+ update = test_spice_create_update_from_bitmap(command->bitmap.surface_id,
+ command->bitmap.bbox, command->bitmap.bitmap);
+ break;
+ case SIMPLE_DRAW_SOLID:
+ update = test_spice_create_update_solid(command->solid.surface_id,
+ command->solid.bbox, command->solid.color);
+ break;
}
push_command(&update->ext);
break;
diff --git a/server/tests/test_display_base.h b/server/tests/test_display_base.h
index b7697217..3b24641e 100644
--- a/server/tests/test_display_base.h
+++ b/server/tests/test_display_base.h
@@ -17,6 +17,8 @@ typedef enum {
PATH_PROGRESS,
SIMPLE_CREATE_SURFACE,
SIMPLE_DRAW,
+ SIMPLE_DRAW_BITMAP,
+ SIMPLE_DRAW_SOLID,
SIMPLE_COPY_BITS,
SIMPLE_DESTROY_SURFACE,
SIMPLE_UPDATE,