mirror of https://github.com/GNOME/gimp.git
app/core/gimpbrush.c some minor fixes and stylistic paranoia i overlooked
2007-03-14 Michael Natterer <mitch@gimp.org> * app/core/gimpbrush.c * app/core/gimpbrushgenerated.c: some minor fixes and stylistic paranoia i overlooked in last night's late review. svn path=/trunk/; revision=22119
This commit is contained in:
parent
74927c03a4
commit
94fe72a220
|
@ -1,3 +1,9 @@
|
|||
2007-03-14 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/core/gimpbrush.c
|
||||
* app/core/gimpbrushgenerated.c: some minor fixes and stylistic
|
||||
paranoia i overlooked in last night's late review.
|
||||
|
||||
2007-03-14 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/display/gimpdisplayshell.[ch]: cache the display scale
|
||||
|
|
|
@ -385,16 +385,15 @@ gimp_brush_scale_buf (TempBuf *brush_buf,
|
|||
TempBuf *dest_brush_buf;
|
||||
|
||||
pixel_region_init_temp_buf (&source_region, brush_buf,
|
||||
brush_buf->x,
|
||||
brush_buf->y,
|
||||
0, 0,
|
||||
brush_buf->width,
|
||||
brush_buf->height);
|
||||
|
||||
dest_brush_buf = temp_buf_new (dest_width, dest_height, brush_buf->bytes, 0, 0, NULL);
|
||||
dest_brush_buf = temp_buf_new (dest_width, dest_height, brush_buf->bytes,
|
||||
0, 0, NULL);
|
||||
|
||||
pixel_region_init_temp_buf (&dest_region, dest_brush_buf,
|
||||
brush_buf->x,
|
||||
brush_buf->y,
|
||||
0, 0,
|
||||
dest_width,
|
||||
dest_height);
|
||||
|
||||
|
@ -428,13 +427,13 @@ gimp_brush_real_scale_mask (GimpBrush *brush,
|
|||
|
||||
if (scale <= 1.0)
|
||||
{
|
||||
/* Downscaling with brush_scale_mask is much faster than with
|
||||
/* Downscaling with brush_scale_mask is much faster than with
|
||||
* gimp_brush_scale_buf.
|
||||
*/
|
||||
return brush_scale_mask (brush->mask, dest_width, dest_height);
|
||||
}
|
||||
else
|
||||
return gimp_brush_scale_buf (brush->mask, dest_width, dest_height);
|
||||
|
||||
return gimp_brush_scale_buf (brush->mask, dest_width, dest_height);
|
||||
}
|
||||
|
||||
static TempBuf *
|
||||
|
@ -451,14 +450,16 @@ gimp_brush_real_scale_pixmap (GimpBrush *brush,
|
|||
|
||||
if (scale <= 1.0)
|
||||
{
|
||||
/* Downscaling with brush_scale_pixmap is much faster than with
|
||||
* gimp_brush_scale_buf. */
|
||||
/* Downscaling with brush_scale_pixmap is much faster than with
|
||||
* gimp_brush_scale_buf.
|
||||
*/
|
||||
return brush_scale_pixmap (brush->pixmap, dest_width, dest_height);
|
||||
}
|
||||
else
|
||||
return gimp_brush_scale_buf (brush->pixmap, dest_width, dest_height);
|
||||
|
||||
return gimp_brush_scale_buf (brush->pixmap, dest_width, dest_height);
|
||||
}
|
||||
|
||||
|
||||
/* public functions */
|
||||
|
||||
GimpData *
|
||||
|
@ -518,6 +519,21 @@ gimp_brush_want_null_motion (GimpBrush *brush,
|
|||
cur_coords);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_brush_scale_size (GimpBrush *brush,
|
||||
gdouble scale,
|
||||
gint *width,
|
||||
gint *height)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_BRUSH (brush));
|
||||
g_return_if_fail (scale > 0.0);
|
||||
g_return_if_fail (width != NULL);
|
||||
g_return_if_fail (height != NULL);
|
||||
|
||||
return GIMP_BRUSH_GET_CLASS (brush)->scale_size (brush, scale,
|
||||
width, height);
|
||||
}
|
||||
|
||||
TempBuf *
|
||||
gimp_brush_scale_mask (GimpBrush *brush,
|
||||
gdouble scale)
|
||||
|
@ -539,18 +555,6 @@ gimp_brush_scale_pixmap (GimpBrush *brush,
|
|||
return GIMP_BRUSH_GET_CLASS (brush)->scale_pixmap (brush, scale);
|
||||
}
|
||||
|
||||
void
|
||||
gimp_brush_scale_size (GimpBrush *brush,
|
||||
gdouble scale,
|
||||
gint *width,
|
||||
gint *height)
|
||||
{
|
||||
g_return_if_fail (GIMP_IS_BRUSH (brush));
|
||||
g_return_if_fail (scale > 0.0);
|
||||
|
||||
return GIMP_BRUSH_GET_CLASS (brush)->scale_size (brush, scale, width, height);
|
||||
}
|
||||
|
||||
TempBuf *
|
||||
gimp_brush_get_mask (const GimpBrush *brush)
|
||||
{
|
||||
|
|
|
@ -427,8 +427,8 @@ gimp_brush_generated_dirty (GimpData *data)
|
|||
}
|
||||
|
||||
/* This function is shared between gimp_brush_scale_size and
|
||||
* gimp_brush_generated_calc, therefore we provide a bunch of optional pointers
|
||||
* for returnvalues.
|
||||
* gimp_brush_generated_calc, therefore we provide a bunch of optional
|
||||
* pointers for returnvalues.
|
||||
*/
|
||||
static void
|
||||
gimp_brush_generated_get_half_size (GimpBrushGenerated *gbrush,
|
||||
|
@ -487,8 +487,9 @@ gimp_brush_generated_get_half_size (GimpBrushGenerated *gbrush,
|
|||
y_axis.y = c * radius;
|
||||
}
|
||||
|
||||
/* These will typically be set then this function is called by
|
||||
gimp_brush_generated_calc, which needs the values in its algorithms. */
|
||||
/* These will typically be set then this function is called by
|
||||
* gimp_brush_generated_calc, which needs the values in its algorithms.
|
||||
*/
|
||||
if (_s != NULL)
|
||||
*_s = s;
|
||||
|
||||
|
@ -503,28 +504,26 @@ gimp_brush_generated_get_half_size (GimpBrushGenerated *gbrush,
|
|||
}
|
||||
|
||||
static void
|
||||
gimp_brush_generated_real_scale_size (GimpBrush *brush,
|
||||
gimp_brush_generated_real_scale_size (GimpBrush *gbrush,
|
||||
gdouble scale,
|
||||
gint *width,
|
||||
gint *height)
|
||||
{
|
||||
GimpBrushGenerated *gbrush;
|
||||
GimpBrushGenerated *brush = GIMP_BRUSH_GENERATED (gbrush);
|
||||
gint half_width;
|
||||
gint half_height;
|
||||
|
||||
gbrush = GIMP_BRUSH_GENERATED (brush);
|
||||
|
||||
gimp_brush_generated_get_half_size (gbrush,
|
||||
gbrush->shape,
|
||||
gbrush->radius * scale,
|
||||
gbrush->spikes,
|
||||
gbrush->hardness,
|
||||
gbrush->aspect_ratio,
|
||||
gbrush->angle,
|
||||
gimp_brush_generated_get_half_size (brush,
|
||||
brush->shape,
|
||||
brush->radius * scale,
|
||||
brush->spikes,
|
||||
brush->hardness,
|
||||
brush->aspect_ratio,
|
||||
brush->angle,
|
||||
&half_width, &half_height,
|
||||
NULL, NULL, NULL, NULL);
|
||||
|
||||
*width = half_width * 2 + 1;
|
||||
*width = half_width * 2 + 1;
|
||||
*height = half_height * 2 + 1;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue