Better separation between fx_plot_canvas and window_surface - gsl-shell.git - gsl-shell

index : gsl-shell.git
gsl-shell
summary refs log tree commit diff
path: root/fox-gui/window_surface.cpp
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2012年11月01日 16:50:24 +0100
committerFrancesco Abbate <francesco.bbt@gmail.com>2012年11月01日 16:50:24 +0100
commit4987136e35dc3647d7c681705937846d429ef6bf (patch)
treea9905c132869fa5cc2694a4d997ebeed4587f4b8 /fox-gui/window_surface.cpp
parent6db20db232abdecf3975f350635b7a1df0dfce70 (diff)
downloadgsl-shell-4987136e35dc3647d7c681705937846d429ef6bf.tar.gz
Better separation between fx_plot_canvas and window_surface
Diffstat (limited to 'fox-gui/window_surface.cpp')
-rw-r--r--fox-gui/window_surface.cpp 60
1 files changed, 58 insertions, 2 deletions
diff --git a/fox-gui/window_surface.cpp b/fox-gui/window_surface.cpp
index b44bb01d..9d4d71e8 100644
--- a/fox-gui/window_surface.cpp
+++ b/fox-gui/window_surface.cpp
@@ -5,8 +5,8 @@
#include "fatal.h"
#include "lua-graph.h"
-window_surface::window_surface(const char* split_str):
-m_img(), m_save_img(), m_canvas(0)
+window_surface::window_surface(display_window* win, const char* split_str):
+m_img(), m_save_img(), m_window(win), m_canvas(0)
{
split(split_str ? split_str : ".");
}
@@ -140,3 +140,59 @@ agg::rect_i window_surface::get_plot_area(unsigned index, int width, int height)
{
return m_part.rect(index, width, height);
}
+
+void window_surface::slot_refresh(unsigned index)
+{
+ bool redraw = plot(index)->need_redraw();
+ if (redraw)
+ {
+ render(index);
+ }
+
+ opt_rect<int> r = render_drawing_queue(index);
+ agg::rect_i area = get_plot_area(index);
+ if (redraw)
+ {
+ m_window->update_region(area);
+ }
+ else
+ {
+ if (r.is_defined())
+ {
+ const int pad = 4;
+ const agg::rect_i& ri = r.rect();
+ agg::rect_i r_pad(ri.x1 - pad, ri.y1 - pad, ri.x2 + pad, ri.y2 + pad);
+ r_pad.clip(area);
+ m_window->update_region(r_pad);
+ }
+ }
+}
+
+void
+window_surface::slot_update(unsigned index)
+{
+ render(index);
+ render_drawing_queue(index);
+ agg::rect_i area = get_plot_area(index);
+ m_window->update_region(area);
+}
+
+void
+window_surface::save_slot_image(unsigned index)
+{
+ save_plot_image(index);
+}
+
+void
+window_surface::restore_slot_image(unsigned index)
+{
+ if (m_plots[index].have_save_img)
+ {
+ restore_plot_image(index);
+ }
+ else
+ {
+ render(index);
+ save_plot_image(index);
+ }
+}
generated by cgit v1.2.3 (git 2.39.1) at 2025年09月18日 15:07:56 +0000

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