wfreerdp: fix warnings and color conversion

This commit is contained in:
Marc-André Moreau 2012-01-16 11:40:18 -05:00
parent 757e41a0d5
commit 949bce4d54
7 changed files with 38 additions and 35 deletions

View File

@ -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_rgb(patblt->foreColor, wfi->srcBpp, 24, wfi->clrconv);
bgcolor = freerdp_color_convert_rgb(patblt->backColor, wfi->srcBpp, 24, wfi->clrconv);
fgcolor = freerdp_color_convert_bgr(patblt->foreColor, wfi->srcBpp, 32, wfi->clrconv);
bgcolor = freerdp_color_convert_bgr(patblt->backColor, wfi->srcBpp, 32, 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_var_rgb(opaque_rect->color, wfi->srcBpp, 32, wfi->clrconv);
brush_color = freerdp_color_convert_var_bgr(opaque_rect->color, wfi->srcBpp, 24, 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_var_rgb(multi_opaque_rect->color, wfi->srcBpp, 32, wfi->clrconv);
brush_color = freerdp_color_convert_var_bgr(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_rgb(line_to->penColor, wfi->srcBpp, wfi->dstBpp, wfi->clrconv);
pen_color = freerdp_color_convert_bgr(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_rgb(polyline->penColor, wfi->srcBpp, wfi->dstBpp, wfi->clrconv);
pen_color = freerdp_color_convert_bgr(polyline->penColor, wfi->srcBpp, wfi->dstBpp, wfi->clrconv);
hpen = CreatePen(0, 1, pen_color);
org_rop2 = wf_set_rop2(wfi->drawing->hdc, polyline->bRop2);
@ -430,7 +430,7 @@ void wf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* surface_bits
tx = message->tiles[i]->x + surface_bits_command->destLeft;
ty = message->tiles[i]->y + surface_bits_command->destTop;
freerdp_image_convert(message->tiles[i]->data, wfi->tile->pdata, 64, 64, 32, 24, wfi->clrconv);
freerdp_image_convert(message->tiles[i]->data, wfi->tile->pdata, 64, 64, 32, 32, wfi->clrconv);
for (j = 0; j < message->num_rects; j++)
{

View File

@ -168,6 +168,8 @@ boolean wf_pre_connect(freerdp* instance)
settings->order_support[NEG_ELLIPSE_SC_INDEX] = false;
settings->order_support[NEG_ELLIPSE_CB_INDEX] = false;
settings->glyph_cache = false;
wfi->cursor = g_default_cursor;
wfi->fullscreen = settings->fullscreen;
@ -175,8 +177,8 @@ boolean wf_pre_connect(freerdp* instance)
wfi->sw_gdi = settings->sw_gdi;
wfi->clrconv = (HCLRCONV) xzalloc(sizeof(CLRCONV));
wfi->clrconv->alpha = 1;
wfi->clrconv->palette = NULL;
wfi->clrconv->alpha = 0;
instance->context->cache = cache_new(settings);
@ -570,7 +572,7 @@ static DWORD WINAPI kbd_thread_func(LPVOID lpParam)
if (hook_handle)
{
while( (status = GetMessage( &msg, NULL, 0, 0 )) != 0)
while ((status = GetMessage( &msg, NULL, 0, 0 )) != 0)
{
if (status == -1)
{

View File

@ -479,7 +479,7 @@ void glyph_cache_free(rdpGlyphCache* glyph_cache)
{
int j;
for (j = 0; j < glyph_cache->glyphCache[i].number; j++)
for (j = 0; j < (int) glyph_cache->glyphCache[i].number; j++)
{
rdpGlyph* glyph;

View File

@ -88,8 +88,8 @@ 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;
*alpha = (clrconv->alpha) ? 0xFF : 0x00;
switch (bpp)
{
@ -139,8 +139,8 @@ INLINE void freerdp_color_split_rgb(uint32* color, int bpp, uint8* red, uint8* g
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;
*alpha = (clrconv->alpha) ? 0xFF : 0x00;
switch (bpp)
{
@ -913,7 +913,7 @@ uint8* freerdp_mono_image_convert(uint8* srcData, int width, int height, int src
{
if (clrconv->rgb555)
{
if(srcBpp == 16)
if (srcBpp == 16)
{
/* convert 15-bit colors to 16-bit colors */
RGB16_RGB15(redBg, greenBg, blueBg, bgcolor);
@ -922,7 +922,7 @@ uint8* freerdp_mono_image_convert(uint8* srcData, int width, int height, int src
}
else
{
if(srcBpp == 15)
if (srcBpp == 15)
{
/* convert 15-bit colors to 16-bit colors */
RGB15_RGB16(redBg, greenBg, blueBg, bgcolor);
@ -933,7 +933,7 @@ uint8* freerdp_mono_image_convert(uint8* srcData, int width, int height, int src
dstData = (uint8*) malloc(width * height * 2);
dst16 = (uint16*) dstData;
for(index = height; index > 0; index--)
for (index = height; index > 0; index--)
{
/* each bit encodes a pixel */
bitMask = *srcData;
@ -965,7 +965,7 @@ uint8* freerdp_mono_image_convert(uint8* srcData, int width, int height, int src
for (bitIndex = 7; bitIndex >= 0; bitIndex--)
{
if((bitMask >> bitIndex) & 0x01)
if ((bitMask >> bitIndex) & 0x01)
{
*dst32 = (clrconv->invert) ? BGR32(redBg, greenBg, blueBg) : RGB32(redBg, greenBg, blueBg);
}

View File

@ -42,7 +42,7 @@ void nsc_cl_expand(STREAM* stream, uint8 shiftcount, uint32 origsz)
bitoff = bitno % 0x8;
(*temptr) |= (sign >> bitoff);
}
while(((uint32)(stream->p - stream->data)) < origsz);
while (((uint32)(stream->p - stream->data)) < origsz);
stream->p = stream->data;
}
@ -68,7 +68,7 @@ void nsc_chroma_supersample(NSC_CONTEXT* context)
for (i = 0; i < 3; i++)
{
if(i != 0)
if (i != 0)
alloclen = orglen + ((orglen & 0x7) ? (orglen >> 3) + 0x1 : (orglen >> 3));
new_s = stream_new(alloclen);
@ -78,7 +78,7 @@ void nsc_chroma_supersample(NSC_CONTEXT* context)
nbitstream = new_s->data + orglen;
cur = new_s->p;
if(i == 1)
if (i == 1)
pw >>= 1;
while (((uint32)(temp->p - temp->data)) < context->OrgByteCount[i])
@ -89,10 +89,10 @@ void nsc_chroma_supersample(NSC_CONTEXT* context)
*cur = val;
row = (temp->p - temp->data) % pw;
if(i == 0)
if (i == 0)
{
cur++;
if(row >= w)
if (row >= w)
stream_seek(temp, pw-row);
}
else
@ -115,7 +115,7 @@ void nsc_chroma_supersample(NSC_CONTEXT* context)
*(cur+1) = val;
bitoff = (bytno + 1) % 8;
*(nbitstream + ((bytno + 1) >> 3)) |= (sign >> bitoff);
if((bytno+w) < orglen)
if ((bytno+w) < orglen)
{
*(cur+w+1) = val;
bitoff = (bytno + w + 1) % 8;
@ -128,7 +128,7 @@ void nsc_chroma_supersample(NSC_CONTEXT* context)
if (((bytno/w) < h) && ((bytno) % w) < 2 )
{
if(w % 2)
if (w % 2)
cur += w-1;
else
cur += w;
@ -162,7 +162,7 @@ void nsc_ycocg_rgb(NSC_CONTEXT* context)
for (i = 0; i < 3; i++)
ycocg[i] = *(context->org_buf[i]->p);
for(i = 1; i < 3; i++)
for (i = 1; i < 3; i++)
{
bytno = context->OrgByteCount[i] - size;
bitoff = bytno % 8;
@ -174,20 +174,21 @@ void nsc_ycocg_rgb(NSC_CONTEXT* context)
rgb[1] = ycocg[0] + (ycocg[2] >> 1);
rgb[2] = ycocg[0] - (ycocg[1] >> 1) - (ycocg[2] >> 1);
for(i = 0; i < 3; i++)
for (i = 0; i < 3; i++)
{
if(((rgb[i] >> 8) & 0x1) == 0x1)
val = ~((uint8)rgb[i]) + 0x1;
if (((rgb[i] >> 8) & 0x1) == 0x1)
val = ~((uint8) rgb[i]) + 0x1;
else
val = rgb[i];
val = (uint8) rgb[i];
stream_write_uint8(context->org_buf[i], val);
}
size--;
}
while(size);
while (size);
for(i = 0; i < 3; i++)
for (i = 0; i < 3; i++)
context->org_buf[i]->p = context->org_buf[i]->data;
}
@ -197,7 +198,7 @@ void nsc_colorloss_recover(NSC_CONTEXT* context)
uint8 cllvl;
cllvl = context->nsc_stream->colorLossLevel;
for(i = 1; i < 3; i++)
for (i = 1; i < 3; i++)
nsc_cl_expand(context->org_buf[i], cllvl, context->OrgByteCount[i]);
}
@ -336,7 +337,7 @@ void nsc_context_destroy(NSC_CONTEXT* context)
{
int i;
for(i = 0;i < 4; i++)
for (i = 0;i < 4; i++)
stream_free(context->org_buf[i]);
stream_detach(context->nsc_stream->pdata);
@ -365,7 +366,7 @@ void nsc_process_message(NSC_CONTEXT* context, uint8* data, uint32 length)
nsc_colorloss_recover(context);
/* Chroma supersample */
if(context->nsc_stream->ChromaSubSamplingLevel > 0)
if (context->nsc_stream->ChromaSubSamplingLevel > 0)
nsc_chroma_supersample(context);
/* YCoCg to RGB Convert */

View File

@ -924,7 +924,7 @@ void ntlmssp_input_av_pairs(NTLMSSP* ntlmssp, STREAM* s)
freerdp_hexdump(value, AvLen);
#endif
}
while(AvId != MsvAvEOL);
while (AvId != MsvAvEOL);
#ifdef WITH_DEBUG_NLA
printf("}\n");

View File

@ -53,6 +53,6 @@ void freerdp_usleep(uint32 useconds)
{
QueryPerformanceCounter((LARGE_INTEGER*) &t2);
}
while((t2 - t1) < useconds);
while ((t2 - t1) < useconds);
#endif
}