Always set transformation mode when setting zoom in image scaler
ClosedPublic

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

Details

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.

Diff Detail

Repository
R260 Gwenview
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
rkflx requested review of this revision.Jul 24 2018, 11:21 PM
rkflx created this revision.
muhlenpfordt accepted this revision.Jul 25 2018, 11:46 AM

Works good and I can't spot any visual difference. :)

This revision is now accepted and ready to land.Jul 25 2018, 11:46 AM
This revision was automatically updated to reflect the committed changes.