diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2022-03-26 15:36:55 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2022-03-27 09:58:21 +0100 |
commit | c69bc8ba9ceeb5096a2312fb74176f49e8d3a5f8 (patch) | |
tree | d2d2a1ff6302917bcb1682439e9cb057c58257b6 /desktop | |
parent | 05a0a6997eca876230e9230375ef8601c5cdcfa3 (diff) | |
download | netsurf-c69bc8ba9ceeb5096a2312fb74176f49e8d3a5f8.tar.gz netsurf-c69bc8ba9ceeb5096a2312fb74176f49e8d3a5f8.tar.bz2 |
Bitmap: Colour layout converter doesn't need to be exposed.
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/bitmap.c | 46 | ||||
-rw-r--r-- | 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 @@ -43,52 +43,6 @@ extern bitmap_fmt_t bitmap_fmt; 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). * * The bitmap must be in the client format. |