Commit c105447b authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann
Browse files

handle grayscale buffers (bug #127666).

2003-11-22  Sven Neumann  <sven@gimp.org>

	* app/paint-funcs/paint-funcs.c (color_erase_inten_pixels): handle
	grayscale buffers (bug #127666).
parent 1bacaa64
2003-11-22 Sven Neumann <sven@gimp.org>
* app/paint-funcs/paint-funcs.c (color_erase_inten_pixels): handle
grayscale buffers (bug #127666).
2003-11-22 Sven Neumann <sven@gimp.org>
 
Fixed some selection editor problems (bug #127644):
......@@ -1854,7 +1854,6 @@ color_erase_inten_pixels (const guchar *src1,
guint length,
guint bytes)
{
gint alpha;
guchar src2_alpha;
const guchar *m;
glong tmp;
......@@ -1865,30 +1864,38 @@ color_erase_inten_pixels (const guchar *src1,
else
m = &no_mask;
alpha = bytes - 1;
while (length --)
{
src2_alpha = INT_MULT3(src2[alpha], *m, opacity, tmp);
switch (bytes)
{
case 2:
src2_alpha = INT_MULT3 (src2[1], *m, opacity, tmp);
gimp_rgba_set_uchar (&color,
src1[0], src1[0], src1[0], src1[1]);
gimp_rgba_set_uchar (&bgcolor,
src2[0], src2[0], src2[0], src2_alpha);
color_erase_helper (&color, &bgcolor);
gimp_rgba_get_uchar (&color, dest, NULL, NULL, dest + 1);
break;
case 4:
src2_alpha = INT_MULT3 (src2[3], *m, opacity, tmp);
gimp_rgba_set_uchar (&color,
src1[0], src1[1], src1[2], src1[3]);
gimp_rgba_set_uchar (&bgcolor,
src2[0], src2[1], src2[2], src2_alpha);
gimp_rgba_set_uchar (&color,
src1 [0],
src1 [1],
src1 [2],
src1 [3]);
gimp_rgba_set_uchar (&bgcolor,
src2 [0],
src2 [1],
src2 [2],
src2_alpha);
color_erase_helper (&color, &bgcolor);
gimp_rgba_get_uchar (&color,
&(dest[0]),
&(dest[1]),
&(dest[2]),
&(dest[3]));
color_erase_helper (&color, &bgcolor);
gimp_rgba_get_uchar (&color, dest, dest + 1, dest + 2, dest + 3);
break;
}
if (mask)
m++;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment