diff options
| author | Manolo Gouy <Manolo> | 2017-02-19 15:42:31 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2017-02-19 15:42:31 +0000 |
| commit | 3ce40f3fafe6699eff086fde41ba11ce018217db (patch) | |
| tree | fcdcd91adfaedc37c516d0265fcbab507f34500c /test/offscreen.cxx | |
| parent | 9c6add494394eaa304ad045750b71c1dcfc15b9c (diff) | |
Reset offscreen surface when the window is hidden.
This is necessary for compatibility with rescaling, so line widths are also rescaled.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.4@12175 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'test/offscreen.cxx')
| -rw-r--r-- | test/offscreen.cxx | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/test/offscreen.cxx b/test/offscreen.cxx index c8b41637b..91e0174ef 100644 --- a/test/offscreen.cxx +++ b/test/offscreen.cxx @@ -68,6 +68,7 @@ private: int page_x, page_y; // top left of view area // Width and height of the offscreen surface int offsc_w, offsc_h; + int iters; // Must be set on first pass! }; /*****************************************************************************/ @@ -77,7 +78,8 @@ oscr_box::oscr_box(int x, int y, int w, int h) : x1(0), y1(0), drag_state(0), // not dragging view page_x((offscreen_size - win_size) / 2), // roughly centred in view page_y((offscreen_size - win_size) / 2), - offsc_w(0), offsc_h(0) // offscreen size - initially none + offsc_w(0), offsc_h(0), // offscreen size - initially none + iters(num_iterations + 1) { } // Constructor /*****************************************************************************/ @@ -110,6 +112,12 @@ void oscr_box::draw() int oscr_box::handle(int ev) { int ret = Fl_Box::handle(ev); + + if (ev == FL_HIDE && oscr) { + fl_delete_offscreen(oscr); + oscr = 0; + iters = num_iterations + 1; + } // handle dragging of visible page area - if a valid context exists if (has_oscr()) { @@ -184,7 +192,6 @@ void oscr_box::oscr_drawing(void) static int icol = first_useful_color; static int ox = (offscreen_size / 2); static int oy = (offscreen_size / 2); - static int iters = num_iterations + 1; // Must be set on first pass! if (!has_oscr()) { |
