• Huon Imberger's avatar
    Add support for configurable transparent background to SVGs · 836ec0e4
    Huon Imberger authored
    Summary:
    SVGs do not honor the "Transparent background" config option, and simply have no
    background at all. This patch ensures this option is applied to SVGs as well as
    raster images.
    
    Unlike `RasterImageView` that uses a `QPixmap` buffer (`mCurrentBuffer`) for drawing
    the background and the image, SVGs are rendered directly on top of `SvgImageView`
    (`QGraphicsWidget`). Therefore we just paint the background in `SvgImageView::paint`
    which happens before the SVG is rendered.
    
    We move the checkboard texture code to `AbstractImageView` now that it's used by
    both subclasses `RasterImageView` and `SvgImageView`.
    
    This patch also configures kconf_update due to the moving of the above enum.
    Since I didn't want to litter `/app` with files, I've moved the update files to
    `/kconf_update`.
    
    Fixes T8125
    
    Before:
    {F5764298}
    
    After:
    {F5764299}
    {F5764300}
    
    Test Plan:
      - Open an SVG with solid color config option
      - Open and SVG with checkboard background config. At a high enough zoom (where the
        birdseye view shows up), panning/scrolling should have the checkboard pattern
        fixed to the image, like raster images
      - Ensure raster images with transparent backgrounds are unaffected
    
    ## kconf_update
    The script `gwenview-imageview-alphabackgroundmode-update.pl` must be in
    `/usr/share/kconf_update` in order for `/usr/lib/kf5/kconf_update` to find it.
    If successfull, instances of `RasterImageView::AlphaBackground*` should change to
    `AbstractImageView::AlphaBackground*`.
    
    Reviewers: #gwenview, rkflx, ngraham
    
    Reviewed By: #gwenview, rkflx, ngraham
    
    Tags: #gwenview
    
    Maniphest Tasks: T8125
    
    Differential Revision: https://phabricator.kde.org/D11629
    836ec0e4
configdialog.cpp 5.91 KB