Mercurial > mplayer.hg
changeset 35730:330325df88ed
Relocate #defines and make them functions.
Additionally, add doxygen comments.
author | ib |
---|---|
date | Tue, 22 Jan 2013 17:34:52 +0000 |
parents | a5f7a861a293 |
children | e6ee0c8ef341 |
files | gui/wm/ws.c |
diffstat | 1 files changed, 48 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/gui/wm/ws.c Tue Jan 22 17:04:36 2013 +0000 +++ b/gui/wm/ws.c Tue Jan 22 17:34:52 2013 +0000 @@ -78,22 +78,6 @@ static int wsUseXShm = True; static int wsUseXShape = True; -/* --- */ - -#define PACK_RGB16(r, g, b, pixel) \ - pixel = (r >> 3); \ - pixel <<= 6; \ - pixel |= (g >> 2); \ - pixel <<= 5; \ - pixel |= (b >> 3) - -#define PACK_RGB15(r, g, b, pixel) \ - pixel = (r >> 3); \ - pixel <<= 5; \ - pixel |= (g >> 3); \ - pixel <<= 5; \ - pixel |= (b >> 3) - static enum AVPixelFormat out_pix_fmt = PIX_FMT_NONE; /* --- */ @@ -1085,6 +1069,50 @@ // ---------------------------------------------------------------------------------------------- // Set window background to 'color'. // ---------------------------------------------------------------------------------------------- +/** + * @brief Pack color components @a r, @a g and @a b into 15 bits. + * + * @param r red (0 - 255) + * @param g green (0 - 255) + * @param b blue (0 - 255) + * + * @return pixel suitable for a RGB 15 bits color format + */ +static int pack_rgb15(int r, int g, int b) +{ + int pixel; + + pixel = (r >> 3); + pixel <<= 5; + pixel |= (g >> 3); + pixel <<= 5; + pixel |= (b >> 3); + + return pixel; +} + +/** + * @brief Pack color components @a r, @a g and @a b into 16 bits. + * + * @param r red (0 - 255) + * @param g green (0 - 255) + * @param b blue (0 - 255) + * + * @return pixel suitable for a RGB 16 bits color format + */ +static int pack_rgb16(int r, int g, int b) +{ + int pixel; + + pixel = (r >> 3); + pixel <<= 6; + pixel |= (g >> 2); + pixel <<= 5; + pixel |= (b >> 3); + + return pixel; +} + void wsWindowBackground(wsWindow *win, int r, int g, int b) { int color = 0; @@ -1101,19 +1129,19 @@ break; case wsRGB16: - PACK_RGB16(r, g, b, color); + color = pack_rgb16(r, g, b); break; case wsBGR16: - PACK_RGB16(b, g, r, color); + color = pack_rgb16(b, g, r); break; case wsRGB15: - PACK_RGB15(r, g, b, color); + color = pack_rgb15(r, g, b); break; case wsBGR15: - PACK_RGB15(b, g, r, color); + color = pack_rgb15(b, g, r); break; }