[gimp] app: change segment drawing to using pixel centers and CAP_SQUARE line ends
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp] app: change segment drawing to using pixel centers and CAP_SQUARE line ends
- Date: Thu, 23 Sep 2010 17:29:01 +0000 (UTC)
commit 612aee9f334e19ce5fae9d0b50d479702b53d3ef
Author: Michael Natterer <mitch gimp org>
Date: Thu Sep 23 14:26:52 2010 +0200
app: change segment drawing to using pixel centers and CAP_SQUARE line ends
This looks exactly the same for the selection, but is needed like that
for segment drawing in tools.
app/display/gimpdisplayshell-selection.c | 1 +
app/display/gimpdisplayshell-style.c | 8 ++++++--
app/widgets/gimpcairo.c | 8 ++++----
3 files changed, 11 insertions(+), 6 deletions(-)
---
diff --git a/app/display/gimpdisplayshell-selection.c b/app/display/gimpdisplayshell-selection.c
index 8e54ed3..cbbfe49 100644
--- a/app/display/gimpdisplayshell-selection.c
+++ b/app/display/gimpdisplayshell-selection.c
@@ -385,6 +385,7 @@ selection_render_mask (Selection *selection)
cairo_push_group_with_content (cr, CAIRO_CONTENT_ALPHA);
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
cairo_set_line_width (cr, 1.0);
gimp_cairo_add_segments (cr,
diff --git a/app/display/gimpdisplayshell-style.c b/app/display/gimpdisplayshell-style.c
index bcb19d1..e0f2146 100644
--- a/app/display/gimpdisplayshell-style.c
+++ b/app/display/gimpdisplayshell-style.c
@@ -224,6 +224,7 @@ gimp_display_shell_set_layer_style (GimpDisplayShell *shell,
g_return_if_fail (GIMP_IS_DRAWABLE (drawable));
cairo_set_line_width (cr, 1.0);
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
if (GIMP_IS_LAYER_MASK (drawable))
{
@@ -258,6 +259,7 @@ gimp_display_shell_set_selection_out_style (GimpDisplayShell *shell,
g_return_if_fail (cr != NULL);
cairo_set_line_width (cr, 1.0);
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
pattern = gimp_cairo_stipple_pattern_create (&selection_out_fg,
&selection_out_bg,
@@ -326,9 +328,10 @@ gimp_display_shell_set_tool_bg_style (GimpDisplayShell *shell,
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (cr != NULL);
+ cairo_set_line_width (cr, 3.0);
cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
- cairo_set_line_width (cr, 3.0);
+
gimp_cairo_set_source_rgba (cr, &tool_bg);
}
@@ -339,8 +342,9 @@ gimp_display_shell_set_tool_fg_style (GimpDisplayShell *shell,
g_return_if_fail (GIMP_IS_DISPLAY_SHELL (shell));
g_return_if_fail (cr != NULL);
+ cairo_set_line_width (cr, 1.0);
cairo_set_line_cap (cr, CAIRO_LINE_CAP_SQUARE);
cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
- cairo_set_line_width (cr, 1.0);
+
gimp_cairo_set_source_rgba (cr, &tool_fg);
}
diff --git a/app/widgets/gimpcairo.c b/app/widgets/gimpcairo.c
index c115f74..86738ba 100644
--- a/app/widgets/gimpcairo.c
+++ b/app/widgets/gimpcairo.c
@@ -101,13 +101,13 @@ gimp_cairo_add_segments (cairo_t *cr,
{
if (segs[i].x1 == segs[i].x2)
{
- cairo_move_to (cr, segs[i].x1 + 0.5, segs[i].y1);
- cairo_line_to (cr, segs[i].x2 + 0.5, segs[i].y2);
+ cairo_move_to (cr, segs[i].x1 + 0.5, segs[i].y1 + 0.5);
+ cairo_line_to (cr, segs[i].x2 + 0.5, segs[i].y2 - 1.0);
}
else
{
- cairo_move_to (cr, segs[i].x1, segs[i].y1 + 0.5);
- cairo_line_to (cr, segs[i].x2, segs[i].y2 + 0.5);
+ cairo_move_to (cr, segs[i].x1 + 0.5, segs[i].y1 + 0.5);
+ cairo_line_to (cr, segs[i].x2 - 1.0, segs[i].y2 + 0.5);
}
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]