GNOME Bugzilla – Bug 131964
Zoom ratio problem
Last modified: 2004-12-22 21:47:04 UTC
Steps to reproduce: 1) New image 2) View->Zoom->Other 3) enter 99:100 as the ratio 4) observe a 10000% zoom, where it should be 99% (100:99 works as expected) This will likely be a thing of the past very quickly as Simon is hacking this area presently.
GSR spotted the reason for that: gimp_display_shell_scale accepts the zoom ratio as an integer, where i / 100 is the numerator and i % 100 is the denominator of the fraction. So 99:100 gets encoded as 99*100+100 = 10000 and decoded to 100:0, 100:1 after a sanity check. Of course this is totally insane and should be fixed at the API level. I have a patch and can commit it if I get some thumbs up from the maintainers (it changes not only a lot of code, but also zoom stepping). The patch is attached to bug 131563. Setting target milestone to 2.0.
Removing PATCH keyword, since there isn't one, and making this bug depend on bug #131563. We are agreed that patch should be applied, we are just wondering when is the right time. I'm still in favour of post-2.0, and would like to set the milestone of this bug to 2.2. The only alternatives are to come up with a quick fix for this bug which can go into 2.0 or commit the patch attached to bug #131563 now, which could result in other bugs. Cheers, Dave.
Fixed in CVS: 2004-01-29 Simon Budig <simon@gimp.org> * app/display/gimpdisplayshell.[ch]: Store the zoom factor as float, not as a ratio. * app/display/gimpdisplayshell-scale.[ch]: change the API to expose the Float instead a weirdly encoded integer. Implement functions to get a ratio from the scale factor. Implement a set as presets as discussed on the mailinglist. Changed Zoom->Other dialog to enable entering a float. * app/display/gimpdisplayshell-title.c * app/display/gimpnavigationview.c * app/gui/image-menu.c * app/gui/info-window.c * app/tools/gimpmagnifytool.c: changed accordingly. * app/core/gimp.[ch] * app/display/gimpdisplay.[ch] * app/gui/gui-vtable.c * app/widgets/widgets-enums.h: Made the various display-creating functions accept a float for the scale. Introduce a new GimpZoomType: GIMP_ZOOM_TO. Generally adjust the API to use floats instead of weird integers. * app/core/gimp-edit.c * app/core/gimptemplate.c * app/display/gimpdisplayshell-callbacks.c * app/file/file-open.c * app/gui/image-commands.c * app/gui/view-commands.[ch] * tools/pdbgen/pdb/display.pdb * app/widgets/gimpimageview.c * app/widgets/gimptoolbox-dnd.c: changed accordingly * app/pdb/display_cmds.c: regenerated