GitLab repository storage has been migrated to hashed layout. Please contact Infrastructure team if you notice any issues with repositories or hooks.

Commit c690ed6b authored by Ell's avatar Ell

Bug 771616 - Changing parametric brush Hardness parameter doesn't work properly

Check if the brush parameters match the identity parameters, and
return the original brush mask/pixmap if they do, in the actual
mask/pixmap transformation virtual functions, instead of in their
wrappers.  While the identity parameters for raster brushes are
always scale=1, aspect-ratio=0, angle=0, and hardness=1, for
generated brushes they depend on the specific brush
parameterization.
parent ecf5a6e9
......@@ -176,6 +176,14 @@ gimp_brush_real_transform_mask (GimpBrush *brush,
source = gimp_brush_get_mask (brush);
if (scale == 1.0 &&
aspect_ratio == 0.0 &&
angle == 0.0 &&
hardness == 1.0)
{
return gimp_temp_buf_copy (source);
}
src_width = gimp_brush_get_width (brush);
src_height = gimp_brush_get_height (brush);
......@@ -467,6 +475,14 @@ gimp_brush_real_transform_pixmap (GimpBrush *brush,
source = gimp_brush_get_pixmap (brush);
if (scale == 1.0 &&
aspect_ratio == 0.0 &&
angle == 0.0 &&
hardness == 1.0)
{
return gimp_temp_buf_copy (source);
}
src_width = gimp_brush_get_width (brush);
src_height = gimp_brush_get_height (brush);
......
......@@ -676,45 +676,35 @@ gimp_brush_transform_mask (GimpBrush *brush,
if (! mask)
{
if (scale == 1.0 &&
aspect_ratio == 0.0 &&
angle == 0.0 &&
hardness == 1.0)
#if 0
/* This code makes sure that brushes using blur for hardness
* (all of them but generated) are blurred once and no more.
* It also makes hardnes dynamics not work for these brushes.
* This is intentional. Confoliving for each stamp is too expensive.*/
if (! brush->priv->blured_mask &&
! GIMP_IS_BRUSH_GENERATED(brush) &&
! GIMP_IS_BRUSH_PIPE(brush) && /*Cant cache pipes. Sanely anway*/
hardness < 1.0)
{
mask = gimp_temp_buf_copy (brush->priv->mask);
brush->priv->blured_mask = GIMP_BRUSH_GET_CLASS (brush)->transform_mask (brush,
1.0,
0.0,
0.0,
hardness);
brush->priv->blur_hardness = hardness;
}
else
{
#if 0
/* This code makes sure that brushes using blur for hardness
* (all of them but generated) are blurred once and no more.
* It also makes hardnes dynamics not work for these brushes.
* This is intentional. Confoliving for each stamp is too expensive.*/
if (! brush->priv->blured_mask &&
! GIMP_IS_BRUSH_GENERATED(brush) &&
! GIMP_IS_BRUSH_PIPE(brush) && /*Cant cache pipes. Sanely anway*/
hardness < 1.0)
{
brush->priv->blured_mask = GIMP_BRUSH_GET_CLASS (brush)->transform_mask (brush,
1.0,
0.0,
0.0,
hardness);
brush->priv->blur_hardness = hardness;
}
if (brush->priv->blured_mask)
{
effective_hardness = 1.0; /*Hardness has already been applied*/
}
if (brush->priv->blured_mask)
{
effective_hardness = 1.0; /*Hardness has already been applied*/
}
#endif
mask = GIMP_BRUSH_GET_CLASS (brush)->transform_mask (brush,
scale,
aspect_ratio,
angle,
effective_hardness);
}
mask = GIMP_BRUSH_GET_CLASS (brush)->transform_mask (brush,
scale,
aspect_ratio,
angle,
effective_hardness);
if (op)
{
......@@ -780,40 +770,30 @@ gimp_brush_transform_pixmap (GimpBrush *brush,
if (! pixmap)
{
if (scale == 1.0 &&
aspect_ratio == 0.0 &&
angle == 0.0 &&
hardness == 1.0)
{
pixmap = gimp_temp_buf_copy (brush->priv->pixmap);
}
else
{
#if 0
if (! brush->priv->blured_pixmap &&
! GIMP_IS_BRUSH_GENERATED(brush) &&
! GIMP_IS_BRUSH_PIPE(brush) /*Cant cache pipes. Sanely anway*/
&& hardness < 1.0)
{
brush->priv->blured_pixmap = GIMP_BRUSH_GET_CLASS (brush)->transform_pixmap (brush,
1.0,
0.0,
0.0,
hardness);
brush->priv->blur_hardness = hardness;
}
if (brush->priv->blured_pixmap) {
effective_hardness = 1.0; /*Hardness has already been applied*/
}
if (! brush->priv->blured_pixmap &&
! GIMP_IS_BRUSH_GENERATED(brush) &&
! GIMP_IS_BRUSH_PIPE(brush) /*Cant cache pipes. Sanely anway*/
&& hardness < 1.0)
{
brush->priv->blured_pixmap = GIMP_BRUSH_GET_CLASS (brush)->transform_pixmap (brush,
1.0,
0.0,
0.0,
hardness);
brush->priv->blur_hardness = hardness;
}
if (brush->priv->blured_pixmap) {
effective_hardness = 1.0; /*Hardness has already been applied*/
}
#endif
pixmap = GIMP_BRUSH_GET_CLASS (brush)->transform_pixmap (brush,
scale,
aspect_ratio,
angle,
effective_hardness);
}
pixmap = GIMP_BRUSH_GET_CLASS (brush)->transform_pixmap (brush,
scale,
aspect_ratio,
angle,
effective_hardness);
if (op)
{
......
......@@ -356,6 +356,14 @@ gimp_brush_generated_transform_mask (GimpBrush *gbrush,
else if (angle > 180.0)
angle = fmod (angle, 180.0);
if (scale == 1.0 &&
ratio == brush->aspect_ratio &&
angle == brush->angle &&
hardness == brush->hardness)
{
return gimp_temp_buf_copy (gimp_brush_get_mask (gbrush));
}
return gimp_brush_generated_calc (brush,
brush->shape,
brush->radius * scale,
......
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