NewDesktopGeometry derives a declared model-facing geometry from the native desktop size.
(nativeWidth, nativeHeight int)
| 50 | // NewDesktopGeometry derives a declared model-facing geometry from the native |
| 51 | // desktop size. |
| 52 | func NewDesktopGeometry(nativeWidth, nativeHeight int) DesktopGeometry { |
| 53 | nativeWidth = sanitizeDesktopDimension(nativeWidth) |
| 54 | nativeHeight = sanitizeDesktopDimension(nativeHeight) |
| 55 | |
| 56 | declaredWidth, declaredHeight := computeDeclaredDesktopSize( |
| 57 | nativeWidth, |
| 58 | nativeHeight, |
| 59 | ) |
| 60 | |
| 61 | return DesktopGeometry{ |
| 62 | NativeWidth: nativeWidth, |
| 63 | NativeHeight: nativeHeight, |
| 64 | DeclaredWidth: declaredWidth, |
| 65 | DeclaredHeight: declaredHeight, |
| 66 | } |
| 67 | } |
| 68 | |
| 69 | // NewDesktopGeometryWithDeclared returns a geometry that preserves the native |
| 70 | // desktop size while using the provided declared model-facing dimensions. |