From 407e20578ff0b8c2b3fa534f82b4cf139e914ee0 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Fri, 25 Jun 2021 18:08:17 +0100 Subject: [PATCH] RISC OS: GUI: Clean up alpha sprite support test. --- frontends/riscos/gui.c | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/frontends/riscos/gui.c b/frontends/riscos/gui.c index 3f2a212f2..f9268cac1 100644 --- a/frontends/riscos/gui.c +++ b/frontends/riscos/gui.c @@ -1112,9 +1112,11 @@ static void ro_gui_check_resolvers(void) } /** - * Set global variable for whether the OS version supports alpha channels. + * Determine whether the OS version supports alpha channels. + * + * \return true iff alpha channels are supported, false otherwise. */ -static void ro_gui__check_os_alpha_sprites(void) +static bool ro_gui__os_alpha_sprites_supported(void) { os_error *error; int var_val; @@ -1126,17 +1128,10 @@ static void ro_gui__check_os_alpha_sprites(void) if (error) { NSLOG(netsurf, ERROR, "xos_read_mode_variable: 0x%x: %s", error->errnum, error->errmess); - return; + return false; } - if (var_val == (1 << 15)) { - os_alpha_sprite_supported = true; - } else { - os_alpha_sprite_supported = false; - } - - NSLOG(netsurf, INFO, "OS supports alpha sprites: %s (%i)", - os_alpha_sprite_supported ? "yes" : "no", var_val); + return (var_val == (1 << 15)); } /** @@ -1179,7 +1174,10 @@ static nserror gui_init(int argc, char** argv) * (remember that it's preferable to check for specific features * being present) */ xos_byte(osbyte_IN_KEY, 0, 0xff, &os_version, NULL); - ro_gui__check_os_alpha_sprites(); + + os_alpha_sprite_supported = ro_gui__os_alpha_sprites_supported(); + NSLOG(netsurf, INFO, "OS supports alpha sprites: %s", + os_alpha_sprite_supported ? "yes" : "no"); /* the first release version of the A9home OS is incapable of plotting patterned lines (presumably a fault in the hw acceleration) */