Remove GimpUint8Array in favor of GBytes

GLib has a specific type for byte arrays: `GBytes` (and it's underlying
GType `G_TYPE_BYTES`).

By using this type, we can avoid having a `GimpUint8Array` which is a
bit cumbersome to use for both the C API, as well as bindings. By using
`GBytes`, we allow other languages to pass on byte arrays as they are
used to, while the bindings will make sure to do the right thing.

In the end, it makes the API a little bit simpler for everyone, and
reduces confusion for people who are used to working with byte arrays
in other C/GLib based code (and not having 2 different types to denote
the same thing).

Related: https://gitlab.gnome.org/GNOME/gimp/-/issues/5919
This commit is contained in:
Niels De Graef 2023-05-23 23:37:46 +02:00
parent 9e79bb78a1
commit 89c359ce47
98 changed files with 841 additions and 1681 deletions

View file

@ -314,31 +314,31 @@ gimp_aspect_preview_draw_buffer (GimpPreview *preview,
}
else
{
guchar *sel;
guchar *src;
GBytes *sel;
GBytes *src;
GimpSelection *selection;
gint w, h;
gint bpp;
selection = gimp_image_get_selection (image);
w = width;
h = height;
src = gimp_drawable_get_thumbnail_data (priv->drawable,
width, height,
&w, &h, &bpp);
sel = gimp_drawable_get_thumbnail_data (GIMP_DRAWABLE (selection),
width, height,
&w, &h, &bpp);
gimp_preview_area_mask (GIMP_PREVIEW_AREA (area),
0, 0, width, height,
gimp_drawable_type (priv->drawable),
src, width * gimp_drawable_get_bpp (priv->drawable),
g_bytes_get_data (src, NULL),
width * gimp_drawable_get_bpp (priv->drawable),
buffer, rowstride,
sel, width);
g_bytes_get_data (sel, NULL), width);
g_free (sel);
g_free (src);
g_bytes_unref (sel);
g_bytes_unref (src);
}
}