Bug 645345: 'Color Management' display filter causes performance problems

This commit is contained in:
Massimo Valentini 2012-06-09 15:36:34 +02:00
parent 9f33f384e7
commit 1338bba7db
2 changed files with 39 additions and 8 deletions

View File

@ -292,9 +292,11 @@ static cairo_region_t *
gimp_canvas_arc_get_extents (GimpCanvasItem *item,
GimpDisplayShell *shell)
{
cairo_rectangle_int_t rectangle;
gdouble center_x, center_y;
gdouble radius_x, radius_y;
GimpCanvasArcPrivate *private = GET_PRIVATE (item);
cairo_region_t *region;
cairo_rectangle_int_t rectangle;
gdouble center_x, center_y;
gdouble radius_x, radius_y;
gimp_canvas_arc_transform (item, shell,
&center_x, &center_y,
@ -305,7 +307,24 @@ gimp_canvas_arc_get_extents (GimpCanvasItem *item,
rectangle.width = ceil (center_x + radius_x + 1.5) - rectangle.x;
rectangle.height = ceil (center_y + radius_y + 1.5) - rectangle.y;
return cairo_region_create_rectangle (&rectangle);
region = cairo_region_create_rectangle (&rectangle);
if (! private->filled &&
rectangle.width > 64 * 1.43 &&
rectangle.height > 64 * 1.43)
{
radius_x *= 0.7;
radius_y *= 0.7;
rectangle.x = ceil (center_x - radius_x + 1.5);
rectangle.y = ceil (center_y - radius_y + 1.5);
rectangle.width = floor (center_x + radius_x - 1.5) - rectangle.x;
rectangle.height = floor (center_y + radius_y - 1.5) - rectangle.y;
cairo_region_subtract_rectangle (region, &rectangle);
}
return region;
}
GimpCanvasItem *

View File

@ -176,12 +176,24 @@ gimp_display_shell_render (GimpDisplayShell *shell,
g_assert_not_reached ();
}
cairo_surface_mark_dirty (shell->render_surface);
/* apply filters to the rendered projection */
if (shell->filter_stack)
gimp_color_display_stack_convert_surface (shell->filter_stack,
shell->render_surface);
{
cairo_surface_t *sub = shell->render_surface;
if (w != GIMP_DISPLAY_RENDER_BUF_WIDTH ||
h != GIMP_DISPLAY_RENDER_BUF_HEIGHT)
sub = cairo_image_surface_create_for_data (cairo_image_surface_get_data (sub),
CAIRO_FORMAT_ARGB32, w, h,
GIMP_DISPLAY_RENDER_BUF_WIDTH * 4);
gimp_color_display_stack_convert_surface (shell->filter_stack, sub);
if (sub != shell->render_surface)
cairo_surface_destroy (sub);
}
cairo_surface_mark_dirty_rectangle (shell->render_surface, 0, 0, w, h);
if (shell->mask)
{