[gimp] libgimp: remove GimpPixelRgn, it's now completely unused, yay!
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] libgimp: remove GimpPixelRgn, it's now completely unused, yay!
- Date: Fri, 19 Jul 2019 17:09:11 +0000 (UTC)
commit 60554eaed98b811e3434d49c979f93351d7efb66
Author: Michael Natterer <mitch gimp org>
Date: Fri Jul 19 19:08:31 2019 +0200
libgimp: remove GimpPixelRgn, it's now completely unused, yay!
libgimp/Makefile.am | 3 -
libgimp/gimp.def | 8 -
libgimp/gimp.h | 1 -
libgimp/gimplayer.c | 184 ++----------
libgimp/gimppixelrgn.c | 755 -------------------------------------------------
libgimp/gimppixelrgn.h | 94 ------
6 files changed, 23 insertions(+), 1022 deletions(-)
---
diff --git a/libgimp/Makefile.am b/libgimp/Makefile.am
index 0a5ee72f66..c9ef274a3f 100644
--- a/libgimp/Makefile.am
+++ b/libgimp/Makefile.am
@@ -228,8 +228,6 @@ libgimp_sources = \
gimppatternselect.h \
gimppixbuf.c \
gimppixbuf.h \
- gimppixelrgn.c \
- gimppixelrgn.h \
gimpplugin.c \
gimpplugin.h \
gimpproceduraldb.c \
@@ -319,7 +317,6 @@ gimpinclude_HEADERS = \
gimplayer.h \
gimppaletteselect.h \
gimppatternselect.h \
- gimppixelrgn.h \
gimpplugin.h \
gimpproceduraldb.h \
gimpprogress.h \
diff --git a/libgimp/gimp.def b/libgimp/gimp.def
index b9b1313ad1..b6223fc17f 100644
--- a/libgimp/gimp.def
+++ b/libgimp/gimp.def
@@ -589,14 +589,6 @@ EXPORTS
gimp_patterns_refresh
gimp_patterns_set_popup
gimp_pencil
- gimp_pixel_rgn_get_rect
- gimp_pixel_rgn_get_row
- gimp_pixel_rgn_init
- gimp_pixel_rgn_set_rect
- gimp_pixel_rgn_set_row
- gimp_pixel_rgns_process
- gimp_pixel_rgns_register
- gimp_pixel_rgns_register2
gimp_plugin_domain_register
gimp_plugin_enable_precision
gimp_plugin_get_pdb_error_handler
diff --git a/libgimp/gimp.h b/libgimp/gimp.h
index 2a7395cef4..8b408837f8 100644
--- a/libgimp/gimp.h
+++ b/libgimp/gimp.h
@@ -47,7 +47,6 @@
#include <libgimp/gimppaletteselect.h>
#include <libgimp/gimppatternselect.h>
#include <libgimp/gimppixbuf.h>
-#include <libgimp/gimppixelrgn.h>
#include <libgimp/gimpplugin.h>
#include <libgimp/gimpproceduraldb.h>
#include <libgimp/gimpprogress.h>
diff --git a/libgimp/gimplayer.c b/libgimp/gimplayer.c
index 6612440f3e..b48804e443 100644
--- a/libgimp/gimplayer.c
+++ b/libgimp/gimplayer.c
@@ -117,11 +117,12 @@ gimp_layer_new_from_pixbuf (gint32 image_ID,
gdouble progress_start,
gdouble progress_end)
{
- gint32 layer;
- gint width;
- gint height;
- gint bpp;
- gdouble range = progress_end - progress_start;
+ GeglBuffer *dest_buffer;
+ gint32 layer;
+ gint width;
+ gint height;
+ gint bpp;
+ gdouble range = progress_end - progress_start;
g_return_val_if_fail (GDK_IS_PIXBUF (pixbuf), -1);
@@ -137,9 +138,9 @@ gimp_layer_new_from_pixbuf (gint32 image_ID,
return -1;
}
- width = gdk_pixbuf_get_width (pixbuf);
- height = gdk_pixbuf_get_height (pixbuf);
- bpp = gdk_pixbuf_get_n_channels (pixbuf);
+ width = gdk_pixbuf_get_width (pixbuf);
+ height = gdk_pixbuf_get_height (pixbuf);
+ bpp = gdk_pixbuf_get_n_channels (pixbuf);
layer = gimp_layer_new (image_ID, name, width, height,
bpp == 3 ? GIMP_RGB_IMAGE : GIMP_RGBA_IMAGE,
@@ -148,66 +149,14 @@ gimp_layer_new_from_pixbuf (gint32 image_ID,
if (layer == -1)
return -1;
- if (gimp_plugin_precision_enabled ())
- {
- GeglBuffer *dest_buffer;
-
- dest_buffer = gimp_drawable_get_buffer (layer);
-
- gegl_buffer_set (dest_buffer, GEGL_RECTANGLE (0, 0, width, height), 0,
- gimp_pixbuf_get_format (pixbuf),
- gdk_pixbuf_get_pixels (pixbuf),
- gdk_pixbuf_get_rowstride (pixbuf));
-
- 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);
-
- g_assert (bpp == rgn.bpp);
+ dest_buffer = gimp_drawable_get_buffer (layer);
- rowstride = gdk_pixbuf_get_rowstride (pixbuf);
- pixels = gdk_pixbuf_get_pixels (pixbuf);
+ gegl_buffer_set (dest_buffer, GEGL_RECTANGLE (0, 0, width, height), 0,
+ gimp_pixbuf_get_format (pixbuf),
+ gdk_pixbuf_get_pixels (pixbuf),
+ gdk_pixbuf_get_rowstride (pixbuf));
- for (pr = gimp_pixel_rgns_register (1, &rgn);
- pr != NULL;
- pr = gimp_pixel_rgns_process (pr))
- {
- const guchar *src = pixels + rgn.y * rowstride + rgn.x * bpp;
- guchar *dest = rgn.data;
- gint y;
-
- for (y = 0; y < rgn.h; y++)
- {
- memcpy (dest, src, rgn.w * rgn.bpp);
-
- src += rowstride;
- dest += rgn.rowstride;
- }
-
- if (range > 0.0)
- {
- done += rgn.h * rgn.w;
-
- if (count++ % 32 == 0)
- gimp_progress_update (progress_start +
- (gdouble) done / (width * height) * range);
- }
- }
-
- gimp_drawable_detach (drawable);
- }
+ g_object_unref (dest_buffer);
if (range > 0.0)
gimp_progress_update (progress_end);
@@ -244,6 +193,8 @@ gimp_layer_new_from_surface (gint32 image_ID,
gdouble progress_start,
gdouble progress_end)
{
+ GeglBuffer *src_buffer;
+ GeglBuffer *dest_buffer;
gint32 layer;
gint width;
gint height;
@@ -280,103 +231,14 @@ gimp_layer_new_from_surface (gint32 image_ID,
if (layer == -1)
return -1;
- if (gimp_plugin_precision_enabled ())
- {
- GeglBuffer *src_buffer;
- GeglBuffer *dest_buffer;
-
- src_buffer = gimp_cairo_surface_create_buffer (surface);
- dest_buffer = gimp_drawable_get_buffer (layer);
-
- gegl_buffer_copy (src_buffer, NULL, GEGL_ABYSS_NONE,
- dest_buffer, NULL);
-
- g_object_unref (src_buffer);
- g_object_unref (dest_buffer);
- }
- else
- {
- GimpDrawable *drawable;
- GimpPixelRgn rgn;
- const guchar *pixels;
- gpointer pr;
- gsize rowstride;
- guint count = 0;
- guint done = 0;
-
- drawable = gimp_drawable_get (layer);
-
- gimp_pixel_rgn_init (&rgn, drawable, 0, 0, width, height, TRUE, FALSE);
-
- rowstride = cairo_image_surface_get_stride (surface);
- pixels = cairo_image_surface_get_data (surface);
-
- for (pr = gimp_pixel_rgns_register (1, &rgn);
- pr != NULL;
- pr = gimp_pixel_rgns_process (pr))
- {
- const guchar *src = pixels + rgn.y * rowstride + rgn.x * 4;
- guchar *dest = rgn.data;
- gint y;
-
- switch (format)
- {
- case CAIRO_FORMAT_RGB24:
- for (y = 0; y < rgn.h; y++)
- {
- const guchar *s = src;
- guchar *d = dest;
- gint w = rgn.w;
-
- while (w--)
- {
- GIMP_CAIRO_RGB24_GET_PIXEL (s, d[0], d[1], d[2]);
-
- s += 4;
- d += 3;
- }
-
- src += rowstride;
- dest += rgn.rowstride;
- }
- break;
-
- case CAIRO_FORMAT_ARGB32:
- for (y = 0; y < rgn.h; y++)
- {
- const guchar *s = src;
- guchar *d = dest;
- gint w = rgn.w;
-
- while (w--)
- {
- GIMP_CAIRO_ARGB32_GET_PIXEL (s, d[0], d[1], d[2], d[3]);
-
- s += 4;
- d += 4;
- }
-
- src += rowstride;
- dest += rgn.rowstride;
- }
- break;
-
- default:
- break;
- }
-
- if (range > 0.0)
- {
- done += rgn.h * rgn.w;
+ src_buffer = gimp_cairo_surface_create_buffer (surface);
+ dest_buffer = gimp_drawable_get_buffer (layer);
- if (count++ % 32 == 0)
- gimp_progress_update (progress_start +
- (gdouble) done / (width * height) * range);
- }
- }
+ gegl_buffer_copy (src_buffer, NULL, GEGL_ABYSS_NONE,
+ dest_buffer, NULL);
- gimp_drawable_detach (drawable);
- }
+ g_object_unref (src_buffer);
+ g_object_unref (dest_buffer);
if (range > 0.0)
gimp_progress_update (progress_end);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]