From cfbde0f3019bb3a0c45a03943dc49c82eac73963 Mon Sep 17 00:00:00 2001 From: Dave Neary Date: Sat, 19 Jul 2003 10:51:18 +0000 Subject: [PATCH] Fixed a mistake in the code which does a pattern clone. Closes bug 2003-07-19 Dave Neary * app/paint/gimpclone.c: Fixed a mistake in the code which does a pattern clone. Closes bug #117433. * app/widgets/gimpbrushfactoryview.c: Added a tooltip for the Spacing slider. --- ChangeLog | 8 ++++++++ app/paint/gimpclone.c | 15 +++++++++------ app/paint/gimpsourcecore.c | 15 +++++++++------ app/widgets/gimpbrushfactoryview.c | 3 ++- 4 files changed, 28 insertions(+), 13 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3dc4cc97d7..4b327b5406 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2003-07-19 Dave Neary + + * app/paint/gimpclone.c: Fixed a mistake in the code which does + a pattern clone. Closes bug #117433. + + * app/widgets/gimpbrushfactoryview.c: Added a tooltip for the + Spacing slider. + 2003-07-19 Sven Neumann * libgimpwidgets/gimpcolornotebook.c: save some space by showing diff --git a/app/paint/gimpclone.c b/app/paint/gimpclone.c index 4396d68f3f..2a29cb6f4a 100644 --- a/app/paint/gimpclone.c +++ b/app/paint/gimpclone.c @@ -504,8 +504,11 @@ gimp_clone_line_pattern (GimpImage *dest, guchar *pat, *p; GimpImageBaseType color_type; gint alpha; + gint pat_bytes; gint i; + pat_bytes = pattern->mask->bytes; + /* Make sure x, y are positive */ while (x < 0) x += pattern->mask->width; @@ -514,21 +517,21 @@ gimp_clone_line_pattern (GimpImage *dest, /* Get a pointer to the appropriate scanline of the pattern buffer */ pat = temp_buf_data (pattern->mask) + - (y % pattern->mask->height) * pattern->mask->width * pattern->mask->bytes; + (y % pattern->mask->height) * pattern->mask->width * pat_bytes; - color_type = (pattern->mask->bytes == 3 || - pattern->mask->bytes == 4) ? GIMP_RGB : GIMP_GRAY; + color_type = (pat_bytes == 3 || + pat_bytes == 4) ? GIMP_RGB : GIMP_GRAY; alpha = bytes - 1; for (i = 0; i < width; i++) { - p = pat + ((i + x) % pattern->mask->width) * pattern->mask->bytes; + p = pat + ((i + x) % pattern->mask->width) * pat_bytes; gimp_image_transform_color (dest, drawable, p, d, color_type); - if (pattern->mask->bytes == 2 || pattern->mask->bytes == 4) - d[alpha] = p[alpha]; + if (pat_bytes == 2 || pat_bytes == 4) + d[alpha] = p[pat_bytes - 1]; else d[alpha] = OPAQUE_OPACITY; diff --git a/app/paint/gimpsourcecore.c b/app/paint/gimpsourcecore.c index 4396d68f3f..2a29cb6f4a 100644 --- a/app/paint/gimpsourcecore.c +++ b/app/paint/gimpsourcecore.c @@ -504,8 +504,11 @@ gimp_clone_line_pattern (GimpImage *dest, guchar *pat, *p; GimpImageBaseType color_type; gint alpha; + gint pat_bytes; gint i; + pat_bytes = pattern->mask->bytes; + /* Make sure x, y are positive */ while (x < 0) x += pattern->mask->width; @@ -514,21 +517,21 @@ gimp_clone_line_pattern (GimpImage *dest, /* Get a pointer to the appropriate scanline of the pattern buffer */ pat = temp_buf_data (pattern->mask) + - (y % pattern->mask->height) * pattern->mask->width * pattern->mask->bytes; + (y % pattern->mask->height) * pattern->mask->width * pat_bytes; - color_type = (pattern->mask->bytes == 3 || - pattern->mask->bytes == 4) ? GIMP_RGB : GIMP_GRAY; + color_type = (pat_bytes == 3 || + pat_bytes == 4) ? GIMP_RGB : GIMP_GRAY; alpha = bytes - 1; for (i = 0; i < width; i++) { - p = pat + ((i + x) % pattern->mask->width) * pattern->mask->bytes; + p = pat + ((i + x) % pattern->mask->width) * pat_bytes; gimp_image_transform_color (dest, drawable, p, d, color_type); - if (pattern->mask->bytes == 2 || pattern->mask->bytes == 4) - d[alpha] = p[alpha]; + if (pat_bytes == 2 || pat_bytes == 4) + d[alpha] = p[pat_bytes - 1]; else d[alpha] = OPAQUE_OPACITY; diff --git a/app/widgets/gimpbrushfactoryview.c b/app/widgets/gimpbrushfactoryview.c index e66ae9b7c4..082b8f2a5d 100644 --- a/app/widgets/gimpbrushfactoryview.c +++ b/app/widgets/gimpbrushfactoryview.c @@ -115,7 +115,8 @@ gimp_brush_factory_view_init (GimpBrushFactoryView *view) _("Spacing:"), -1, -1, 0.0, 1.0, 1000.0, 1.0, 10.0, 1, TRUE, 0.0, 0.0, - NULL, NULL)); + _("Percentage of width of brush"), + NULL)); view->spacing_scale = GIMP_SCALE_ENTRY_SCALE (view->spacing_adjustment);