mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-04 01:43:24 +00:00
app: gimp_view_render_temp_buf_to_surface(): fix component extraction
The code was still assuming that GimpTempBuf is always 8 bit. Fixed that, and optimized it to call babl_process() once per line instead of per pixel. Fixes #13253.
This commit is contained in:
parent
7121109655
commit
6151deaff9
1 changed files with 12 additions and 17 deletions
|
@ -1402,28 +1402,23 @@ gimp_view_render_temp_buf_to_surface (GimpViewRenderer *renderer,
|
||||||
dest += y * dest_stride + x * 4;
|
dest += y * dest_stride + x * 4;
|
||||||
|
|
||||||
fish = babl_fish (temp_buf_format,
|
fish = babl_fish (temp_buf_format,
|
||||||
babl_format ("cairo-RGB24"));
|
babl_format ("R~G~B~ u8"));
|
||||||
|
|
||||||
for (i = y; i < (y + height); i++)
|
for (i = 0; i < height; i++)
|
||||||
{
|
{
|
||||||
const guchar *s = src;
|
guchar line[width * 3];
|
||||||
guchar *d = dest;
|
const guchar *s = line;
|
||||||
|
guint32 *d = (guint32*) dest;
|
||||||
gint j;
|
gint j;
|
||||||
|
|
||||||
for (j = x; j < (x + width); j++, d += 4, s += bytes)
|
babl_process (fish, src, line, width);
|
||||||
{
|
|
||||||
if (bytes > 2)
|
|
||||||
{
|
|
||||||
guchar pixel[4] = { s[channel], s[channel], s[channel], 255 };
|
|
||||||
|
|
||||||
babl_process (fish, pixel, d, 1);
|
for (j = 0; j < width; j++)
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
guchar pixel[2] = { s[channel], 255 };
|
*d = s[channel] | s[channel] << 8 | s[channel] << 16;
|
||||||
|
|
||||||
babl_process (fish, pixel, d, 1);
|
s += 3;
|
||||||
}
|
d += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
src += rowstride;
|
src += rowstride;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue