[goffice] Fix color scales drawing bounds.



commit f36df5797a6924c595b991049ac6d578ea8a46a5
Author: Jean Brefort <jean brefort normalesup org>
Date:   Fri Sep 20 14:26:50 2013 +0200

    Fix color scales drawing bounds.

 ChangeLog                       |    7 +++++++
 goffice/graph/gog-color-scale.c |   11 +++++++++++
 goffice/gtk/go-combo-box.c      |    4 ++--
 3 files changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d380326..cd37b98 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2013-09-20  Jean Brefort  <jean brefort normalesup org>
+
+       * goffice/graph/gog-color-scale.c (gog_color_scale_view_render): ensure that
+       the scale doe not extend outside of its bounding box, especially when axis
+       settings are wrong or missing.
+       * goffice/gtk/go-combo-box.c: make gtk-doc happy.
+
 2013-09-19  Jean Brefort  <jean brefort normalesup org>
 
        * goffice/Makefile.am: add subdir-objects option.
diff --git a/goffice/graph/gog-color-scale.c b/goffice/graph/gog-color-scale.c
index d1526be..caaed21 100644
--- a/goffice/graph/gog-color-scale.c
+++ b/goffice/graph/gog-color-scale.c
@@ -570,6 +570,17 @@ gog_color_scale_view_render (GogView *view, GogViewAllocation const *bbox)
                tick_size = gog_renderer_pt2r (view->renderer, scale->tick_size);
        } else
                line_width = tick_size = 0.;
+       if (min == max || first == last) {
+               /* avoid infinites and nans later, this might happen if no data are available */
+               if (min < first)
+                       first = min;
+               else
+                       min = first;
+               if (max > last)
+                       last = max;
+               else
+                       max = last;
+       }
        if (scale->horizontal) {
                scale_area.x = view->residual.x;
                /* we make sure that we have enough room to display the last and first labels */
diff --git a/goffice/gtk/go-combo-box.c b/goffice/gtk/go-combo-box.c
index ee25d3d..121dab1 100644
--- a/goffice/gtk/go-combo-box.c
+++ b/goffice/gtk/go-combo-box.c
@@ -44,8 +44,8 @@ enum {
 /**
  * GOComboBoxClass:
  * @set_title: sets the title.
- * @pop_down_done: invoked when the popup has been hidden, if the signal
- * returns %TRUE, it means it should be killed
+ * @pop_down_done: invoked when the popup has been hidden, if the
+ * signal returns %TRUE, it means it should be killed
  **/
 
 enum {


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