script: Simply exchange source/dest images for _set_source_image

But note we can only do the exchange if they do indeed match and
there are no other references (the objects are only on the stack).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
This commit is contained in:
Chris Wilson 2013-01-08 12:53:24 +00:00
parent 146da77d85
commit e1307da861

View file

@ -5356,11 +5356,20 @@ _set_source_image (csi_t *ctx)
* principally to remove the pixman ops from the profiles.
*/
if (_csi_likely (_matching_images (surface, source))) {
cairo_surface_flush (surface);
memcpy (cairo_image_surface_get_data (surface),
cairo_image_surface_get_data (source),
cairo_image_surface_get_height (source) * cairo_image_surface_get_stride (source));
cairo_surface_mark_dirty (surface);
if (cairo_surface_get_reference_count (surface) == 1 &&
cairo_surface_get_reference_count (source) == 1)
{
_csi_peek_ostack (ctx, 0)->datum.surface = surface;
_csi_peek_ostack (ctx, 1)->datum.surface = source;
}
else
{
cairo_surface_flush (surface);
memcpy (cairo_image_surface_get_data (surface),
cairo_image_surface_get_data (source),
cairo_image_surface_get_height (source) * cairo_image_surface_get_stride (source));
cairo_surface_mark_dirty (surface);
}
} else {
cairo_t *cr;