Code rationalization in native plot window - gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/agg-plot/window-cpp.h
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2012年11月05日 16:17:42 +0100
committerFrancesco Abbate <francesco.bbt@gmail.com>2012年11月05日 16:17:42 +0100
commit6c3c3823077f90a3bf870fa75fc0818d9f31f3d3 (patch)
tree7b1cb72a430fa6b59c0690ec61e1068e1e1e57b1 /agg-plot/window-cpp.h
parent96439321439d5919d58a3627a06460b3a2c31c4a (diff)
downloadgsl-shell-6c3c3823077f90a3bf870fa75fc0818d9f31f3d3.tar.gz
Code rationalization in native plot window
Use a template member function to visit all the plot and apply a given function.
Diffstat (limited to 'agg-plot/window-cpp.h')
-rw-r--r--agg-plot/window-cpp.h 28
1 files changed, 22 insertions, 6 deletions
diff --git a/agg-plot/window-cpp.h b/agg-plot/window-cpp.h
index 564a4160..32d294c4 100644
--- a/agg-plot/window-cpp.h
+++ b/agg-plot/window-cpp.h
@@ -45,6 +45,16 @@ public:
if (layer_buf) delete layer_buf;
};
+ void dispose_buffer()
+ {
+ valid_rect = false;
+ if (layer_buf)
+ {
+ delete [] layer_buf;
+ layer_buf = 0;
+ }
+ }
+
void save_image (agg::rendering_buffer& winbuf, agg::rect_base<int>& r,
int bpp, bool flip_y);
@@ -55,7 +65,6 @@ public:
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);
static ref *ref_lookup (ref::node *p, int slot_id);
@@ -87,13 +96,20 @@ public:
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);
+
+private:
+ struct slot_draw_function
+ {
+ slot_draw_function(window* w): win(w) { }
+ void call(window::ref* ref) { win->draw_slot_by_ref(*ref, false); }
+ window* win;
+ };
+
+ struct dispose_buffer_function {
+ void call(window::ref* ref) { ref->dispose_buffer(); }
+ };
};
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月13日 06:45:00 +0000

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