Fix bug related to plot's legend drawing on very small windows - gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/agg-plot/plot.h
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2012年10月15日 11:59:37 +0200
committerFrancesco Abbate <francesco.bbt@gmail.com>2012年10月15日 11:59:37 +0200
commit7d157c5bd8ddf920094907a35c9329ce0688e3d4 (patch)
treec3252f20a66503b483d7a6df0b2098ad4e78cc51 /agg-plot/plot.h
parentdf23ea7a2af4fe271e5a48af0f06f8e27363f330 (diff)
downloadgsl-shell-7d157c5bd8ddf920094907a35c9329ce0688e3d4.tar.gz
Fix bug related to plot's legend drawing on very small windows
Diffstat (limited to 'agg-plot/plot.h')
-rw-r--r--agg-plot/plot.h 15
1 files changed, 13 insertions, 2 deletions
diff --git a/agg-plot/plot.h b/agg-plot/plot.h
index f9cc41e8..359742b5 100644
--- a/agg-plot/plot.h
+++ b/agg-plot/plot.h
@@ -78,6 +78,13 @@ struct plot_layout {
plot_active_area.ty = ty;
}
+ static void set_area_undefined(agg::trans_affine& m) { m.sx = -1.0; }
+
+ static bool is_area_defined(const agg::trans_affine& m)
+ {
+ return (m.sx > 0.0);
+ }
+
point title_pos;
double title_font_size;
@@ -774,6 +781,10 @@ plot_layout plot<RM>::compute_plot_layout(const agg::trans_affine& canvas_mtx, b
const double x0 = canvas_mtx.tx + px, y0 = canvas_mtx.ty + py;
layout.legend_area[k] = agg::trans_affine(dx, 0.0, 0.0, dy, x0, y0);
}
+ else
+ {
+ plot_layout::set_area_undefined(layout.legend_area[k]);
+ }
}
}
@@ -799,10 +810,10 @@ void plot<RM>::draw_legends(canvas_type& canvas, const plot_layout& layout)
for (int k = 0; k < 4; k++)
{
plot* mp = m_legend[k];
+ const agg::trans_affine& mtx = layout.legend_area[k];
- if (mp)
+ if (mp && plot_layout::is_area_defined(mtx))
{
- const agg::trans_affine& mtx = layout.legend_area[k];
agg::rect_i clip = rect_of_slot_matrix<int>(mtx);
plot_layout mp_layout = mp->compute_plot_layout(mtx, false);
mp->draw_simple(canvas, mp_layout, &clip);
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月13日 18:06:13 +0000

AltStyle によって変換されたページ (->オリジナル) /