[goffice] Fix graph scale after a size change. [#599887]
- From: Jean Bréfort <jbrefort src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [goffice] Fix graph scale after a size change. [#599887]
- Date: Thu, 29 Oct 2009 13:08:45 +0000 (UTC)
commit e4a6b509577c7cc4daffd844dec1a2facc1f0243
Author: Jean Brefort <jean brefort normalesup org>
Date: Thu Oct 29 14:09:02 2009 +0100
Fix graph scale after a size change. [#599887]
ChangeLog | 6 ++++++
NEWS | 1 +
goffice/canvas/goc-graph.c | 4 +++-
goffice/graph/gog-renderer.c | 9 +++++----
4 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 41bca23..16e211c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2009-10-29 Jean Brefort <jean brefort normalesup org>
+
+ * goffice/canvas/goc-graph.c (goc_graph_update_bounds): set the right size.
+ * goffice/graph/gog-renderer.c (gog_renderer_update): fixed resizing a
+ graph. [#599887]
+
2009-10-28 Jean Brefort <jean brefort normalesup org>
* goffice/graph/gog-chart.c (gog_chart_view_render): reapply patch for
diff --git a/NEWS b/NEWS
index 52e15d0..36b33d2 100644
--- a/NEWS
+++ b/NEWS
@@ -6,6 +6,7 @@ Jean:
* Display coordinates when moving the mouseover a graph. [#382666]
* Make titles the first logical child and ensure they are rendered last.
Really fixes #152675.
+ * Fix graph scale after a size change. [#599887]
Morten:
* Canvas improvements for arrows.
diff --git a/goffice/canvas/goc-graph.c b/goffice/canvas/goc-graph.c
index 3560c32..c93e04d 100644
--- a/goffice/canvas/goc-graph.c
+++ b/goffice/canvas/goc-graph.c
@@ -219,7 +219,9 @@ goc_graph_update_bounds (GocItem *item)
item->y0 = graph->y;
item->x1 = graph->x + graph->w;
item->y1 = graph->y + graph->h;
- gog_renderer_update (graph->renderer, graph->w, graph->h);
+ gog_renderer_update (graph->renderer,
+ (int) (graph->w * item->canvas->pixels_per_unit),
+ (int) (graph->h * item->canvas->pixels_per_unit));
}
static char *
diff --git a/goffice/graph/gog-renderer.c b/goffice/graph/gog-renderer.c
index 36670ae..f8033af 100644
--- a/goffice/graph/gog-renderer.c
+++ b/goffice/graph/gog-renderer.c
@@ -1029,11 +1029,12 @@ gog_renderer_update (GogRenderer *rend, double w, double h)
rend->cairo = cairo_create (rend->cairo_surface);
- if (size_changed) {
- rend->scale_x = (graph->width >= 1.) ? (rend->w / graph->width) : 1.;
- rend->scale_y = (graph->height >= 1.) ? (rend->h / graph->height) : 1.;
- rend->scale = MIN (rend->scale_x, rend->scale_y);
+ /* we need to update scale even if size did not change since graph size might have changed (#599887) */
+ rend->scale_x = (graph->width >= 1.) ? (rend->w / graph->width) : 1.;
+ rend->scale_y = (graph->height >= 1.) ? (rend->h / graph->height) : 1.;
+ rend->scale = MIN (rend->scale_x, rend->scale_y);
+ if (size_changed) {
/* make sure we dont try to queue an update while updating */
rend->needs_update = TRUE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]