summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSøren Sandmann Pedersen <ssp@redhat.com>2012-01-28 14:31:41 -0500
committerSøren Sandmann Pedersen <ssp@redhat.com>2012-04-25 09:21:43 -0400
commit9aed9921e11abc7cd25a942aabf830abe0d271ba (patch)
treeb360e84a11301f09220a942ef49b3f82965500ab
parent6771b3d3b5524bb44aafef68e25e985f4fae89be (diff)
get
-rw-r--r--trace/pixman-replay.c81
1 files changed, 78 insertions, 3 deletions
diff --git a/trace/pixman-replay.c b/trace/pixman-replay.c
index cc73e1e2..6bc46076 100644
--- a/trace/pixman-replay.c
+++ b/trace/pixman-replay.c
@@ -241,6 +241,7 @@ get_rects16 (uint32_t **buffer, int *n_rects, pixman_rectangle16_t **rects16)
int i;
*n_rects = read_int (buffer);
+ *rects16 = realloc (*rects16, *n_rects * sizeof (pixman_rectangle16_t));
for (i = 0; i < *n_rects; ++i)
get_rect16 (buffer, &((*rects16)[i]));
}
@@ -251,10 +252,37 @@ get_boxes32 (uint32_t **buffer, int *n_boxes, pixman_box32_t **boxes32)
int i;
*n_boxes = read_int (buffer);
+ *boxes32 = realloc (*boxes32, *n_boxes * sizeof (pixman_box32_t));
for (i = 0; i < *n_boxes; ++i)
get_box32 (buffer, &((*boxes32)[i]));
}
+static void
+get_span_fix (uint32_t **buffer, pixman_span_fix_t *span)
+{
+ get_fixed (buffer, &span->l);
+ get_fixed (buffer, &span->r);
+ get_fixed (buffer, &span->y);
+}
+
+static void
+get_trap (uint32_t **buffer, pixman_trap_t *trap)
+{
+ get_span_fix (buffer, &trap->top);
+ get_span_fix (buffer, &trap->bot);
+}
+
+static void
+get_traps (uint32_t **buffer, int *n_traps, pixman_trap_t **traps)
+{
+ int i;
+
+ *n_traps = read_int (buffer);
+ *traps = realloc (*traps, *n_traps * sizeof (pixman_trap_t));
+ for (i = 0; i < *n_traps; ++i)
+ get_trap (buffer, &((*traps)[i]));
+}
+
typedef struct
{
pixman_image_t * image;
@@ -337,15 +365,18 @@ pixman_replay (const char *filename)
int width, height, rowstride;
uint8_t *data = NULL;
int n_stops, iv, x_off, y_off, n_bytes, n_rects, n_boxes;
- uint32_t id, alpha_id;
+ uint32_t id, alpha_id, src_id, mask_id, dst_id;
pixman_bool_t bool;
pixman_transform_t transform;
int n_params;
pixman_fixed_t *filter_params = NULL;
pixman_indexed_t *indexed = NULL;
- pixman_rectangle16_t *rects16;
- pixman_box32_t *boxes32;
+ pixman_rectangle16_t *rects16 = NULL;
+ pixman_box32_t *boxes32 = NULL;
pixman_op_t operator;
+ int src_x, src_y, mask_x, mask_y, dst_x, dst_y;
+ int n_traps;
+ pixman_trap_t *traps = NULL;
switch (op)
{
@@ -496,8 +527,52 @@ pixman_replay (const char *filename)
break;
case COMPOSITE:
+ get_operator (&buffer, &operator);
+ get_id (&buffer, &src_id);
+ get_id (&buffer, &mask_id);
+ get_id (&buffer, &dst_id);
+ get_int (&buffer, &src_x);
+ get_int (&buffer, &src_y);
+ get_int (&buffer, &mask_x);
+ get_int (&buffer, &mask_y);
+ get_int (&buffer, &dst_x);
+ get_int (&buffer, &dst_y);
+ get_int (&buffer, &width);
+ get_int (&buffer, &height);
+ pixman_image_composite (
+ operator,
+ find_image (src_id), find_image (mask_id), find_image (dst_id),
+ src_x, src_y, mask_x, mask_y, dst_x, dst_y, width, height);
+ break;
+
case COMPOSITE32:
+ get_operator (&buffer, &operator);
+ get_id (&buffer, &src_id);
+ get_id (&buffer, &mask_id);
+ get_id (&buffer, &dst_id);
+ get_int (&buffer, &src_x);
+ get_int (&buffer, &src_y);
+ get_int (&buffer, &mask_x);
+ get_int (&buffer, &mask_y);
+ get_int (&buffer, &dst_x);
+ get_int (&buffer, &dst_y);
+ get_int (&buffer, &width);
+ get_int (&buffer, &height);
+ pixman_image_composite32 (
+ operator,
+ find_image (src_id), find_image (mask_id), find_image (dst_id),
+ src_x, src_y, mask_x, mask_y, dst_x, dst_y, width, height);
+ break;
+
case ADD_TRAPS:
+ get_operator (&buffer, &operator);
+ get_id (&buffer, &id);
+ get_int (&buffer, &x_off);
+ get_int (&buffer, &y_off);
+ get_traps (&buffer, &n_traps, &traps);
+ pixman_add_traps (find_image (id), x_off, y_off, n_traps, traps);
+ break;
+
case ADD_TRAPEZOIDS:
case RASTERIZE_TRAPEZOID:
case COMPOSITE_TRAPEZOIDS: