[gimp] app: remove rectangle parameters from gimp_display_shell_draw_checkerboard()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: remove rectangle parameters from gimp_display_shell_draw_checkerboard()
- Date: Sat, 20 Apr 2013 08:48:21 +0000 (UTC)
commit 057ec9ac4aa003a97d8a3d9f8f21150c915b9cac
Author: Michael Natterer <mitch gimp org>
Date: Sat Apr 20 10:47:13 2013 +0200
app: remove rectangle parameters from gimp_display_shell_draw_checkerboard()
because the cairo_t is already clipped to the right extents.
app/display/gimpdisplayshell-callbacks.c | 6 +--
app/display/gimpdisplayshell-draw.c | 81 ++++++++++++++------------------
app/display/gimpdisplayshell-draw.h | 9 ++--
3 files changed, 39 insertions(+), 57 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-callbacks.c b/app/display/gimpdisplayshell-callbacks.c
index 2b20cfa..3209ba4 100644
--- a/app/display/gimpdisplayshell-callbacks.c
+++ b/app/display/gimpdisplayshell-callbacks.c
@@ -503,11 +503,7 @@ gimp_display_shell_canvas_draw_image (GimpDisplayShell *shell,
gint i;
cairo_save (cr);
- gimp_display_shell_draw_checkerboard (shell, cr,
- image_rect.x,
- image_rect.y,
- image_rect.width,
- image_rect.height);
+ gimp_display_shell_draw_checkerboard (shell, cr);
cairo_restore (cr);
clip_rectangles = cairo_copy_clip_rectangle_list (cr);
diff --git a/app/display/gimpdisplayshell-draw.c b/app/display/gimpdisplayshell-draw.c
index def972d..075b2ec 100644
--- a/app/display/gimpdisplayshell-draw.c
+++ b/app/display/gimpdisplayshell-draw.c
@@ -90,6 +90,41 @@ gimp_display_shell_draw_background (GimpDisplayShell *shell,
}
void
+gimp_display_shell_draw_checkerboard (GimpDisplayShell *shell,
+ cairo_t *cr)
+{
+ g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
+ g_return_if_fail (cr != NULL);
+
+ if (G_UNLIKELY (! shell->checkerboard))
+ {
+ GimpCheckSize check_size;
+ GimpCheckType check_type;
+ guchar check_light;
+ guchar check_dark;
+ GimpRGB light;
+ GimpRGB dark;
+
+ g_object_get (shell->display->config,
+ "transparency-size", &check_size,
+ "transparency-type", &check_type,
+ NULL);
+
+ gimp_checks_get_shades (check_type, &check_light, &check_dark);
+ gimp_rgb_set_uchar (&light, check_light, check_light, check_light);
+ gimp_rgb_set_uchar (&dark, check_dark, check_dark, check_dark);
+
+ shell->checkerboard =
+ gimp_cairo_checkerboard_create (cr,
+ 1 << (check_size + 2), &light, &dark);
+ }
+
+ cairo_translate (cr, - shell->offset_x, - shell->offset_y);
+ cairo_set_source (cr, shell->checkerboard);
+ cairo_paint (cr);
+}
+
+void
gimp_display_shell_draw_image (GimpDisplayShell *shell,
cairo_t *cr,
gint x,
@@ -123,49 +158,3 @@ gimp_display_shell_draw_image (GimpDisplayShell *shell,
}
}
}
-
-static cairo_pattern_t *
-gimp_display_shell_create_checkerboard (GimpDisplayShell *shell,
- cairo_t *cr)
-{
- GimpCheckSize check_size;
- GimpCheckType check_type;
- guchar check_light;
- guchar check_dark;
- GimpRGB light;
- GimpRGB dark;
-
- g_object_get (shell->display->config,
- "transparency-size", &check_size,
- "transparency-type", &check_type,
- NULL);
-
- gimp_checks_get_shades (check_type, &check_light, &check_dark);
- gimp_rgb_set_uchar (&light, check_light, check_light, check_light);
- gimp_rgb_set_uchar (&dark, check_dark, check_dark, check_dark);
-
- return gimp_cairo_checkerboard_create (cr,
- 1 << (check_size + 2), &light, &dark);
-}
-
-void
-gimp_display_shell_draw_checkerboard (GimpDisplayShell *shell,
- cairo_t *cr,
- gint x,
- gint y,
- gint w,
- gint h)
-{
- g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
- g_return_if_fail (cr != NULL);
-
- if (G_UNLIKELY (! shell->checkerboard))
- shell->checkerboard = gimp_display_shell_create_checkerboard (shell, cr);
-
- cairo_rectangle (cr, x, y, w, h);
- cairo_clip (cr);
-
- cairo_translate (cr, - shell->offset_x, - shell->offset_y);
- cairo_set_source (cr, shell->checkerboard);
- cairo_paint (cr);
-}
diff --git a/app/display/gimpdisplayshell-draw.h b/app/display/gimpdisplayshell-draw.h
index 4713d53..5297dd3 100644
--- a/app/display/gimpdisplayshell-draw.h
+++ b/app/display/gimpdisplayshell-draw.h
@@ -27,15 +27,12 @@ void gimp_display_shell_draw_selection_in (GimpDisplayShell *shell,
cairo_t *cr,
cairo_pattern_t *mask,
gint index);
+
void gimp_display_shell_draw_background (GimpDisplayShell *shell,
cairo_t *cr);
-void gimp_display_shell_draw_image (GimpDisplayShell *shell,
- cairo_t *cr,
- gint x,
- gint y,
- gint w,
- gint h);
void gimp_display_shell_draw_checkerboard (GimpDisplayShell *shell,
+ cairo_t *cr);
+void gimp_display_shell_draw_image (GimpDisplayShell *shell,
cairo_t *cr,
gint x,
gint y,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]