[gimp] Bug 771616 - Changing parametric brush Hardness parameter doesn't work properly
- From: N/A <ell src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 771616 - Changing parametric brush Hardness parameter doesn't work properly
- Date: Wed, 14 Jun 2017 19:22:00 +0000 (UTC)
commit c690ed6bf108a491c181640a7065f4e815d6a9c4
Author: Ell <ell_se yahoo com>
Date: Wed Jun 14 15:08:55 2017 -0400
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.
app/core/gimpbrush-transform.c | 16 ++++++
app/core/gimpbrush.c | 110 ++++++++++++++++-----------------------
app/core/gimpbrushgenerated.c | 8 +++
3 files changed, 69 insertions(+), 65 deletions(-)
---
diff --git a/app/core/gimpbrush-transform.c b/app/core/gimpbrush-transform.c
index f8af255..88b038c 100644
--- a/app/core/gimpbrush-transform.c
+++ b/app/core/gimpbrush-transform.c
@@ -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);
diff --git a/app/core/gimpbrush.c b/app/core/gimpbrush.c
index dff9464..907244e 100644
--- a/app/core/gimpbrush.c
+++ b/app/core/gimpbrush.c
@@ -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)
{
diff --git a/app/core/gimpbrushgenerated.c b/app/core/gimpbrushgenerated.c
index fa634a8..c832688 100644
--- a/app/core/gimpbrushgenerated.c
+++ b/app/core/gimpbrushgenerated.c
@@ -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,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]