gfig: Don't bother selecting if we're not going to fill the selection

This commit is contained in:
Mikael Magnusson 2012-03-25 15:03:37 +02:00
parent 34000d4ce2
commit 0726abfa73
5 changed files with 71 additions and 56 deletions

View File

@ -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 ();
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);
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

View File

@ -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 ();
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);
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)
{

View File

@ -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 ();
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);
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);

View File

@ -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 ();
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);
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)
{

View File

@ -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 ();
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);
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);