Always set transformation mode when setting zoom in image scaler

Authored by rkflx on Jul 24 2018, 11:17 PM.

Description

Always set transformation mode when setting zoom in image scaler

Summary:
RasterImageView::updateBuffer will be called in many situations,
sometimes even multiple times per second, e.g. when panning an image.

Since it is often not necessary to update the zoom level of the image
scaler because only properties other than zoom have changed,
ImageScaler::setZoom can be moved to RasterImageView::onZoomChanged,
which is already being called exactly when needed. (Note that before the
change, onZoomChanged would already call setZoom implicitly through
updateBuffer.)

With that change done, the next part can be implemented without adding
unnecessary calls: mTransformationMode is a property of ImageScaler
and should be changed whenever ImageScaler::mZoom changes, not only
for RasterImageView::onZoomChanged. Currently there should be no
difference in behaviour, but handling both zoom and transformation in
the same place should prevent mistakes in the future. This also
uncovered a bug in imagescalertest.

Finally, add a comment why onZoomChanged is needed in
RasterImageView::finishSetDocument.

Test Plan:
Zoom, pan and change images in every possible way, and also follow the
test plan for 1ce062a458b1. Everything should work as before.

Reviewers: Gwenview, muhlenpfordt

Reviewed By: Gwenview, muhlenpfordt

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

Details