PixelUnits.cpp 491 B

123456789101112131415161718192021222324252627
  1. /*
  2. * Copyright (c) 2023, Aliaksandr Kalenik <kalenik.aliaksandr@gmail.com>
  3. *
  4. * SPDX-License-Identifier: BSD-2-Clause
  5. */
  6. #include <AK/Math.h>
  7. #include <LibWeb/PixelUnits.h>
  8. namespace Web {
  9. float CSSPixels::to_float() const
  10. {
  11. return static_cast<float>(m_value) / fixed_point_denominator;
  12. }
  13. double CSSPixels::to_double() const
  14. {
  15. return static_cast<double>(m_value) / fixed_point_denominator;
  16. }
  17. int CSSPixels::to_int() const
  18. {
  19. return m_value / fixed_point_denominator;
  20. }
  21. }