From 6bdc9042a445d9da0e0d1337df02eb718bf0fda4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Fri, 5 Aug 2011 02:19:17 -0400 Subject: [PATCH] libfreerdp-core: fix bounds parsing --- cunit/test_orders.c | 12 - include/freerdp/update.h | 13 +- libfreerdp-core/activation.c | 2 + libfreerdp-core/orders.c | 46 ++- libfreerdp-gdi/gdi.c | 621 ----------------------------------- 5 files changed, 28 insertions(+), 666 deletions(-) diff --git a/cunit/test_orders.c b/cunit/test_orders.c index a01a6e968..b295b0240 100644 --- a/cunit/test_orders.c +++ b/cunit/test_orders.c @@ -188,10 +188,6 @@ void test_read_draw_nine_grid_order(void) memset(orderInfo, 0, sizeof(ORDER_INFO)); orderInfo->fieldFlags = 0x1C; - orderInfo->boundLeft = 925; - orderInfo->boundTop = 134; - orderInfo->boundRight = 846; - orderInfo->boundBottom = 155; orderInfo->deltaCoordinates = True; memset(&draw_nine_grid, 0, sizeof(DRAW_NINE_GRID_ORDER)); @@ -272,10 +268,6 @@ void test_read_line_to_order(void) memset(orderInfo, 0, sizeof(ORDER_INFO)); orderInfo->fieldFlags = 0x021E; - orderInfo->boundLeft = 829; - orderInfo->boundTop = 257; - orderInfo->boundRight = 842; - orderInfo->boundBottom = 270; orderInfo->deltaCoordinates = True; memset(&line_to, 0, sizeof(LINE_TO_ORDER)); @@ -506,10 +498,6 @@ void test_read_fast_glyph_order(void) memset(orderInfo, 0, sizeof(ORDER_INFO)); orderInfo->fieldFlags = 0x7EFB; - orderInfo->boundLeft = 139; - orderInfo->boundTop = 177; - orderInfo->boundRight = 1068; - orderInfo->boundBottom = 189; memset(&fast_glyph, 0, sizeof(FAST_GLYPH_ORDER)); diff --git a/include/freerdp/update.h b/include/freerdp/update.h index cd07e9705..bb058f004 100644 --- a/include/freerdp/update.h +++ b/include/freerdp/update.h @@ -26,10 +26,10 @@ struct _BOUNDS { - uint16 left; - uint16 top; - uint16 right; - uint16 bottom; + sint16 left; + sint16 top; + sint16 right; + sint16 bottom; }; typedef struct _BOUNDS BOUNDS; @@ -74,10 +74,7 @@ struct _ORDER_INFO { uint8 orderType; uint32 fieldFlags; - uint16 boundLeft; - uint16 boundTop; - uint16 boundRight; - uint16 boundBottom; + BOUNDS bounds; sint8 deltaBoundLeft; sint8 deltaBoundTop; sint8 deltaBoundRight; diff --git a/libfreerdp-core/activation.c b/libfreerdp-core/activation.c index 5121dff7f..9b2d412b8 100644 --- a/libfreerdp-core/activation.c +++ b/libfreerdp-core/activation.c @@ -170,6 +170,8 @@ void rdp_send_client_font_list_pdu(rdpRdp* rdp, uint16 flags) void rdp_recv_server_font_map_pdu(rdpRdp* rdp, STREAM* s, rdpSettings* settings) { rdp->activated = True; + rdp->update->switch_surface.bitmapId = SCREEN_BITMAP_SURFACE; + IFCALL(rdp->update->SwitchSurface, rdp->update, &(rdp->update->switch_surface)); } void rdp_recv_deactivate_all(rdpRdp* rdp, STREAM* s) diff --git a/libfreerdp-core/orders.c b/libfreerdp-core/orders.c index 1238b1461..0c6587c8b 100644 --- a/libfreerdp-core/orders.c +++ b/libfreerdp-core/orders.c @@ -1567,36 +1567,35 @@ void update_read_field_flags(STREAM* s, uint32* fieldFlags, uint8 flags, uint8 f } } -void update_read_bounds(STREAM* s, ORDER_INFO* orderInfo) +void update_read_bounds(STREAM* s, BOUNDS* bounds) { uint8 flags; stream_read_uint8(s, flags); /* field flags */ - if (flags & BOUND_DELTA_LEFT) - stream_read_uint8(s, orderInfo->deltaBoundLeft); - else if (flags & BOUND_LEFT) - stream_read_uint16(s, orderInfo->boundLeft); + if (flags & BOUND_LEFT) + update_read_coord(s, &bounds->left, False); + else if (flags & BOUND_DELTA_LEFT) + update_read_coord(s, &bounds->left, True); - if (flags & BOUND_DELTA_TOP) - stream_read_uint8(s, orderInfo->deltaBoundTop); - else if (flags & BOUND_TOP) - stream_read_uint16(s, orderInfo->boundTop); + if (flags & BOUND_TOP) + update_read_coord(s, &bounds->top, False); + else if (flags & BOUND_DELTA_TOP) + update_read_coord(s, &bounds->top, True); - if (flags & BOUND_DELTA_RIGHT) - stream_read_uint8(s, orderInfo->deltaBoundRight); - else if (flags & BOUND_RIGHT) - stream_read_uint16(s, orderInfo->boundRight); + if (flags & BOUND_RIGHT) + update_read_coord(s, &bounds->right, False); + else if (flags & BOUND_DELTA_RIGHT) + update_read_coord(s, &bounds->right, True); - if (flags & BOUND_DELTA_BOTTOM) - stream_read_uint8(s, orderInfo->deltaBoundBottom); - else if (flags & BOUND_BOTTOM) - stream_read_uint16(s, orderInfo->boundBottom); + if (flags & BOUND_BOTTOM) + update_read_coord(s, &bounds->bottom, False); + else if (flags & BOUND_DELTA_BOTTOM) + update_read_coord(s, &bounds->bottom, True); } void update_recv_primary_order(rdpUpdate* update, STREAM* s, uint8 flags) { - BOUNDS bounds; ORDER_INFO* orderInfo = &(update->order_info); if (flags & ORDER_TYPE_CHANGE) @@ -1608,14 +1607,9 @@ void update_recv_primary_order(rdpUpdate* update, STREAM* s, uint8 flags) if (flags & ORDER_BOUNDS) { if (!(flags & ORDER_ZERO_BOUNDS_DELTAS)) - update_read_bounds(s, orderInfo); + update_read_bounds(s, &orderInfo->bounds); - bounds.left = orderInfo->boundLeft; - bounds.top = orderInfo->boundTop; - bounds.right = orderInfo->boundRight; - bounds.bottom = orderInfo->boundBottom; - - IFCALL(update->SetBounds, update, &bounds); + IFCALL(update->SetBounds, update, &orderInfo->bounds); } orderInfo->deltaCoordinates = (flags & ORDER_DELTA_COORDINATES) ? True : False; @@ -1742,7 +1736,9 @@ void update_recv_primary_order(rdpUpdate* update, STREAM* s, uint8 flags) } if (flags & ORDER_BOUNDS) + { IFCALL(update->SetBounds, update, NULL); + } } void update_recv_secondary_order(rdpUpdate* update, STREAM* s, uint8 flags) diff --git a/libfreerdp-gdi/gdi.c b/libfreerdp-gdi/gdi.c index 7eea44d98..63ef9db55 100644 --- a/libfreerdp-gdi/gdi.c +++ b/libfreerdp-gdi/gdi.c @@ -444,627 +444,6 @@ gdi_bitmap_free(GDI_IMAGE *gdi_bmp) } } -#if 0 - -/* GDI callbacks registered in libfreerdp */ - -static void -gdi_ui_desktop_save(struct rdp_inst * inst, int offset, int x, int y, int cx, int cy) -{ - DEBUG_GDI("gdi_ui_desktop_save"); -} - -static void -gdi_ui_desktop_restore(struct rdp_inst * inst, int offset, int x, int y, int cx, int cy) -{ - DEBUG_GDI("gdi_ui_desktop_restore"); -} - -/** - * Create a new glyph. - * @param inst current instance - * @param width glyph width - * @param height glyph height - * @param data glyph data - * @return new glyph - */ - -static FRDP_HGLYPH -gdi_ui_create_glyph(struct rdp_inst * inst, int width, int height, uint8 * data) -{ - uint8* glyph; - GDI_IMAGE *gdi_bmp; - - DEBUG_GDI("gdi_ui_create_glyph: width:%d height:%d", width, height); - - gdi_bmp = (GDI_IMAGE*) malloc(sizeof(GDI_IMAGE)); - - gdi_bmp->hdc = gdi_GetDC(); - gdi_bmp->hdc->bytesPerPixel = 1; - gdi_bmp->hdc->bitsPerPixel = 1; - glyph = gdi_glyph_convert(width, height, data); - gdi_bmp->bitmap = gdi_CreateBitmap(width, height, 1, glyph); - gdi_bmp->bitmap->bytesPerPixel = 1; - gdi_bmp->bitmap->bitsPerPixel = 1; - gdi_SelectObject(gdi_bmp->hdc, (HGDIOBJECT) gdi_bmp->bitmap); - gdi_bmp->org_bitmap = NULL; - - return (FRDP_HGLYPH) gdi_bmp; -} - -/** - * Destroy a glyph. - * @param inst current instance - * @param glyph glyph - */ - -static void -gdi_ui_destroy_glyph(struct rdp_inst * inst, FRDP_HGLYPH glyph) -{ - gdi_bitmap_free((GDI_IMAGE*) glyph); -} - -/** - * Create a new bitmap. - * @param inst current instance - * @param width bitmap width - * @param height bitmap height - * @param data bitmap data - * @return new bitmap - */ - -static FRDP_HBITMAP -gdi_ui_create_bitmap(struct rdp_inst * inst, int width, int height, uint8* data) -{ - GDI_IMAGE *gdi_bmp; - GDI *gdi = GET_GDI(inst); - - DEBUG_GDI("gdi_ui_create_bitmap: width:%d height:%d", width, height); - - gdi_bmp = gdi_bitmap_new(gdi, width, height, gdi->dstBpp, data); - - return (FRDP_HBITMAP) gdi_bmp; -} - -/** - * Paint a bitmap without persisting it in the bitmap cache. - * @param inst current instance - * @param x x position - * @param y y position - * @param cx delta x - * @param cy delta y - * @param width bitmap width - * @param height bitmap height - * @param data bitmap data - */ - -static void -gdi_ui_paint_bitmap(struct rdp_inst * inst, int x, int y, int cx, int cy, int width, int height, uint8 * data) -{ - GDI_IMAGE *gdi_bmp; - GDI *gdi = GET_GDI(inst); - - DEBUG_GDI("ui_paint_bitmap: x:%d y:%d cx:%d cy:%d", x, y, cx, cy); - - gdi_bmp = (GDI_IMAGE*) inst->ui_create_bitmap(inst, width, height, data); - gdi_BitBlt(gdi->primary->hdc, x, y, cx, cy, gdi_bmp->hdc, 0, 0, GDI_SRCCOPY); - inst->ui_destroy_bitmap(inst, (FRDP_HBITMAP) gdi_bmp); -} - -/** - * Destroy a bitmap. - * @param inst current instance - * @param bmp bitmap - */ - -static void -gdi_ui_destroy_bitmap(struct rdp_inst * inst, FRDP_HBITMAP bmp) -{ - gdi_bitmap_free((GDI_IMAGE*) bmp); -} - -/** - * Draw a line using a pen.\n - * LineTo (LINETO_ORDER) @msdn{cc241589} - * @param inst current instance - * @param opcode raster operation code - * @param startx line starting x position - * @param starty line starting y position - * @param endx line ending x position - * @param endy line ending y position - * @param pen pen - */ - -static void -gdi_ui_line(struct rdp_inst * inst, uint8 opcode, int startx, int starty, int endx, int endy, FRDP_PEN * pen) -{ - HGDI_PEN hPen; - int cx, cy; - uint32 color; - GDI *gdi = GET_GDI(inst); - - DEBUG_GDI("ui_line opcode:0x%02X startx:%d starty:%d endx:%d endy:%d", opcode, startx, starty, endx, endy); - - cx = endx - startx + 1; - cy = endy - starty + 1; - - color = gdi_color_convert(pen->color, gdi->srcBpp, 32, gdi->clrconv); - hPen = gdi_CreatePen(pen->style, pen->width, (GDI_COLOR) color); - gdi_SelectObject(gdi->drawing->hdc, (HGDIOBJECT) hPen); - gdi_SetROP2(gdi->drawing->hdc, opcode); - - gdi_MoveToEx(gdi->drawing->hdc, startx, starty, NULL); - gdi_LineTo(gdi->drawing->hdc, endx, endy); - - gdi_DeleteObject((HGDIOBJECT) hPen); -} - -/** - * Draw a rectangle using a color. - * @param inst current instance - * @param x x position - * @param y y position - * @param cx delta x - * @param cy delta y - * @param color color - */ - -static void -gdi_ui_rect(struct rdp_inst * inst, int x, int y, int cx, int cy, uint32 color) -{ - GDI_RECT rect; - HGDI_BRUSH hBrush; - uint32 brush_color; - GDI *gdi = GET_GDI(inst); - - DEBUG_GDI("ui_rect: x:%d y:%d cx:%d cy:%d", x, y, cx, cy); - - gdi_CRgnToRect(x, y, cx, cy, &rect); - brush_color = gdi_color_convert(color, gdi->srcBpp, 32, gdi->clrconv); - - hBrush = gdi_CreateSolidBrush(brush_color); - gdi_FillRect(gdi->drawing->hdc, &rect, hBrush); - gdi_DeleteObject((HGDIOBJECT) hBrush); -} - -/** - * Draw a polygon using a brush.\n - * PolygonSC (POLYGON_SC_ORDER) @msdn{cc241594}\n - * PolygonCB (POLYGON_CB_ORDER) @msdn{cc241595} - * @param inst current instance - * @param opcode raster operation code - * @param fillmode fill mode - * @param point array of points - * @param npoints number of points - * @param brush brush - * @param bgcolor background color - * @param fgcolor foreground color - */ - -static void -gdi_ui_polygon(struct rdp_inst * inst, uint8 opcode, uint8 fillmode, FRDP_POINT * point, int npoints, FRDP_BRUSH * brush, uint32 bgcolor, uint32 fgcolor) -{ - DEBUG_GDI("ui_polygon"); -} - -/** - * Draw a solid color polyline.\n - * Polyline (POLYLINE_ORDER) @msdn{cc241596} - * @param inst current instance - * @param opcode raster operation code - * @param points array of points - * @param npoints number of points - * @param pen pen - */ - -static void -gdi_ui_polyline(struct rdp_inst * inst, uint8 opcode, FRDP_POINT * points, int npoints, FRDP_PEN * pen) -{ - int i; - HGDI_PEN hPen; - int cx, cy; - uint32 color; - GDI *gdi = GET_GDI(inst); - - DEBUG_GDI("ui_polyline: opcode:%d npoints:%d", opcode, npoints); - - color = gdi_color_convert(pen->color, gdi->srcBpp, 32, gdi->clrconv); - - hPen = gdi_CreatePen(pen->style, pen->width, (GDI_COLOR) color); - gdi_SelectObject(gdi->drawing->hdc, (HGDIOBJECT) hPen); - gdi_SetROP2(gdi->drawing->hdc, opcode); - - cx = points[0].x; - cy = points[0].y; - for(i = 1; i < npoints; i++) - { - gdi_MoveToEx(gdi->drawing->hdc, cx, cy, NULL); - cx += points[i].x; - cy += points[i].y; - gdi_LineTo(gdi->drawing->hdc, cx, cy); - } - - gdi_DeleteObject((HGDIOBJECT) hPen); -} - -/** - * Draw an ellipse using a brush.\n - * EclipseSC (ELLIPSE_SC_ORDER) @msdn{cc241597}\n - * EclipseCB (ELLIPSE_CB_ORDER) @msdn{cc241599} - * @param inst current instance - * @param opcode raster operation code - * @param fillmode fill mode - * @param x x position - * @param y y position - * @param cx delta x - * @param cy delta y - * @param brush brush - * @param bgcolor background color - * @param fgcolor foreground color - */ - -static void -gdi_ui_ellipse(struct rdp_inst * inst, uint8 opcode, uint8 fillmode, int x, int y, int cx, int cy, FRDP_BRUSH * brush, uint32 bgcolor, uint32 fgcolor) -{ - DEBUG_GDI("ui_ellipse"); -} - -/** - * Start drawing a set of glyphs. - * @param inst current instance - * @param bgcolor background color - * @param fgcolor foreground color - */ - -static void -gdi_ui_start_draw_glyphs(struct rdp_inst * inst, uint32 bgcolor, uint32 fgcolor) -{ - uint32 color; - GDI *gdi = GET_GDI(inst); - color = gdi_color_convert(fgcolor, gdi->srcBpp, 32, gdi->clrconv); - gdi->textColor = gdi_SetTextColor(gdi->drawing->hdc, color); -} - -/** - * Draw a single glyph. - * @param inst current instance - * @param x x position - * @param y y position - * @param cx delta x - * @param cy delta y - * @param glyph glyph - */ - -static void -gdi_ui_draw_glyph(struct rdp_inst * inst, int x, int y, int cx, int cy, FRDP_HGLYPH glyph) -{ - GDI_IMAGE* gdi_bmp; - GDI *gdi = GET_GDI(inst); - - gdi_bmp = (GDI_IMAGE*) glyph; - gdi_BitBlt(gdi->drawing->hdc, x, y, cx, cy, gdi_bmp->hdc, 0, 0, GDI_DSPDxax); -} - -/** - * End drawing a set of glyphs. - * @param inst current instance - * @param x x position - * @param y y position - * @param cx delta x - * @param cy delta y - */ - -static void -gdi_ui_end_draw_glyphs(struct rdp_inst * inst, int x, int y, int cx, int cy) -{ - GDI *gdi = GET_GDI(inst); - gdi_SetTextColor(gdi->drawing->hdc, gdi->textColor); -} - -/** - * DstBlt (DSTBLT_ORDER) primary drawing order.\n - * @msdn{cc241587} - * @param inst current instance - * @param opcode raster operation code - * @param x x position - * @param y y position - * @param cx delta x - * @param cy delta y - */ - -static void -gdi_ui_destblt(struct rdp_inst * inst, uint8 opcode, int x, int y, int cx, int cy) -{ - GDI *gdi = GET_GDI(inst); - - DEBUG_GDI("ui_destblt: x: %d y: %d cx: %d cy: %d rop: 0x%X", x, y, cx, cy, rop3_code_table[opcode]); - gdi_BitBlt(gdi->drawing->hdc, x, y, cx, cy, NULL, 0, 0, gdi_rop3_code(opcode)); -} - -/** - * PatBlt (PATBLT_ORDER) primary drawing order.\n - * @msdn{cc241602} - * @param inst current instance - * @param opcode raster operation code - * @param x x position - * @param y y position - * @param cx delta x - * @param cy delta y - * @param brush brush - * @param bgcolor background color - * @param fgcolor foreground color - */ - -static void -gdi_ui_patblt(struct rdp_inst * inst, uint8 opcode, int x, int y, int cx, int cy, FRDP_BRUSH * brush, uint32 bgcolor, uint32 fgcolor) -{ - HGDI_BRUSH originalBrush; - GDI *gdi = GET_GDI(inst); - - DEBUG_GDI("ui_patblt: x: %d y: %d cx: %d cy: %d rop: 0x%X", x, y, cx, cy, gdi_rop3_code(opcode)); - - if (brush->style == GDI_BS_PATTERN) - { - uint8* data; - HGDI_BITMAP hBmp; - - if (brush->bd->color_code > 1) - data = gdi_image_convert(brush->bd->data, NULL, 8, 8, gdi->srcBpp, gdi->dstBpp, gdi->clrconv); - else - data = gdi_mono_image_convert(brush->bd->data, 8, 8, gdi->srcBpp, gdi->dstBpp, bgcolor, fgcolor, gdi->clrconv); - - hBmp = gdi_CreateBitmap(8, 8, gdi->drawing->hdc->bitsPerPixel, data); - - originalBrush = gdi->drawing->hdc->brush; - gdi->drawing->hdc->brush = gdi_CreatePatternBrush(hBmp); - - gdi_PatBlt(gdi->drawing->hdc, x, y, cx, cy, gdi_rop3_code(opcode)); - - gdi_DeleteObject((HGDIOBJECT) gdi->drawing->hdc->brush); - gdi->drawing->hdc->brush = originalBrush; - } - else if (brush->style == GDI_BS_SOLID) - { - uint32 color; - originalBrush = gdi->drawing->hdc->brush; - - color = gdi_color_convert(fgcolor, gdi->srcBpp, 32, gdi->clrconv); - gdi->drawing->hdc->brush = gdi_CreateSolidBrush(color); - - gdi_PatBlt(gdi->drawing->hdc, x, y, cx, cy, gdi_rop3_code(opcode)); - - gdi_DeleteObject((HGDIOBJECT) gdi->drawing->hdc->brush); - gdi->drawing->hdc->brush = originalBrush; - } - else - { - printf("ui_patblt: unknown brush style: %d\n", brush->style); - } -} - -/** - * ScrBlt (SCRBLT_ORDER) primary drawing order.\n - * @msdn{cc241606} - * @param inst current instance - * @param opcode raster operation code - * @param x x position - * @param y y position - * @param cx delta x - * @param cy delta y - * @param srcx source x position - * @param srcy source y position - */ - -static void -gdi_ui_screenblt(struct rdp_inst * inst, uint8 opcode, int x, int y, int cx, int cy, int srcx, int srcy) -{ - GDI *gdi = GET_GDI(inst); - - DEBUG_GDI("gdi_ui_screenblt x:%d y:%d cx:%d cy:%d srcx:%d srcy:%d rop:0x%X", - x, y, cx, cy, srcx, srcy, rop3_code_table[opcode]); - - gdi_BitBlt(gdi->drawing->hdc, x, y, cx, cy, gdi->primary->hdc, srcx, srcy, gdi_rop3_code(opcode)); -} - -/** - * MemBlt (MEMBLT_ORDER) primary drawing order.\n - * @msdn{cc241608} - * @param inst current instance - * @param opcode raster operation code - * @param x x position - * @param y y position - * @param cx delta x - * @param cy delta y - * @param src source bitmap - * @param srcx source bitmap x position - * @param srcy source bitmap y position - */ - -static void -gdi_ui_memblt(struct rdp_inst * inst, uint8 opcode, int x, int y, int cx, int cy, FRDP_HBITMAP src, int srcx, int srcy) -{ - GDI_IMAGE *gdi_bmp; - GDI *gdi = GET_GDI(inst); - - DEBUG_GDI("gdi_ui_memblt: x:%d y:%d cx:%d cy:%d srcx:%d, srcy:%d rop:0x%X", - x, y, cx, cy, srcx, srcy, gdi_rop3_code(opcode)); - - gdi_bmp = (GDI_IMAGE*) src; - gdi_BitBlt(gdi->drawing->hdc, x, y, cx, cy, gdi_bmp->hdc, srcx, srcy, gdi_rop3_code(opcode)); -} - -/** - * Mem3Blt (MEM3BLT_ORDER) primary drawing order.\n - * @msdn{cc241588} - * @param inst current instance - * @param opcode raster operation code - * @param x x position - * @param y y position - * @param cx delta x - * @param cy delta y - * @param src source bitmap - * @param srcx source bitmap x position - * @param srcy source bitmap y position - * @param brush brush - * @param bgcolor background color - * @param fgcolor foreground color - */ - -static void -gdi_ui_mem3blt(struct rdp_inst * inst, uint8 opcode, int x, int y, int cx, int cy, - FRDP_HBITMAP src, int srcx, int srcy, FRDP_BRUSH * brush, uint32 bgcolor, uint32 fgcolor) -{ - DEBUG_GDI("gdi_ui_mem3blt opcode: 0x%X", rop3_code_table[opcode]); -} - -/** - * Cache color table (CACHE_COLOR_TABLE_ORDER).\n - * @msdn{cc241617} - * @param inst current instance - * @param colors color table - * @return new palette created from color table - */ - -static FRDP_HPALETTE -gdi_ui_create_palette(struct rdp_inst * inst, FRDP_PALETTE * palette) -{ - DEBUG_GDI("gdi_ui_create_palette"); - return (FRDP_HPALETTE) gdi_CreatePalette((HGDI_PALETTE) palette); -} - -/** - * Set the current palette. - * @param inst current instance - * @param palette new color palette - */ - -static void -gdi_ui_set_palette(struct rdp_inst * inst, FRDP_HPALETTE palette) -{ - GDI *gdi = GET_GDI(inst); - DEBUG_GDI("gdi_ui_set_palette"); - gdi->clrconv->palette = (FRDP_PALETTE*) palette; -} - -/** - * Set current clipping region. - * @param inst current instance - * @param x x position - * @param y y position - * @param cx delta x - * @param cy delta y - */ - -static void -gdi_ui_set_clipping_region(struct rdp_inst * inst, int x, int y, int cx, int cy) -{ - GDI *gdi = GET_GDI(inst); - gdi_SetClipRgn(gdi->drawing->hdc, x, y, cx, cy); -} - -/** - * Reset the current clipping region. - * @param inst current instance - */ - -static void -gdi_ui_reset_clipping_region(struct rdp_inst * inst) -{ - GDI *gdi = GET_GDI(inst); - gdi_SetNullClipRgn(gdi->drawing->hdc); -} - -/** - * Create new drawing surface - * @param inst current instance - * @param width surface width - * @param height surface height - * @param old_surface old drawing surface - * @return new drawing surface - */ - -static FRDP_HBITMAP -gdi_ui_create_surface(struct rdp_inst * inst, int width, int height, FRDP_HBITMAP old_surface) -{ - GDI_IMAGE *gdi_bmp; - GDI_IMAGE *old_gdi_bmp; - GDI *gdi = GET_GDI(inst); - - gdi_bmp = gdi_bitmap_new(gdi, width, height, gdi->dstBpp, NULL); - old_gdi_bmp = (GDI_IMAGE*) old_surface; - - if (old_gdi_bmp != 0) - { - gdi_bitmap_free(old_gdi_bmp); - } - - if (gdi->drawing == old_gdi_bmp) - { - gdi->drawing = gdi_bmp; - } - - DEBUG_GDI("ui_create_surface"); - - return (FRDP_HBITMAP) gdi_bmp; -} - -/** - * Switch Surface (SWITCH_SURFACE_ORDER). - * @msdn{cc241630} - * @param inst current instance - * @param surface new surface - */ - -static void -gdi_ui_switch_surface(struct rdp_inst * inst, FRDP_HBITMAP surface) -{ - GDI *gdi = GET_GDI(inst); - - DEBUG_GDI("ui_switch_surface"); - - if (surface != 0) - { - gdi->drawing = (GDI_IMAGE*) surface; - } - else - { - gdi->drawing = (GDI_IMAGE*) gdi->primary; - } -} - -/** - * Destroy a surface. - * @param inst - * @param surface - */ - -static void -gdi_ui_destroy_surface(struct rdp_inst * inst, FRDP_HBITMAP surface) -{ - GDI *gdi = GET_GDI(inst); - - DEBUG_GDI("ui_destroy_surface"); - - if (gdi->drawing == surface) - { - gdi->drawing = gdi->primary; - } - - if (surface != 0) - { - gdi_bitmap_free((GDI_IMAGE*) surface); - } -} - -static int -gdi_ui_decode(struct rdp_inst * inst, uint8 * data, int size) -{ - GDI *gdi = GET_GDI(inst); - gdi_decode_data(gdi, data, size); - return 0; -} -#endif - void gdi_bitmap_update(rdpUpdate* update, BITMAP_UPDATE* bitmap) { int i;