Skip to content
  • Jehan's avatar
    libgimpwidgets: improve/fix more of GimpMemSizeEntry. · c8c12f2a
    Jehan authored
    Looking further at this widget, many things are not right. Here are the
    changes:
    - Use binary prefixes (i.e. kibibyte, mebibyte and gibibyte) instead of
      decimal ones. We are making binary shifts so we were actually showing
      the wrong units.
    - Round the value to the closest integer when showing it, not towards 0.
      Otherwise I had cases where it was showing 7GiB for an actual value of
      7.69GiB (default as computed by GIMP from my actual physical memory).
      Note that I am actually unsure even rounding makes sense. Shouldn't we
      rather show double values with a few digits after the decimal points?
      For such values, I think it would make sense.
    - Do not edit the internally saved accurate value when the entry is
      edited to the same less accurate value as our saved value would be
      shown too. In particular when changing the display unit to a bigger
      one, we don't want to lose accuracy. This is especially true for low
      values. Say you don't have a lot of memory and you set the Tile cache
      size to 1.5GiB (1536MiB), you certainly don't want it to become either
      1 or 2GiB when switching display unit to GiB. Now even if the number
      will still display with less accuracy, the internal value will stay
      accurate.
    
    (cherry picked from commit d886bb1b)
    c8c12f2a