After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 588512 - Grid Spacing errors depending on unit
Grid Spacing errors depending on unit
Status: RESOLVED FIXED
Product: GIMP
Classification: Other
Component: General
2.6.6
Other All
: Normal normal
: 2.8
Assigned To: GIMP Bugs
GIMP Bugs
: 627348 663468 699738 (view as bug list)
Depends on:
Blocks:
 
 
Reported: 2009-07-14 05:47 UTC by Johan Friis
Modified: 2014-05-21 19:09 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Turn on grid-view and check the painted cell. It is 32x33 when it should be only 32 in height. (52.33 KB, application/octet-stream)
2010-05-10 09:43 UTC, Rene Jensen
Details
How the bad-grid.xcf attached image looks on my PC (39.97 KB, image/png)
2010-05-10 09:44 UTC, Rene Jensen
Details

Description Johan Friis 2009-07-14 05:47:24 UTC
When setting up a grid, and changing the unit type to millimeters, the grid will change back and forth depending on which box the cursor is in.

An example:

cursor in 'Width' pixel box:
Width: 16px, 4.15mm
Height: 16px, 4.23mm

cursor in 'Height' unit box:
Width: 16px, 4.15mm
Height: 16px, 4.24mm

As you can see, the height in millimeters is rounded up here. In any case, the entire grid behaves oddly there. In an 8x8 grid i have had a few 9x8 grids show up. There is a screenshot of such a case here:
http://www.dotright.net/gimp-grid.png

Let me know if more information is needed, or the explanation is not clear enough.
Comment 1 Sven Neumann 2009-07-14 07:33:52 UTC
The grid is always set up in pixels internally. If you enter the spacing in millimeters it is converted to pixels. Of course there can be rounding issues when doing that.

The incorrectly drawn grid lines that you show in your screen-shot looks like a bug though.
Comment 2 Johan Friis 2009-07-14 07:54:22 UTC
I can see how specifying the grid in millimeters could cause rounding problems. However, I have only been adjusting the pixel value. I did however tab down to close the window the first time I experienced this, and that is what caused the millimeter value to be rounded. I have uploaded another image illustrating this. Note that I have not changed any value manually, just tabbed into the field.

http://www.dotright.net/gimp-grid2.png.

Hope this clears it up a bit.
Comment 3 Michael Schumacher 2009-07-14 08:16:39 UTC
Confirming for 2.6.6. It's a disüplay problem, any action I'm doing in the image window will cause the grid to redraw correctly.
Comment 4 Sven Neumann 2009-07-14 20:36:37 UTC
Let's keep this focused on the display problem then. The rounding problem is a different issue and probably not worth keeping a bug report for.
Comment 5 Rene Jensen 2010-05-10 09:43:23 UTC
Created attachment 160700 [details]
Turn on grid-view and check the painted cell. It is 32x33 when it should be only 32 in height.
Comment 6 Rene Jensen 2010-05-10 09:44:22 UTC
Created attachment 160701 [details]
How the bad-grid.xcf attached image looks on my PC
Comment 7 Rene Jensen 2010-05-10 09:46:56 UTC
Something does seem to be wrong with the grid spacing.

I am adding an XCF file which is set to have a grid with 32x32. On my screen there is one cell (the one I've painted) which is 32x33.
I'm also adding a screen shot in case the XCF file looks correct on the computer of the developers.

My setup:
Windows Vista, 64 bit.
Gimp 2.6.7.
The image is 128x512 and the grid is configured to be 32x32 with offset 0,0

Cheers,
Rene Jensen
Comment 8 Michael Schumacher 2010-12-04 10:05:23 UTC
*** Bug 627348 has been marked as a duplicate of this bug. ***
Comment 9 Bruno 2011-04-06 10:36:19 UTC
I suggest possibles fixes :
1) Custom unit value being used only if actually changed, so that simply tabbing through the field won't apply any change.
2) Using much more digits in custom unit display, enough so that rounding errors won't happen. (the unit detail dialog does use 6 digits)

In any case, the pixel fields should allow for decimals since this is technically possible, more accurate, and does happens internally when using custom unit.
Comment 10 Michael Schumacher 2011-11-08 16:07:03 UTC
*** Bug 663468 has been marked as a duplicate of this bug. ***
Comment 11 Michael Natterer 2014-05-21 18:42:53 UTC
*** Bug 699738 has been marked as a duplicate of this bug. ***
Comment 12 Michael Natterer 2014-05-21 19:09:34 UTC
commit 247267031eb8915641490d1385a74df42e794557
Author: Michael Natterer <mitch@gimp.org>
Date:   Wed May 21 20:43:05 2014 +0200

    Bug 588512 - Grid Spacing errors depending on unit
    
    Always round grid spacings and offsets to integer precision when
    using them for snapping and grid drawing. While we might *want* to
    have subpixel precision grids, all the UI is pretending it to be
    on pixel boundaries. Make that pretense an fact.
    
    (cherry picked from commit 08c6aefa2398dcd36f0c8963633715de6a6430b4)

 app/core/gimpimage-snap.c    | 16 ++++++++++++++++
 app/display/gimpcanvasgrid.c | 45 +++++++++++++++++++++++++++++----------------
 2 files changed, 45 insertions(+), 16 deletions(-)