[goffice] Fixed position of rotated label frame. [#686478]
- From: Jean BrÃfort <jbrefort src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [goffice] Fixed position of rotated label frame. [#686478]
- Date: Fri, 19 Oct 2012 19:00:35 +0000 (UTC)
commit 17d1ddb284ce8ebebfe8189ebcdde82e0270f11b
Author: Jean Brefort <jean brefort normalesup org>
Date: Fri Oct 19 20:59:17 2012 +0200
Fixed position of rotated label frame. [#686478]
ChangeLog | 4 ++++
NEWS | 1 +
goffice/graph/gog-label.c | 15 ++++++---------
goffice/graph/gog-renderer.c | 13 +++++++------
4 files changed, 18 insertions(+), 15 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 90f57ca..7b59dd7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
2012-10-19 Jean Brefort <jean brefort normalesup org>
+ * goffice/graph/gog-label.c (gog_text_view_render):
+
+2012-10-19 Jean Brefort <jean brefort normalesup org>
+
* goffice/graph/gog-legend.c (cb_render_elements): restore pixel aligned
lines. [#686476]
diff --git a/NEWS b/NEWS
index 703af53..5fcc25c 100644
--- a/NEWS
+++ b/NEWS
@@ -16,6 +16,7 @@ Jean:
* Removed span tab 3D axes that don't support it. [#685405]
* Don't draw a marker in the legend when not needed. [#685484]
* Restore pixel aligned lines. [#686476]
+ * Fixed position of rotated label frame. [#686478]
--------------------------------------------------------------------------
goffice 0.9.6:
diff --git a/goffice/graph/gog-label.c b/goffice/graph/gog-label.c
index 9b8455c..c57b682 100644
--- a/goffice/graph/gog-label.c
+++ b/goffice/graph/gog-label.c
@@ -718,22 +718,19 @@ gog_text_view_render (GogView *view, GogViewAllocation const *bbox)
gog_renderer_get_gostring_AABR (view->renderer, gostr, &aabr, w);
else
gog_renderer_get_text_AABR (view->renderer, str, text->allow_markup, &aabr, w);
+ rect = view->allocation;
+ rect.w = aabr.w + 2. * outline + pad_x;
+ rect.h = aabr.h + 2. * outline + pad_y;
if (text->rotate_frame) {
- rect = view->allocation;
- rect.w = aabr.w + 2. * outline + pad_x;
- rect.h = aabr.h + 2. * outline + pad_y;
if (rot > 0.)
rect.y += rect.w * sin (rot);
else
rect.x -= rect.h * sin (rot);
gog_renderer_pop_style (view->renderer);
g_object_unref (rect_style);
- } else {
- rect = view->allocation;
- rect.w = aabr.w + 2. * outline + pad_x;
- rect.h = aabr.h + 2. * outline + pad_y;
- }
- gog_renderer_draw_rotated_rectangle (view->renderer, &rect, text->rotate_bg);
+ gog_renderer_draw_rotated_rectangle (view->renderer, &rect, text->rotate_bg);
+ } else
+ gog_renderer_draw_rectangle (view->renderer, &rect);
}
if (gostr) {
gog_renderer_draw_gostring (view->renderer, gostr,
diff --git a/goffice/graph/gog-renderer.c b/goffice/graph/gog-renderer.c
index ff18391..a0e8896 100644
--- a/goffice/graph/gog-renderer.c
+++ b/goffice/graph/gog-renderer.c
@@ -686,7 +686,7 @@ _draw_rotated_rectangle (GogRenderer *rend, GogViewAllocation const *rect, gbool
GOStyle const *style;
GOPath *path;
gboolean narrow = (rect->w < 3.) || (rect->h < 3.);
- double o, o_2;
+ double o, h, w;
g_return_if_fail (GOG_IS_RENDERER (rend));
g_return_if_fail (GO_IS_STYLE (rend->cur_style));
@@ -698,15 +698,16 @@ _draw_rotated_rectangle (GogRenderer *rend, GogViewAllocation const *rect, gbool
go_path_set_options (path, GO_PATH_OPTIONS_SHARP);
if (!narrow) {
- o = gog_renderer_line_size (rend, style->line.width);
- o_2 = o / 2.;
+ o = gog_renderer_line_size (rend, style->line.width) * 2.;
} else
- o = o_2 = 0.;
+ o = 0.;
- go_path_rectangle (path, 0., 0., rect->w - o, rect->h - o);
+ w = (rect->w - o) / 2.;
+ h = (rect->h - o) / 2.;
+ go_path_rectangle (path, -w, -h, rect->w - o, rect->h - o);
cairo_save (rend->cairo);
- cairo_translate (rend->cairo, rect->x - o_2, rect->y - o_2);
+ cairo_translate (rend->cairo, rect->x + w, rect->y + h);
_draw_rotated_shape (rend, path, fill, stroke && !narrow, rotate_bg);
cairo_restore (rend->cairo);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]