mirror of https://github.com/GNOME/gimp.git
libgimp: add GEGL branch to gimp_layer_new_from_pixbuf()
can't get rid of the legacy impl yet bacause plug-ins need to be able to run in compat mode.
This commit is contained in:
parent
3ad73b3658
commit
48a264ce4b
|
@ -116,18 +116,11 @@ gimp_layer_new_from_pixbuf (gint32 image_ID,
|
|||
gdouble progress_start,
|
||||
gdouble progress_end)
|
||||
{
|
||||
GimpDrawable *drawable;
|
||||
GimpPixelRgn rgn;
|
||||
const guchar *pixels;
|
||||
gpointer pr;
|
||||
gint32 layer;
|
||||
gint width;
|
||||
gint height;
|
||||
gint rowstride;
|
||||
gint bpp;
|
||||
gdouble range = progress_end - progress_start;
|
||||
guint count = 0;
|
||||
guint done = 0;
|
||||
|
||||
g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), -1);
|
||||
|
||||
|
@ -154,6 +147,29 @@ gimp_layer_new_from_pixbuf (gint32 image_ID,
|
|||
if (layer == -1)
|
||||
return -1;
|
||||
|
||||
if (gimp_plugin_precision_enabled ())
|
||||
{
|
||||
GeglBuffer *src_buffer;
|
||||
GeglBuffer *dest_buffer;
|
||||
|
||||
src_buffer = gimp_pixbuf_create_buffer (pixbuf);
|
||||
dest_buffer = gimp_drawable_get_buffer (layer);
|
||||
|
||||
gegl_buffer_copy (src_buffer, NULL, dest_buffer, NULL);
|
||||
|
||||
g_object_unref (src_buffer);
|
||||
g_object_unref (dest_buffer);
|
||||
}
|
||||
else
|
||||
{
|
||||
GimpDrawable *drawable;
|
||||
GimpPixelRgn rgn;
|
||||
gpointer pr;
|
||||
const guchar *pixels;
|
||||
gint rowstride;
|
||||
guint done = 0;
|
||||
guint count = 0;
|
||||
|
||||
drawable = gimp_drawable_get (layer);
|
||||
|
||||
gimp_pixel_rgn_init (&rgn, drawable, 0, 0, width, height, TRUE, FALSE);
|
||||
|
@ -189,11 +205,12 @@ gimp_layer_new_from_pixbuf (gint32 image_ID,
|
|||
}
|
||||
}
|
||||
|
||||
gimp_drawable_detach (drawable);
|
||||
}
|
||||
|
||||
if (range > 0.0)
|
||||
gimp_progress_update (progress_end);
|
||||
|
||||
gimp_drawable_detach (drawable);
|
||||
|
||||
return layer;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue