Commit 057ec9ac authored by Michael Natterer's avatar Michael Natterer 😴

app: remove rectangle parameters from gimp_display_shell_draw_checkerboard()

because the cairo_t is already clipped to the right extents.
parent 6b842687
......@@ -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);
......
......@@ -89,6 +89,41 @@ gimp_display_shell_draw_background (GimpDisplayShell *shell,
cairo_paint (cr);
}
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,
......@@ -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);
}
......@@ -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,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment