From: Søren Sandmann Date: Wed, 13 Jun 2007 02:14:32 +0000 (-0400) Subject: Add pixman_fill_rectangles() X-Git-Tag: 1.0_branch~1500 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b6bdd8273cc3500d1f69402f39c3d6e718920a66;p=profile%2Fivi%2Fpixman.git Add pixman_fill_rectangles() --- diff --git a/pixman/pixman-edge.c b/pixman/pixman-edge.c index 06517e0..cec1902 100644 --- a/pixman/pixman-edge.c +++ b/pixman/pixman-edge.c @@ -406,12 +406,12 @@ _pixman_edge_tMultiInit (pixman_edge_t *e, int n, pixman_fixed_t *stepx_p, pixma */ void pixman_edge_init (pixman_edge_t *e, - int n, - pixman_fixed_t y_start, - pixman_fixed_t x_top, - pixman_fixed_t y_top, - pixman_fixed_t x_bot, - pixman_fixed_t y_bot) + int n, + pixman_fixed_t y_start, + pixman_fixed_t x_top, + pixman_fixed_t y_top, + pixman_fixed_t x_bot, + pixman_fixed_t y_bot) { pixman_fixed_t dx, dy; @@ -452,13 +452,13 @@ void pixman_line_fixed_edge_init (pixman_edge_t *e, int n, pixman_fixed_t y, - pixman_line_fixed_t *line, + const pixman_line_fixed_t *line, int x_off, int y_off) { pixman_fixed_t x_off_fixed = pixman_int_to_fixed(x_off); pixman_fixed_t y_off_fixed = pixman_int_to_fixed(y_off); - pixman_point_fixed_t *top, *bot; + const pixman_point_fixed_t *top, *bot; if (line->p1.y <= line->p2.y) { diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c index d7ae309..467dcdb 100644 --- a/pixman/pixman-image.c +++ b/pixman/pixman-image.c @@ -321,7 +321,7 @@ pixman_image_create_bits (pixman_format_code_t format, return image; } -void +pixman_bool_t pixman_image_set_clip_region (pixman_image_t *image, pixman_region16_t *region) { @@ -329,12 +329,14 @@ pixman_image_set_clip_region (pixman_image_t *image, if (region) { - pixman_region_copy (&common->clip_region, region); + return pixman_region_copy (&common->clip_region, region); } else { pixman_region_fini (&common->clip_region); pixman_region_init (&common->clip_region); + + return TRUE; } } @@ -512,3 +514,31 @@ pixman_image_get_depth (pixman_image_t *image) return PIXMAN_FORMAT_DEPTH (image->bits.format); } + +pixman_bool_t +pixman_image_fill_rectangles (pixman_op_t op, + pixman_image_t *dest, + pixman_color_t *color, + int n_rects, + const pixman_rectangle16_t *rects) +{ + pixman_image_t *solid = pixman_image_create_solid_fill (color); + int i; + + if (!solid) + return FALSE; + + for (i = 0; i < n_rects; ++i) + { + const pixman_rectangle16_t *rect = &(rects[i]); + + pixman_image_composite (op, solid, NULL, dest, + 0, 0, 0, 0, + rect->x, rect->y, + rect->width, rect->height); + } + + pixman_image_unref (solid); + + return TRUE; +} diff --git a/pixman/pixman-trap.c b/pixman/pixman-trap.c index fb88d21..179bf8f 100644 --- a/pixman/pixman-trap.c +++ b/pixman/pixman-trap.c @@ -107,7 +107,7 @@ pixman_add_trapezoids (pixman_image_t *image, void pixman_rasterize_trapezoid (pixman_image_t * image, - pixman_trapezoid_t *trap, + const pixman_trapezoid_t *trap, int x_off, int y_off) { diff --git a/pixman/pixman.h b/pixman/pixman.h index bda856c..0014cef 100644 --- a/pixman/pixman.h +++ b/pixman/pixman.h @@ -453,7 +453,7 @@ void pixman_image_unref (pixman_image_t /* Set properties */ -void pixman_image_set_clip_region (pixman_image_t *image, +pixman_bool_t pixman_image_set_clip_region (pixman_image_t *image, pixman_region16_t *region); void pixman_image_set_has_client_clip (pixman_image_t *image, pixman_bool_t clien_clip); @@ -484,6 +484,11 @@ int pixman_image_get_width (pixman_image_t *image); int pixman_image_get_height (pixman_image_t *image); int pixman_image_get_stride (pixman_image_t *image); int pixman_image_get_depth (pixman_image_t *image); +pixman_bool_t pixman_image_fill_rectangles (pixman_op_t op, + pixman_image_t *image, + pixman_color_t *color, + int n_rects, + const pixman_rectangle16_t *rects); /* Composite */ pixman_bool_t pixman_compute_composite_region (pixman_region16_t * pRegion, @@ -578,7 +583,7 @@ void pixman_edge_init (pixman_edge_t *e, void pixman_line_fixed_edge_init (pixman_edge_t *e, int bpp, pixman_fixed_t y, - pixman_line_fixed_t *line, + const pixman_line_fixed_t *line, int x_off, int y_off); void pixman_rasterize_edges (pixman_image_t *image, @@ -593,11 +598,11 @@ void pixman_add_traps (pixman_image_t *image, pixman_trap_t *traps); void pixman_add_trapezoids (pixman_image_t *image, int16_t x_off, - int y_off, - int ntraps, - const pixman_trapezoid_t *traps); + int y_off, + int ntraps, + const pixman_trapezoid_t *traps); void pixman_rasterize_trapezoid (pixman_image_t *image, - pixman_trapezoid_t *trap, + const pixman_trapezoid_t *trap, int x_off, int y_off);