diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2022-03-26 14:41:12 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2022-03-27 09:58:21 +0100 |
commit | d00c049d0221c5b63a6a423d5adc7933ac1e758d (patch) | |
tree | 1cb27e3e85a45f54a50d74a0bd89aa252e4c74d4 | |
parent | 1bbb499f88ef324a4526a74230851dd9a5325e19 (diff) | |
download | netsurf-d00c049d0221c5b63a6a423d5adc7933ac1e758d.tar.gz netsurf-d00c049d0221c5b63a6a423d5adc7933ac1e758d.tar.bz2 |
Bitmap: Move bitmap pixel to colour macro to bitmap header.
-rw-r--r-- | content/handlers/image/image.c | 3 | ||||
-rw-r--r-- | desktop/bitmap.h | 4 | ||||
-rw-r--r-- | include/netsurf/plot_style.h | 4 |
3 files changed, 6 insertions, 5 deletions
diff --git a/content/handlers/image/image.c b/content/handlers/image/image.c index 4eb366e0b..3107ee495 100644 --- a/content/handlers/image/image.c +++ b/content/handlers/image/image.c @@ -26,6 +26,7 @@ #include "netsurf/bitmap.h" #include "netsurf/content.h" #include "desktop/gui_internal.h" +#include "desktop/bitmap.h" #include "image/bmp.h" #include "image/gif.h" @@ -124,7 +125,7 @@ bool image_bitmap_plot(struct bitmap *bitmap, if (height == 1) { /* optimise 1x1 bitmap plot */ pixel = guit->bitmap->get_buffer(bitmap); - fill_style.fill_colour = pixel_to_colour(pixel); + fill_style.fill_colour = bitmap_pixel_to_colour(pixel); if (guit->bitmap->get_opaque(bitmap) || ((fill_style.fill_colour & 0xff000000) == 0xff000000)) { diff --git a/desktop/bitmap.h b/desktop/bitmap.h index af7e9040f..8756c50a1 100644 --- a/desktop/bitmap.h +++ b/desktop/bitmap.h @@ -84,6 +84,10 @@ static inline struct bitmap_colour_layout bitmap__get_colour_layout( } } +/* get a bitmap pixel (image/bitmap.h) into a plot colour */ +#define bitmap_pixel_to_colour(b) \ + b[0] | (b[1] << 8) | (b[2] << 16) | (b[3] << 24) + /** * Sanitise bitmap pixel component layout. * diff --git a/include/netsurf/plot_style.h b/include/netsurf/plot_style.h index bfc0805ea..875020cd8 100644 --- a/include/netsurf/plot_style.h +++ b/include/netsurf/plot_style.h @@ -201,10 +201,6 @@ typedef struct plot_font_style { (((((c1 & 0x00ff00) * (255 - p)) + \ ((c0 & 0x00ff00) * ( p)) ) >> 8) & 0x00ff00)) -/* get a bitmap pixel (image/bitmap.h) into a plot colour */ -#define pixel_to_colour(b) \ - b[0] | (b[1] << 8) | (b[2] << 16) | (b[3] << 24) - /* Get the red channel from a colour */ #define red_from_colour(c) \ ((c ) & 0xff) |