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
This commit is contained in:
Manolo Gouy 2017-02-19 15:42:31 +00:00
parent 9c6add4943
commit 3ce40f3faf
1 changed files with 9 additions and 2 deletions

View File

@ -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())
{