diff options
author | Søren Sandmann Pedersen <ssp@redhat.com> | 2012-10-05 01:52:57 -0400 |
---|---|---|
committer | Søren Sandmann Pedersen <ssp@redhat.com> | 2012-10-05 01:52:57 -0400 |
commit | a0d95588fcc13c30e0717b5e10bc8779daee748b (patch) | |
tree | ae86e3fe996ff881b5f3f6d7260b1b4aa766f1f9 /fimage.c | |
parent | 8749ffeeeec953ae0b6b926207d26d1d5dff1a8f (diff) |
Diffstat (limited to 'fimage.c')
-rw-r--r-- | fimage.c | 32 |
1 files changed, 22 insertions, 10 deletions
@@ -19,14 +19,15 @@ struct fimage_t static const fimage_t broken_fimage = { TRUE, /* broken */ - 0, - NULL + 0, /* n_allocated_fragments */ + 0, /* n_fragments */ + { NULL } /* fragments */ }; static fimage_t * fimage_ensure_space (fimage_t *fimage, int n_more) { - size_t required_fragments = fimage->n_fragments + n_more; + int required_fragments = fimage->n_fragments + n_more; if (required_fragments > fimage->n_allocated_fragments) { @@ -72,7 +73,7 @@ fimage_append_fragment (fimage_t *fimage, fragment_t *fragment) return fimage; } - fimage = ensure_space (fimage, 1); + fimage = fimage_ensure_space (fimage, 1); if (fimage->broken) return fimage; @@ -138,22 +139,22 @@ fimage_new_image (int width, int height, pixman_image_t *image) return make_image (fragment_new_image (width, height, image)); } - /* Makes a copy of the region; does not take ownership */ fimage_t * fimage_new_region (int width, int height, pixman_region32_t *region) { fragment_t *fragment1, *fragment2; + fimage_t *image; fragment1 = fragment_new_region (region); fragment2 = fragment_new_blank (width, height); - fragment2 = fragment_subtract (fragment1, fragment_2); + fragment2 = fragment_subtract (fragment1, fragment2); image = fimage_new (); - image = fimage_append (image, fragment1); - image = fimage_appned (image, fragment2); + image = fimage_append_fragment (image, fragment1); + image = fimage_append_fragment (image, fragment2); return image; } @@ -195,7 +196,7 @@ fimage_composite (fimage_t *dest, pixman_op_t op, fimage_t *source) } void -fimage_paint (fimage_t *image, pixman_image_t *image) +fimage_paint (fimage_t *image, pixman_image_t *pimage) { int i; @@ -203,6 +204,17 @@ fimage_paint (fimage_t *image, pixman_image_t *image) { fragment_t *fragment = image->fragments[i]; - fragment_apply (fragment, image); + fragment_apply (fragment, pimage); } } + +void +fimage_free (fimage_t *image) +{ + int i; + + for (i = 0; i < image->n_fragments; ++i) + fragment_free (image->fragments[i]); + + free (image); +} |