Bug 342709

Summary: Minimum/maximum zoom doesn't update after rescale
Product: [Applications] krita Reporter: Storm Engineer <storm.anthro>
Component: GeneralAssignee: Halla Rempt <halla>
Status: RESOLVED FIXED    
Severity: normal CC: dimula73
Priority: NOR    
Version: 2.9 Beta   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Storm Engineer 2015-01-10 19:06:59 UTC
After the image is rescaled the allowed minimum and maximum zoom doesn't accommodate the new image size.

Reproducible: Always

Steps to Reproduce:
1. Create a new image with 8000 x 6000 pixels size.
2. Create another image with 800 x 600 size, then rescale it afterwards to 8000 x 6000

Actual Results:  
The minimum zoom level of second image won't match that of the first, and you probably can't zoom out enough to see the whole image.

Expected Results:  
Minimum zooms levels should be the same.
Comment 1 Dmitry Kazakov 2015-01-24 10:03:26 UTC
The problem happens because we calculate the minimum zoom once in KisZoomManager::setup() which is called only once.

There is another problem: KoZoomMode::setMinimumZoom() is a static function that works throughout the whole Krita instance. It should be made owned by KoView/KoCanvasBase or something.
Comment 2 Halla Rempt 2015-01-30 13:33:39 UTC
But why do we actually set the minimum zoom to something defined by the image size -- this was changed in, but in other application, the minimum is the same percentage no matter what the image size.

commit 53e9ce5107a4a8c0fc4eb41e4205fc1c8b3426c8
Author: Dmitry Kazakov <dimula73@gmail.com>
Date:   Tue Nov 13 15:56:32 2012 +0400
Follows: v2.5.90
Precedes: v2.6.90
Branches: <Expand>

    Made the zooming steps consistent in Krita
    
    1) Now the wheel and hotkey zooming in Krita is done using KoZoomAction
       instead of hardcoded code
    2) The zoom levels are changed to be in consistency with other
       applications (checked in Adobe Reader and Adobe Photoshop).
       Such change was demanded in bug 302775
    
    BUG:302775
Comment 3 Dmitry Kazakov 2015-01-30 13:58:30 UTC
The main reason was that the user can open some really huge images that cannot be shown on screen because they need to small zoom level.

There was also another point, though I'm not sure how it is related. OpenGL gives artifacts on too small zoom levels because:

1) the number of mipmap levels is limited;
2) the textures should have an overlapping border, which size depends on the number of mipmaps.

See KisConfig::textureOverlapBorder()
Comment 4 Halla Rempt 2015-01-30 13:59:56 UTC
Right... I'll try and move the minimumzoom to KoZoomAction, that's per canvas, and KoZoomMode::minimum seems only usef from there.
Comment 5 Dmitry Kazakov 2015-01-30 14:05:37 UTC
Yes, that should be the best approach :)
Comment 6 Halla Rempt 2015-01-30 14:12:01 UTC
Git commit 4d6318b7532f41b8bb5bc643e4acb5f3e7f0c7d4 by Boudewijn Rempt.
Committed on 30/01/2015 at 14:11.
Pushed by rempt into branch 'calligra/2.9'.

M  +18   -8    krita/ui/kis_zoom_manager.cc
M  +1    -0    krita/ui/kis_zoom_manager.h
M  +66   -14   libs/widgets/KoZoomAction.cpp
M  +43   -0    libs/widgets/KoZoomAction.h

http://commits.kde.org/calligra/4d6318b7532f41b8bb5bc643e4acb5f3e7f0c7d4