From bef124c9c9e081062a457f6d0b2ab1eda6283a3e Mon Sep 17 00:00:00 2001 From: Francesco Abbate Date: 2010年8月19日 00:19:58 +0200 Subject: improved window slot identification vs plot The code to generate a tree, to parse a split spec and to store window plot tree information is now factored. Now each plot area get a slot_id and redraw is made only in the region when required. --- agg-plot/window-cpp.h | 36 +++++++++++++++++++++++++----------- 1 file changed, 25 insertions(+), 11 deletions(-) (limited to 'agg-plot/window-cpp.h') diff --git a/agg-plot/window-cpp.h b/agg-plot/window-cpp.h index ede02c45..be6a8f92 100644 --- a/agg-plot/window-cpp.h +++ b/agg-plot/window-cpp.h @@ -14,27 +14,39 @@ extern "C" { #include "agg_color_rgba.h" #include "agg_trans_affine.h" -#include "split-spec-parser.h" +#include "split-parser.h" class window : public canvas_window { +public: typedef plot plot_type; + typedef agg::trans_affine bmatrix; + struct ref { + typedef tree::node node; + plot_type *plot; - int id; + int plot_id; + int slot_id; - ref() : plot(0), id(-1) {}; - ref(plot_type *p, int _id) : plot(p), id(_id) {}; - }; + bmatrix matrix; - typedef split::node node_type; - typedef split::node::list list_type; + ref() : plot(0), plot_id(-1), matrix() {}; + ref(plot_type *p, int _id) : plot(p), plot_id(_id), matrix() {}; - node_type* m_tree; + static void compose(bmatrix& a, const bmatrix& b); + static int calculate(node *t, const bmatrix& m, int id); + }; + +private: + void clear_box(const agg::trans_affine& box_mtx); + void draw_rec(ref::node *n); + void cleanup_tree_rec (lua_State *L, int window_index, ref::node* n); - void draw_rec(node_type *n); - void cleanup_tree_rec (lua_State *L, int window_index, node_type* n); + static ref *ref_lookup (ref::node *p, int slot_id); + ref::node* m_tree; + public: window(agg::rgba& bgcol) : canvas_window(bgcol), m_tree(0) { @@ -46,13 +58,15 @@ public: static window *check (lua_State *L, int index); void split(const char *spec); - int attach(lua_plot *plot, const char *spec, int id); + int attach(lua_plot *plot, const char *spec, int plot_id, int& slot_id); void cleanup_refs(lua_State *L, int window_index) { cleanup_tree_rec (L, window_index, m_tree); }; + void draw_slot(int slot_id); + void on_draw_unprotected(); virtual void on_draw(); }; -- cgit v1.2.3

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