libfreerdp-core: improve update interface with bounds
This commit is contained in:
parent
24ba845f04
commit
97f8a022a9
@ -34,17 +34,15 @@ struct thread_data
|
||||
freerdp* instance;
|
||||
};
|
||||
|
||||
int df_begin_paint(rdpUpdate* update)
|
||||
void df_begin_paint(rdpUpdate* update)
|
||||
{
|
||||
GDI* gdi;
|
||||
|
||||
gdi = GET_GDI(update);
|
||||
gdi->primary->hdc->hwnd->invalid->null = 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int df_end_paint(rdpUpdate* update)
|
||||
void df_end_paint(rdpUpdate* update)
|
||||
{
|
||||
GDI* gdi;
|
||||
dfInfo* dfi;
|
||||
@ -53,7 +51,7 @@ int df_end_paint(rdpUpdate* update)
|
||||
dfi = GET_DFI(update);
|
||||
|
||||
if (gdi->primary->hdc->hwnd->invalid->null)
|
||||
return 0;
|
||||
return;
|
||||
|
||||
dfi->update_rect.x = gdi->primary->hdc->hwnd->invalid->x;
|
||||
dfi->update_rect.y = gdi->primary->hdc->hwnd->invalid->y;
|
||||
@ -61,8 +59,6 @@ int df_end_paint(rdpUpdate* update)
|
||||
dfi->update_rect.h = gdi->primary->hdc->hwnd->invalid->h;
|
||||
|
||||
dfi->primary->Blit(dfi->primary, dfi->surface, &(dfi->update_rect), dfi->update_rect.x, dfi->update_rect.y);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
boolean df_get_fds(freerdp* instance, void** rfds, int* rcount, void** wfds, int* wcount)
|
||||
|
@ -22,6 +22,16 @@
|
||||
|
||||
#include <freerdp/types.h>
|
||||
|
||||
/* Common */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
uint16 left;
|
||||
uint16 top;
|
||||
uint16 right;
|
||||
uint16 bottom;
|
||||
} BOUNDS;
|
||||
|
||||
/* Bitmap Updates */
|
||||
|
||||
typedef struct
|
||||
@ -378,33 +388,34 @@ typedef struct
|
||||
|
||||
typedef struct rdp_update rdpUpdate;
|
||||
|
||||
typedef int (*pcBeginPaint)(rdpUpdate* update);
|
||||
typedef int (*pcEndPaint)(rdpUpdate* update);
|
||||
typedef int (*pcSynchronize)(rdpUpdate* update);
|
||||
typedef int (*pcBitmap)(rdpUpdate* update, BITMAP_UPDATE* bitmap);
|
||||
typedef int (*pcPalette)(rdpUpdate* update, PALETTE_UPDATE* palette);
|
||||
typedef int (*pcDstBlt)(rdpUpdate* update, DSTBLT_ORDER* dstblt);
|
||||
typedef int (*pcPatBlt)(rdpUpdate* update, PATBLT_ORDER* patblt);
|
||||
typedef int (*pcScrBlt)(rdpUpdate* update, SCRBLT_ORDER* scrblt);
|
||||
typedef int (*pcDrawNineGrid)(rdpUpdate* update, DRAW_NINE_GRID_ORDER* draw_nine_grid);
|
||||
typedef int (*pcMultiDrawNineGrid)(rdpUpdate* update, MULTI_DRAW_NINE_GRID_ORDER* multi_draw_nine_grid);
|
||||
typedef int (*pcLineTo)(rdpUpdate* update, LINE_TO_ORDER* line_to);
|
||||
typedef int (*pcOpaqueRect)(rdpUpdate* update, OPAQUE_RECT_ORDER* opaque_rect);
|
||||
typedef int (*pcSaveBitmap)(rdpUpdate* update, SAVE_BITMAP_ORDER* save_bitmap);
|
||||
typedef int (*pcMemBlt)(rdpUpdate* update, MEMBLT_ORDER* memblt);
|
||||
typedef int (*pcMem3Blt)(rdpUpdate* update, MEM3BLT_ORDER* memblt);
|
||||
typedef int (*pcMultiDstBlt)(rdpUpdate* update, MULTI_DSTBLT_ORDER* multi_dstblt);
|
||||
typedef int (*pcMultiPatBlt)(rdpUpdate* update, MULTI_PATBLT_ORDER* multi_patblt);
|
||||
typedef int (*pcMultiScrBlt)(rdpUpdate* update, MULTI_SCRBLT_ORDER* multi_scrblt);
|
||||
typedef int (*pcMultiOpaqueRect)(rdpUpdate* update, MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect);
|
||||
typedef int (*pcFastIndex)(rdpUpdate* update, FAST_INDEX_ORDER* fast_index);
|
||||
typedef int (*pcPolygonSC)(rdpUpdate* update, POLYGON_SC_ORDER* polygon_sc);
|
||||
typedef int (*pcPolygonCB)(rdpUpdate* update, POLYGON_CB_ORDER* polygon_cb);
|
||||
typedef int (*pcPolyline)(rdpUpdate* update, POLYLINE_ORDER* polyline);
|
||||
typedef int (*pcFastGlyph)(rdpUpdate* update, FAST_GLYPH_ORDER* fast_glyph);
|
||||
typedef int (*pcEllipseSC)(rdpUpdate* update, ELLIPSE_SC_ORDER* ellipse_sc);
|
||||
typedef int (*pcEllipseCB)(rdpUpdate* update, ELLIPSE_CB_ORDER* ellipse_cb);
|
||||
typedef int (*pcGlyphIndex)(rdpUpdate* update, GLYPH_INDEX_ORDER* glyph_index);
|
||||
typedef void (*pcBeginPaint)(rdpUpdate* update);
|
||||
typedef void (*pcEndPaint)(rdpUpdate* update);
|
||||
typedef void (*pcSetBounds)(rdpUpdate* update, BOUNDS* bounds);
|
||||
typedef void (*pcSynchronize)(rdpUpdate* update);
|
||||
typedef void (*pcBitmap)(rdpUpdate* update, BITMAP_UPDATE* bitmap);
|
||||
typedef void (*pcPalette)(rdpUpdate* update, PALETTE_UPDATE* palette);
|
||||
typedef void (*pcDstBlt)(rdpUpdate* update, DSTBLT_ORDER* dstblt);
|
||||
typedef void (*pcPatBlt)(rdpUpdate* update, PATBLT_ORDER* patblt);
|
||||
typedef void (*pcScrBlt)(rdpUpdate* update, SCRBLT_ORDER* scrblt);
|
||||
typedef void (*pcDrawNineGrid)(rdpUpdate* update, DRAW_NINE_GRID_ORDER* draw_nine_grid);
|
||||
typedef void (*pcMultiDrawNineGrid)(rdpUpdate* update, MULTI_DRAW_NINE_GRID_ORDER* multi_draw_nine_grid);
|
||||
typedef void (*pcLineTo)(rdpUpdate* update, LINE_TO_ORDER* line_to);
|
||||
typedef void (*pcOpaqueRect)(rdpUpdate* update, OPAQUE_RECT_ORDER* opaque_rect);
|
||||
typedef void (*pcSaveBitmap)(rdpUpdate* update, SAVE_BITMAP_ORDER* save_bitmap);
|
||||
typedef void (*pcMemBlt)(rdpUpdate* update, MEMBLT_ORDER* memblt);
|
||||
typedef void (*pcMem3Blt)(rdpUpdate* update, MEM3BLT_ORDER* memblt);
|
||||
typedef void (*pcMultiDstBlt)(rdpUpdate* update, MULTI_DSTBLT_ORDER* multi_dstblt);
|
||||
typedef void (*pcMultiPatBlt)(rdpUpdate* update, MULTI_PATBLT_ORDER* multi_patblt);
|
||||
typedef void (*pcMultiScrBlt)(rdpUpdate* update, MULTI_SCRBLT_ORDER* multi_scrblt);
|
||||
typedef void (*pcMultiOpaqueRect)(rdpUpdate* update, MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect);
|
||||
typedef void (*pcFastIndex)(rdpUpdate* update, FAST_INDEX_ORDER* fast_index);
|
||||
typedef void (*pcPolygonSC)(rdpUpdate* update, POLYGON_SC_ORDER* polygon_sc);
|
||||
typedef void (*pcPolygonCB)(rdpUpdate* update, POLYGON_CB_ORDER* polygon_cb);
|
||||
typedef void (*pcPolyline)(rdpUpdate* update, POLYLINE_ORDER* polyline);
|
||||
typedef void (*pcFastGlyph)(rdpUpdate* update, FAST_GLYPH_ORDER* fast_glyph);
|
||||
typedef void (*pcEllipseSC)(rdpUpdate* update, ELLIPSE_SC_ORDER* ellipse_sc);
|
||||
typedef void (*pcEllipseCB)(rdpUpdate* update, ELLIPSE_CB_ORDER* ellipse_cb);
|
||||
typedef void (*pcGlyphIndex)(rdpUpdate* update, GLYPH_INDEX_ORDER* glyph_index);
|
||||
|
||||
struct rdp_update
|
||||
{
|
||||
@ -415,6 +426,7 @@ struct rdp_update
|
||||
|
||||
pcBeginPaint BeginPaint;
|
||||
pcEndPaint EndPaint;
|
||||
pcSetBounds SetBounds;
|
||||
pcSynchronize Synchronize;
|
||||
pcBitmap Bitmap;
|
||||
pcPalette Palette;
|
||||
|
@ -1009,6 +1009,7 @@ void update_read_bounds(STREAM* s, ORDER_INFO* orderInfo)
|
||||
|
||||
void update_recv_primary_order(rdpUpdate* update, STREAM* s, uint8 flags)
|
||||
{
|
||||
BOUNDS bounds;
|
||||
ORDER_INFO* orderInfo = &(update->order_info);
|
||||
|
||||
if (flags & ORDER_TYPE_CHANGE)
|
||||
@ -1022,6 +1023,13 @@ void update_recv_primary_order(rdpUpdate* update, STREAM* s, uint8 flags)
|
||||
if (!(flags & ORDER_ZERO_BOUNDS_DELTAS))
|
||||
{
|
||||
update_read_bounds(s, orderInfo);
|
||||
|
||||
bounds.left = orderInfo->boundLeft;
|
||||
bounds.top = orderInfo->boundTop;
|
||||
bounds.right = orderInfo->boundRight;
|
||||
bounds.bottom = orderInfo->boundBottom;
|
||||
|
||||
IFCALL(update->SetBounds, update, &bounds);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1144,6 +1152,9 @@ void update_recv_primary_order(rdpUpdate* update, STREAM* s, uint8 flags)
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if (flags & ORDER_BOUNDS)
|
||||
IFCALL(update->SetBounds, update, NULL);
|
||||
}
|
||||
|
||||
void update_recv_secondary_order(rdpUpdate* update, STREAM* s, uint8 flags)
|
||||
|
@ -1065,7 +1065,7 @@ gdi_ui_decode(struct rdp_inst * inst, uint8 * data, int size)
|
||||
}
|
||||
#endif
|
||||
|
||||
int gdi_bitmap_update(rdpUpdate* update, BITMAP_UPDATE* bitmap)
|
||||
void gdi_bitmap_update(rdpUpdate* update, BITMAP_UPDATE* bitmap)
|
||||
{
|
||||
int i;
|
||||
BITMAP_DATA* bmp;
|
||||
@ -1079,8 +1079,44 @@ int gdi_bitmap_update(rdpUpdate* update, BITMAP_UPDATE* bitmap)
|
||||
gdi_BitBlt(gdi->primary->hdc, bmp->left, bmp->top, bmp->width, bmp->height, gdi_bmp->hdc, 0, 0, GDI_SRCCOPY);
|
||||
gdi_bitmap_free((GDI_IMAGE*) gdi_bmp);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
void gdi_palette_update(rdpUpdate* update, PALETTE_UPDATE* palette)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void gdi_set_bounds(rdpUpdate* update, BOUNDS* bounds)
|
||||
{
|
||||
GDI* gdi = GET_GDI(update);
|
||||
|
||||
if (bounds != NULL)
|
||||
{
|
||||
gdi_SetClipRgn(gdi->drawing->hdc, bounds->left, bounds->top,
|
||||
bounds->right - bounds->left + 1, bounds->bottom - bounds->top + 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
gdi_SetNullClipRgn(gdi->drawing->hdc);
|
||||
}
|
||||
}
|
||||
|
||||
void gdi_opaque_rect(rdpUpdate* update, OPAQUE_RECT_ORDER* opaque_rect)
|
||||
{
|
||||
GDI_RECT rect;
|
||||
HGDI_BRUSH hBrush;
|
||||
uint32 brush_color;
|
||||
GDI *gdi = GET_GDI(update);
|
||||
|
||||
gdi_CRgnToRect(opaque_rect->nLeftRect, opaque_rect->nTopRect,
|
||||
opaque_rect->nWidth, opaque_rect->nHeight, &rect);
|
||||
|
||||
brush_color = gdi_color_convert(opaque_rect->color, gdi->srcBpp, 32, gdi->clrconv);
|
||||
|
||||
hBrush = gdi_CreateSolidBrush(brush_color);
|
||||
gdi_FillRect(gdi->drawing->hdc, &rect, hBrush);
|
||||
|
||||
gdi_DeleteObject((HGDIOBJECT) hBrush);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -1092,14 +1128,15 @@ int gdi_bitmap_update(rdpUpdate* update, BITMAP_UPDATE* bitmap)
|
||||
void gdi_register_update_callbacks(rdpUpdate* update)
|
||||
{
|
||||
update->Bitmap = gdi_bitmap_update;
|
||||
update->Palette = NULL;
|
||||
update->Palette = gdi_palette_update;
|
||||
update->SetBounds = gdi_set_bounds;
|
||||
update->DstBlt = NULL;
|
||||
update->PatBlt = NULL;
|
||||
update->ScrBlt = NULL;
|
||||
update->DrawNineGrid = NULL;
|
||||
update->MultiDrawNineGrid = NULL;
|
||||
update->LineTo = NULL;
|
||||
update->OpaqueRect = NULL;
|
||||
update->OpaqueRect = gdi_opaque_rect;
|
||||
update->SaveBitmap = NULL;
|
||||
update->MemBlt = NULL;
|
||||
update->Mem3Blt = NULL;
|
||||
|
Loading…
x
Reference in New Issue
Block a user