Commit f705bfb3 authored by Jehan's avatar Jehan

libgimpbase: return 0 for GIMP_UNIT_PIXEL in gimp_unit_get_factor().

Just as documented, pixel unit should always return factor 0. There is
no need to call _gimp_unit_vtable.unit_get_factor().

This is even more important as there is one implementation of
unit_get_factor() in core, and another in libgimp and the one in libgimp
is expecting unit to always be >= GIMP_UNIT_INCH. So we were getting
CRITICALs in libgimp when calling gimp_unit_get_factor() on pixel unit
(for instance when drawing a GimpRuler).
parent 91bde62b
Pipeline #105394 failed with stages
in 5 minutes and 42 seconds
......@@ -233,6 +233,9 @@ gimp_unit_get_factor (GimpUnit unit)
g_return_val_if_fail (_gimp_unit_vtable.unit_get_factor != NULL, 1.0);
if (unit == GIMP_UNIT_PIXEL)
return 0.0;
return _gimp_unit_vtable.unit_get_factor (unit);
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment