libfreerdp-codec: add freerdp_convert_color_var()

This commit is contained in:
Marc-André Moreau 2012-01-09 18:45:36 -05:00
parent 5165399b8c
commit c7cc745575
3 changed files with 12 additions and 6 deletions

View File

@ -432,13 +432,12 @@ void xf_gdi_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect)
uint32 color; uint32 color;
xfInfo* xfi = ((xfContext*) context)->xfi; xfInfo* xfi = ((xfContext*) context)->xfi;
color = (xfi->clrconv->invert)? color = freerdp_color_convert_var(opaque_rect->color, xfi->srcBpp, 32, xfi->clrconv);
freerdp_color_convert_var_bgr(opaque_rect->color, xfi->srcBpp, 32, xfi->clrconv):
freerdp_color_convert_var_rgb(opaque_rect->color, xfi->srcBpp, 32, xfi->clrconv);
XSetFunction(xfi->display, xfi->gc, GXcopy); XSetFunction(xfi->display, xfi->gc, GXcopy);
XSetFillStyle(xfi->display, xfi->gc, FillSolid); XSetFillStyle(xfi->display, xfi->gc, FillSolid);
XSetForeground(xfi->display, xfi->gc, color); XSetForeground(xfi->display, xfi->gc, color);
XFillRectangle(xfi->display, xfi->drawing, xfi->gc, XFillRectangle(xfi->display, xfi->drawing, xfi->gc,
opaque_rect->nLeftRect, opaque_rect->nTopRect, opaque_rect->nLeftRect, opaque_rect->nTopRect,
opaque_rect->nWidth, opaque_rect->nHeight); opaque_rect->nWidth, opaque_rect->nHeight);
@ -463,9 +462,7 @@ void xf_gdi_multi_opaque_rect(rdpContext* context, MULTI_OPAQUE_RECT_ORDER* mult
DELTA_RECT* rectangle; DELTA_RECT* rectangle;
xfInfo* xfi = ((xfContext*) context)->xfi; xfInfo* xfi = ((xfContext*) context)->xfi;
color = (xfi->clrconv->invert)? color = freerdp_color_convert_var(multi_opaque_rect->color, xfi->srcBpp, 32, xfi->clrconv);
freerdp_color_convert_var_bgr(multi_opaque_rect->color, xfi->srcBpp, 32, xfi->clrconv):
freerdp_color_convert_var_rgb(multi_opaque_rect->color, xfi->srcBpp, 32, xfi->clrconv);
XSetFunction(xfi->display, xfi->gc, GXcopy); XSetFunction(xfi->display, xfi->gc, GXcopy);
XSetFillStyle(xfi->display, xfi->gc, FillSolid); XSetFillStyle(xfi->display, xfi->gc, FillSolid);

View File

@ -246,6 +246,7 @@ FREERDP_API uint8* freerdp_mono_image_convert(uint8* srcData, int width, int hei
FREERDP_API void freerdp_alpha_cursor_convert(uint8* alphaData, uint8* xorMask, uint8* andMask, int width, int height, int bpp, HCLRCONV clrconv); FREERDP_API void freerdp_alpha_cursor_convert(uint8* alphaData, uint8* xorMask, uint8* andMask, int width, int height, int bpp, HCLRCONV clrconv);
FREERDP_API void freerdp_image_swap_color_order(uint8* data, int width, int height); FREERDP_API void freerdp_image_swap_color_order(uint8* data, int width, int height);
FREERDP_API uint32 freerdp_color_convert_var(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv);
FREERDP_API uint32 freerdp_color_convert_rgb(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv); FREERDP_API uint32 freerdp_color_convert_rgb(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv);
FREERDP_API uint32 freerdp_color_convert_bgr(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv); FREERDP_API uint32 freerdp_color_convert_bgr(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv);
FREERDP_API uint32 freerdp_color_convert_rgb_bgr(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv); FREERDP_API uint32 freerdp_color_convert_rgb_bgr(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv);

View File

@ -326,6 +326,14 @@ uint32 freerdp_color_convert_bgr_rgb(uint32 srcColor, int srcBpp, int dstBpp, HC
return dstColor; return dstColor;
} }
uint32 freerdp_color_convert_var(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv)
{
if (clrconv->invert)
return freerdp_color_convert_var_bgr(srcColor, srcBpp, dstBpp, clrconv);
else
return freerdp_color_convert_var_rgb(srcColor, srcBpp, dstBpp, clrconv);
}
uint32 freerdp_color_convert_var_rgb(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv) uint32 freerdp_color_convert_var_rgb(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv)
{ {
if (srcBpp > 16) if (srcBpp > 16)