Fix alpha conversion for wayland single pixel buffer

This commit is contained in:
Kovid Goyal 2024-10-20 09:35:28 +05:30
parent 002d0a0403
commit 16c82c7c16
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

2
glfw/wl_window.c vendored
View file

@ -824,7 +824,7 @@ create_single_color_buffer(int width, int height, pixel color) {
if (width == 1 && height == 1 && _glfw.wl.wp_single_pixel_buffer_manager_v1) {
#define C(x) (uint32_t)(((double)((uint64_t)color.alpha * color.x * UINT32_MAX)) / (255 * 255))
struct wl_buffer *ans = wp_single_pixel_buffer_manager_v1_create_u32_rgba_buffer(
_glfw.wl.wp_single_pixel_buffer_manager_v1, C(red), C(green), C(blue), color.alpha * UINT32_MAX);
_glfw.wl.wp_single_pixel_buffer_manager_v1, C(red), C(green), C(blue), (uint32_t)((color.alpha / 255.) * UINT32_MAX));
#undef C
if (!ans) _glfwInputError(GLFW_PLATFORM_ERROR, "Wayland: failed to create single pixel buffer");
return ans;