author | francesco-ST <francesco.abbate@st.com> | 2010年09月16日 18:42:47 +0200 |
---|---|---|
committer | francesco-ST <francesco.abbate@st.com> | 2010年09月16日 18:42:47 +0200 |
commit | f4b88da6e6c09ab3c20ac8e604eae0a376c235cc (patch) | |
tree | 34fcffe0d45d800ae6f0a75df5c54404c16a5cae /agg-plot/window-cpp.h | |
parent | 9e38131c02023b7159d6220c7e4e354c14a70046 (diff) | |
download | gsl-shell-f4b88da6e6c09ab3c20ac8e604eae0a376c235cc.tar.gz |
-rw-r--r-- | agg-plot/window-cpp.h | 24 |
diff --git a/agg-plot/window-cpp.h b/agg-plot/window-cpp.h index 359520eb..5f636357 100644 --- a/agg-plot/window-cpp.h +++ b/agg-plot/window-cpp.h @@ -16,6 +16,25 @@ extern "C" { #include "agg_trans_affine.h" #include "split-parser.h" +class opt_rect { + typedef agg::rect_base<int> rect_type; + + bool m_defined; + rect_type m_rect; + +public: + opt_rect() : m_defined(false) {}; + + void clear() { m_defined = false; }; + void set(const rect_type& r) { m_defined = true; m_rect = r; }; + const rect_type& box() const { return m_rect; }; + + void compose(rect_type& dst, const rect_type& r) + { + dst = (m_defined ? agg::unite_rectangles(m_rect, r) : r); + }; +}; + class window : public canvas_window { public: typedef plot<drawable, lua_management> plot_type; @@ -33,8 +52,9 @@ public: unsigned char *layer_buf; agg::rendering_buffer layer_img; - ref() : plot(0), matrix(), layer_buf(0) {}; - ref(plot_type *p) : plot(p), matrix(), layer_buf(0) {}; + opt_rect dirty_rect; + + ref(plot_type *p = 0) : plot(p), matrix(), layer_buf(0), dirty_rect() {}; ~ref() { if (layer_buf) delete layer_buf; }; |