[Spice-devel] [PATCH spice 13/18] server/tests: add SIMPLE_DRAW_SOLID and SIMPLE_DRAW_BITMAP
Yonit Halperin
yhalperi at redhat.com
Wed May 2 07:01:48 PDT 2012
From: Alon Levy <alevy at redhat.com>
---
server/tests/test_display_base.c | 43 ++++++++++++++++++++++++++++++++-----
server/tests/test_display_base.h | 2 +
2 files changed, 39 insertions(+), 6 deletions(-)
diff --git a/server/tests/test_display_base.c b/server/tests/test_display_base.c
index f7b85c1..b43859c 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 b769721..3b24641 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,
--
1.7.7.6
More information about the Spice-devel
mailing list