mirror of
https://invent.kde.org/graphics/okular
synced 2024-08-27 03:30:20 +00:00
Presentation: correct durations for "Fade" transition effect by doing 20 FPS instead of 100 frames total
Right now, fade transition is always done in 100 frames. If the intended duration is, say, 1 second, the actual duration can easily be a few seconds instead, due to the limited CPU power (on my laptop with core i5, those 100 frames take 2 seconds). I propose a patch that changes the number of frames to 20 * (duration in seconds). 20 FPS still looks completely smooth to me. REVIEW: 125310 BUGS: 352876
This commit is contained in:
parent
8c141cc2fc
commit
9f0ff21a22
|
@ -1406,7 +1406,7 @@ void PresentationWidget::slotTransitionStep()
|
|||
case Okular::PageTransition::Fade:
|
||||
{
|
||||
QPainter pixmapPainter;
|
||||
m_currentPixmapOpacity += 0.01;
|
||||
m_currentPixmapOpacity += 1.0 / m_transitionSteps;
|
||||
m_lastRenderedPixmap = QPixmap( m_lastRenderedPixmap.size() );
|
||||
m_lastRenderedPixmap.fill( Qt::transparent );
|
||||
pixmapPainter.begin( &m_lastRenderedPixmap );
|
||||
|
@ -2145,7 +2145,9 @@ void PresentationWidget::initTransition( const Okular::PageTransition *transitio
|
|||
|
||||
case Okular::PageTransition::Fade:
|
||||
{
|
||||
const int steps = 100;
|
||||
enum {FADE_TRANSITION_FPS = 20};
|
||||
const int steps = totalTime * FADE_TRANSITION_FPS;
|
||||
m_transitionSteps = steps;
|
||||
QPainter pixmapPainter;
|
||||
m_currentPixmapOpacity = (double) 1 / steps;
|
||||
m_transitionDelay = (int)( totalTime * 1000 ) / steps;
|
||||
|
|
|
@ -118,6 +118,7 @@ class PresentationWidget : public QWidget, public Okular::DocumentObserver
|
|||
QTimer * m_nextPageTimer;
|
||||
int m_transitionDelay;
|
||||
int m_transitionMul;
|
||||
int m_transitionSteps;
|
||||
QList< QRect > m_transitionRects;
|
||||
Okular::PageTransition m_currentTransition;
|
||||
QPixmap m_currentPagePixmap;
|
||||
|
|
Loading…
Reference in a new issue