diff --git a/ChangeLog b/ChangeLog index b84cfbaac9..697089ba29 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2005-03-14 Shlomi Fish + + * app/paint-funcs/paint-funcs.c + * app/paint-funcs/paint-funcs-generic.h: fix bug #143315. When the + visibility of the Alpha channel is turned off, it should make alpha=255. + 2005-03-13 Manish Singh * app/composite/gimp-composite-altivec.[ch]: More accelerated functions diff --git a/app/paint-funcs/paint-funcs-generic.h b/app/paint-funcs/paint-funcs-generic.h index 165b5745ff..c526e37fa6 100644 --- a/app/paint-funcs/paint-funcs-generic.h +++ b/app/paint-funcs/paint-funcs-generic.h @@ -1568,6 +1568,9 @@ initial_inten_pixels (const guchar *src, const guchar *srcp; const gint dest_bytes = bytes + 1; + if (!affect[bytes]) + opacity = 255; + if (mask) { m = mask; @@ -1578,8 +1581,6 @@ initial_inten_pixels (const guchar *src, if (bytes == 3 && affect[0] && affect[1] && affect[2]) { - if (!affect[bytes]) - opacity = 0; destp = dest + bytes; @@ -1629,8 +1630,6 @@ initial_inten_pixels (const guchar *src, } /* fill the alpha channel */ - if (!affect[bytes]) - opacity = 0; destp = dest + bytes; @@ -1656,9 +1655,6 @@ initial_inten_pixels (const guchar *src, if (bytes == 3 && affect[0] && affect[1] && affect[2]) { - if (!affect[bytes]) - opacity = 0; - destp = dest + bytes; while(length--) @@ -1695,8 +1691,6 @@ initial_inten_pixels (const guchar *src, } /* fill the alpha channel */ - if (!affect[bytes]) - opacity = 0; destp = dest + bytes; @@ -1733,7 +1727,7 @@ initial_inten_a_pixels (const guchar *src, /* Set the alpha channel */ dest[alpha] = affect [alpha] ? INT_MULT3(opacity, src[alpha], *m, tmp) - : 0; + : 255; m++; @@ -1749,7 +1743,7 @@ initial_inten_a_pixels (const guchar *src, dest[b] = src[b] * affect[b]; /* Set the alpha channel */ - dest[alpha] = affect [alpha] ? INT_MULT(opacity , src[alpha], tmp) : 0; + dest[alpha] = affect [alpha] ? INT_MULT(opacity , src[alpha], tmp) : 255; dest += bytes; src += bytes; diff --git a/app/paint-funcs/paint-funcs.c b/app/paint-funcs/paint-funcs.c index 2b87b12c91..dd56d9f9b4 100644 --- a/app/paint-funcs/paint-funcs.c +++ b/app/paint-funcs/paint-funcs.c @@ -832,7 +832,12 @@ combine_inten_and_inten_a_pixels (const guchar *src1, }*/ #define alphify(src2_alpha,new_alpha) \ - if (src2_alpha != 0 && new_alpha != 0) \ + if (! affect[alpha]) \ + { \ + b = alpha; \ + do { b--; dest[b] = src2[b]; } while(b); \ + } \ + else if (src2_alpha != 0 && new_alpha != 0) \ { \ b = alpha; \ if (src2_alpha == new_alpha){ \ @@ -966,6 +971,24 @@ combine_inten_a_and_inten_pixels (const guchar *src1, } } +#define copy_bytes1() \ + j = bytes * sizeof(int); \ + if (affect[alpha]) \ + { \ + src2 += j; \ + while (j--) \ + { \ + *(dest++) = *(src1++); \ + } \ + } \ + else \ + { \ + src1 += j; \ + while (j--) \ + { \ + *(dest++) = *(src2++); \ + } \ + } void combine_inten_a_and_inten_a_pixels (const guchar *src1, @@ -1067,12 +1090,7 @@ combine_inten_a_and_inten_a_pixels (const guchar *src1, } else { - j = bytes * sizeof(int); - src2 += j; - while (j--) - { - *(dest++) = *(src1++); - } + copy_bytes1(); } mask_ip++; } @@ -1185,12 +1203,7 @@ combine_inten_a_and_inten_a_pixels (const guchar *src1, } else { - j = bytes * sizeof(int); - src2 += j; - while (j--) - { - *(dest++) = *(src1++); - } + copy_bytes1(); } mask_ip++; } @@ -1280,6 +1293,7 @@ combine_inten_a_and_inten_a_pixels (const guchar *src1, } } } +#undef copy_bytes1 #undef alphify void