|
1 commit d2120bdb06c9aacc470bb346d6bc2071c2e0749d |
|
2 Author: Jeff Muizelaar <jmuizelaar@mozilla.com> |
|
3 Date: Fri Mar 12 15:32:09 2010 -0500 |
|
4 |
|
5 BGR |
|
6 |
|
7 diff --git a/src/cairo-surface.c b/src/cairo-surface.c |
|
8 index 332e3ab..4a1d6a0 100644 |
|
9 --- a/src/cairo-surface.c |
|
10 +++ b/src/cairo-surface.c |
|
11 @@ -1501,7 +1501,9 @@ static void |
|
12 _wrap_release_source_image (void *data) |
|
13 { |
|
14 struct acquire_source_image_data *acquire_data = data; |
|
15 - _cairo_surface_release_source_image (acquire_data->src, acquire_data->image, acquire_data->image_extra); |
|
16 + _cairo_surface_release_source_image (acquire_data->src, |
|
17 + acquire_data->image, |
|
18 + acquire_data->image_extra); |
|
19 free(data); |
|
20 } |
|
21 |
|
22 @@ -1515,42 +1517,47 @@ _wrap_image (cairo_surface_t *src, |
|
23 cairo_image_surface_t *surface; |
|
24 cairo_status_t status; |
|
25 |
|
26 - struct acquire_source_image_data *data = malloc(sizeof(*data)); |
|
27 + struct acquire_source_image_data *data = malloc (sizeof (*data)); |
|
28 + if (unlikely (data == NULL)) |
|
29 + return _cairo_error (CAIRO_STATUS_NO_MEMORY); |
|
30 data->src = src; |
|
31 data->image = image; |
|
32 data->image_extra = image_extra; |
|
33 |
|
34 - surface = (cairo_image_surface_t*)cairo_image_surface_create_for_data (image->data, |
|
35 - image->format, |
|
36 - image->width, |
|
37 - image->height, |
|
38 - image->stride); |
|
39 + surface = (cairo_image_surface_t*) |
|
40 + _cairo_image_surface_create_with_pixman_format (image->data, |
|
41 + image->pixman_format, |
|
42 + image->width, |
|
43 + image->height, |
|
44 + image->stride); |
|
45 status = surface->base.status; |
|
46 - if (status) |
|
47 + if (status) { |
|
48 + free (data); |
|
49 return status; |
|
50 + } |
|
51 |
|
52 status = _cairo_user_data_array_set_data (&surface->base.user_data, |
|
53 - &wrap_image_key, |
|
54 - data, |
|
55 - _wrap_release_source_image); |
|
56 + &wrap_image_key, |
|
57 + data, |
|
58 + _wrap_release_source_image); |
|
59 if (status) { |
|
60 cairo_surface_destroy (&surface->base); |
|
61 + free (data); |
|
62 return status; |
|
63 } |
|
64 -/* |
|
65 - pixman_image_set_component_alpha (surface->pixman_image, |
|
66 - pixman_image_get_component_alpha (image->pixman_image)); |
|
67 -*/ |
|
68 + |
|
69 + pixman_image_set_component_alpha ( |
|
70 + surface->pixman_image, |
|
71 + pixman_image_get_component_alpha (image->pixman_image)); |
|
72 + |
|
73 *out = surface; |
|
74 return CAIRO_STATUS_SUCCESS; |
|
75 } |
|
76 |
|
77 - |
|
78 /** |
|
79 * _cairo_surface_clone_similar: |
|
80 * @surface: a #cairo_surface_t |
|
81 * @src: the source image |
|
82 - * @content: target content mask |
|
83 * @src_x: extent for the rectangle in src we actually care about |
|
84 * @src_y: extent for the rectangle in src we actually care about |
|
85 * @width: extent for the rectangle in src we actually care about |
|
86 @@ -1627,12 +1634,12 @@ _cairo_surface_clone_similar (cairo_surface_t *surface, |
|
87 _cairo_surface_release_source_image (src, image, image_extra); |
|
88 } else { |
|
89 status = |
|
90 - surface->backend->clone_similar (surface, &image->base, |
|
91 - src_x, src_y, |
|
92 - width, height, |
|
93 - clone_offset_x, |
|
94 - clone_offset_y, |
|
95 - clone_out); |
|
96 + surface->backend->clone_similar (surface, &image->base, |
|
97 + src_x, src_y, |
|
98 + width, height, |
|
99 + clone_offset_x, |
|
100 + clone_offset_y, |
|
101 + clone_out); |
|
102 cairo_surface_destroy(&image->base); |
|
103 } |
|
104 } |