From: Søren Sandmann Pedersen Date: Fri, 31 Jul 2009 21:27:38 +0000 (-0400) Subject: Add a dirty bit to the image struct, and validate before using the image. X-Git-Tag: 1.0_branch~800 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7b1df41b6110424b8dca9fa655dbc8dd95a76882;p=profile%2Fivi%2Fpixman.git Add a dirty bit to the image struct, and validate before using the image. This cuts down the number of property_changed calls significantly. --- diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c index 0be2af3..9e1ee13 100644 --- a/pixman/pixman-bits-image.c +++ b/pixman/pixman-bits-image.c @@ -765,8 +765,6 @@ pixman_image_create_bits (pixman_format_code_t format, image->common.property_changed = bits_image_property_changed; - bits_image_property_changed (image); - _pixman_image_reset_clip_region (image); return image; diff --git a/pixman/pixman-conical-gradient.c b/pixman/pixman-conical-gradient.c index 6a4e31e..d720db3 100644 --- a/pixman/pixman-conical-gradient.c +++ b/pixman/pixman-conical-gradient.c @@ -175,8 +175,6 @@ pixman_image_create_conical_gradient (pixman_point_fixed_t * center, image->common.property_changed = conical_gradient_property_changed; - conical_gradient_property_changed (image); - return image; } diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c index 163d247..5831953 100644 --- a/pixman/pixman-image.c +++ b/pixman/pixman-image.c @@ -120,6 +120,7 @@ _pixman_image_allocate (void) common->destroy_func = NULL; common->destroy_data = NULL; common->need_workaround = FALSE; + common->dirty = TRUE; } return image; @@ -168,7 +169,7 @@ _pixman_image_get_scanline_64 (pixman_image_t *image, static void image_property_changed (pixman_image_t *image) { - image->common.property_changed (image); + image->common.dirty = TRUE; } /* Ref Counting */ @@ -238,6 +239,16 @@ _pixman_image_reset_clip_region (pixman_image_t *image) image->common.have_clip_region = FALSE; } +void +_pixman_image_validate (pixman_image_t *image) +{ + if (image->common.dirty) + { + image->common.property_changed (image); + image->common.dirty = FALSE; + } +} + PIXMAN_EXPORT pixman_bool_t pixman_image_set_clip_region32 (pixman_image_t * image, pixman_region32_t *region) diff --git a/pixman/pixman-linear-gradient.c b/pixman/pixman-linear-gradient.c index aafdd3b..d9409fe 100644 --- a/pixman/pixman-linear-gradient.c +++ b/pixman/pixman-linear-gradient.c @@ -289,8 +289,6 @@ pixman_image_create_linear_gradient (pixman_point_fixed_t * p1, image->common.classify = linear_gradient_classify; image->common.property_changed = linear_gradient_property_changed; - linear_gradient_property_changed (image); - return image; } diff --git a/pixman/pixman-private.h b/pixman/pixman-private.h index a4e6cbd..ff7a65f 100644 --- a/pixman/pixman-private.h +++ b/pixman/pixman-private.h @@ -82,6 +82,7 @@ struct image_common pixman_bool_t clip_sources; /* Whether the clip applies when * the image is used as a source */ + pixman_bool_t dirty; pixman_bool_t need_workaround; pixman_transform_t * transform; pixman_repeat_t repeat; @@ -277,6 +278,9 @@ _pixman_init_gradient (gradient_t * gradient, void _pixman_image_reset_clip_region (pixman_image_t *image); +void +_pixman_image_validate (pixman_image_t *image); + pixman_bool_t _pixman_image_is_opaque (pixman_image_t *image); diff --git a/pixman/pixman-radial-gradient.c b/pixman/pixman-radial-gradient.c index 67a618d..022157b 100644 --- a/pixman/pixman-radial-gradient.c +++ b/pixman/pixman-radial-gradient.c @@ -363,8 +363,6 @@ pixman_image_create_radial_gradient (pixman_point_fixed_t * inner, image->common.property_changed = radial_gradient_property_changed; - radial_gradient_property_changed (image); - return image; } diff --git a/pixman/pixman-region.c b/pixman/pixman-region.c index db23be3..f88955f 100644 --- a/pixman/pixman-region.c +++ b/pixman/pixman-region.c @@ -66,7 +66,7 @@ #define GOOD_RECT(rect) ((rect)->x1 < (rect)->x2 && (rect)->y1 < (rect)->y2) #define BAD_RECT(rect) ((rect)->x1 > (rect)->x2 || (rect)->y1 > (rect)->y2) -#define PIXMAN_REGION_LOG_FAILURES +#define noPIXMAN_REGION_LOG_FAILURES #if defined PIXMAN_REGION_LOG_FAILURES || defined PIXMAN_REGION_DEBUG diff --git a/pixman/pixman-solid-fill.c b/pixman/pixman-solid-fill.c index 67aec92..38675dc 100644 --- a/pixman/pixman-solid-fill.c +++ b/pixman/pixman-solid-fill.c @@ -86,8 +86,6 @@ pixman_image_create_solid_fill (pixman_color_t *color) img->common.classify = solid_fill_classify; img->common.property_changed = solid_fill_property_changed; - solid_fill_property_changed (img); - return img; } diff --git a/pixman/pixman-trap.c b/pixman/pixman-trap.c index 4d7a90a..962cbb3 100644 --- a/pixman/pixman-trap.c +++ b/pixman/pixman-trap.c @@ -243,6 +243,8 @@ pixman_add_traps (pixman_image_t * image, pixman_edge_t l, r; pixman_fixed_t t, b; + _pixman_image_validate (image); + width = image->bits.width; height = image->bits.height; bpp = PIXMAN_FORMAT_BPP (image->bits.format); @@ -357,6 +359,8 @@ pixman_rasterize_trapezoid (pixman_image_t * image, return_if_fail (image->type == BITS); + _pixman_image_validate (image); + if (!pixman_trapezoid_valid (trap)) return; diff --git a/pixman/pixman.c b/pixman/pixman.c index 12b4c5a..0edd967 100644 --- a/pixman/pixman.c +++ b/pixman/pixman.c @@ -173,6 +173,11 @@ pixman_image_composite (pixman_op_t op, uint32_t *dest_bits; int dest_dx, dest_dy; + _pixman_image_validate (src); + if (mask) + _pixman_image_validate (mask); + _pixman_image_validate (dest); + /* * Check if we can replace our operator by a simpler one * if the src or dest are opaque. The output operator should be @@ -322,6 +327,8 @@ pixman_image_fill_rectangles (pixman_op_t op, pixman_color_t c; int i; + _pixman_image_validate (dest); + if (color->alpha == 0xffff) { if (op == PIXMAN_OP_OVER)