[Pixman] [PATCH] Avoid marking images dirty when properties are reset

Andrea Canciani ranma42 at gmail.com
Tue Feb 15 02:28:32 PST 2011


On Tue, Feb 15, 2011 at 10:55 AM, Soeren Sandmann <sandmann at cs.au.dk> wrote:
> When an image property is set to the same value that it already is,
> there is no reason to mark the image dirty and incur a recomputation
> of the flags.
> ---
>  pixman/pixman-image.c |   20 +++++++++++++++++++-
>  1 files changed, 19 insertions(+), 1 deletions(-)
>
> diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c
> index e91d87c..9103ca6 100644
> --- a/pixman/pixman-image.c
> +++ b/pixman/pixman-image.c
> @@ -502,7 +502,7 @@ pixman_image_set_transform (pixman_image_t *          image,
>     if (common->transform == transform)
>        return TRUE;
>
> -    if (memcmp (&id, transform, sizeof (pixman_transform_t)) == 0)
> +    if (!transform || memcmp (&id, transform, sizeof (pixman_transform_t)) == 0)
>     {
>        free (common->transform);
>        common->transform = NULL;

This change looks like a bugfix unrelated to the commit message.
Overall, the patch looks correct.

Andrea

> @@ -511,6 +511,12 @@ pixman_image_set_transform (pixman_image_t *          image,
>        goto out;
>     }
>
> +    if (common->transform &&
> +       memcmp (common->transform, transform, sizeof (pixman_transform_t) == 0))
> +    {
> +       return TRUE;
> +    }
> +
>     if (common->transform == NULL)
>        common->transform = malloc (sizeof (pixman_transform_t));
>
> @@ -535,6 +541,9 @@ PIXMAN_EXPORT void
>  pixman_image_set_repeat (pixman_image_t *image,
>                          pixman_repeat_t repeat)
>  {
> +    if (image->common.repeat == repeat)
> +       return;
> +
>     image->common.repeat = repeat;
>
>     image_property_changed (image);
> @@ -579,6 +588,9 @@ PIXMAN_EXPORT void
>  pixman_image_set_source_clipping (pixman_image_t *image,
>                                   pixman_bool_t   clip_sources)
>  {
> +    if (image->common.clip_sources == clip_sources)
> +       return;
> +
>     image->common.clip_sources = clip_sources;
>
>     image_property_changed (image);
> @@ -594,6 +606,9 @@ pixman_image_set_indexed (pixman_image_t *        image,
>  {
>     bits_image_t *bits = (bits_image_t *)image;
>
> +    if (bits->indexed == indexed)
> +       return;
> +
>     bits->indexed = indexed;
>
>     image_property_changed (image);
> @@ -656,6 +671,9 @@ PIXMAN_EXPORT void
>  pixman_image_set_component_alpha   (pixman_image_t *image,
>                                     pixman_bool_t   component_alpha)
>  {
> +    if (image->common.component_alpha == component_alpha)
> +       return;
> +
>     image->common.component_alpha = component_alpha;
>
>     image_property_changed (image);
> --
> 1.6.0.6
>
> _______________________________________________
> Pixman mailing list
> Pixman at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/pixman
>


More information about the Pixman mailing list