Skip to content

ImageItem: autoDownsample forces qimage recalculation every render #752

@ChristophRose

Description

@ChristophRose

The way autoDownsample is currently implemented forces the entire Image to be downsampled, the lut/levels to be applied and the ARGB and QImage to be recalculated every single time the image is updated. This happens even if the calculated downsample is 1 (ie. no downsampling needed). This leads to using autoDownsample often making drawing images slower than not downsampling. That is kind of counterproductive.

This happens because in viewTransformChanged, the qimage is simply set to None if autoDownsampling is enabled, and an update is forced which calls render. There everything is realculated every time. viewTranformChanged is called everytime the image is moved or zoomed in/out on.

However, since the entire image is downsampled and the LUT applied to it, a new recalculation would only be needed if the downsampling factors change (because of zooming in or out) or if the LUT/levels are changed (which works with a different event pathway).

[Edit] A relatively easy fix is to do the check for the xds, yds in viewTransformChanged and only delete the qimage if that is different from before.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions