wfreerdp: fix wf_gdi.c

This commit is contained in:
Marc-André Moreau 2011-10-07 14:55:07 -04:00
parent d8e0df3af7
commit 51c8794e89
3 changed files with 46 additions and 13 deletions

View File

@ -126,6 +126,7 @@ LRESULT CALLBACK wf_event_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam
HDC hdc;
LONG ptr;
wfInfo* wfi;
int x, y, w, h;
PAINTSTRUCT ps;
rdpInput* input;
boolean processed;
@ -142,11 +143,16 @@ LRESULT CALLBACK wf_event_proc(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam
{
case WM_PAINT:
hdc = BeginPaint(hWnd, &ps);
BitBlt(hdc, ps.rcPaint.left, ps.rcPaint.top,
ps.rcPaint.right - ps.rcPaint.left,
ps.rcPaint.bottom - ps.rcPaint.top,
wfi->primary->hdc, ps.rcPaint.left, ps.rcPaint.top,
SRCCOPY);
x = ps.rcPaint.left;
y = ps.rcPaint.top;
w = ps.rcPaint.right - ps.rcPaint.left + 1;
h = ps.rcPaint.bottom - ps.rcPaint.top + 1;
//printf("WM_PAINT: x:%d y:%d w:%d h:%d\n", x, y, w, h);
BitBlt(hdc, x, y, w, h, wfi->primary->hdc, x, y, SRCCOPY);
EndPaint(hWnd, &ps);
break;

View File

@ -252,7 +252,7 @@ void wf_gdi_opaque_rect(rdpUpdate* update, OPAQUE_RECT_ORDER* opaque_rect)
DeleteObject(brush);
if (wfi->drawing == wfi->primary)
wf_invalidate_region(wfi, rect.left, rect.top, rect.right, rect.bottom);
wf_invalidate_region(wfi, rect.left, rect.top, rect.right - rect.left + 1, rect.bottom - rect.top + 1);
}
void wf_gdi_multi_opaque_rect(rdpUpdate* update, MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect)
@ -309,6 +309,28 @@ void wf_gdi_polyline(rdpUpdate* update, POLYLINE_ORDER* polyline)
}
void wf_gdi_memblt(rdpUpdate* update, MEMBLT_ORDER* memblt)
{
void* extra;
WF_IMAGE* wf_bmp;
wfInfo* wfi = GET_WFI(update);
bitmap_v2_get(wfi->cache->bitmap_v2, memblt->cacheId, memblt->cacheIndex, (void**) &extra);
wf_bmp = (WF_IMAGE*) extra;
BitBlt(wfi->drawing->hdc, memblt->nLeftRect, memblt->nTopRect,
memblt->nWidth, memblt->nHeight, wf_bmp->hdc,
memblt->nXSrc, memblt->nYSrc, gdi_rop3_code(memblt->bRop));
if (wfi->drawing == wfi->primary)
wf_invalidate_region(wfi, memblt->nLeftRect, memblt->nTopRect, memblt->nWidth, memblt->nHeight);
}
void wf_gdi_mem3blt(rdpUpdate* update, MEM3BLT_ORDER* mem3blt)
{
}
void wf_gdi_fast_index(rdpUpdate* update, FAST_INDEX_ORDER* fast_index)
{
@ -341,10 +363,15 @@ void wf_gdi_switch_surface(rdpUpdate* update, SWITCH_SURFACE_ORDER* switch_surfa
void wf_gdi_cache_bitmap_v2(rdpUpdate* update, CACHE_BITMAP_V2_ORDER* cache_bitmap_v2)
{
WF_IMAGE* bitmap;
BITMAP_DATA* bitmap_data;
wfInfo* wfi = GET_WFI(update);
bitmap_data = cache_bitmap_v2->bitmap_data;
bitmap = wf_image_new(wfi, bitmap_data->width, bitmap_data->height, wfi->dstBpp, bitmap_data->dstData);
bitmap_v2_put(wfi->cache->bitmap_v2, cache_bitmap_v2->cacheId,
cache_bitmap_v2->cacheIndex, cache_bitmap_v2->bitmapDataStream);
cache_bitmap_v2->cacheIndex, bitmap_data, (void*) bitmap);
}
void wf_gdi_cache_color_table(rdpUpdate* update, CACHE_COLOR_TABLE_ORDER* cache_color_table)
@ -427,8 +454,8 @@ void wf_gdi_register_update_callbacks(rdpUpdate* update)
update->MultiDrawNineGrid = NULL;
update->LineTo = wf_gdi_line_to;
update->Polyline = NULL;
update->MemBlt = NULL;
update->Mem3Blt = NULL;
update->MemBlt = wf_gdi_memblt;
update->Mem3Blt = wf_gdi_mem3blt;
update->SaveBitmap = NULL;
update->GlyphIndex = NULL;
update->FastIndex = wf_gdi_fast_index;

View File

@ -97,6 +97,8 @@ void wf_sw_end_paint(rdpUpdate* update)
update_rect.right = x + w - 1;
update_rect.bottom = y + h - 1;
//printf("InvalidateRect: x:%d y:%d w:%d h:%d\n", x, y, w, h);
InvalidateRect(wfi->hwnd, &update_rect, FALSE);
}
}
@ -213,12 +215,10 @@ boolean wf_post_connect(freerdp* instance)
if (wfi->sw_gdi)
{
uint8* primary_buffer;
primary_buffer = (uint8*) xmalloc(width * height * (wfi->dstBpp / 8));
wfi->primary = wf_image_new(wfi, width, height, wfi->dstBpp, primary_buffer);
gdi_init(instance, CLRCONV_ALPHA | CLRBUF_32BPP, primary_buffer);
gdi_init(instance, CLRCONV_ALPHA | CLRBUF_32BPP, NULL);
gdi = GET_GDI(instance->update);
wfi->hdc = gdi->primary->hdc;
wfi->primary = wf_image_new(wfi, width, height, wfi->dstBpp, gdi->primary_buffer);
}
else
{