From: Eric Anholt Date: Mon, 20 Aug 2007 19:58:47 +0000 (-0700) Subject: Fix failure to set identity transform in pixman. X-Git-Tag: pixman-0.9.5~5^2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=9c09561a91debfd7c77a39b337b51b2ab16d6da9;p=platform%2Fupstream%2Fpixman.git Fix failure to set identity transform in pixman. While here, optimize out a free/malloc in the case where a transform existed previously and the new transform is non-identity. --- diff --git a/pixman/pixman-image.c b/pixman/pixman-image.c index 2cbf88c..32ffaee 100644 --- a/pixman/pixman-image.c +++ b/pixman/pixman-image.c @@ -403,25 +403,17 @@ pixman_image_set_transform (pixman_image_t *image, if (memcmp (&id, transform, sizeof (pixman_transform_t)) == 0) { - transform = NULL; + free(common->transform); + common->transform = NULL; return TRUE; } - if (common->transform) - free (common->transform); - - if (transform) - { + if (common->transform == NULL) common->transform = malloc (sizeof (pixman_transform_t)); - if (!common->transform) - return FALSE; + if (common->transform == NULL) + return FALSE; - *common->transform = *transform; - } - else - { - common->transform = NULL; - } + memcpy(common->transform, transform, sizeof(pixman_transform_t)); return TRUE; }