Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit 9f0ff21a authored by Arseniy Lartsev's avatar Arseniy Lartsev Committed by Albert Astals Cid

Presentation: correct durations for "Fade" transition effect by doing 20 FPS...

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
parent 8c141cc2
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment