diff options
author | Konstantin Ritt <ritt.ks@gmail.com> | 2019-04-05 21:56:47 +0300 |
---|---|---|
committer | Rebecca Worledge <rebecca.worledge@theqtcompany.com> | 2019-04-06 03:59:53 +0000 |
commit | 16b32a004e8a5df6df3cb83b3e206faa25428b10 (patch) | |
tree | 7a6393e1425f3f80d3651b573aa2441a55e9ced2 | |
parent | 078703650aed559155de2fcc694da5a21f9caf45 (diff) |
LottieAnimation: fix effect of changing output quality
Enable expensive Antialiasig for High quality only;
enable much cheaper Smooth Sampling (linear texture filtering)
for both Medium and High quality.
Setting these properties on QQuickPaintedItem implies
respective properties of the QPainter and the texture provider.
Change-Id: Ice664935686d9b663d4892fea9389f21d870f9ee
Reviewed-by: Rebecca Worledge <rebecca.worledge@theqtcompany.com>
-rw-r--r-- | src/imports/lottieanimation.cpp | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/imports/lottieanimation.cpp b/src/imports/lottieanimation.cpp index 87d739d..5477bdf 100644 --- a/src/imports/lottieanimation.cpp +++ b/src/imports/lottieanimation.cpp @@ -222,13 +222,6 @@ void LottieAnimation::componentComplete() void LottieAnimation::paint(QPainter *painter) { - // TODO: Check does this have effect on output quality (or performance) - if (m_quality != LowQuality) - painter->setRenderHints(QPainter::Antialiasing); - if (m_quality == HighQuality) - painter->setRenderHints(QPainter::SmoothPixmapTransform); - - LottieRasterRenderer renderer(painter); BMBase* bmTree = m_frameRenderThread->getFrame(this, m_currentFrame); if (!bmTree) { @@ -237,6 +230,8 @@ void LottieAnimation::paint(QPainter *painter) return; } + LottieRasterRenderer renderer(painter); + qCDebug(lcLottieQtBodymovinRender) << static_cast<void*>(this) << "Start to paint frame" << m_currentFrame; for (BMBase *elem : bmTree->children()) { @@ -357,7 +352,7 @@ void LottieAnimation::setFrameRate(int frameRate) used \value LottieAnimation.MediumQuality - Antialiasing is used but no smooth pixmap transformation algorithm + Smooth pixmap transformation algorithm is used but no antialiasing (Default) \value LottieAnimation.HighQuality @@ -377,6 +372,8 @@ void LottieAnimation::setQuality(LottieAnimation::Quality quality) setRenderTarget(QQuickPaintedItem::FramebufferObject); else setRenderTarget(QQuickPaintedItem::Image); + setSmooth(quality != LowQuality); + setAntialiasing(quality == HighQuality); emit qualityChanged(); } } |