Fix points_to_pixels impl

This commit is contained in:
Marco Pesenti Gritti 2007-02-28 19:05:56 +01:00
parent 458aaf3786
commit abc400f841

View File

@ -73,7 +73,8 @@ def _compute_zoom_factor():
else: else:
return min(_MAX_ZOOM_FACTOR, screen_width / _ZOOM_CONSTANT) return min(_MAX_ZOOM_FACTOR, screen_width / _ZOOM_CONSTANT)
_dpi_factor = float(_sugar.get_screen_dpi()) / 201.0 _screen_dpi = float(_sugar.get_screen_dpi())
_dpi_factor = _screen_dpi / 201.0
_zoom_factor = _compute_zoom_factor() _zoom_factor = _compute_zoom_factor()
STANDARD_ICON_SCALE = 1.0 * _dpi_factor * _zoom_factor STANDARD_ICON_SCALE = 1.0 * _dpi_factor * _zoom_factor
@ -83,7 +84,7 @@ LARGE_ICON_SCALE = 2.0 * _dpi_factor * _zoom_factor
XLARGE_ICON_SCALE = 3.0 * _dpi_factor * _zoom_factor XLARGE_ICON_SCALE = 3.0 * _dpi_factor * _zoom_factor
def points_to_pixels(points): def points_to_pixels(points):
return int(points * _zoom_factor) return int(points * _screen_dpi * 72.0 * _zoom_factor)
def grid_to_pixels(units): def grid_to_pixels(units):
return int(units * 75.0 * _dpi_factor * _zoom_factor) return int(units * 75.0 * _dpi_factor * _zoom_factor)