From 1dcc1c2be2e669ecde12ce0ff328b5fa2a5617d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Moreau?= Date: Thu, 4 Aug 2011 16:22:15 -0400 Subject: [PATCH] libfreerdp-cache: started offscreen bitmap cache --- CMakeLists.txt | 1 + client/DirectFB/dfreerdp.c | 26 ++++++++++ include/freerdp/settings.h | 24 +++++++++ libfreerdp-cache/CMakeLists.txt | 31 ++++++++++++ libfreerdp-cache/cache.c | 46 +++++++++++++++++ libfreerdp-cache/cache.h | 38 ++++++++++++++ libfreerdp-cache/offscreen.c | 87 +++++++++++++++++++++++++++++++++ libfreerdp-cache/offscreen.h | 47 ++++++++++++++++++ libfreerdp-core/capabilities.c | 3 +- libfreerdp-core/capabilities.h | 23 --------- libfreerdp-core/orders.c | 28 ++++------- libfreerdp-core/orders.h | 6 --- libfreerdp-core/settings.c | 29 ++++++----- libfreerdp-core/update.c | 2 + libfreerdp-gdi/gdi.c | 40 ++++++++++++++- 15 files changed, 367 insertions(+), 64 deletions(-) create mode 100644 libfreerdp-cache/CMakeLists.txt create mode 100644 libfreerdp-cache/cache.c create mode 100644 libfreerdp-cache/cache.h create mode 100644 libfreerdp-cache/offscreen.c create mode 100644 libfreerdp-cache/offscreen.h diff --git a/CMakeLists.txt b/CMakeLists.txt index 0b33edc0e..bd34a14f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,6 +89,7 @@ add_subdirectory(include) add_subdirectory(libfreerdp-utils) add_subdirectory(libfreerdp-kbd) add_subdirectory(libfreerdp-gdi) +add_subdirectory(libfreerdp-cache) add_subdirectory(libfreerdp-chanman) add_subdirectory(libfreerdp-core) add_subdirectory(channels) diff --git a/client/DirectFB/dfreerdp.c b/client/DirectFB/dfreerdp.c index 1494cbf91..c64f7ab32 100644 --- a/client/DirectFB/dfreerdp.c +++ b/client/DirectFB/dfreerdp.c @@ -94,10 +94,36 @@ boolean df_check_fds(freerdp* instance, fd_set* set) boolean df_pre_connect(freerdp* instance) { dfInfo* dfi; + rdpSettings* settings; dfi = (dfInfo*) xzalloc(sizeof(dfInfo)); SET_DFI(instance, dfi); + settings = instance->settings; + + settings->order_support[NEG_DSTBLT_INDEX] = True; + settings->order_support[NEG_PATBLT_INDEX] = True; + settings->order_support[NEG_SCRBLT_INDEX] = True; + settings->order_support[NEG_OPAQUE_RECT_INDEX] = True; + settings->order_support[NEG_DRAWNINEGRID_INDEX] = False; + settings->order_support[NEG_MULTIDSTBLT_INDEX] = False; + settings->order_support[NEG_MULTIPATBLT_INDEX] = False; + settings->order_support[NEG_MULTISCRBLT_INDEX] = False; + settings->order_support[NEG_MULTIOPAQUERECT_INDEX] = True; + settings->order_support[NEG_MULTI_DRAWNINEGRID_INDEX] = False; + settings->order_support[NEG_LINETO_INDEX] = True; + settings->order_support[NEG_POLYLINE_INDEX] = True; + settings->order_support[NEG_MEMBLT_INDEX] = False; + settings->order_support[NEG_MEM3BLT_INDEX] = False; + settings->order_support[NEG_SAVEBITMAP_INDEX] = False; + settings->order_support[NEG_GLYPH_INDEX_INDEX] = True; + settings->order_support[NEG_FAST_INDEX_INDEX] = True; + settings->order_support[NEG_FAST_GLYPH_INDEX] = True; + settings->order_support[NEG_POLYGON_SC_INDEX] = False; + settings->order_support[NEG_POLYGON_CB_INDEX] = False; + settings->order_support[NEG_ELLIPSE_SC_INDEX] = False; + settings->order_support[NEG_ELLIPSE_CB_INDEX] = False; + freerdp_chanman_pre_connect(GET_CHANMAN(instance), instance); return True; diff --git a/include/freerdp/settings.h b/include/freerdp/settings.h index 41ff72c45..aaec93caf 100644 --- a/include/freerdp/settings.h +++ b/include/freerdp/settings.h @@ -52,6 +52,30 @@ /* Auto Reconnect Version */ #define AUTO_RECONNECT_VERSION_1 0x00000001 +/* Order Support */ +#define NEG_DSTBLT_INDEX 0x00 +#define NEG_PATBLT_INDEX 0x01 +#define NEG_SCRBLT_INDEX 0x02 +#define NEG_MEMBLT_INDEX 0x03 +#define NEG_MEM3BLT_INDEX 0x04 +#define NEG_DRAWNINEGRID_INDEX 0x07 +#define NEG_LINETO_INDEX 0x08 +#define NEG_MULTI_DRAWNINEGRID_INDEX 0x09 +#define NEG_OPAQUE_RECT_INDEX 0x0A +#define NEG_SAVEBITMAP_INDEX 0x0B +#define NEG_MULTIDSTBLT_INDEX 0x0F +#define NEG_MULTIPATBLT_INDEX 0x10 +#define NEG_MULTISCRBLT_INDEX 0x11 +#define NEG_MULTIOPAQUERECT_INDEX 0x12 +#define NEG_FAST_INDEX_INDEX 0x13 +#define NEG_POLYGON_SC_INDEX 0x14 +#define NEG_POLYGON_CB_INDEX 0x15 +#define NEG_POLYLINE_INDEX 0x16 +#define NEG_FAST_GLYPH_INDEX 0x18 +#define NEG_ELLIPSE_SC_INDEX 0x19 +#define NEG_ELLIPSE_CB_INDEX 0x1A +#define NEG_GLYPH_INDEX_INDEX 0x1B + /* SYSTEM_TIME */ typedef struct { diff --git a/libfreerdp-cache/CMakeLists.txt b/libfreerdp-cache/CMakeLists.txt new file mode 100644 index 000000000..6f0c66599 --- /dev/null +++ b/libfreerdp-cache/CMakeLists.txt @@ -0,0 +1,31 @@ +# FreeRDP: A Remote Desktop Protocol Client +# libfreerdp-cache cmake build script +# +# Copyright 2011 O.S. Systems Software Ltda. +# Copyright 2011 Otavio Salvador +# Copyright 2011 Marc-Andre Moreau +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +set(FREERDP_CACHE_SRCS + offscreen.c + offscreen.h + cache.c + cache.h) + +add_library(freerdp-cache SHARED ${FREERDP_CACHE_SRCS}) + +set_target_properties(freerdp-cache PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION}) + +install(TARGETS freerdp-cache DESTINATION lib) + diff --git a/libfreerdp-cache/cache.c b/libfreerdp-cache/cache.c new file mode 100644 index 000000000..4e2f606bb --- /dev/null +++ b/libfreerdp-cache/cache.c @@ -0,0 +1,46 @@ +/** + * FreeRDP: A Remote Desktop Protocol Client + * RDP Caches + * + * Copyright 2011 Marc-Andre Moreau + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +#include "cache.h" + +rdpCache* cache_new() +{ + rdpCache* cache; + + cache = (rdpCache*) xzalloc(sizeof(rdpCache)); + + if (cache != NULL) + { + cache->offscreen = offscreen_new(); + } + + return cache; +} + +void cache_free(rdpCache* cache) +{ + if (cache != NULL) + { + offscreen_free(cache->offscreen); + xfree(cache); + } +} diff --git a/libfreerdp-cache/cache.h b/libfreerdp-cache/cache.h new file mode 100644 index 000000000..089cae135 --- /dev/null +++ b/libfreerdp-cache/cache.h @@ -0,0 +1,38 @@ +/** + * FreeRDP: A Remote Desktop Protocol Client + * RDP Caches + * + * Copyright 2011 Marc-Andre Moreau + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __CACHE_H +#define __CACHE_H + +#include "offscreen.h" + +#include +#include + +typedef struct rdp_cache rdpCache; + +struct rdp_cache +{ + rdpOffscreen* offscreen; +}; + +rdpCache* cache_new(); +void cache_free(rdpCache* cache); + +#endif /* __CACHE_H */ diff --git a/libfreerdp-cache/offscreen.c b/libfreerdp-cache/offscreen.c new file mode 100644 index 000000000..6cf182085 --- /dev/null +++ b/libfreerdp-cache/offscreen.c @@ -0,0 +1,87 @@ +/** + * FreeRDP: A Remote Desktop Protocol Client + * Offscreen Bitmap Cache + * + * Copyright 2011 Marc-Andre Moreau + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include +#include + +#include "offscreen.h" + +void* offscreen_get(rdpOffscreen* offscreen, uint16 index) +{ + void* bitmap; + + if (index < offscreen->maxEntries) + { + printf("invalid offscreen bitmap index: 0x%04X\n", index); + return NULL; + } + + bitmap = offscreen->entries[index].bitmap; + + if (bitmap == NULL) + { + printf("invalid offscreen bitmap at index: 0x%04X\n", index); + return NULL; + } + + return bitmap; +} + +void offscreen_put(rdpOffscreen* offscreen, uint16 index, void* bitmap) +{ + if (index < offscreen->maxEntries) + { + printf("invalid offscreen bitmap index: 0x%04X\n", index); + return; + } + + offscreen->entries[index].bitmap = bitmap; +} + +rdpOffscreen* offscreen_new(rdpSettings* settings) +{ + rdpOffscreen* offscreen; + + offscreen = (rdpOffscreen*) xzalloc(sizeof(rdpOffscreen)); + + if (offscreen != NULL) + { + offscreen->settings = settings; + + offscreen->maxSize = 7680; + offscreen->maxEntries = 100; + + settings->offscreen_bitmap_cache = True; + settings->offscreen_bitmap_cache_size = offscreen->maxSize; + settings->offscreen_bitmap_cache_entries = offscreen->maxEntries; + + offscreen->entries = (OFFSCREEN_ENTRY*) xzalloc(sizeof(OFFSCREEN_ENTRY) * offscreen->maxEntries); + } + + return offscreen; +} + +void offscreen_free(rdpOffscreen* offscreen) +{ + if (offscreen != NULL) + { + xfree(offscreen->entries); + xfree(offscreen); + } +} diff --git a/libfreerdp-cache/offscreen.h b/libfreerdp-cache/offscreen.h new file mode 100644 index 000000000..5c8728ca5 --- /dev/null +++ b/libfreerdp-cache/offscreen.h @@ -0,0 +1,47 @@ +/** + * FreeRDP: A Remote Desktop Protocol Client + * Offscreen Bitmap Cache + * + * Copyright 2011 Marc-Andre Moreau + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef __OFFSCREEN_CACHE_H +#define __OFFSCREEN_CACHE_H + +#include +#include + +struct _OFFSCREEN_ENTRY +{ + void* bitmap; +}; +typedef struct _OFFSCREEN_ENTRY OFFSCREEN_ENTRY; + +struct rdp_offscreen +{ + uint16 maxSize; + uint16 maxEntries; + rdpSettings* settings; + OFFSCREEN_ENTRY* entries; +}; +typedef struct rdp_offscreen rdpOffscreen; + +void* offscreen_get(rdpOffscreen* offscreen, uint16 index); +void offscreen_put(rdpOffscreen* offscreen, uint16 index, void* bitmap); + +rdpOffscreen* offscreen_new(); +void offscreen_free(rdpOffscreen* offscreen); + +#endif /* __OFFSCREEN_CACHE_H */ diff --git a/libfreerdp-core/capabilities.c b/libfreerdp-core/capabilities.c index 8cd22ab32..c7ccb85cf 100644 --- a/libfreerdp-core/capabilities.c +++ b/libfreerdp-core/capabilities.c @@ -1558,7 +1558,7 @@ void rdp_write_confirm_active(STREAM* s, rdpSettings* settings) stream_write_uint16(s, 0); /* pad2Octets (2 bytes) */ /* Capability Sets */ - numberCapabilities = 15; + numberCapabilities = 14; rdp_write_general_capability_set(s, settings); rdp_write_bitmap_capability_set(s, settings); rdp_write_order_capability_set(s, settings); @@ -1567,7 +1567,6 @@ void rdp_write_confirm_active(STREAM* s, rdpSettings* settings) rdp_write_input_capability_set(s, settings); rdp_write_brush_capability_set(s, settings); rdp_write_glyph_cache_capability_set(s, settings); - rdp_write_offscreen_bitmap_cache_capability_set(s, settings); rdp_write_virtual_channel_capability_set(s, settings); rdp_write_sound_capability_set(s, settings); rdp_write_share_capability_set(s, settings); diff --git a/libfreerdp-core/capabilities.h b/libfreerdp-core/capabilities.h index c2508aaed..ddf84f540 100644 --- a/libfreerdp-core/capabilities.h +++ b/libfreerdp-core/capabilities.h @@ -86,29 +86,6 @@ #define CACHE_BITMAP_V3_SUPPORT 0x0002 #define ALTSEC_FRAME_MARKER_SUPPORT 0x0004 -/* Order Support */ -#define NEG_DSTBLT_INDEX 0x00 -#define NEG_PATBLT_INDEX 0x01 -#define NEG_SCRBLT_INDEX 0x02 -#define NEG_MEMBLT_INDEX 0x03 -#define NEG_MEM3BLT_INDEX 0x04 -#define NEG_DRAWNINEGRID_INDEX 0x07 -#define NEG_LINETO_INDEX 0x08 -#define NEG_MULTI_DRAWNINEGRID_INDEX 0x09 -#define NEG_SAVEBITMAP_INDEX 0x0B -#define NEG_MULTIDSTBLT_INDEX 0x0F -#define NEG_MULTIPATBLT_INDEX 0x10 -#define NEG_MULTISCRBLT_INDEX 0x11 -#define NEG_MULTIOPAQUERECT_INDEX 0x12 -#define NEG_FAST_INDEX_INDEX 0x13 -#define NEG_POLYGON_SC_INDEX 0x14 -#define NEG_POLYGON_CB_INDEX 0x15 -#define NEG_POLYLINE_INDEX 0x16 -#define NEG_FAST_GLYPH_INDEX 0x18 -#define NEG_ELLIPSE_SC_INDEX 0x19 -#define NEG_ELLIPSE_CB_INDEX 0x1A -#define NEG_INDEX_INDEX 0x1B - /* Sound Flags */ #define SOUND_BEEPS_FLAG 0x0001 diff --git a/libfreerdp-core/orders.c b/libfreerdp-core/orders.c index 5090d0a60..dba6a76ee 100644 --- a/libfreerdp-core/orders.c +++ b/libfreerdp-core/orders.c @@ -30,6 +30,7 @@ uint8 PRIMARY_DRAWING_ORDER_STRINGS[][20] = "LineTo", "OpaqueRect", "SaveBitmap", + "", "MemBlt", "Mem3Blt", "MultiDstBlt", @@ -40,6 +41,7 @@ uint8 PRIMARY_DRAWING_ORDER_STRINGS[][20] = "PolygonSC", "PolygonCB", "Polyline", + "", "FastGlyph", "EllipseSC", "EllipseCB", @@ -1750,13 +1752,11 @@ void update_recv_secondary_order(rdpUpdate* update, STREAM* s, uint8 flags) uint16 extraFlags; uint16 orderLength; - stream_get_mark(s, next); stream_read_uint16(s, orderLength); /* orderLength (2 bytes) */ stream_read_uint16(s, extraFlags); /* extraFlags (2 bytes) */ stream_read_uint8(s, orderType); /* orderType (1 byte) */ - orderLength += 13; /* adjust length (13 bytes less than actual length) */ - next += orderLength; + next = s->p + ((sint16) orderLength) + 7; if (orderType < SECONDARY_DRAWING_ORDER_COUNT) printf("%s Secondary Drawing Order (0x%02X)\n", SECONDARY_DRAWING_ORDER_STRINGS[orderType], orderType); @@ -1817,7 +1817,7 @@ void update_recv_secondary_order(rdpUpdate* update, STREAM* s, uint8 flags) break; } - stream_set_mark(s, next); + s->p = next; } void update_recv_altsec_order(rdpUpdate* update, STREAM* s, uint8 flags) @@ -1910,19 +1910,11 @@ void update_recv_order(rdpUpdate* update, STREAM* s) stream_read_uint8(s, controlFlags); /* controlFlags (1 byte) */ - switch (controlFlags & ORDER_CLASS_MASK) - { - case ORDER_PRIMARY_CLASS: - update_recv_primary_order(update, s, controlFlags); - break; - - case ORDER_SECONDARY_CLASS: - update_recv_secondary_order(update, s, controlFlags); - break; - - case ORDER_ALTSEC_CLASS: - update_recv_altsec_order(update, s, controlFlags); - break; - } + if (!(controlFlags & ORDER_STANDARD)) + update_recv_altsec_order(update, s, controlFlags); + else if (controlFlags & ORDER_SECONDARY) + update_recv_secondary_order(update, s, controlFlags); + else + update_recv_primary_order(update, s, controlFlags); } diff --git a/libfreerdp-core/orders.h b/libfreerdp-core/orders.h index 69182be54..7cccba501 100644 --- a/libfreerdp-core/orders.h +++ b/libfreerdp-core/orders.h @@ -99,12 +99,6 @@ #define SCREEN_BITMAP_SURFACE 0xFFFF -/* Order Classes */ -#define ORDER_PRIMARY_CLASS 0x01 -#define ORDER_SECONDARY_CLASS 0x03 -#define ORDER_ALTSEC_CLASS 0x02 -#define ORDER_CLASS_MASK 0x03 - /* Primary Drawing Orders */ #define ORDER_TYPE_DSTBLT 0x00 #define ORDER_TYPE_PATBLT 0x01 diff --git a/libfreerdp-core/settings.c b/libfreerdp-core/settings.c index feeba5028..d67c3e230 100644 --- a/libfreerdp-core/settings.c +++ b/libfreerdp-core/settings.c @@ -61,42 +61,45 @@ rdpSettings* settings_new() settings->encryption_method = ENCRYPTION_METHOD_NONE; settings->encryption_level = ENCRYPTION_LEVEL_NONE; + /* settings->order_support[NEG_DSTBLT_INDEX] = True; settings->order_support[NEG_PATBLT_INDEX] = True; settings->order_support[NEG_SCRBLT_INDEX] = True; - settings->order_support[NEG_MEMBLT_INDEX] = True; - settings->order_support[NEG_MEM3BLT_INDEX] = True; + settings->order_support[NEG_OPAQUE_RECT_INDEX] = True; settings->order_support[NEG_DRAWNINEGRID_INDEX] = True; - settings->order_support[NEG_LINETO_INDEX] = True; - settings->order_support[NEG_MULTI_DRAWNINEGRID_INDEX] = True; - settings->order_support[NEG_SAVEBITMAP_INDEX] = True; settings->order_support[NEG_MULTIDSTBLT_INDEX] = True; settings->order_support[NEG_MULTIPATBLT_INDEX] = True; settings->order_support[NEG_MULTISCRBLT_INDEX] = True; settings->order_support[NEG_MULTIOPAQUERECT_INDEX] = True; + settings->order_support[NEG_MULTI_DRAWNINEGRID_INDEX] = True; + settings->order_support[NEG_LINETO_INDEX] = True; + settings->order_support[NEG_POLYLINE_INDEX] = True; + settings->order_support[NEG_MEMBLT_INDEX] = True; + settings->order_support[NEG_MEM3BLT_INDEX] = True; + settings->order_support[NEG_SAVEBITMAP_INDEX] = True; + settings->order_support[NEG_GLYPH_INDEX_INDEX] = True; settings->order_support[NEG_FAST_INDEX_INDEX] = True; + settings->order_support[NEG_FAST_GLYPH_INDEX] = True; settings->order_support[NEG_POLYGON_SC_INDEX] = True; settings->order_support[NEG_POLYGON_CB_INDEX] = True; - settings->order_support[NEG_POLYLINE_INDEX] = True; - settings->order_support[NEG_FAST_GLYPH_INDEX] = True; settings->order_support[NEG_ELLIPSE_SC_INDEX] = True; settings->order_support[NEG_ELLIPSE_CB_INDEX] = True; - settings->order_support[NEG_INDEX_INDEX] = True; + */ settings->color_pointer = True; settings->large_pointer = True; - settings->draw_gdi_plus = True; + settings->draw_gdi_plus = False; settings->frame_marker = False; settings->bitmap_cache_v3 = False; - settings->bitmap_cache = True; + settings->bitmap_cache = False; settings->persistent_bitmap_cache = False; - settings->offscreen_bitmap_cache = True; - settings->offscreen_bitmap_cache_size = 7680; - settings->offscreen_bitmap_cache_entries = 100; + settings->offscreen_bitmap_cache = False; + settings->offscreen_bitmap_cache_size = 0; + settings->offscreen_bitmap_cache_entries = 0; settings->draw_nine_grid_cache_size = 2560; settings->draw_nine_grid_cache_entries = 256; diff --git a/libfreerdp-core/update.c b/libfreerdp-core/update.c index 983523b50..166a57a8c 100644 --- a/libfreerdp-core/update.c +++ b/libfreerdp-core/update.c @@ -36,6 +36,8 @@ void update_recv_orders(rdpUpdate* update, STREAM* s) stream_read_uint16(s, numberOrders); /* numberOrders (2 bytes) */ stream_seek_uint16(s); /* pad2OctetsB (2 bytes) */ + printf("numberOrders:%d\n", numberOrders); + while (numberOrders > 0) { update_recv_order(update, s); diff --git a/libfreerdp-gdi/gdi.c b/libfreerdp-gdi/gdi.c index 1b59b1b2f..3f5892cfa 100644 --- a/libfreerdp-gdi/gdi.c +++ b/libfreerdp-gdi/gdi.c @@ -1237,8 +1237,42 @@ void gdi_line_to(rdpUpdate* update, LINE_TO_ORDER* line_to) gdi_DeleteObject((HGDIOBJECT) hPen); } +void gdi_polyline(rdpUpdate* update, POLYLINE_ORDER* polyline) +{ + int i; + uint32 color; + HGDI_PEN hPen; + DELTA_POINT* points; + GDI *gdi = GET_GDI(update); + + color = gdi_color_convert(polyline->penColor, gdi->srcBpp, 32, gdi->clrconv); + hPen = gdi_CreatePen(0, 1, (GDI_COLOR) color); + gdi_SelectObject(gdi->drawing->hdc, (HGDIOBJECT) hPen); + gdi_SetROP2(gdi->drawing->hdc, polyline->bRop2); + + points = polyline->points; + for (i = 0; i < polyline->numPoints; i++) + { + gdi_MoveToEx(gdi->drawing->hdc, points[i].x, points[i].y, NULL); + gdi_LineTo(gdi->drawing->hdc, points[i + 1].x, points[i + 1].y); + } + + gdi_DeleteObject((HGDIOBJECT) hPen); +} + +void gdi_create_offscreen_bitmap(rdpUpdate* update, CREATE_OFFSCREEN_BITMAP_ORDER* create_offscreen_bitmap) +{ + printf("create_offscreen_bitmap: id:%d cx:%d cy:%d\n", + create_offscreen_bitmap->id, create_offscreen_bitmap->cx, create_offscreen_bitmap->cy); +} + +void gdi_switch_surface(rdpUpdate* update, SWITCH_SURFACE_ORDER* switch_surface) +{ + printf("switch surface: 0x%04X\n", switch_surface->bitmapId); +} + /** - * Register GDI callbacks with libfreerdp. + * Register GDI callbacks with libfreerdp-core. * @param inst current instance * @return */ @@ -1259,7 +1293,7 @@ void gdi_register_update_callbacks(rdpUpdate* update) update->MultiOpaqueRect = gdi_multi_opaque_rect; update->MultiDrawNineGrid = NULL; update->LineTo = gdi_line_to; - update->Polyline = NULL; + update->Polyline = gdi_polyline; update->MemBlt = NULL; update->Mem3Blt = NULL; update->SaveBitmap = NULL; @@ -1270,6 +1304,8 @@ void gdi_register_update_callbacks(rdpUpdate* update) update->PolygonCB = NULL; update->EllipseSC = NULL; update->EllipseCB = NULL; + update->CreateOffscreenBitmap = gdi_create_offscreen_bitmap; + update->SwitchSurface = gdi_switch_surface; } /**