mirror of https://github.com/GNOME/gimp.git
app: several GimpCanvasPath fixes
- fix get_extents() - don't use cairo_path_destroy() for a path we allocated ourselves - pass a const GimpBezierDesc to new()
This commit is contained in:
parent
149ba1ec4b
commit
0b078d3dad
|
@ -156,7 +156,7 @@ gimp_canvas_path_set_property (GObject *object,
|
||||||
|
|
||||||
if (private->path)
|
if (private->path)
|
||||||
{
|
{
|
||||||
cairo_path_destroy (private->path);
|
gimp_bezier_desc_free (private->path, TRUE);
|
||||||
private->path = NULL;
|
private->path = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,10 +240,12 @@ gimp_canvas_path_get_extents (GimpCanvasItem *item,
|
||||||
|
|
||||||
cr = gdk_cairo_create (gtk_widget_get_window (shell->canvas));
|
cr = gdk_cairo_create (gtk_widget_get_window (shell->canvas));
|
||||||
|
|
||||||
|
cairo_save (cr);
|
||||||
cairo_translate (cr, - shell->offset_x, - shell->offset_y);
|
cairo_translate (cr, - shell->offset_x, - shell->offset_y);
|
||||||
cairo_scale (cr, shell->scale_x, shell->scale_y);
|
cairo_scale (cr, shell->scale_x, shell->scale_y);
|
||||||
|
|
||||||
cairo_append_path (cr, private->path);
|
cairo_append_path (cr, private->path);
|
||||||
|
cairo_restore (cr);
|
||||||
|
|
||||||
cairo_path_extents (cr, &x1, &y1, &x2, &y2);
|
cairo_path_extents (cr, &x1, &y1, &x2, &y2);
|
||||||
|
|
||||||
|
@ -252,14 +254,14 @@ gimp_canvas_path_get_extents (GimpCanvasItem *item,
|
||||||
if (private->filled)
|
if (private->filled)
|
||||||
{
|
{
|
||||||
rectangle.x = floor (x1 - 1.0);
|
rectangle.x = floor (x1 - 1.0);
|
||||||
rectangle.y = floor (x1 - 1.0);
|
rectangle.y = floor (y1 - 1.0);
|
||||||
rectangle.width = ceil (x2 + 1.0) - rectangle.x;
|
rectangle.width = ceil (x2 + 1.0) - rectangle.x;
|
||||||
rectangle.height = ceil (y2 + 1.0) - rectangle.y;
|
rectangle.height = ceil (y2 + 1.0) - rectangle.y;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
rectangle.x = floor (x1 - 1.5);
|
rectangle.x = floor (x1 - 1.5);
|
||||||
rectangle.y = floor (x1 - 1.5);
|
rectangle.y = floor (y1 - 1.5);
|
||||||
rectangle.width = ceil (x2 + 1.5) - rectangle.x;
|
rectangle.width = ceil (x2 + 1.5) - rectangle.x;
|
||||||
rectangle.height = ceil (y2 + 1.5) - rectangle.y;
|
rectangle.height = ceil (y2 + 1.5) - rectangle.y;
|
||||||
}
|
}
|
||||||
|
@ -295,7 +297,7 @@ gimp_canvas_path_stroke (GimpCanvasItem *item,
|
||||||
|
|
||||||
GimpCanvasItem *
|
GimpCanvasItem *
|
||||||
gimp_canvas_path_new (GimpDisplayShell *shell,
|
gimp_canvas_path_new (GimpDisplayShell *shell,
|
||||||
GimpBezierDesc *path,
|
const GimpBezierDesc *path,
|
||||||
gboolean filled,
|
gboolean filled,
|
||||||
gboolean path_style)
|
gboolean path_style)
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,7 +50,7 @@ struct _GimpCanvasPathClass
|
||||||
GType gimp_canvas_path_get_type (void) G_GNUC_CONST;
|
GType gimp_canvas_path_get_type (void) G_GNUC_CONST;
|
||||||
|
|
||||||
GimpCanvasItem * gimp_canvas_path_new (GimpDisplayShell *shell,
|
GimpCanvasItem * gimp_canvas_path_new (GimpDisplayShell *shell,
|
||||||
GimpBezierDesc *path,
|
const GimpBezierDesc *path,
|
||||||
gboolean filled,
|
gboolean filled,
|
||||||
gboolean path_style);
|
gboolean path_style);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue