xref: /haiku/headers/private/kernel/boot/platform/generic/video_splash.h (revision 344ded80d400028c8f561b4b876257b94c12db4a)
1 /*
2  * Copyright 2024, Haiku, Inc. All rights reserved.
3  * Distributed under the terms of the MIT License.
4  */
5 #ifndef GENERIC_VIDEO_SPLASH_H
6 #define GENERIC_VIDEO_SPLASH_H
7 
8 
9 #include <SupportDefs.h>
10 
11 
12 void
13 compute_splash_logo_placement(uint32 screenWidth, uint32 screenHeight,
14 	int& width, int& height, int& x, int& y)
15 {
16 	uint16 iconsHalfHeight = kSplashIconsHeight / 2;
17 
18 	width = min_c(kSplashLogoWidth, screenWidth);
19 	height = min_c(uint32(kSplashLogoHeight) + iconsHalfHeight,
20 		screenHeight);
21 	int placementX = max_c(0, min_c(100, kSplashLogoPlacementX));
22 	int placementY = max_c(0, min_c(100, kSplashLogoPlacementY));
23 
24 	x = (screenWidth - width) * placementX / 100;
25 	y = (screenHeight - height) * placementY / 100;
26 
27 	height = min_c(kSplashLogoHeight, screenHeight);
28 }
29 
30 
31 void
32 compute_splash_icons_placement(uint32 screenWidth, uint32 screenHeight,
33 	int& width, int& height, int& x, int& y)
34 {
35 	uint16 iconsHalfHeight = kSplashIconsHeight / 2;
36 
37 	width = min_c(kSplashIconsWidth, screenWidth);
38 	height = min_c(uint32(kSplashLogoHeight) + iconsHalfHeight,
39 		screenHeight);
40 	int placementX = max_c(0, min_c(100, kSplashIconsPlacementX));
41 	int placementY = max_c(0, min_c(100, kSplashIconsPlacementY));
42 
43 	x = (screenWidth - width) * placementX / 100;
44 	y = kSplashLogoHeight + (screenHeight - height)
45 		* placementY / 100;
46 
47 	height = min_c(iconsHalfHeight, screenHeight);
48 }
49 
50 
51 #endif	/* GENERIC_VIDEO_SPLASH_H */
52