diff --git a/ChangeLog b/ChangeLog index 854d0a72ad..7a5a6ab5ea 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2003-09-27 Michael Natterer + + * app/core/gimpdrawable-bucket-fill.c + (gimp_drawable_bucket_fill_full): set the transformed color's + alpha to OPAQUE so it works with color_region(). + + * app/core/gimpdrawable-stroke.c (gimp_drawable_stroke_vectors): + no need to transform the color into a newly allocated array, + simply use guchar[MAX_CHANNELS] instead. + + Cleaned up both functions to use RED_PIX, GREEN_PIX and BLUE_PIX + instead of 0, 1 and 2. + 2003-09-27 Michael Natterer * app/paint-funcs/paint-funcs.[ch]: added new functions diff --git a/app/core/gimpdrawable-bucket-fill.c b/app/core/gimpdrawable-bucket-fill.c index b26215b4b6..e1c4f4c1dc 100644 --- a/app/core/gimpdrawable-bucket-fill.c +++ b/app/core/gimpdrawable-bucket-fill.c @@ -134,8 +134,8 @@ gimp_drawable_bucket_fill_full (GimpDrawable *drawable, g_return_if_fail (GIMP_IS_DRAWABLE (drawable)); g_return_if_fail (fill_mode != GIMP_PATTERN_BUCKET_FILL || GIMP_IS_PATTERN (pattern)); - g_return_if_fail ((fill_mode != GIMP_FG_BUCKET_FILL && - fill_mode != GIMP_BG_BUCKET_FILL) || color != NULL); + g_return_if_fail (fill_mode == GIMP_PATTERN_BUCKET_FILL || + color != NULL); gimage = gimp_item_get_image (GIMP_ITEM (drawable)); @@ -146,9 +146,13 @@ gimp_drawable_bucket_fill_full (GimpDrawable *drawable, { guchar tmp_col[MAX_CHANNELS]; - gimp_rgb_get_uchar (color, &tmp_col[0], &tmp_col[1], &tmp_col[2]); + gimp_rgb_get_uchar (color, + &tmp_col[RED_PIX], + &tmp_col[GREEN_PIX], + &tmp_col[BLUE_PIX]); gimp_image_transform_color (gimage, drawable, col, GIMP_RGB, tmp_col); + col[gimp_drawable_bytes_with_alpha (drawable) - 1] = OPAQUE_OPACITY; } else if (fill_mode == GIMP_PATTERN_BUCKET_FILL) { @@ -245,7 +249,7 @@ gimp_drawable_bucket_fill_full (GimpDrawable *drawable, */ if (! has_alpha) { - bytes ++; + bytes++; has_alpha = TRUE; } } diff --git a/app/core/gimpdrawable-stroke.c b/app/core/gimpdrawable-stroke.c index 825975e9fe..804504826d 100644 --- a/app/core/gimpdrawable-stroke.c +++ b/app/core/gimpdrawable-stroke.c @@ -186,22 +186,21 @@ gimp_drawable_stroke_vectors (GimpDrawable *drawable, case GIMP_STROKE_STYLE_SOLID: { GimpRGB *color; - guchar ucolor[4] = { 0, 0, 0, OPAQUE_OPACITY }; - guchar *src_bytes; + guchar tmp_col[MAX_CHANNELS] = { 0, }; + guchar col[MAX_CHANNELS] = { 0, }; g_object_get (options, "foreground", &color, NULL); - gimp_rgb_get_uchar (color, ucolor + 0, ucolor + 1, ucolor + 2); + gimp_rgb_get_uchar (color, + &tmp_col[RED_PIX], + &tmp_col[GREEN_PIX], + &tmp_col[BLUE_PIX]); g_free (color); - src_bytes = g_malloc0 (bytes); - - src_bytes[bytes - 1] = OPAQUE_OPACITY; gimp_image_transform_color (GIMP_ITEM (drawable)->gimage, drawable, - src_bytes, GIMP_RGB, ucolor); + col, GIMP_RGB, tmp_col); + col[bytes - 1] = OPAQUE_OPACITY; - color_region_mask (&basePR, &maskPR, src_bytes); - - g_free (src_bytes); + color_region_mask (&basePR, &maskPR, col); } break;