diff options
author | Ross Burton <ross@openedhand.com> | 2007-06-13 16:59:17 +0000 |
---|---|---|
committer | Ross Burton <ross@openedhand.com> | 2007-06-13 16:59:17 +0000 |
commit | 303ed7ca2b654539566e3c8adac0d4fa2970a0a8 (patch) | |
tree | 9a531746906ab2e54ec3a3918e48a4109ce7f753 /meta/packages/cairo | |
parent | 3a685ca6c8a49f35d6d1daa9a06d14d4b2b1551d (diff) | |
download | poky-303ed7ca2b654539566e3c8adac0d4fa2970a0a8.tar.gz |
Remove unused patch, from 1.4.2
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@1929 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/packages/cairo')
-rw-r--r-- | meta/packages/cairo/files/cairo-surface-cache-3.patch | 371 |
1 files changed, 0 insertions, 371 deletions
diff --git a/meta/packages/cairo/files/cairo-surface-cache-3.patch b/meta/packages/cairo/files/cairo-surface-cache-3.patch deleted file mode 100644 index ba714359a6..0000000000 --- a/meta/packages/cairo/files/cairo-surface-cache-3.patch +++ /dev/null | |||
@@ -1,371 +0,0 @@ | |||
1 | diff --git a/src/cairo-clip.c b/src/cairo-clip.c | ||
2 | diff --git a/src/cairo-color.c b/src/cairo-color.c | ||
3 | index a348839..0688167 100644 | ||
4 | --- a/src/cairo-color.c | ||
5 | +++ b/src/cairo-color.c | ||
6 | @@ -159,3 +159,10 @@ _cairo_color_get_rgba_premultiplied (cai | ||
7 | *blue = color->blue * color->alpha; | ||
8 | *alpha = color->alpha; | ||
9 | } | ||
10 | + | ||
11 | +cairo_bool_t | ||
12 | +_cairo_color_equal (cairo_color_t *color_a, | ||
13 | + cairo_color_t *color_b) | ||
14 | +{ | ||
15 | + return (memcmp (color_a, color_b, sizeof (cairo_color_t)) == 0); | ||
16 | +} | ||
17 | diff --git a/src/cairo-directfb-surface.c b/src/cairo-directfb-surface.c | ||
18 | index 686510d..96ee212 100644 | ||
19 | --- a/src/cairo-directfb-surface.c | ||
20 | +++ b/src/cairo-directfb-surface.c | ||
21 | @@ -1514,6 +1514,15 @@ _cairo_directfb_surface_show_glyphs ( vo | ||
22 | } | ||
23 | #endif /* DFB_SHOW_GLYPHS */ | ||
24 | |||
25 | +static cairo_bool_t | ||
26 | +_cairo_directfb_surface_is_compatible (void *surface_a, | ||
27 | + void *surface_b) | ||
28 | +{ | ||
29 | + cairo_directfb_surface_t *a = (cairo_directfb_surface_t*) surface_a; | ||
30 | + cairo_directfb_surface_t *b = (cairo_directfb_surface_t*) surface_b; | ||
31 | + | ||
32 | + return (a->dfb == b->dfb); | ||
33 | +} | ||
34 | |||
35 | static cairo_surface_backend_t cairo_directfb_surface_backend = { | ||
36 | CAIRO_SURFACE_TYPE_DIRECTFB, /*type*/ | ||
37 | @@ -1564,7 +1573,8 @@ #if DFB_SHOW_GLYPHS | ||
38 | #else | ||
39 | NULL, /* show_glyphs */ | ||
40 | #endif | ||
41 | - NULL /* snapshot */ | ||
42 | + NULL, /* snapshot */ | ||
43 | + _cairo_directfb_is_compatible | ||
44 | }; | ||
45 | |||
46 | |||
47 | diff --git a/src/cairo-ft-font.c b/src/cairo-ft-font.c | ||
48 | diff --git a/src/cairo-glitz-surface.c b/src/cairo-glitz-surface.c | ||
49 | index f492739..79e0162 100644 | ||
50 | --- a/src/cairo-glitz-surface.c | ||
51 | +++ b/src/cairo-glitz-surface.c | ||
52 | @@ -1799,6 +1799,19 @@ _cairo_glitz_surface_scaled_glyph_fini ( | ||
53 | } | ||
54 | } | ||
55 | |||
56 | +static cairo_bool_t | ||
57 | +_cairo_glitz_surface_is_compatible (void *surface_a, | ||
58 | + void *surface_b) | ||
59 | +{ | ||
60 | + cairo_glitz_surface_t *a = (cairo_glitz_surface_t*) surface_a; | ||
61 | + cairo_glitz_surface_t *b = (cairo_glitz_surface_t*) surface_b; | ||
62 | + | ||
63 | + glitz_drawable *drawable_a = glitz_surface_get_drawable (a->surface); | ||
64 | + glitz_drawable *drawable_b = glitz_surface_get_drawable (b->surface); | ||
65 | + | ||
66 | + return (drawable_a == drawable_b); | ||
67 | +} | ||
68 | + | ||
69 | #define FIXED_TO_FLOAT(f) (((glitz_float_t) (f)) / 65536) | ||
70 | |||
71 | static cairo_status_t | ||
72 | @@ -2194,7 +2207,16 @@ static const cairo_surface_backend_t cai | ||
73 | _cairo_glitz_surface_flush, | ||
74 | NULL, /* mark_dirty_rectangle */ | ||
75 | _cairo_glitz_surface_scaled_font_fini, | ||
76 | - _cairo_glitz_surface_scaled_glyph_fini | ||
77 | + _cairo_glitz_surface_scaled_glyph_fini, | ||
78 | + | ||
79 | + NULL, /* paint */ | ||
80 | + NULL, /* mask */ | ||
81 | + NULL, /* stroke */ | ||
82 | + NULL, /* fill */ | ||
83 | + NULL, /* show_glyphs */ | ||
84 | + | ||
85 | + NULL, /* snapshot */ | ||
86 | + _cairo_glitz_surface_is_compatible | ||
87 | }; | ||
88 | |||
89 | static const cairo_surface_backend_t * | ||
90 | diff --git a/src/cairo-gstate.c b/src/cairo-gstate.c | ||
91 | diff --git a/src/cairo-meta-surface.c b/src/cairo-meta-surface.c | ||
92 | diff --git a/src/cairo-pattern.c b/src/cairo-pattern.c | ||
93 | index b488d1f..28f8561 100644 | ||
94 | --- a/src/cairo-pattern.c | ||
95 | +++ b/src/cairo-pattern.c | ||
96 | @@ -1020,6 +1020,8 @@ _cairo_pattern_acquire_surface_for_gradi | ||
97 | return status; | ||
98 | } | ||
99 | |||
100 | +#define MAX_CACHE_SIZE 16 | ||
101 | + | ||
102 | static cairo_int_status_t | ||
103 | _cairo_pattern_acquire_surface_for_solid (cairo_solid_pattern_t *pattern, | ||
104 | cairo_surface_t *dst, | ||
105 | @@ -1030,12 +1032,59 @@ _cairo_pattern_acquire_surface_for_solid | ||
106 | cairo_surface_t **out, | ||
107 | cairo_surface_attributes_t *attribs) | ||
108 | { | ||
109 | - *out = _cairo_surface_create_similar_solid (dst, | ||
110 | - CAIRO_CONTENT_COLOR_ALPHA, | ||
111 | - 1, 1, | ||
112 | - &pattern->color); | ||
113 | - if ((*out)->status) | ||
114 | - return CAIRO_STATUS_NO_MEMORY; | ||
115 | + /* We have a small cache here, because we don't want to constantly | ||
116 | + * recreate surfaces for simple solid colors */ | ||
117 | + static struct { | ||
118 | + cairo_color_t color; | ||
119 | + cairo_surface_t *surface; | ||
120 | + } cache[MAX_CACHE_SIZE]; | ||
121 | + static int cache_size = 0; | ||
122 | + static int i = 0; | ||
123 | + CAIRO_MUTEX_DECLARE (cache_lock); | ||
124 | + | ||
125 | + cairo_surface_t *surface; | ||
126 | + cairo_status_t status; | ||
127 | + | ||
128 | + CAIRO_MUTEX_LOCK (cache_lock); | ||
129 | + | ||
130 | + /* Check cache first */ | ||
131 | + if (i < cache_size) | ||
132 | + if (_cairo_color_equal (&cache[i].color, &pattern->color) && | ||
133 | + _cairo_surface_is_compatible (cache[i].surface, dst)) | ||
134 | + goto DONE; | ||
135 | + | ||
136 | + for (i = 0; i < cache_size; i++) | ||
137 | + if (_cairo_color_equal (&cache[i].color, &pattern->color) && | ||
138 | + _cairo_surface_is_compatible (cache[i].surface, dst)) | ||
139 | + goto DONE; | ||
140 | + | ||
141 | + /* Not cached, need to create new */ | ||
142 | + surface = _cairo_surface_create_similar_solid (dst, | ||
143 | + CAIRO_CONTENT_COLOR_ALPHA, | ||
144 | + 1, 1, | ||
145 | + &pattern->color); | ||
146 | + if (surface->status) { | ||
147 | + status = CAIRO_STATUS_NO_MEMORY; | ||
148 | + | ||
149 | + goto UNLOCK; | ||
150 | + } | ||
151 | + | ||
152 | + /* Cache new */ | ||
153 | + if (cache_size < MAX_CACHE_SIZE) | ||
154 | + cache_size++; | ||
155 | + else { | ||
156 | + i = rand () % MAX_CACHE_SIZE; | ||
157 | + | ||
158 | + /* Evict old */ | ||
159 | + cairo_surface_destroy (cache[i].surface); | ||
160 | + } | ||
161 | + | ||
162 | + cache[i].color = pattern->color; | ||
163 | + cache[i].surface = surface; | ||
164 | + | ||
165 | +DONE: | ||
166 | + | ||
167 | + *out = cairo_surface_reference (cache[i].surface); | ||
168 | |||
169 | attribs->x_offset = attribs->y_offset = 0; | ||
170 | cairo_matrix_init_identity (&attribs->matrix); | ||
171 | @@ -1043,7 +1092,13 @@ _cairo_pattern_acquire_surface_for_solid | ||
172 | attribs->filter = CAIRO_FILTER_NEAREST; | ||
173 | attribs->acquired = FALSE; | ||
174 | |||
175 | - return CAIRO_STATUS_SUCCESS; | ||
176 | + status = CAIRO_STATUS_SUCCESS; | ||
177 | + | ||
178 | +UNLOCK: | ||
179 | + | ||
180 | + CAIRO_MUTEX_UNLOCK (cache_lock); | ||
181 | + | ||
182 | + return status; | ||
183 | } | ||
184 | |||
185 | /** | ||
186 | diff --git a/src/cairo-scaled-font.c b/src/cairo-scaled-font.c | ||
187 | diff --git a/src/cairo-surface-fallback.c b/src/cairo-surface-fallback.c | ||
188 | diff --git a/src/cairo-surface.c b/src/cairo-surface.c | ||
189 | index 2bff0da..78cad9b 100644 | ||
190 | --- a/src/cairo-surface.c | ||
191 | +++ b/src/cairo-surface.c | ||
192 | @@ -1078,6 +1078,32 @@ _cairo_surface_snapshot (cairo_surface_t | ||
193 | return _cairo_surface_fallback_snapshot (surface); | ||
194 | } | ||
195 | |||
196 | +/** | ||
197 | + * _cairo_surface_is_compatible | ||
198 | + * @surface_a: a #cairo_surface_t | ||
199 | + * @surface_b: a #cairo_surface_t | ||
200 | + * | ||
201 | + * Find out whether the given surfaces share the same backend, | ||
202 | + * and if so, whether they can be considered compatible. | ||
203 | + * | ||
204 | + * The definition of "compatible" depends on the backend. In the | ||
205 | + * xlib case, it means the surfaces share the same display. | ||
206 | + * | ||
207 | + * Return value: TRUE if the surfaces are compatible. | ||
208 | + **/ | ||
209 | +cairo_bool_t | ||
210 | +_cairo_surface_is_compatible (cairo_surface_t *surface_a, | ||
211 | + cairo_surface_t *surface_b) | ||
212 | +{ | ||
213 | + if (surface_a->backend != surface_b->backend) | ||
214 | + return FALSE; | ||
215 | + | ||
216 | + if (surface_a->backend->is_compatible) | ||
217 | + return surface_a->backend->is_compatible (surface_a, surface_b); | ||
218 | + | ||
219 | + return TRUE; | ||
220 | +} | ||
221 | + | ||
222 | cairo_status_t | ||
223 | _cairo_surface_composite (cairo_operator_t op, | ||
224 | cairo_pattern_t *src, | ||
225 | diff --git a/src/cairo-win32-surface.c b/src/cairo-win32-surface.c | ||
226 | index be7e706..81eb916 100644 | ||
227 | --- a/src/cairo-win32-surface.c | ||
228 | +++ b/src/cairo-win32-surface.c | ||
229 | @@ -1609,6 +1609,16 @@ _cairo_win32_surface_show_glyphs (void | ||
230 | return (win_result) ? CAIRO_STATUS_SUCCESS : CAIRO_INT_STATUS_UNSUPPORTED; | ||
231 | } | ||
232 | |||
233 | +static cairo_bool_t | ||
234 | +_cairo_win32_surface_is_compatible (void *surface_a, | ||
235 | + void *surface_b) | ||
236 | +{ | ||
237 | + cairo_win32_surface_t *a = (cairo_win32_surface_t*) surface_a; | ||
238 | + cairo_win32_surface_t *b = (cairo_win32_surface_t*) surface_b; | ||
239 | + | ||
240 | + return (a->dc == b->dc); | ||
241 | +} | ||
242 | + | ||
243 | #undef STACK_GLYPH_SIZE | ||
244 | |||
245 | /** | ||
246 | @@ -1879,7 +1889,8 @@ static const cairo_surface_backend_t cai | ||
247 | NULL, /* fill */ | ||
248 | _cairo_win32_surface_show_glyphs, | ||
249 | |||
250 | - NULL /* snapshot */ | ||
251 | + NULL, /* snapshot */ | ||
252 | + _cairo_win32_surface_is_compatible | ||
253 | }; | ||
254 | |||
255 | /* | ||
256 | diff --git a/src/cairo-xcb-surface.c b/src/cairo-xcb-surface.c | ||
257 | index 2fdf8a1..8df859d 100644 | ||
258 | --- a/src/cairo-xcb-surface.c | ||
259 | +++ b/src/cairo-xcb-surface.c | ||
260 | @@ -1578,6 +1578,10 @@ _cairo_xcb_surface_show_glyphs (void | ||
261 | int num_glyphs, | ||
262 | cairo_scaled_font_t *scaled_font); | ||
263 | |||
264 | +static cairo_bool_t | ||
265 | +_cairo_xcb_surface_is_compatible (void *surface_a, | ||
266 | + void *surface_b); | ||
267 | + | ||
268 | /* XXX: move this to the bottom of the file, XCB and Xlib */ | ||
269 | |||
270 | static const cairo_surface_backend_t cairo_xcb_surface_backend = { | ||
271 | @@ -1609,7 +1613,8 @@ static const cairo_surface_backend_t cai | ||
272 | NULL, /* stroke */ | ||
273 | NULL, /* fill */ | ||
274 | _cairo_xcb_surface_show_glyphs, | ||
275 | - NULL /* snapshot */ | ||
276 | + NULL, /* snapshot */ | ||
277 | + _cairo_xcb_surface_is_compatible | ||
278 | }; | ||
279 | |||
280 | /** | ||
281 | @@ -2451,3 +2456,13 @@ _cairo_xcb_surface_show_glyphs (void | ||
282 | |||
283 | return status; | ||
284 | } | ||
285 | + | ||
286 | +static cairo_bool_t | ||
287 | +_cairo_xcb_surface_is_compatible (void *surface_a, | ||
288 | + void *surface_b) | ||
289 | +{ | ||
290 | + cairo_xcb_surface_t *a = (cairo_xcb_surface_t*) surface_a; | ||
291 | + cairo_xcb_surface_t *b = (cairo_xcb_surface_t*) surface_b; | ||
292 | + | ||
293 | + return (a->dpy == b->dpy); | ||
294 | +} | ||
295 | diff --git a/src/cairo-xlib-surface.c b/src/cairo-xlib-surface.c | ||
296 | index 6a0d3e4..9228c95 100644 | ||
297 | --- a/src/cairo-xlib-surface.c | ||
298 | +++ b/src/cairo-xlib-surface.c | ||
299 | @@ -74,6 +74,10 @@ _cairo_xlib_surface_show_glyphs (void | ||
300 | int num_glyphs, | ||
301 | cairo_scaled_font_t *scaled_font); | ||
302 | |||
303 | +static cairo_bool_t | ||
304 | +_cairo_xlib_surface_is_compatible (void *surface_a, | ||
305 | + void *surface_b); | ||
306 | + | ||
307 | /* | ||
308 | * Instead of taking two round trips for each blending request, | ||
309 | * assume that if a particular drawable fails GetImage that it will | ||
310 | @@ -1783,7 +1787,8 @@ static const cairo_surface_backend_t cai | ||
311 | NULL, /* stroke */ | ||
312 | NULL, /* fill */ | ||
313 | _cairo_xlib_surface_show_glyphs, | ||
314 | - NULL /* snapshot */ | ||
315 | + NULL, /* snapshot */ | ||
316 | + _cairo_xlib_surface_is_compatible | ||
317 | }; | ||
318 | |||
319 | /** | ||
320 | @@ -2913,3 +2918,13 @@ _cairo_xlib_surface_show_glyphs (void | ||
321 | |||
322 | return status; | ||
323 | } | ||
324 | + | ||
325 | +static cairo_bool_t | ||
326 | +_cairo_xlib_surface_is_compatible (void *surface_a, | ||
327 | + void *surface_b) | ||
328 | +{ | ||
329 | + cairo_xlib_surface_t *a = (cairo_xlib_surface_t*) surface_a; | ||
330 | + cairo_xlib_surface_t *b = (cairo_xlib_surface_t*) surface_b; | ||
331 | + | ||
332 | + return (a->dpy == b->dpy); | ||
333 | +} | ||
334 | diff --git a/src/cairo.c b/src/cairo.c | ||
335 | diff --git a/src/cairoint.h b/src/cairoint.h | ||
336 | index 060b988..01c0e2a 100755 | ||
337 | --- a/src/cairoint.h | ||
338 | +++ b/src/cairoint.h | ||
339 | @@ -933,6 +933,10 @@ struct _cairo_surface_backend { | ||
340 | |||
341 | cairo_surface_t * | ||
342 | (*snapshot) (void *surface); | ||
343 | + | ||
344 | + cairo_bool_t | ||
345 | + (*is_compatible) (void *surface_a, | ||
346 | + void *surface_b); | ||
347 | }; | ||
348 | |||
349 | typedef struct _cairo_format_masks { | ||
350 | @@ -1497,6 +1501,10 @@ _cairo_color_get_rgba_premultiplied (cai | ||
351 | double *blue, | ||
352 | double *alpha); | ||
353 | |||
354 | +cairo_private cairo_bool_t | ||
355 | +_cairo_color_equal (cairo_color_t *color_a, | ||
356 | + cairo_color_t *color_b); | ||
357 | + | ||
358 | /* cairo-font.c */ | ||
359 | |||
360 | cairo_private void | ||
361 | @@ -1922,6 +1930,10 @@ _cairo_surface_clone_similar (cairo_surf | ||
362 | cairo_private cairo_surface_t * | ||
363 | _cairo_surface_snapshot (cairo_surface_t *surface); | ||
364 | |||
365 | +cairo_private cairo_bool_t | ||
366 | +_cairo_surface_is_compatible (cairo_surface_t *surface_a, | ||
367 | + cairo_surface_t *surface_b); | ||
368 | + | ||
369 | cairo_private unsigned int | ||
370 | _cairo_surface_get_current_clip_serial (cairo_surface_t *surface); | ||
371 | |||