[goffice] Fixed hairline.



commit 14f440bb0ef275c5a53f34099962799db9b8bf6c
Author: Jean Brefort <jean brefort normalesup org>
Date:   Sun Mar 7 22:02:06 2010 +0100

    Fixed hairline.

 ChangeLog                |    4 ++++
 goffice/utils/go-style.c |    9 ++++++++-
 2 files changed, 12 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 00b64e2..e49f94d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2010-03-07  Jean Brefort  <jean brefort normalesup org>
 
+	* goffice/utils/go-style.c (go_style_set_cairo_line): fix hairline.
+
+2010-03-07  Jean Brefort  <jean brefort normalesup org>
+
 	* tests/shapes-demo.c (parse_line): use go_style_object_style_changed().
 
 2010-03-06  Valek Filippov  <frob gnome org>
diff --git a/goffice/utils/go-style.c b/goffice/utils/go-style.c
index 4cb2ba3..675ee2a 100644
--- a/goffice/utils/go-style.c
+++ b/goffice/utils/go-style.c
@@ -2205,7 +2205,14 @@ go_style_set_cairo_line (GOStyle const *style, cairo_t *cr)
 	g_return_val_if_fail (GO_IS_STYLE (style) && cr != NULL, FALSE);
 	if (style->line.dash_type == GO_LINE_NONE)
 		return FALSE;
-	width = (style->line.width)? style->line.width: 1.;
+	if (style->line.width > 0.)
+		width = style->line.width;
+	else {
+		cairo_matrix_t m;
+		cairo_get_matrix (cr, &m);
+		width = m.xx * m.yy - m.xy * m.yx;
+		width = (width > 0.)? 1. / sqrt (m.xx * m.yy - m.xy * m.yx): 1.;
+	}
 	cairo_set_line_width (cr, width);
 	cairo_set_line_cap (cr, style->line.cap);
 	cairo_set_line_join (cr, style->line.join);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]