Dangerous cast between cairo_image_surface_t and cairo_image_source_t

Yannick Poirier <[email protected]>
Newsgroups gmane.comp.lib.cairo
Message-ID <CAJLBeVZ5_QrcqOjv1U=-OMKxcZ9A=n-ODxw2r0fVhEhzi6EhNg@mail.gmail.com>
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

-- 
cairo mailing list
[email protected]
http://lists.cairographics.org/mailman/listinfo/cairo
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.