__init__.py 437 B

12345678910111213
  1. # -*- coding: utf-8 -*-
  2. from __future__ import absolute_import
  3. def compute_fb_scale(window_size, frame_buffer_size) -> tuple[float, float]: # type: ignore
  4. win_width, win_height = window_size
  5. fb_width, fb_height = frame_buffer_size
  6. # future: remove floats after dropping py27 support
  7. if win_width != 0 and win_height != 0:
  8. return float(fb_width) / win_width, float(fb_height) / win_height
  9. return 1.0, 1.0