[gimp] Bug 645345: 'Color Management' display filter causes performance problems
- From: Massimo Valentini <mvalentini src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] Bug 645345: 'Color Management' display filter causes performance problems
- Date: Sat, 9 Jun 2012 13:48:28 +0000 (UTC)
commit 1338bba7db1925c38cee7051a618dbab6c2e1e50
Author: Massimo Valentini <mvalentini src gnome org>
Date: Sat Jun 9 15:36:34 2012 +0200
Bug 645345: 'Color Management' display filter causes performance problems
app/display/gimpcanvasarc.c | 27 +++++++++++++++++++++++----
app/display/gimpdisplayshell-render.c | 20 ++++++++++++++++----
2 files changed, 39 insertions(+), 8 deletions(-)
---
diff --git a/app/display/gimpcanvasarc.c b/app/display/gimpcanvasarc.c
index 5d76bc0..cc6759a 100644
--- a/app/display/gimpcanvasarc.c
+++ b/app/display/gimpcanvasarc.c
@@ -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,
¢er_x, ¢er_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 *
diff --git a/app/display/gimpdisplayshell-render.c b/app/display/gimpdisplayshell-render.c
index 841f2e0..55f3b41 100644
--- a/app/display/gimpdisplayshell-render.c
+++ b/app/display/gimpdisplayshell-render.c
@@ -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)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]