Fix crash when ending magnifier effect
How did I test that?...
This commit is contained in:
parent
0740a01c6a
commit
4ed28ed2b0
1 changed files with 15 additions and 9 deletions
|
@ -85,8 +85,16 @@ void MagnifierEffect::prePaintScreen(ScreenPrePaintData& data, int time)
|
||||||
double diff = time / animationTime(500.0);
|
double diff = time / animationTime(500.0);
|
||||||
if (target_zoom > zoom)
|
if (target_zoom > zoom)
|
||||||
zoom = qMin(zoom * qMax(1 + diff, 1.2), target_zoom);
|
zoom = qMin(zoom * qMax(1 + diff, 1.2), target_zoom);
|
||||||
else
|
else {
|
||||||
zoom = qMax(zoom * qMin(1 - diff, 0.8), target_zoom);
|
zoom = qMax(zoom * qMin(1 - diff, 0.8), target_zoom);
|
||||||
|
if (zoom == 1.0) {
|
||||||
|
// zoom ended - delete FBO and texture
|
||||||
|
delete m_fbo;
|
||||||
|
delete m_texture;
|
||||||
|
m_fbo = NULL;
|
||||||
|
m_texture = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
effects->prePaintScreen(data, time);
|
effects->prePaintScreen(data, time);
|
||||||
if (zoom != 1.0)
|
if (zoom != 1.0)
|
||||||
|
@ -188,10 +196,12 @@ void MagnifierEffect::zoomOut()
|
||||||
polling = false;
|
polling = false;
|
||||||
effects->stopMousePolling();
|
effects->stopMousePolling();
|
||||||
}
|
}
|
||||||
delete m_fbo;
|
if (zoom == target_zoom) {
|
||||||
delete m_texture;
|
delete m_fbo;
|
||||||
m_fbo = NULL;
|
delete m_texture;
|
||||||
m_texture = NULL;
|
m_fbo = NULL;
|
||||||
|
m_texture = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
effects->addRepaint(magnifierArea().adjusted(-FRAME_WIDTH, -FRAME_WIDTH, FRAME_WIDTH, FRAME_WIDTH));
|
effects->addRepaint(magnifierArea().adjusted(-FRAME_WIDTH, -FRAME_WIDTH, FRAME_WIDTH, FRAME_WIDTH));
|
||||||
}
|
}
|
||||||
|
@ -215,10 +225,6 @@ void MagnifierEffect::toggle()
|
||||||
polling = false;
|
polling = false;
|
||||||
effects->stopMousePolling();
|
effects->stopMousePolling();
|
||||||
}
|
}
|
||||||
delete m_fbo;
|
|
||||||
delete m_texture;
|
|
||||||
m_fbo = NULL;
|
|
||||||
m_texture = NULL;
|
|
||||||
}
|
}
|
||||||
effects->addRepaint(magnifierArea().adjusted(-FRAME_WIDTH, -FRAME_WIDTH, FRAME_WIDTH, FRAME_WIDTH));
|
effects->addRepaint(magnifierArea().adjusted(-FRAME_WIDTH, -FRAME_WIDTH, FRAME_WIDTH, FRAME_WIDTH));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue