[gimp] gfig: Don't bother selecting if we're not going to fill the selection
- From: Mikael Magnusson <mikachu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] gfig: Don't bother selecting if we're not going to fill the selection
- Date: Sun, 25 Mar 2012 13:38:29 +0000 (UTC)
commit 0726abfa73b38c6c7eb667ff96ac38e6402e925a
Author: Mikael Magnusson <mikachu src gnome org>
Date: Sun Mar 25 15:03:37 2012 +0200
gfig: Don't bother selecting if we're not going to fill the selection
plug-ins/gfig/gfig-circle.c | 33 ++++++++++++++++++---------------
plug-ins/gfig/gfig-ellipse.c | 27 +++++++++++++++------------
plug-ins/gfig/gfig-poly.c | 25 ++++++++++++++-----------
plug-ins/gfig/gfig-rectangle.c | 27 +++++++++++++++------------
plug-ins/gfig/gfig-star.c | 25 ++++++++++++++-----------
5 files changed, 76 insertions(+), 61 deletions(-)
---
diff --git a/plug-ins/gfig/gfig-circle.c b/plug-ins/gfig/gfig-circle.c
index 0120a0a..a8c9d11 100644
--- a/plug-ins/gfig/gfig-circle.c
+++ b/plug-ins/gfig/gfig-circle.c
@@ -117,21 +117,24 @@ d_paint_circle (GfigObject *obj)
else
scale_to_xy (&dpnts[0], 2);
- gimp_context_push ();
- gimp_context_set_antialias (selopt.antia);
- gimp_context_set_feather (selopt.feather);
- gimp_context_set_feather_radius (selopt.feather_radius, selopt.feather_radius);
- gimp_image_select_ellipse (gfig_context->image_id,
- selopt.type,
- dpnts[0], dpnts[1],
- dpnts[2], dpnts[3]);
- gimp_context_pop ();
-
- paint_layer_fill (center_pnt->pnt.x - radius,
- center_pnt->pnt.y - radius,
- center_pnt->pnt.x + radius,
- center_pnt->pnt.y + radius);
- gimp_selection_none (gfig_context->image_id);
+ if (gfig_context_get_current_style ()->fill_type != FILL_NONE)
+ {
+ gimp_context_push ();
+ gimp_context_set_antialias (selopt.antia);
+ gimp_context_set_feather (selopt.feather);
+ gimp_context_set_feather_radius (selopt.feather_radius, selopt.feather_radius);
+ gimp_image_select_ellipse (gfig_context->image_id,
+ selopt.type,
+ dpnts[0], dpnts[1],
+ dpnts[2], dpnts[3]);
+ gimp_context_pop ();
+
+ paint_layer_fill (center_pnt->pnt.x - radius,
+ center_pnt->pnt.y - radius,
+ center_pnt->pnt.x + radius,
+ center_pnt->pnt.y + radius);
+ gimp_selection_none (gfig_context->image_id);
+ }
/* Drawing a circle may be harder than stroking a circular selection,
* but we have to do it or we will not be able to draw outside of the
diff --git a/plug-ins/gfig/gfig-ellipse.c b/plug-ins/gfig/gfig-ellipse.c
index 5ff0aff..405f21c 100644
--- a/plug-ins/gfig/gfig-ellipse.c
+++ b/plug-ins/gfig/gfig-ellipse.c
@@ -124,18 +124,21 @@ d_paint_ellipse (GfigObject *obj)
else
scale_to_xy (&dpnts[0], 2);
- gimp_context_push ();
- gimp_context_set_antialias (selopt.antia);
- gimp_context_set_feather (selopt.feather);
- gimp_context_set_feather_radius (selopt.feather_radius, selopt.feather_radius);
- gimp_image_select_ellipse (gfig_context->image_id,
- selopt.type,
- dpnts[0], dpnts[1],
- dpnts[2], dpnts[3]);
- gimp_context_pop ();
-
- paint_layer_fill (top_x, top_y, top_x + bound_wx, top_y + bound_wy);
- gimp_selection_none (gfig_context->image_id);
+ if (gfig_context_get_current_style ()->fill_type != FILL_NONE)
+ {
+ gimp_context_push ();
+ gimp_context_set_antialias (selopt.antia);
+ gimp_context_set_feather (selopt.feather);
+ gimp_context_set_feather_radius (selopt.feather_radius, selopt.feather_radius);
+ gimp_image_select_ellipse (gfig_context->image_id,
+ selopt.type,
+ dpnts[0], dpnts[1],
+ dpnts[2], dpnts[3]);
+ gimp_context_pop ();
+
+ paint_layer_fill (top_x, top_y, top_x + bound_wx, top_y + bound_wy);
+ gimp_selection_none (gfig_context->image_id);
+ }
if (obj->style.paint_type == PAINT_BRUSH_TYPE)
{
diff --git a/plug-ins/gfig/gfig-poly.c b/plug-ins/gfig/gfig-poly.c
index 7a073c5..6cb06d5 100644
--- a/plug-ins/gfig/gfig-poly.c
+++ b/plug-ins/gfig/gfig-poly.c
@@ -248,17 +248,20 @@ d_paint_poly (GfigObject *obj)
}
- gimp_context_push ();
- gimp_context_set_antialias (selopt.antia);
- gimp_context_set_feather (selopt.feather);
- gimp_context_set_feather_radius (selopt.feather_radius, selopt.feather_radius);
- gimp_image_select_polygon (gfig_context->image_id,
- selopt.type,
- i, line_pnts);
- gimp_context_pop ();
-
- paint_layer_fill (min_max[0], min_max[1], min_max[2], min_max[3]);
- gimp_selection_none (gfig_context->image_id);
+ if (gfig_context_get_current_style ()->fill_type != FILL_NONE)
+ {
+ gimp_context_push ();
+ gimp_context_set_antialias (selopt.antia);
+ gimp_context_set_feather (selopt.feather);
+ gimp_context_set_feather_radius (selopt.feather_radius, selopt.feather_radius);
+ gimp_image_select_polygon (gfig_context->image_id,
+ selopt.type,
+ i, line_pnts);
+ gimp_context_pop ();
+
+ paint_layer_fill (min_max[0], min_max[1], min_max[2], min_max[3]);
+ gimp_selection_none (gfig_context->image_id);
+ }
if (obj->style.paint_type == PAINT_BRUSH_TYPE)
gfig_paint (selvals.brshtype, gfig_context->drawable_id, i, line_pnts);
diff --git a/plug-ins/gfig/gfig-rectangle.c b/plug-ins/gfig/gfig-rectangle.c
index 6baf6a9..e0df2d7 100644
--- a/plug-ins/gfig/gfig-rectangle.c
+++ b/plug-ins/gfig/gfig-rectangle.c
@@ -115,18 +115,21 @@ d_paint_rectangle (GfigObject *obj)
else
scale_to_xy (&dpnts[0], 2);
- gimp_context_push ();
- gimp_context_set_feather (selopt.feather);
- gimp_context_set_feather_radius (selopt.feather_radius, selopt.feather_radius);
- gimp_image_select_rectangle (gfig_context->image_id,
- selopt.type,
- dpnts[0], dpnts[1],
- dpnts[2] - dpnts[0],
- dpnts[3] - dpnts[1]);
- gimp_context_pop ();
-
- paint_layer_fill (dpnts[0], dpnts[1], dpnts[2], dpnts[3]);
- gimp_selection_none (gfig_context->image_id);
+ if (gfig_context_get_current_style ()->fill_type != FILL_NONE)
+ {
+ gimp_context_push ();
+ gimp_context_set_feather (selopt.feather);
+ gimp_context_set_feather_radius (selopt.feather_radius, selopt.feather_radius);
+ gimp_image_select_rectangle (gfig_context->image_id,
+ selopt.type,
+ dpnts[0], dpnts[1],
+ dpnts[2] - dpnts[0],
+ dpnts[3] - dpnts[1]);
+ gimp_context_pop ();
+
+ paint_layer_fill (dpnts[0], dpnts[1], dpnts[2], dpnts[3]);
+ gimp_selection_none (gfig_context->image_id);
+ }
if (obj->style.paint_type == PAINT_BRUSH_TYPE)
{
diff --git a/plug-ins/gfig/gfig-star.c b/plug-ins/gfig/gfig-star.c
index ca995c7..29a3e45 100644
--- a/plug-ins/gfig/gfig-star.c
+++ b/plug-ins/gfig/gfig-star.c
@@ -309,17 +309,20 @@ d_paint_star (GfigObject *obj)
scale_to_xy (min_max, 2);
}
- gimp_context_push ();
- gimp_context_set_antialias (selopt.antia);
- gimp_context_set_feather (selopt.feather);
- gimp_context_set_feather_radius (selopt.feather_radius, selopt.feather_radius);
- gimp_image_select_polygon (gfig_context->image_id,
- selopt.type,
- i, line_pnts);
- gimp_context_pop ();
-
- paint_layer_fill (min_max[0], min_max[1], min_max[2], min_max[3]);
- gimp_selection_none (gfig_context->image_id);
+ if (gfig_context_get_current_style ()->fill_type != FILL_NONE)
+ {
+ gimp_context_push ();
+ gimp_context_set_antialias (selopt.antia);
+ gimp_context_set_feather (selopt.feather);
+ gimp_context_set_feather_radius (selopt.feather_radius, selopt.feather_radius);
+ gimp_image_select_polygon (gfig_context->image_id,
+ selopt.type,
+ i, line_pnts);
+ gimp_context_pop ();
+
+ paint_layer_fill (min_max[0], min_max[1], min_max[2], min_max[3]);
+ gimp_selection_none (gfig_context->image_id);
+ }
if (obj->style.paint_type == PAINT_BRUSH_TYPE)
gfig_paint (selvals.brshtype, gfig_context->drawable_id, i, line_pnts);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]