[cairo] Dangerous cast between cairo_image_surface_t and cairo_image_source_t
Yannick Poirier
contact at yannickpoirier.fr
Tue Apr 16 06:28:40 PDT 2013
I'm writting a cairo backend to use some hw acceleration. Basically I'm
overloaded cairo_image_surface_t and cairo_image_source_t.
I'm facing a crash in one of my functions and this is because of a cast
from cairo_image_surface_t to cairo_image_source_t.
In cairo-span-compositor.c:composite_aligned_boxes() :
if need_clip_mask is true it creates a mask using get_clip_surface() that
returns a cairo_image_surface_t*
Then if no_mask is true it will call compositor->composite_boxes and gives
a cairo_image_surface_t* mask as parameter instead of
a cairo_image_source_t*
*Conditions:*
*no_mask = 1*
*need_clip_mask = 1*
if (need_clip_mask) {
* mask = get_clip_surface* (compositor, dst, extents->clip,
&extents->bounded);
if (unlikely (mask->status))
return mask->status;
mask_x = -extents->bounded.x;
mask_y = -extents->bounded.y;
}
if (! no_mask) {
...
}
src = compositor->pattern_to_surface (dst, source, FALSE,
&extents->bounded,
&extents->source_sample_area,
&src_x, &src_y);
if (likely (src->status == CAIRO_STATUS_SUCCESS)) {
status = *compositor->composite_boxes* (dst, op, src, *mask*,
src_x, src_y,
mask_x, mask_y,
0, 0,
boxes, &extents->bounded);
I welcome your thoughts,
Yannick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.cairographics.org/archives/cairo/attachments/20130416/e613be5a/attachment-0001.html>
More information about the cairo
mailing list