From c69bc8ba9ceeb5096a2312fb74176f49e8d3a5f8 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Sat, 26 Mar 2022 15:36:55 +0000 Subject: [PATCH] Bitmap: Colour layout converter doesn't need to be exposed. --- desktop/bitmap.c | 46 ++++++++++++++++++++++++++++++++++++++++++++++ desktop/bitmap.h | 46 ---------------------------------------------- 2 files changed, 46 insertions(+), 46 deletions(-) diff --git a/desktop/bitmap.c b/desktop/bitmap.c index 4977f7a0a..a78057631 100644 --- a/desktop/bitmap.c +++ b/desktop/bitmap.c @@ -41,6 +41,52 @@ struct bitmap_colour_layout bitmap_layout = { .a = 3, }; +/** + * Get the colour layout for the given bitmap format. + * + * \param[in] fmt Pixel format to get channel layout for, + * \return channel layout structure. + */ +static struct bitmap_colour_layout bitmap__get_colour_layout( + const bitmap_fmt_t *fmt) +{ + switch (fmt->layout) { + default: + /* Fall through. */ + case BITMAP_LAYOUT_R8G8B8A8: + return (struct bitmap_colour_layout) { + .r = 0, + .g = 1, + .b = 2, + .a = 3, + }; + + case BITMAP_LAYOUT_B8G8R8A8: + return (struct bitmap_colour_layout) { + .b = 0, + .g = 1, + .r = 2, + .a = 3, + }; + + case BITMAP_LAYOUT_A8R8G8B8: + return (struct bitmap_colour_layout) { + .a = 0, + .r = 1, + .g = 2, + .b = 3, + }; + + case BITMAP_LAYOUT_A8B8G8R8: + return (struct bitmap_colour_layout) { + .a = 0, + .b = 1, + .g = 2, + .r = 3, + }; + } +} + /* Exported function, documented in include/netsurf/bitmap.h */ void bitmap_set_format(const bitmap_fmt_t *bitmap_format) { diff --git a/desktop/bitmap.h b/desktop/bitmap.h index 107089f66..574f8fb8e 100644 --- a/desktop/bitmap.h +++ b/desktop/bitmap.h @@ -42,52 +42,6 @@ extern bitmap_fmt_t bitmap_fmt; /** The client bitmap colour channel layout. */ extern struct bitmap_colour_layout bitmap_layout; -/** - * Get the colour layout for the given bitmap format. - * - * \param[in] fmt Pixel format to get channel layout for, - * \return channel layout structure. - */ -static inline struct bitmap_colour_layout bitmap__get_colour_layout( - const bitmap_fmt_t *fmt) -{ - switch (fmt->layout) { - default: - /* Fall through. */ - case BITMAP_LAYOUT_R8G8B8A8: - return (struct bitmap_colour_layout) { - .r = 0, - .g = 1, - .b = 2, - .a = 3, - }; - - case BITMAP_LAYOUT_B8G8R8A8: - return (struct bitmap_colour_layout) { - .b = 0, - .g = 1, - .r = 2, - .a = 3, - }; - - case BITMAP_LAYOUT_A8R8G8B8: - return (struct bitmap_colour_layout) { - .a = 0, - .r = 1, - .g = 2, - .b = 3, - }; - - case BITMAP_LAYOUT_A8B8G8R8: - return (struct bitmap_colour_layout) { - .a = 0, - .b = 1, - .g = 2, - .r = 3, - }; - } -} - /** * Convert a bitmap pixel to a NetSurf colour (0xAARRGGBB). *