Skip to content
Commit 25fb575e authored by Huon Imberger's avatar Huon Imberger
Browse files

Improve Image View fade transitions

Summary:
This patch fixes three problems:

  # 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.
  # 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.
  # 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
{F5776639}

## Problem 2 Before
{F5776643}

## After
(White background to show it doesn't shine through)
{F5783594}

Test Plan:
Test the transition between images in Image {nav 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.

{nav 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
parent 7cb584e2
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