From 0e3d6214df0ccc3f181c97ccd27cc93e428688ae Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Wed, 17 May 2017 15:34:48 -0700 Subject: [PATCH] QStyleAnimation: Go down to 15 fps MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The new implementation of CE_ProgressBarContents in QMacStyle uses NSProgressIndicator, which is noticeably heavier than the previously used HITheme API. Setting the animation frame rate to 20 fps improves things significantly compared to the default 30 fps, but Cocoa seems to update the animation at 15 fps for indeterminate NSProgressIndicator. Going down to 12 or 10 fps may be an option in the future, but it's not compatible with NSProgressIndicator. Change-Id: Ie1e18d7d78d1bd7ea38a12d715a6a7db0e175a29 Reviewed-by: Timur Pocheptsov Reviewed-by: Morten Johan Sørvig Reviewed-by: J-P Nurmi --- src/plugins/styles/mac/qmacstyle_mac.mm | 4 ++-- src/widgets/styles/qstyleanimation_p.h | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/plugins/styles/mac/qmacstyle_mac.mm b/src/plugins/styles/mac/qmacstyle_mac.mm index 8be5baf287..1cd1629347 100644 --- a/src/plugins/styles/mac/qmacstyle_mac.mm +++ b/src/plugins/styles/mac/qmacstyle_mac.mm @@ -4599,8 +4599,8 @@ void QMacStyle::drawControl(ControlElement ce, const QStyleOption *opt, QPainter // implementation for details. if (!animation && opt->styleObject) { auto *animation = new QProgressStyleAnimation(d->animateSpeed(QMacStylePrivate::AquaProgressBar), opt->styleObject); - // NSProgressIndicator is heavier to draw than the HITheme API, so we reduce the frame rate a notch. - animation->setFrameRate(QStyleAnimation::TwentyFps); + // NSProgressIndicator is heavier to draw than the HITheme API, so we reduce the frame rate a couple notches. + animation->setFrameRate(QStyleAnimation::FifteenFps); d->startAnimation(animation); [ipi startAnimation]; } diff --git a/src/widgets/styles/qstyleanimation_p.h b/src/widgets/styles/qstyleanimation_p.h index e5cfe0bbee..bb1ab9d877 100644 --- a/src/widgets/styles/qstyleanimation_p.h +++ b/src/widgets/styles/qstyleanimation_p.h @@ -83,7 +83,8 @@ public: DefaultFps, SixtyFps, ThirtyFps, - TwentyFps + TwentyFps, + FifteenFps }; FrameRate frameRate() const;