servoshell/desktop/
geometry.rs

1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
5use euclid::{Point2D, Size2D};
6use servo::webrender_api::units::DevicePixel;
7use winit::dpi::{PhysicalPosition, PhysicalSize};
8
9pub fn winit_size_to_euclid_size<T>(size: PhysicalSize<T>) -> Size2D<T, DevicePixel> {
10    Size2D::new(size.width, size.height)
11}
12
13pub fn winit_position_to_euclid_point<T>(position: PhysicalPosition<T>) -> Point2D<T, DevicePixel> {
14    Point2D::new(position.x, position.y)
15}