Improve Image View fade transitions

Authored by huoni on Mar 30 2018, 1:45 AM.

Description

Improve Image View fade transitions

Summary:
This patch fixes three problems:

  1. After D11630, fading to a raster image with alpha channel and 'None' background resulted in the old image showing through the transparent parts of the new image, then disappearing.
  2. Switching to an SVG from a raster image resulted in the raster image not fading, then disappearing suddenly at the end of the animation. This was an issue before D11630.
  3. When OpenGL is used for animations, the full screen background texture appears during animations then disappears.

Problem 1 was due to DocumentView::setEraseBorders, which effectively
filled the background of the document view, leaving the parts within
the image transparent. This was okay before D11630 because the
background behind the image was never visible, it was always filled with
the image itself, or a solid color / checkerboard pattern.
This patch fixes the problem by always filling the background with the
default brush, not just the borders.

Problem 2 is fixed at the same time because the code that erased the
borders had no effect on SVGs because the calculated image rect was the
same size as the document view.

Problem 3 is fixed by using QGraphicsOpacityEffect instead of directoy
setting the opacity using setOpacity.

Depends on D11630

BUG: 373161
FIXED-IN: 18.08.0

Problem 1 Before

Problem 2 Before

After

(White background to show it doesn't shine through)

Test Plan:
Test the transition between images in Image View, with the 'None'
transparent background option enabled. Should test between the folowing
types of images:

  • Large raster with no alpha channel, e.g. a wallpaper
  • Raster image with alpha channel
  • SVG

Animation should be smooth with no artifacts. The main view background
shouldn't be visible behind the image during the fade.

View with animations turned off should work as expected.

Full screen should show a textured background with OpenGL animations, i.e.,
no different than with Software animations.

Reviewers: Gwenview, rkflx, ngraham

Reviewed By: Gwenview, rkflx, ngraham

Tags: Gwenview

Differential Revision: https://phabricator.kde.org/D11795

Details

Committed
huoniApr 9 2018, 12:24 AM
Reviewer
Gwenview
Differential Revision
D11795: Improve Image View fade transitions
Parents
R260:7cb584e27286: Add "None" option for transparent background in Image view
Branches
Unknown
Tags
Unknown