diff options
Diffstat (limited to 'src/animationlayer.cpp')
| -rw-r--r-- | src/animationlayer.cpp | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/src/animationlayer.cpp b/src/animationlayer.cpp index 9e771246..a1084eda 100644 --- a/src/animationlayer.cpp +++ b/src/animationlayer.cpp @@ -168,9 +168,9 @@ void AnimationLayer::setFlipped(bool enabled) m_flipped = enabled; } -void AnimationLayer::setTransformationMode(Qt::TransformationMode mode) +void AnimationLayer::setResizeMode(RESIZE_MODE mode) { - m_transformation_mode_hint = mode; + m_resize_mode = mode; } void AnimationLayer::setMinimumDurationPerFrame(int duration) @@ -229,7 +229,7 @@ void AnimationLayer::calculateFrameGeometry() { m_mask_rect = QRect(); m_scaled_frame_size = QSize(); - m_transformation_mode = m_transformation_mode_hint; + m_transformation_mode = Qt::SmoothTransformation; QSize widget_size = size(); if (!widget_size.isValid() || !m_frame_size.isValid()) @@ -240,7 +240,6 @@ void AnimationLayer::calculateFrameGeometry() if (m_stretch_to_fit) { m_scaled_frame_size = widget_size; - m_transformation_mode = Qt::SmoothTransformation; } else { @@ -253,11 +252,20 @@ void AnimationLayer::calculateFrameGeometry() double scale = double(widget_size.height()) / double(m_scaled_frame_size.height()); m_scaled_frame_size *= scale; + + if (m_frame_size.height() < widget_size.height()) + { + m_transformation_mode = Qt::FastTransformation; + } } - if (m_transformation_mode_hint == Qt::FastTransformation) + if (m_resize_mode == PIXEL_RESIZE_MODE) { - m_transformation_mode = widget_size.height() < m_frame_size.height() ? Qt::SmoothTransformation : Qt::FastTransformation; + m_transformation_mode = Qt::FastTransformation; + } + else if (m_resize_mode == SMOOTH_RESIZE_MODE) + { + m_transformation_mode = Qt::SmoothTransformation; } displayCurrentFrame(); @@ -451,7 +459,7 @@ void CharacterAnimationLayer::loadCharacterEmote(QString character, QString file setFileName(file_path); setPlayOnce(play_once); - setTransformationMode(ao_app->get_scaling(ao_app->get_emote_property(character, fileName, "scaling"))); + setResizeMode(ao_app->get_scaling(ao_app->get_emote_property(character, fileName, "scaling"))); setStretchToFit(ao_app->get_emote_property(character, fileName, "stretch").startsWith("true")); if (synchronize_frame && previous_frame_count == frameCount()) { @@ -600,7 +608,7 @@ void BackgroundAnimationLayer::loadAndPlayAnimation(QString fileName) } VPath design_path = ao_app->get_background_path("design.ini"); - setTransformationMode(ao_app->get_scaling(ao_app->read_design_ini("scaling", design_path))); + setResizeMode(ao_app->get_scaling(ao_app->read_design_ini("scaling", design_path))); setStretchToFit(ao_app->read_design_ini("stretch", design_path).startsWith("true")); if (is_different_file) @@ -621,7 +629,7 @@ void SplashAnimationLayer::loadAndPlayAnimation(QString p_filename, QString p_ch { QString file_path = ao_app->get_image(p_filename, Options::getInstance().theme(), Options::getInstance().subTheme(), ao_app->default_theme, p_miscname, p_charname, "placeholder"); setFileName(file_path); - setTransformationMode(ao_app->get_misc_scaling(p_miscname)); + setResizeMode(ao_app->get_misc_scaling(p_miscname)); startPlayback(); } @@ -688,7 +696,7 @@ void StickerAnimationLayer::loadAndPlayAnimation(QString fileName) QString file_path = ao_app->get_image("sticker/" + fileName, Options::getInstance().theme(), Options::getInstance().subTheme(), ao_app->default_theme, misc_file); setFileName(file_path); - setTransformationMode(ao_app->get_misc_scaling(misc_file)); + setResizeMode(ao_app->get_misc_scaling(misc_file)); startPlayback(); } } // namespace kal |
