libfreerdp-codec: fix color conversion issues for OpaqueRect with --gdi sw,hw
This commit is contained in:
parent
cd6d3c0076
commit
2d34a62ce8
@ -237,8 +237,8 @@ void wf_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
|
||||
COLORREF org_textcolor;
|
||||
wfInfo* wfi = ((wfContext*) context)->wfi;
|
||||
|
||||
fgcolor = freerdp_color_convert(patblt->foreColor, wfi->srcBpp, 24, wfi->clrconv);
|
||||
bgcolor = freerdp_color_convert(patblt->backColor, wfi->srcBpp, 24, wfi->clrconv);
|
||||
fgcolor = freerdp_color_convert_rgb(patblt->foreColor, wfi->srcBpp, 24, wfi->clrconv);
|
||||
bgcolor = freerdp_color_convert_rgb(patblt->backColor, wfi->srcBpp, 24, wfi->clrconv);
|
||||
|
||||
brush = wf_create_brush(wfi, &patblt->brush, fgcolor, wfi->srcBpp);
|
||||
org_bkmode = SetBkMode(wfi->drawing->hdc, OPAQUE);
|
||||
@ -279,7 +279,7 @@ void wf_gdi_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect)
|
||||
uint32 brush_color;
|
||||
wfInfo* wfi = ((wfContext*) context)->wfi;
|
||||
|
||||
brush_color = freerdp_color_convert(opaque_rect->color, wfi->srcBpp, 24, wfi->clrconv);
|
||||
brush_color = freerdp_color_convert_var_rgb(opaque_rect->color, wfi->srcBpp, 32, wfi->clrconv);
|
||||
|
||||
rect.left = opaque_rect->nLeftRect;
|
||||
rect.top = opaque_rect->nTopRect;
|
||||
@ -306,7 +306,7 @@ void wf_gdi_multi_opaque_rect(rdpContext* context, MULTI_OPAQUE_RECT_ORDER* mult
|
||||
{
|
||||
rectangle = &multi_opaque_rect->rectangles[i];
|
||||
|
||||
brush_color = freerdp_color_convert(multi_opaque_rect->color, wfi->srcBpp, wfi->dstBpp, wfi->clrconv);
|
||||
brush_color = freerdp_color_convert_var_rgb(multi_opaque_rect->color, wfi->srcBpp, 32, wfi->clrconv);
|
||||
|
||||
rect.left = rectangle->left;
|
||||
rect.top = rectangle->top;
|
||||
@ -332,7 +332,7 @@ void wf_gdi_line_to(rdpContext* context, LINE_TO_ORDER* line_to)
|
||||
uint32 pen_color;
|
||||
wfInfo* wfi = ((wfContext*) context)->wfi;
|
||||
|
||||
pen_color = freerdp_color_convert(line_to->penColor, wfi->srcBpp, wfi->dstBpp, wfi->clrconv);
|
||||
pen_color = freerdp_color_convert_rgb(line_to->penColor, wfi->srcBpp, wfi->dstBpp, wfi->clrconv);
|
||||
|
||||
pen = CreatePen(line_to->penStyle, line_to->penWidth, pen_color);
|
||||
|
||||
@ -364,7 +364,7 @@ void wf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline)
|
||||
uint32 pen_color;
|
||||
wfInfo* wfi = ((wfContext*) context)->wfi;
|
||||
|
||||
pen_color = freerdp_color_convert(polyline->penColor, wfi->srcBpp, wfi->dstBpp, wfi->clrconv);
|
||||
pen_color = freerdp_color_convert_rgb(polyline->penColor, wfi->srcBpp, wfi->dstBpp, wfi->clrconv);
|
||||
|
||||
hpen = CreatePen(0, 1, pen_color);
|
||||
org_rop2 = wf_set_rop2(wfi->drawing->hdc, polyline->bRop2);
|
||||
|
@ -323,8 +323,8 @@ void xf_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
|
||||
brush = &patblt->brush;
|
||||
xf_set_rop3(xfi, gdi_rop3_code(patblt->bRop));
|
||||
|
||||
foreColor = freerdp_color_convert(patblt->foreColor, xfi->srcBpp, 32, xfi->clrconv);
|
||||
backColor = freerdp_color_convert(patblt->backColor, xfi->srcBpp, 32, xfi->clrconv);
|
||||
foreColor = freerdp_color_convert_rgb(patblt->foreColor, xfi->srcBpp, 32, xfi->clrconv);
|
||||
backColor = freerdp_color_convert_rgb(patblt->backColor, xfi->srcBpp, 32, xfi->clrconv);
|
||||
|
||||
if (brush->style == GDI_BS_SOLID)
|
||||
{
|
||||
@ -423,7 +423,7 @@ void xf_gdi_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect)
|
||||
uint32 color;
|
||||
xfInfo* xfi = ((xfContext*) context)->xfi;
|
||||
|
||||
color = freerdp_color_convert(opaque_rect->color, xfi->srcBpp, 32, xfi->clrconv);
|
||||
color = freerdp_color_convert_var_rgb(opaque_rect->color, xfi->srcBpp, 32, xfi->clrconv);
|
||||
|
||||
XSetFunction(xfi->display, xfi->gc, GXcopy);
|
||||
XSetFillStyle(xfi->display, xfi->gc, FillSolid);
|
||||
@ -452,7 +452,7 @@ void xf_gdi_multi_opaque_rect(rdpContext* context, MULTI_OPAQUE_RECT_ORDER* mult
|
||||
DELTA_RECT* rectangle;
|
||||
xfInfo* xfi = ((xfContext*) context)->xfi;
|
||||
|
||||
color = freerdp_color_convert(multi_opaque_rect->color, xfi->srcBpp, 32, xfi->clrconv);
|
||||
color = freerdp_color_convert_var_rgb(multi_opaque_rect->color, xfi->srcBpp, 32, xfi->clrconv);
|
||||
|
||||
XSetFunction(xfi->display, xfi->gc, GXcopy);
|
||||
XSetFillStyle(xfi->display, xfi->gc, FillSolid);
|
||||
@ -485,7 +485,7 @@ void xf_gdi_line_to(rdpContext* context, LINE_TO_ORDER* line_to)
|
||||
xfInfo* xfi = ((xfContext*) context)->xfi;
|
||||
|
||||
xf_set_rop2(xfi, line_to->bRop2);
|
||||
color = freerdp_color_convert(line_to->penColor, xfi->srcBpp, 32, xfi->clrconv);
|
||||
color = freerdp_color_convert_rgb(line_to->penColor, xfi->srcBpp, 32, xfi->clrconv);
|
||||
|
||||
XSetFillStyle(xfi->display, xfi->gc, FillSolid);
|
||||
XSetForeground(xfi->display, xfi->gc, color);
|
||||
@ -531,7 +531,7 @@ void xf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline)
|
||||
xfInfo* xfi = ((xfContext*) context)->xfi;
|
||||
|
||||
xf_set_rop2(xfi, polyline->bRop2);
|
||||
color = freerdp_color_convert(polyline->penColor, xfi->srcBpp, 32, xfi->clrconv);
|
||||
color = freerdp_color_convert_rgb(polyline->penColor, xfi->srcBpp, 32, xfi->clrconv);
|
||||
|
||||
XSetFillStyle(xfi->display, xfi->gc, FillSolid);
|
||||
XSetForeground(xfi->display, xfi->gc, color);
|
||||
|
@ -248,8 +248,8 @@ void xf_Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height
|
||||
{
|
||||
xfInfo* xfi = ((xfContext*) context)->xfi;
|
||||
|
||||
bgcolor = freerdp_color_convert(bgcolor, xfi->srcBpp, 32, xfi->clrconv);
|
||||
fgcolor = freerdp_color_convert(fgcolor, xfi->srcBpp, 32, xfi->clrconv);
|
||||
bgcolor = freerdp_color_convert_rgb(bgcolor, xfi->srcBpp, 32, xfi->clrconv);
|
||||
fgcolor = freerdp_color_convert_rgb(fgcolor, xfi->srcBpp, 32, xfi->clrconv);
|
||||
|
||||
XSetFunction(xfi->display, xfi->gc, GXcopy);
|
||||
XSetFillStyle(xfi->display, xfi->gc, FillSolid);
|
||||
|
@ -409,8 +409,11 @@ boolean xf_get_pixmap_info(xfInfo* xfi)
|
||||
|
||||
if (vi)
|
||||
{
|
||||
// Detect if the server visual has an inverted colormap
|
||||
// (BGR vs RGB, or red being the least significant byte)
|
||||
/*
|
||||
* Detect if the server visual has an inverted colormap
|
||||
* (BGR vs RGB, or red being the least significant byte)
|
||||
*/
|
||||
|
||||
if (vi->red_mask & 0xFF)
|
||||
{
|
||||
xfi->clrconv->invert = true;
|
||||
@ -548,9 +551,9 @@ boolean xf_pre_connect(freerdp* instance)
|
||||
xf_kbd_init(xfi);
|
||||
|
||||
xfi->clrconv = xnew(CLRCONV);
|
||||
xfi->clrconv->alpha = 1;
|
||||
xfi->clrconv->invert = 0;
|
||||
xfi->clrconv->rgb555 = 0;
|
||||
xfi->clrconv->alpha = true;
|
||||
xfi->clrconv->invert = false;
|
||||
xfi->clrconv->rgb555 = false;
|
||||
xfi->clrconv->palette = xnew(rdpPalette);
|
||||
|
||||
instance->context->cache = cache_new(instance->settings);
|
||||
@ -630,7 +633,7 @@ boolean xf_post_connect(freerdp* instance)
|
||||
rdpGdi* gdi;
|
||||
uint32 flags;
|
||||
|
||||
flags = CLRCONV_ALPHA | CLRCONV_INVERT;
|
||||
flags = CLRCONV_ALPHA;
|
||||
|
||||
if (xfi->bpp > 16)
|
||||
flags |= CLRBUF_32BPP;
|
||||
|
@ -237,7 +237,6 @@ typedef CLRCONV* HCLRCONV;
|
||||
|
||||
typedef uint8* (*p_freerdp_image_convert)(uint8* srcData, uint8* dstData, int width, int height, int srcBpp, int dstBpp, HCLRCONV clrconv);
|
||||
|
||||
FREERDP_API uint32 freerdp_color_convert(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv);
|
||||
FREERDP_API uint8* freerdp_image_convert(uint8* srcData, uint8 *dstData, int width, int height, int srcBpp, int dstBpp, HCLRCONV clrconv);
|
||||
FREERDP_API uint8* freerdp_glyph_convert(int width, int height, uint8* data);
|
||||
FREERDP_API void freerdp_bitmap_flip(uint8 * src, uint8 * dst, int scanLineSz, int height);
|
||||
@ -247,6 +246,13 @@ 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_image_swap_color_order(uint8* data, int width, int height);
|
||||
|
||||
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_rgb_bgr(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv);
|
||||
FREERDP_API uint32 freerdp_color_convert_bgr_rgb(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv);
|
||||
FREERDP_API uint32 freerdp_color_convert_var_rgb(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv);
|
||||
FREERDP_API uint32 freerdp_color_convert_var_bgr(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -20,6 +20,7 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <freerdp/api.h>
|
||||
#include <freerdp/freerdp.h>
|
||||
#include <freerdp/codec/color.h>
|
||||
#include <freerdp/utils/memory.h>
|
||||
@ -85,86 +86,200 @@ void freerdp_set_pixel(uint8* data, int x, int y, int width, int height, int bpp
|
||||
}
|
||||
}
|
||||
|
||||
INLINE void freerdp_color_split_rgb(uint32* color, int bpp, uint8* red, uint8* green, uint8* blue, uint8* alpha, HCLRCONV clrconv)
|
||||
{
|
||||
*alpha = 0xFF;
|
||||
*red = *green = *blue = 0;
|
||||
|
||||
switch (bpp)
|
||||
{
|
||||
case 32:
|
||||
if (clrconv->alpha)
|
||||
{
|
||||
GetARGB32(*alpha, *red, *green, *blue, *color);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetRGB32(*red, *green, *blue, *color);
|
||||
}
|
||||
break;
|
||||
|
||||
case 24:
|
||||
GetRGB24(*red, *green, *blue, *color);
|
||||
break;
|
||||
|
||||
case 16:
|
||||
GetRGB16(*red, *green, *blue, *color);
|
||||
break;
|
||||
|
||||
case 15:
|
||||
GetRGB15(*red, *green, *blue, *color);
|
||||
break;
|
||||
|
||||
case 8:
|
||||
*color &= 0xFF;
|
||||
*red = clrconv->palette->entries[*color].red;
|
||||
*green = clrconv->palette->entries[*color].green;
|
||||
*blue = clrconv->palette->entries[*color].blue;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (*color != 0)
|
||||
{
|
||||
*red = 0xFF;
|
||||
*green = 0xFF;
|
||||
*blue = 0xFF;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
INLINE void freerdp_color_split_bgr(uint32* color, int bpp, uint8* red, uint8* green, uint8* blue, uint8* alpha, HCLRCONV clrconv)
|
||||
{
|
||||
*alpha = 0xFF;
|
||||
*red = *green = *blue = 0;
|
||||
|
||||
switch (bpp)
|
||||
{
|
||||
case 32:
|
||||
if (clrconv->alpha)
|
||||
{
|
||||
GetABGR32(*alpha, *red, *green, *blue, *color);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetBGR32(*red, *green, *blue, *color);
|
||||
}
|
||||
break;
|
||||
|
||||
case 24:
|
||||
GetBGR24(*red, *green, *blue, *color);
|
||||
break;
|
||||
|
||||
case 16:
|
||||
GetBGR16(*red, *green, *blue, *color);
|
||||
break;
|
||||
|
||||
case 15:
|
||||
GetBGR15(*red, *green, *blue, *color);
|
||||
break;
|
||||
|
||||
case 8:
|
||||
*color &= 0xFF;
|
||||
*red = clrconv->palette->entries[*color].red;
|
||||
*green = clrconv->palette->entries[*color].green;
|
||||
*blue = clrconv->palette->entries[*color].blue;
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if (*color != 0)
|
||||
{
|
||||
*red = 0xFF;
|
||||
*green = 0xFF;
|
||||
*blue = 0xFF;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
INLINE void freerdp_color_make_rgb(uint32* color, int bpp, uint8* red, uint8* green, uint8* blue, uint8* alpha, HCLRCONV clrconv)
|
||||
{
|
||||
switch (bpp)
|
||||
{
|
||||
case 32:
|
||||
*color = ARGB32(*alpha, *red, *green, *blue);
|
||||
break;
|
||||
|
||||
case 24:
|
||||
*color = RGB24(*red, *green, *blue);
|
||||
break;
|
||||
|
||||
case 16:
|
||||
if (clrconv->rgb555)
|
||||
{
|
||||
*color = RGB15(*red, *green, *blue);
|
||||
}
|
||||
else
|
||||
{
|
||||
*color = RGB16(*red, *green, *blue);
|
||||
}
|
||||
break;
|
||||
|
||||
case 15:
|
||||
*color = RGB15(*red, *green, *blue);
|
||||
break;
|
||||
|
||||
case 8:
|
||||
*color = RGB24(*red, *green, *blue);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if ((*red != 0) || (*green != 0) || (*blue != 0))
|
||||
*color = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
INLINE void freerdp_color_make_bgr(uint32* color, int bpp, uint8* red, uint8* green, uint8* blue, uint8* alpha, HCLRCONV clrconv)
|
||||
{
|
||||
switch (bpp)
|
||||
{
|
||||
case 32:
|
||||
*color = ABGR32(*alpha, *red, *green, *blue);
|
||||
break;
|
||||
|
||||
case 24:
|
||||
*color = BGR24(*red, *green, *blue);
|
||||
break;
|
||||
|
||||
case 16:
|
||||
if (clrconv->rgb555)
|
||||
{
|
||||
*color = BGR15(*red, *green, *blue);
|
||||
}
|
||||
else
|
||||
{
|
||||
*color = BGR16(*red, *green, *blue);
|
||||
}
|
||||
break;
|
||||
|
||||
case 15:
|
||||
*color = BGR15(*red, *green, *blue);
|
||||
break;
|
||||
|
||||
case 8:
|
||||
*color = BGR24(*red, *green, *blue);
|
||||
break;
|
||||
|
||||
case 1:
|
||||
if ((*red != 0) || (*green != 0) || (*blue != 0))
|
||||
*color = 1;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uint32 freerdp_color_convert_rgb(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv)
|
||||
{
|
||||
uint8 red = 0;
|
||||
uint8 green = 0;
|
||||
uint8 blue = 0;
|
||||
uint8 alpha = 0xFF;
|
||||
int dstColor = 0;
|
||||
uint32 dstColor = 0;
|
||||
|
||||
switch (srcBpp)
|
||||
{
|
||||
case 32:
|
||||
if (clrconv->alpha)
|
||||
{
|
||||
GetARGB32(alpha, red, green, blue, srcColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetBGR32(red, green, blue, srcColor);
|
||||
}
|
||||
break;
|
||||
case 24:
|
||||
GetBGR24(red, green, blue, srcColor);
|
||||
break;
|
||||
case 16:
|
||||
GetBGR16(red, green, blue, srcColor);
|
||||
break;
|
||||
case 15:
|
||||
GetBGR15(red, green, blue, srcColor);
|
||||
break;
|
||||
case 8:
|
||||
srcColor &= 0xFF;
|
||||
red = clrconv->palette->entries[srcColor].red;
|
||||
green = clrconv->palette->entries[srcColor].green;
|
||||
blue = clrconv->palette->entries[srcColor].blue;
|
||||
break;
|
||||
case 1:
|
||||
if (srcColor != 0)
|
||||
{
|
||||
red = 0xFF;
|
||||
green = 0xFF;
|
||||
blue = 0xFF;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (dstBpp)
|
||||
{
|
||||
case 32:
|
||||
dstColor = ABGR32(alpha, red, green, blue);
|
||||
break;
|
||||
case 24:
|
||||
dstColor = BGR24(red, green, blue);
|
||||
break;
|
||||
case 16:
|
||||
if(clrconv->rgb555)
|
||||
{
|
||||
dstColor = RGB15(red, green, blue);
|
||||
}
|
||||
else
|
||||
{
|
||||
dstColor = RGB16(red, green, blue);
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
dstColor = RGB15(red, green, blue);
|
||||
break;
|
||||
case 8:
|
||||
srcColor &= 0xFF;
|
||||
red = clrconv->palette->entries[srcColor].red;
|
||||
green = clrconv->palette->entries[srcColor].green;
|
||||
blue = clrconv->palette->entries[srcColor].blue;
|
||||
break;
|
||||
case 1:
|
||||
if ((red != 0) || (green != 0) || (blue != 0))
|
||||
dstColor = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
freerdp_color_split_rgb(&srcColor, srcBpp, &red, &green, &blue, &alpha, clrconv);
|
||||
freerdp_color_make_rgb(&dstColor, dstBpp, &red, &green, &blue, &alpha, clrconv);
|
||||
|
||||
return dstColor;
|
||||
}
|
||||
@ -175,90 +290,56 @@ uint32 freerdp_color_convert_bgr(uint32 srcColor, int srcBpp, int dstBpp, HCLRCO
|
||||
uint8 green = 0;
|
||||
uint8 blue = 0;
|
||||
uint8 alpha = 0xFF;
|
||||
int dstColor = 0;
|
||||
uint32 dstColor = 0;
|
||||
|
||||
switch (srcBpp)
|
||||
{
|
||||
case 32:
|
||||
if (clrconv->alpha)
|
||||
{
|
||||
GetABGR32(alpha, red, green, blue, srcColor);
|
||||
}
|
||||
else
|
||||
{
|
||||
GetBGR32(red, green, blue, srcColor);
|
||||
}
|
||||
break;
|
||||
case 24:
|
||||
GetBGR24(red, green, blue, srcColor);
|
||||
break;
|
||||
case 16:
|
||||
GetRGB16(red, green, blue, srcColor);
|
||||
break;
|
||||
case 15:
|
||||
GetRGB15(red, green, blue, srcColor);
|
||||
break;
|
||||
case 8:
|
||||
srcColor &= 0xFF;
|
||||
red = clrconv->palette->entries[srcColor].red;
|
||||
green = clrconv->palette->entries[srcColor].green;
|
||||
blue = clrconv->palette->entries[srcColor].blue;
|
||||
break;
|
||||
case 1:
|
||||
if (srcColor != 0)
|
||||
{
|
||||
red = 0xFF;
|
||||
green = 0xFF;
|
||||
blue = 0xFF;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
switch (dstBpp)
|
||||
{
|
||||
case 32:
|
||||
dstColor = ABGR32(alpha, red, green, blue);
|
||||
break;
|
||||
case 24:
|
||||
dstColor = BGR24(red, green, blue);
|
||||
break;
|
||||
case 16:
|
||||
if(clrconv->rgb555)
|
||||
{
|
||||
dstColor = BGR15(red, green, blue);
|
||||
}
|
||||
else
|
||||
{
|
||||
dstColor = BGR16(red, green, blue);
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
dstColor = BGR15(red, green, blue);
|
||||
break;
|
||||
case 8:
|
||||
srcColor &= 0xFF;
|
||||
red = clrconv->palette->entries[srcColor].red;
|
||||
green = clrconv->palette->entries[srcColor].green;
|
||||
blue = clrconv->palette->entries[srcColor].blue;
|
||||
break;
|
||||
case 1:
|
||||
if ((red != 0) || (green != 0) || (blue != 0))
|
||||
dstColor = 1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
freerdp_color_split_bgr(&srcColor, srcBpp, &red, &green, &blue, &alpha, clrconv);
|
||||
freerdp_color_make_bgr(&dstColor, dstBpp, &red, &green, &blue, &alpha, clrconv);
|
||||
|
||||
return dstColor;
|
||||
}
|
||||
|
||||
uint32 freerdp_color_convert(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv)
|
||||
uint32 freerdp_color_convert_rgb_bgr(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv)
|
||||
{
|
||||
if (clrconv->invert)
|
||||
return freerdp_color_convert_bgr(srcColor, srcBpp, dstBpp, clrconv);
|
||||
uint8 red = 0;
|
||||
uint8 green = 0;
|
||||
uint8 blue = 0;
|
||||
uint8 alpha = 0xFF;
|
||||
uint32 dstColor = 0;
|
||||
|
||||
freerdp_color_split_rgb(&srcColor, srcBpp, &red, &green, &blue, &alpha, clrconv);
|
||||
freerdp_color_make_bgr(&dstColor, dstBpp, &red, &green, &blue, &alpha, clrconv);
|
||||
|
||||
return dstColor;
|
||||
}
|
||||
|
||||
uint32 freerdp_color_convert_bgr_rgb(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv)
|
||||
{
|
||||
uint8 red = 0;
|
||||
uint8 green = 0;
|
||||
uint8 blue = 0;
|
||||
uint8 alpha = 0xFF;
|
||||
uint32 dstColor = 0;
|
||||
|
||||
freerdp_color_split_bgr(&srcColor, srcBpp, &red, &green, &blue, &alpha, clrconv);
|
||||
freerdp_color_make_rgb(&dstColor, dstBpp, &red, &green, &blue, &alpha, clrconv);
|
||||
|
||||
return dstColor;
|
||||
}
|
||||
|
||||
uint32 freerdp_color_convert_var_rgb(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv)
|
||||
{
|
||||
if (srcBpp > 16)
|
||||
return freerdp_color_convert_bgr_rgb(srcColor, srcBpp, 32, clrconv);
|
||||
else
|
||||
return freerdp_color_convert_rgb(srcColor, srcBpp, dstBpp, clrconv);
|
||||
return freerdp_color_convert_rgb(srcColor, srcBpp, 32, clrconv);
|
||||
}
|
||||
|
||||
uint32 freerdp_color_convert_var_bgr(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv)
|
||||
{
|
||||
if (srcBpp > 16)
|
||||
return freerdp_color_convert_bgr(srcColor, srcBpp, 32, clrconv);
|
||||
else
|
||||
return freerdp_color_convert_rgb_bgr(srcColor, srcBpp, 32, clrconv);
|
||||
}
|
||||
|
||||
uint8* freerdp_image_convert_8bpp(uint8* srcData, uint8* dstData, int width, int height, int srcBpp, int dstBpp, HCLRCONV clrconv)
|
||||
@ -898,7 +979,7 @@ void freerdp_alpha_cursor_convert(uint8* alphaData, uint8* xorMask, uint8* andMa
|
||||
for (i = 0; i < width; i++)
|
||||
{
|
||||
xpixel = freerdp_get_pixel(xorMask, i, jj, width, height, bpp);
|
||||
xpixel = freerdp_color_convert(xpixel, bpp, 32, clrconv);
|
||||
xpixel = freerdp_color_convert_rgb(xpixel, bpp, 32, clrconv);
|
||||
apixel = freerdp_get_pixel(andMask, i, jj, width, height, 1);
|
||||
|
||||
if (apixel != 0)
|
||||
|
@ -474,7 +474,7 @@ void gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
|
||||
uint32 color;
|
||||
originalBrush = gdi->drawing->hdc->brush;
|
||||
|
||||
color = freerdp_color_convert(patblt->foreColor, gdi->srcBpp, 32, gdi->clrconv);
|
||||
color = freerdp_color_convert_rgb(patblt->foreColor, gdi->srcBpp, 32, gdi->clrconv);
|
||||
gdi->drawing->hdc->brush = gdi_CreateSolidBrush(color);
|
||||
|
||||
gdi_PatBlt(gdi->drawing->hdc, patblt->nLeftRect, patblt->nTopRect,
|
||||
@ -533,7 +533,7 @@ void gdi_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect)
|
||||
gdi_CRgnToRect(opaque_rect->nLeftRect, opaque_rect->nTopRect,
|
||||
opaque_rect->nWidth, opaque_rect->nHeight, &rect);
|
||||
|
||||
brush_color = freerdp_color_convert(opaque_rect->color, gdi->srcBpp, 32, gdi->clrconv);
|
||||
brush_color = freerdp_color_convert_var_bgr(opaque_rect->color, gdi->srcBpp, 32, gdi->clrconv);
|
||||
|
||||
hBrush = gdi_CreateSolidBrush(brush_color);
|
||||
gdi_FillRect(gdi->drawing->hdc, &rect, hBrush);
|
||||
@ -557,7 +557,7 @@ void gdi_multi_opaque_rect(rdpContext* context, MULTI_OPAQUE_RECT_ORDER* multi_o
|
||||
gdi_CRgnToRect(rectangle->left, rectangle->top,
|
||||
rectangle->width, rectangle->height, &rect);
|
||||
|
||||
brush_color = freerdp_color_convert(multi_opaque_rect->color, gdi->srcBpp, 32, gdi->clrconv);
|
||||
brush_color = freerdp_color_convert_var_bgr(multi_opaque_rect->color, gdi->srcBpp, 32, gdi->clrconv);
|
||||
|
||||
hBrush = gdi_CreateSolidBrush(brush_color);
|
||||
gdi_FillRect(gdi->drawing->hdc, &rect, hBrush);
|
||||
@ -572,7 +572,7 @@ void gdi_line_to(rdpContext* context, LINE_TO_ORDER* line_to)
|
||||
HGDI_PEN hPen;
|
||||
rdpGdi *gdi = context->gdi;
|
||||
|
||||
color = freerdp_color_convert(line_to->penColor, gdi->srcBpp, 32, gdi->clrconv);
|
||||
color = freerdp_color_convert_rgb(line_to->penColor, gdi->srcBpp, 32, gdi->clrconv);
|
||||
hPen = gdi_CreatePen(line_to->penStyle, line_to->penWidth, (GDI_COLOR) color);
|
||||
gdi_SelectObject(gdi->drawing->hdc, (HGDIOBJECT) hPen);
|
||||
gdi_SetROP2(gdi->drawing->hdc, line_to->bRop2);
|
||||
@ -593,7 +593,7 @@ void gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline)
|
||||
sint32 x;
|
||||
sint32 y;
|
||||
|
||||
color = freerdp_color_convert(polyline->penColor, gdi->srcBpp, 32, gdi->clrconv);
|
||||
color = freerdp_color_convert_rgb(polyline->penColor, gdi->srcBpp, 32, gdi->clrconv);
|
||||
hPen = gdi_CreatePen(GDI_PS_SOLID, 1, (GDI_COLOR) color);
|
||||
gdi_SelectObject(gdi->drawing->hdc, (HGDIOBJECT) hPen);
|
||||
gdi_SetROP2(gdi->drawing->hdc, polyline->bRop2);
|
||||
|
@ -186,8 +186,8 @@ void gdi_Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int heigh
|
||||
HGDI_BRUSH brush;
|
||||
rdpGdi* gdi = context->gdi;
|
||||
|
||||
bgcolor = freerdp_color_convert(bgcolor, gdi->srcBpp, 32, gdi->clrconv);
|
||||
fgcolor = freerdp_color_convert(fgcolor, gdi->srcBpp, 32, gdi->clrconv);
|
||||
bgcolor = freerdp_color_convert_rgb(bgcolor, gdi->srcBpp, 32, gdi->clrconv);
|
||||
fgcolor = freerdp_color_convert_rgb(fgcolor, gdi->srcBpp, 32, gdi->clrconv);
|
||||
|
||||
gdi_CRgnToRect(x, y, width, height, &rect);
|
||||
brush = gdi_CreateSolidBrush(fgcolor);
|
||||
@ -201,7 +201,7 @@ void gdi_Glyph_EndDraw(rdpContext* context, int x, int y, int width, int height,
|
||||
{
|
||||
rdpGdi* gdi = context->gdi;
|
||||
|
||||
bgcolor = freerdp_color_convert(bgcolor, gdi->srcBpp, 32, gdi->clrconv);
|
||||
bgcolor = freerdp_color_convert_rgb(bgcolor, gdi->srcBpp, 32, gdi->clrconv);
|
||||
gdi->textColor = gdi_SetTextColor(gdi->drawing->hdc, bgcolor);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user