author | Francesco Abbate <francesco.bbt@gmail.com> | 2012年10月15日 13:11:54 +0200 |
---|---|---|
committer | Francesco Abbate <francesco.bbt@gmail.com> | 2012年10月15日 13:11:54 +0200 |
commit | 137e4d264c73b3087a5d0968362c5b9ca3108f2d (patch) | |
tree | a80691d187615ec2e63f25182be7895b9a8a313f /agg-plot/window-cpp.h | |
parent | 7d157c5bd8ddf920094907a35c9329ce0688e3d4 (diff) | |
download | gsl-shell-137e4d264c73b3087a5d0968362c5b9ca3108f2d.tar.gz |
-rw-r--r-- | agg-plot/window-cpp.h | 110 |
diff --git a/agg-plot/window-cpp.h b/agg-plot/window-cpp.h index 0d724dd2..515b7fda 100644 --- a/agg-plot/window-cpp.h +++ b/agg-plot/window-cpp.h @@ -18,73 +18,77 @@ extern "C" { class window : public canvas_window { public: - int window_id; + int window_id; - typedef agg::trans_affine bmatrix; + typedef agg::trans_affine bmatrix; - struct ref { - typedef tree::node<ref, direction_e> node; + struct ref { + typedef tree::node<ref, direction_e> node; - sg_plot* plot; - int slot_id; + sg_plot* plot; + int slot_id; - plot_render_info inf; - bmatrix matrix; + plot_render_info inf; + bmatrix matrix; - unsigned char *layer_buf; - agg::rendering_buffer layer_img; + unsigned char *layer_buf; + agg::rendering_buffer layer_img; - bool valid_rect; - opt_rect<double> dirty_rect; + bool valid_rect; + opt_rect<double> dirty_rect; - ref(sg_plot* p = 0) - : plot(p), matrix(), layer_buf(0), valid_rect(true), dirty_rect() - {}; + ref(sg_plot* p = 0) + : plot(p), matrix(), layer_buf(0), valid_rect(true), dirty_rect() + {}; - ~ref() { if (layer_buf) delete layer_buf; }; + ~ref() { + if (layer_buf) delete layer_buf; + }; - void save_image (agg::rendering_buffer& winbuf, agg::rect_base<int>& r, - int bpp, bool flip_y); + void save_image (agg::rendering_buffer& winbuf, agg::rect_base<int>& r, + int bpp, bool flip_y); - static void compose(bmatrix& a, const bmatrix& b); - static int calculate(node *t, const bmatrix& m, int id); - }; + static void compose(bmatrix& a, const bmatrix& b); + static int calculate(node *t, const bmatrix& m, int id); + }; private: - void draw_slot_by_ref(ref& ref, bool dirty); - void refresh_slot_by_ref(ref& ref, bool draw_all); - void draw_rec(ref::node *n); - void cleanup_tree_rec (lua_State *L, int window_index, ref::node* n); + void draw_slot_by_ref(ref& ref, bool dirty); + void refresh_slot_by_ref(ref& ref, bool draw_all); + void draw_rec(ref::node *n); + void cleanup_tree_rec (lua_State *L, int window_index, ref::node* n); - static ref *ref_lookup (ref::node *p, int slot_id); + static ref *ref_lookup (ref::node *p, int slot_id); - ref::node* m_tree; + ref::node* m_tree; public: - window(gsl_shell_state* gs, agg::rgba8 bgcol= colors::white): - canvas_window(gs, bgcol), m_tree(0) - { - this->split("."); - }; - - ~window() { if (m_tree) delete m_tree; }; - - bool split(const char *spec); - int attach(sg_plot *plot, const char *spec); - void draw_slot(int slot_id, bool update_req); - void refresh_slot(int slot_id); - void start(lua_State *L, gslshell::ret_status& st); - - void save_slot_image(int slot_id); - void restore_slot_image(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); - - virtual void on_draw(); - virtual void on_resize(int sx, int sy); + window(gsl_shell_state* gs, agg::rgba8 bgcol= colors::white): + canvas_window(gs, bgcol), m_tree(0) + { + this->split("."); + }; + + ~window() { + if (m_tree) delete m_tree; + }; + + bool split(const char *spec); + int attach(sg_plot *plot, const char *spec); + void draw_slot(int slot_id, bool update_req); + void refresh_slot(int slot_id); + void start(lua_State *L, gslshell::ret_status& st); + + void save_slot_image(int slot_id); + void restore_slot_image(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); + + virtual void on_draw(); + virtual void on_resize(int sx, int sy); }; |