forked from AuroraMiddleware/gtk
gdk_pixbuf_get_from_surface: Avoid copying if source is image surface
If the source surface is an image surface we don't need to coerce it to one.
This commit is contained in:
parent
9bde6b10ef
commit
54f5e4af53
@ -248,9 +248,16 @@ gdk_pixbuf_get_from_surface (cairo_surface_t *surface,
|
|||||||
8,
|
8,
|
||||||
width, height);
|
width, height);
|
||||||
|
|
||||||
surface = gdk_cairo_surface_coerce_to_image (surface, content,
|
if (cairo_surface_get_type (surface) == CAIRO_SURFACE_TYPE_IMAGE)
|
||||||
src_x, src_y,
|
surface = cairo_surface_reference (surface);
|
||||||
width, height);
|
else
|
||||||
|
{
|
||||||
|
surface = gdk_cairo_surface_coerce_to_image (surface, content,
|
||||||
|
src_x, src_y,
|
||||||
|
width, height);
|
||||||
|
src_x = 0;
|
||||||
|
src_y = 0;
|
||||||
|
}
|
||||||
cairo_surface_flush (surface);
|
cairo_surface_flush (surface);
|
||||||
if (cairo_surface_status (surface) || dest == NULL)
|
if (cairo_surface_status (surface) || dest == NULL)
|
||||||
{
|
{
|
||||||
@ -263,14 +270,14 @@ gdk_pixbuf_get_from_surface (cairo_surface_t *surface,
|
|||||||
gdk_pixbuf_get_rowstride (dest),
|
gdk_pixbuf_get_rowstride (dest),
|
||||||
cairo_image_surface_get_data (surface),
|
cairo_image_surface_get_data (surface),
|
||||||
cairo_image_surface_get_stride (surface),
|
cairo_image_surface_get_stride (surface),
|
||||||
0, 0,
|
src_x, src_y,
|
||||||
width, height);
|
width, height);
|
||||||
else
|
else
|
||||||
convert_no_alpha (gdk_pixbuf_get_pixels (dest),
|
convert_no_alpha (gdk_pixbuf_get_pixels (dest),
|
||||||
gdk_pixbuf_get_rowstride (dest),
|
gdk_pixbuf_get_rowstride (dest),
|
||||||
cairo_image_surface_get_data (surface),
|
cairo_image_surface_get_data (surface),
|
||||||
cairo_image_surface_get_stride (surface),
|
cairo_image_surface_get_stride (surface),
|
||||||
0, 0,
|
src_x, src_y,
|
||||||
width, height);
|
width, height);
|
||||||
|
|
||||||
cairo_surface_destroy (surface);
|
cairo_surface_destroy (surface);
|
||||||
|
Loading…
Reference in New Issue
Block a user