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).
This commit is contained in:
parent
91bde62b08
commit
f705bfb395
1 changed files with 3 additions and 0 deletions
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue