libfreerdp-gdi: fix compilation
authorMarc-André Moreau <marcandre.moreau@gmail.com>
Fri, 1 Jul 2011 01:23:36 +0000 (21:23 -0400)
committerMarc-André Moreau <marcandre.moreau@gmail.com>
Fri, 1 Jul 2011 01:23:36 +0000 (21:23 -0400)
30 files changed:
CMakeLists.txt
cunit/test_libgdi.c
include/freerdp/freerdp.h [new file with mode: 0644]
include/freerdp/kbd.h
include/freerdp/rdpext.h [new file with mode: 0644]
include/freerdp/rdpset.h [new file with mode: 0644]
include/freerdp/types/base.h
include/freerdp/types/ui.h [new file with mode: 0644]
libfreerdp-core/credssp.c
libfreerdp-gdi/CMakeLists.txt [new file with mode: 0644]
libfreerdp-gdi/color.c [new file with mode: 0644]
libfreerdp-gdi/color.h [new file with mode: 0644]
libfreerdp-gdi/decode.c [new file with mode: 0644]
libfreerdp-gdi/decode.h [new file with mode: 0644]
libfreerdp-gdi/gdi.c [new file with mode: 0644]
libfreerdp-gdi/gdi.h
libfreerdp-gdi/gdi_16bpp.c
libfreerdp-gdi/gdi_32bpp.c
libfreerdp-gdi/gdi_8bpp.c
libfreerdp-kbd/keyboard.h
libfreerdp-kbd/layout_ids.c
libfreerdp-kbd/layout_ids.h
libfreerdp-kbd/layouts_xkb.c
libfreerdp-kbd/layouts_xkb.h
libfreerdp-kbd/libkbd.c
libfreerdp-kbd/locales.c
libfreerdp-kbd/locales.h
libfreerdp-kbd/x_layout_id_table.c
libfreerdp-kbd/x_layout_id_table.h
libfreerdp-utils/unicode.c

index b42de4b..af08cc4 100644 (file)
@@ -25,4 +25,5 @@ add_subdirectory(include)
 add_subdirectory(libfreerdp-asn1)
 add_subdirectory(libfreerdp-utils)
 add_subdirectory(libfreerdp-kbd)
+add_subdirectory(libfreerdp-gdi)
 
index 23db2a3..d12697f 100644 (file)
@@ -1509,7 +1509,7 @@ void test_gdi_LineTo(void)
        HGDI_BITMAP hBmp_LineTo_R2_MERGEPENNOT;
        HGDI_BITMAP hBmp_LineTo_R2_MERGEPEN;
        HGDI_BITMAP hBmp_LineTo_R2_WHITE;
-       RD_PALETTE* hPalette;
+       FRDP_PALETTE* hPalette;
        HCLRCONV clrconv;
        int bitsPerPixel = 8;
        int bytesPerPixel = 1;
@@ -1525,7 +1525,7 @@ void test_gdi_LineTo(void)
        hBmp = gdi_CreateCompatibleBitmap(hdc, 16, 16);
        gdi_SelectObject(hdc, (HGDIOBJECT) hBmp);
 
-       hPalette = (RD_PALETTE*) gdi_GetSystemPalette();
+       hPalette = (FRDP_PALETTE*) gdi_GetSystemPalette();
 
        clrconv = (HCLRCONV) malloc(sizeof(CLRCONV));
        clrconv->alpha = 1;
@@ -1827,7 +1827,7 @@ void test_gdi_Ellipse(void)
        HGDI_BITMAP hBmp_Ellipse_1;
        HGDI_BITMAP hBmp_Ellipse_2;
        HGDI_BITMAP hBmp_Ellipse_3;
-       RD_PALETTE* hPalette;
+       FRDP_PALETTE* hPalette;
        HCLRCONV clrconv;
        int bitsPerPixel = 8;
        int bytesPerPixel = 1;
@@ -1843,7 +1843,7 @@ void test_gdi_Ellipse(void)
        hBmp = gdi_CreateCompatibleBitmap(hdc, 16, 16);
        gdi_SelectObject(hdc, (HGDIOBJECT) hBmp);
 
-       hPalette = (RD_PALETTE*) gdi_GetSystemPalette();
+       hPalette = (FRDP_PALETTE*) gdi_GetSystemPalette();
 
        clrconv = (HCLRCONV) malloc(sizeof(CLRCONV));
        clrconv->alpha = 1;
@@ -1982,7 +1982,7 @@ void test_gdi_BitBlt_32bpp(void)
        HGDI_BITMAP hBmp_PATPAINT;
        HGDI_BITMAP hBmp_PATINVERT;
        HGDI_BITMAP hBmpDstOriginal;
-       RD_PALETTE* hPalette;
+       FRDP_PALETTE* hPalette;
        HCLRCONV clrconv;
 
        int bytesPerPixel = 4;
@@ -1996,7 +1996,7 @@ void test_gdi_BitBlt_32bpp(void)
        hdcDst->bytesPerPixel = bytesPerPixel;
        hdcDst->bitsPerPixel = bitsPerPixel;
 
-       hPalette = (RD_PALETTE*) gdi_GetSystemPalette();
+       hPalette = (FRDP_PALETTE*) gdi_GetSystemPalette();
 
        clrconv = (HCLRCONV) malloc(sizeof(CLRCONV));
        clrconv->alpha = 1;
@@ -2236,7 +2236,7 @@ void test_gdi_BitBlt_16bpp(void)
        HGDI_BITMAP hBmp_PATPAINT;
        HGDI_BITMAP hBmp_PATINVERT;
        HGDI_BITMAP hBmpDstOriginal;
-       RD_PALETTE* hPalette;
+       FRDP_PALETTE* hPalette;
        HCLRCONV clrconv;
 
        int bytesPerPixel = 2;
@@ -2250,7 +2250,7 @@ void test_gdi_BitBlt_16bpp(void)
        hdcDst->bytesPerPixel = bytesPerPixel;
        hdcDst->bitsPerPixel = bitsPerPixel;
 
-       hPalette = (RD_PALETTE*) gdi_GetSystemPalette();
+       hPalette = (FRDP_PALETTE*) gdi_GetSystemPalette();
 
        clrconv = (HCLRCONV) malloc(sizeof(CLRCONV));
        clrconv->alpha = 1;
@@ -2490,7 +2490,7 @@ void test_gdi_BitBlt_8bpp(void)
        HGDI_BITMAP hBmp_PATPAINT;
        HGDI_BITMAP hBmp_PATINVERT;
        HGDI_BITMAP hBmpDstOriginal;
-       RD_PALETTE* hPalette;
+       FRDP_PALETTE* hPalette;
        HCLRCONV clrconv;
 
        int bytesPerPixel = 1;
@@ -2504,7 +2504,7 @@ void test_gdi_BitBlt_8bpp(void)
        hdcDst->bytesPerPixel = bytesPerPixel;
        hdcDst->bitsPerPixel = bitsPerPixel;
 
-       hPalette = (RD_PALETTE*) gdi_GetSystemPalette();
+       hPalette = (FRDP_PALETTE*) gdi_GetSystemPalette();
 
        clrconv = (HCLRCONV) malloc(sizeof(CLRCONV));
        clrconv->alpha = 1;
diff --git a/include/freerdp/freerdp.h b/include/freerdp/freerdp.h
new file mode 100644 (file)
index 0000000..17627da
--- /dev/null
@@ -0,0 +1,157 @@
+/**
+ * FreeRDP: A Remote Desktop Protocol Client
+ * FreeRDP Interface
+ *
+ * Copyright 2009-2011 Jay Sorg
+ *
+ * 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 __FREERDP_H
+#define __FREERDP_H
+
+#include "rdpset.h"
+#include "types/ui.h"
+#include "rdpext.h"
+
+#define FREERDP_INTERFACE_VERSION 4
+
+#if defined _WIN32 || defined __CYGWIN__
+  #ifdef FREERDP_EXPORTS
+    #ifdef __GNUC__
+      #define FREERDP_API __attribute__((dllexport))
+    #else
+      #define FREERDP_API __declspec(dllexport)
+    #endif
+  #else
+    #ifdef __GNUC__
+      #define FREERDP_API __attribute__((dllimport))
+    #else
+      #define FREERDP_API __declspec(dllimport)
+    #endif
+  #endif
+#else
+  #if __GNUC__ >= 4
+    #define FREERDP_API   __attribute__ ((visibility("default")))
+  #else
+    #define FREERDP_API
+  #endif
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+FREERDP_API FRDP_BOOL
+freerdp_global_init(void);
+FREERDP_API void
+freerdp_global_finish(void);
+
+struct rdp_inst
+{
+       int version;
+       int size;
+       rdpSet * settings;
+       void * rdp;
+       void * param1;
+       void * param2;
+       void * param3;
+       void * param4;
+       uint32 disc_reason;
+       /* calls from ui to library */
+       int (* rdp_connect)(rdpInst * inst);
+       int (* rdp_get_fds)(rdpInst * inst, void ** read_fds, int * read_count,
+               void ** write_fds, int * write_count);
+       int (* rdp_check_fds)(rdpInst * inst);
+       int (* rdp_send_input_scancode)(rdpInst * inst, FRDP_BOOL up, FRDP_BOOL extended, uint8 keyCode);
+       int (* rdp_send_input_unicode)(rdpInst * inst, uint16 character);
+       int (* rdp_send_input_mouse)(rdpInst * inst, uint16 pointerFlags, uint16 xPos, uint16 yPos);
+       int (* rdp_sync_input)(rdpInst * inst, int toggle_flags);
+       int (* rdp_channel_data)(rdpInst * inst, int chan_id, char * data, int data_size);
+       void (*rdp_suppress_output)(rdpInst * inst, int allow_display_updates);
+       void (* rdp_disconnect)(rdpInst * inst);
+       int (* rdp_send_frame_ack)(rdpInst * inst, int frame_id);
+       /* calls from library to ui */
+       void (* ui_error)(rdpInst * inst, const char * text);
+       void (* ui_warning)(rdpInst * inst, const char * text);
+       void (* ui_unimpl)(rdpInst * inst, const char * text);
+       void (* ui_begin_update)(rdpInst * inst);
+       void (* ui_end_update)(rdpInst * inst);
+       void (* ui_desktop_save)(rdpInst * inst, int offset, int x, int y,
+               int cx, int cy);
+       void (* ui_desktop_restore)(rdpInst * inst, int offset, int x, int y,
+               int cx, int cy);
+       FRDP_HBITMAP (* ui_create_bitmap)(rdpInst * inst, int width, int height, uint8 * data);
+       void (* ui_paint_bitmap)(rdpInst * inst, int x, int y, int cx, int cy, int width,
+               int height, uint8 * data);
+       void (* ui_destroy_bitmap)(rdpInst * inst, FRDP_HBITMAP bmp);
+       void (* ui_line)(rdpInst * inst, uint8 opcode, int startx, int starty, int endx,
+               int endy, FRDP_PEN * pen);
+       void (* ui_rect)(rdpInst * inst, int x, int y, int cx, int cy, uint32 color);
+       void (* ui_polygon)(rdpInst * inst, uint8 opcode, uint8 fillmode, FRDP_POINT * point,
+               int npoints, FRDP_BRUSH * brush, uint32 bgcolor, uint32 fgcolor);
+       void (* ui_polyline)(rdpInst * inst, uint8 opcode, FRDP_POINT * points, int npoints,
+               FRDP_PEN * pen);
+       void (* ui_ellipse)(rdpInst * inst, uint8 opcode, uint8 fillmode, int x, int y,
+               int cx, int cy, FRDP_BRUSH * brush, uint32 bgcolor, uint32 fgcolor);
+       void (* ui_start_draw_glyphs)(rdpInst * inst, uint32 bgcolor, uint32 fgcolor);
+       void (* ui_draw_glyph)(rdpInst * inst, int x, int y, int cx, int cy,
+               FRDP_HGLYPH glyph);
+       void (* ui_end_draw_glyphs)(rdpInst * inst, int x, int y, int cx, int cy);
+       uint32 (* ui_get_toggle_keys_state)(rdpInst * inst);
+       void (* ui_bell)(rdpInst * inst);
+       void (* ui_destblt)(rdpInst * inst, uint8 opcode, int x, int y, int cx, int cy);
+       void (* ui_patblt)(rdpInst * inst, uint8 opcode, int x, int y, int cx, int cy,
+               FRDP_BRUSH * brush, uint32 bgcolor, uint32 fgcolor);
+       void (* ui_screenblt)(rdpInst * inst, uint8 opcode, int x, int y, int cx, int cy,
+               int srcx, int srcy);
+       void (* ui_memblt)(rdpInst * inst, uint8 opcode, int x, int y, int cx, int cy,
+               FRDP_HBITMAP src, int srcx, int srcy);
+       void (* ui_triblt)(rdpInst * 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);
+       FRDP_HGLYPH (* ui_create_glyph)(rdpInst * inst, int width, int height, uint8 * data);
+       void (* ui_destroy_glyph)(rdpInst * inst, FRDP_HGLYPH glyph);
+       int (* ui_select)(rdpInst * inst, int rdp_socket);
+       void (* ui_set_clip)(rdpInst * inst, int x, int y, int cx, int cy);
+       void (* ui_reset_clip)(rdpInst * inst);
+       void (* ui_resize_window)(rdpInst * inst);
+       void (* ui_set_cursor)(rdpInst * inst, FRDP_HCURSOR cursor);
+       void (* ui_destroy_cursor)(rdpInst * inst, FRDP_HCURSOR cursor);
+       FRDP_HCURSOR (* ui_create_cursor)(rdpInst * inst, unsigned int x, unsigned int y,
+               int width, int height, uint8 * andmask, uint8 * xormask, int bpp);
+       void (* ui_set_null_cursor)(rdpInst * inst);
+       void (* ui_set_default_cursor)(rdpInst * inst);
+       FRDP_HPALETTE (* ui_create_palette)(rdpInst * inst, FRDP_PALETTE * palette);
+       void (* ui_set_palette)(rdpInst * inst, FRDP_HPALETTE palette);
+       void (* ui_move_pointer)(rdpInst * inst, int x, int y);
+       FRDP_HBITMAP (* ui_create_surface)(rdpInst * inst, int width, int height, FRDP_HBITMAP old);
+       void (* ui_set_surface)(rdpInst * inst, FRDP_HBITMAP surface);
+       void (* ui_destroy_surface)(rdpInst * inst, FRDP_HBITMAP surface);
+       void (* ui_channel_data)(rdpInst * inst, int chan_id, char * data, int data_size,
+               int flags, int total_size);
+       FRDP_BOOL (* ui_authenticate)(rdpInst * inst);
+       int (* ui_decode)(rdpInst * inst, uint8 * data, int data_size);
+       FRDP_BOOL (* ui_check_certificate)(rdpInst * inst, const char * fingerprint,
+               const char * subject, const char * issuer, FRDP_BOOL verified);
+};
+
+FREERDP_API rdpInst *
+freerdp_new(rdpSet * settings);
+FREERDP_API void
+freerdp_free(rdpInst * inst);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
index aad392d..3b505af 100644 (file)
 
 #include "types/base.h"
 
-#define RDP_KEYBOARD_LAYOUT_TYPE_STANDARD   1
-#define RDP_KEYBOARD_LAYOUT_TYPE_VARIANT    2
-#define RDP_KEYBOARD_LAYOUT_TYPE_IME        4
+#define RDP_KEYBOAFRDP_LAYOUT_TYPE_STANDARD   1
+#define RDP_KEYBOAFRDP_LAYOUT_TYPE_VARIANT    2
+#define RDP_KEYBOAFRDP_LAYOUT_TYPE_IME        4
 
-typedef struct rdp_keyboard_layout
+typedef struct rdp_keyboaFRDP_layout
 {
        uint32 code;
        char name[50];
@@ -35,10 +35,10 @@ typedef struct rdp_keyboard_layout
 rdpKeyboardLayout *
 freerdp_kbd_get_layouts(int types);
 unsigned int
-freerdp_kbd_init(void *dpy, unsigned int keyboard_layout_id);
+freerdp_kbd_init(void *dpy, unsigned int keyboaFRDP_layout_id);
 uint8
-freerdp_kbd_get_scancode_by_keycode(uint8 keycode, fbool * extended);
+freerdp_kbd_get_scancode_by_keycode(uint8 keycode, FRDP_BOOL * extended);
 uint8
-freerdp_kbd_get_scancode_by_virtualkey(int vkcode, fbool * extended);
+freerdp_kbd_get_scancode_by_virtualkey(int vkcode, FRDP_BOOL * extended);
 
 #endif /* __FREERDP_KBD_H */
diff --git a/include/freerdp/rdpext.h b/include/freerdp/rdpext.h
new file mode 100644 (file)
index 0000000..113f926
--- /dev/null
@@ -0,0 +1,64 @@
+/**
+ * FreeRDP: A Remote Desktop Protocol Client
+ * RDP Extensions
+ *
+ * Copyright 2010-2011 Vic Lee
+ *
+ * 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 __RDPEXT_H
+#define __RDPEXT_H
+
+#include <freerdp/types/ui.h>
+
+#ifdef _WIN32
+#define RDPEXT_CC __stdcall
+#else
+#define RDPEXT_CC
+#endif
+
+/* Extensions ought to check for it to ensure compatibility */
+#define RDPEXT_API 1
+
+#define RDPEXT_EXPORT_FUNC_NAME "FreeRDPExtensionEntry"
+
+typedef struct rdp_ext_plugin rdpExtPlugin;
+
+struct rdp_ext_plugin
+{
+       void * ext;
+       int (*init) (rdpExtPlugin * plugin, rdpInst * inst);
+       int (*uninit) (rdpExtPlugin * plugin, rdpInst * inst);
+};
+
+typedef uint32 (RDPEXT_CC * PFREERDP_EXTENSION_HOOK)(rdpExtPlugin * plugin, rdpInst * inst);
+
+typedef uint32 (RDPEXT_CC * PREGISTEREXTENSION)(rdpExtPlugin * plugin);
+typedef uint32 (RDPEXT_CC * PREGISTERPRECONNECTHOOK)(rdpExtPlugin * plugin, PFREERDP_EXTENSION_HOOK hook);
+typedef uint32 (RDPEXT_CC * PREGISTERPOSTCONNECTHOOK)(rdpExtPlugin * plugin, PFREERDP_EXTENSION_HOOK hook);
+
+struct _FREERDP_EXTENSION_ENTRY_POINTS
+{
+       void * ext; /* Reference to internal instance */
+       PREGISTEREXTENSION pRegisterExtension;
+       PREGISTERPRECONNECTHOOK pRegisterPreConnectHook;
+       PREGISTERPOSTCONNECTHOOK pRegisterPostConnectHook;
+       void * data;
+};
+typedef struct _FREERDP_EXTENSION_ENTRY_POINTS FREERDP_EXTENSION_ENTRY_POINTS;
+typedef FREERDP_EXTENSION_ENTRY_POINTS * PFREERDP_EXTENSION_ENTRY_POINTS;
+
+typedef int (RDPEXT_CC * PFREERDP_EXTENSION_ENTRY)(PFREERDP_EXTENSION_ENTRY_POINTS pEntryPoints);
+
+#endif
diff --git a/include/freerdp/rdpset.h b/include/freerdp/rdpset.h
new file mode 100644 (file)
index 0000000..a663c2b
--- /dev/null
@@ -0,0 +1,98 @@
+/**
+ * FreeRDP: A Remote Desktop Protocol Client
+ * RDP Settings
+ *
+ * Copyright 2009-2011 Jay Sorg
+ *
+ * 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 __RDPSET_H
+#define __RDPSET_H
+
+struct rdp_chan
+{
+       char name[8]; /* ui sets */
+       int flags; /* ui sets */
+       int chan_id; /* core sets */
+       void * handle; /* just for ui */
+};
+
+struct rdp_ext_set
+{
+       char name[256]; /* plugin name or path */
+       void * data; /* plugin data */
+};
+
+struct rdp_monitor
+{
+       int x;
+       int y;
+       int width;
+       int height;
+       int is_primary;
+};
+
+struct rdp_set
+{
+       int width;
+       int height;
+       char hostname[16];
+       char server[64];
+       char domain[16];
+       char password[64];
+       char shell[256];
+       char directory[256];
+       char username[256];
+       int tcp_port_rdp;
+       int keyboard_layout;
+       int keyboard_type;
+       int keyboard_subtype;
+       int keyboard_functionkeys;
+       char xkb_layout[32];
+       char xkb_variant[32];
+       int tls_security;
+       int nla_security;
+       int rdp_security;
+       int encryption;
+       int rdp_version;
+       int remote_app;
+       char app_name[64];
+       int console_session;
+       int server_depth;
+       int bitmap_cache;
+       int bitmap_cache_persist_enable;
+       int bitmap_cache_precache;
+       int bitmap_compression;
+       int performanceflags;
+       int desktop_save;
+       int polygon_ellipse_orders;
+       int autologin;
+       int console_audio;
+       int off_screen_bitmaps;
+       int triblt;
+       int new_cursors;
+       int mouse_motion;
+       int bulk_compression;
+       int rfx_flags;
+       int ui_decode_flags;
+       int use_frame_ack;
+       int num_channels;
+       int software_gdi;
+       struct rdp_chan channels[16];
+       struct rdp_ext_set extensions[16];
+       int num_monitors;
+       struct rdp_monitor monitors[16];
+};
+
+#endif /* __RDPSET_H */
index 4a8af6a..471708b 100644 (file)
@@ -42,6 +42,6 @@ typedef signed long long sint64;
 #define False (0)
 #endif
 
-typedef int fbool;
+typedef int FRDP_BOOL;
 
 #endif
diff --git a/include/freerdp/types/ui.h b/include/freerdp/types/ui.h
new file mode 100644 (file)
index 0000000..cbecf56
--- /dev/null
@@ -0,0 +1,140 @@
+/**
+ * FreeRDP: A Remote Desktop Protocol Client
+ * User Interface Types
+ *
+ * Copyright 2009-2011 Jay Sorg
+ *
+ * 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 __TYPES_UI_H
+#define __TYPES_UI_H
+
+#include <freerdp/types/base.h>
+
+typedef void *FRDP_HBITMAP;
+typedef void *FRDP_HGLYPH;
+typedef void *FRDP_HPALETTE;
+typedef void *FRDP_HCURSOR;
+
+typedef struct _FRDP_POINT
+{
+       sint16 x, y;
+}
+FRDP_POINT;
+
+typedef struct _FRDP_PALETTEENTRY
+{
+       uint8 red;
+       uint8 green;
+       uint8 blue;
+}
+FRDP_PALETTEENTRY;
+
+typedef struct _FRDP_PALETTE
+{
+       uint16 count;
+       FRDP_PALETTEENTRY *entries;
+}
+FRDP_PALETTE;
+
+typedef struct _FRDP_PEN
+{
+       uint8 style;
+       uint8 width;
+       uint32 color;
+}
+FRDP_PEN;
+
+/* this is whats in the brush cache */
+typedef struct _FRDP_BRUSHDATA
+{
+       uint32 color_code;
+       uint32 data_size;
+       uint8 *data;
+}
+FRDP_BRUSHDATA;
+
+typedef struct _FRDP_BRUSH
+{
+       uint8 xorigin;
+       uint8 yorigin;
+       uint8 style;
+       uint8 pattern[8];
+       FRDP_BRUSHDATA *bd;
+}
+FRDP_BRUSH;
+
+typedef struct _FRDP_PLUGIN_DATA
+{
+       uint16 size;
+       void * data[4];
+}
+FRDP_PLUGIN_DATA;
+
+typedef struct _FRDP_RECT
+{
+       sint16 x;
+       sint16 y;
+       sint16 width;
+       sint16 height;
+}
+FRDP_RECT;
+
+typedef struct _FRDP_EVENT FRDP_EVENT;
+
+typedef void (*FRDP_EVENT_CALLBACK) (FRDP_EVENT * event);
+
+struct _FRDP_EVENT
+{
+       uint16 event_type;
+       FRDP_EVENT_CALLBACK event_callback;
+       void * user_data;
+};
+
+struct _FRDP_VIDEO_FRAME_EVENT
+{
+       FRDP_EVENT event;
+       uint8 * frame_data;
+       uint32 frame_size;
+       uint32 frame_pixfmt;
+       sint16 frame_width;
+       sint16 frame_height;
+       sint16 x;
+       sint16 y;
+       sint16 width;
+       sint16 height;
+       uint16 num_visible_rects;
+       FRDP_RECT * visible_rects;
+};
+typedef struct _FRDP_VIDEO_FRAME_EVENT FRDP_VIDEO_FRAME_EVENT;
+
+struct _FRDP_REDRAW_EVENT
+{
+       FRDP_EVENT event;
+       sint16 x;
+       sint16 y;
+       sint16 width;
+       sint16 height;
+};
+typedef struct _FRDP_REDRAW_EVENT FRDP_REDRAW_EVENT;
+
+/* defined in include/freerdp/freerdp.h */
+struct rdp_inst;
+typedef struct rdp_inst rdpInst;
+
+/* defined in include/freerdp/rdpset.h */
+struct rdp_set;
+typedef struct rdp_set rdpSet;
+
+#endif
index f744974..8cb5c40 100644 (file)
@@ -290,39 +290,39 @@ void credssp_encode_ts_credentials(rdpCredssp *credssp)
 {
        asn_enc_rval_t enc_rval;
        TSCredentials_t *ts_credentials;
-       TSPasswordCreds_t *ts_password_creds;
-       DATABLOB ts_password_creds_buffer = { 0 };
+       TSPasswordCreds_t *ts_passwoFRDP_creds;
+       DATABLOB ts_passwoFRDP_creds_buffer = { 0 };
 
        ts_credentials = calloc(1, sizeof(TSCredentials_t));
        ts_credentials->credType = 1; /* TSPasswordCreds */
 
-       ts_password_creds = calloc(1, sizeof(TSPasswordCreds_t));
+       ts_passwoFRDP_creds = calloc(1, sizeof(TSPasswordCreds_t));
 
        /* Domain */
-       ts_password_creds->domainName.buf = credssp->ntlmssp->domain.data;
-       ts_password_creds->domainName.size = credssp->ntlmssp->domain.length;
+       ts_passwoFRDP_creds->domainName.buf = credssp->ntlmssp->domain.data;
+       ts_passwoFRDP_creds->domainName.size = credssp->ntlmssp->domain.length;
 
        /* Username */
-       ts_password_creds->userName.buf = credssp->ntlmssp->username.data;
-       ts_password_creds->userName.size = credssp->ntlmssp->username.length;
+       ts_passwoFRDP_creds->userName.buf = credssp->ntlmssp->username.data;
+       ts_passwoFRDP_creds->userName.size = credssp->ntlmssp->username.length;
 
        /* Password */
-       ts_password_creds->password.buf = credssp->ntlmssp->password.data;
-       ts_password_creds->password.size = credssp->ntlmssp->password.length;
+       ts_passwoFRDP_creds->password.buf = credssp->ntlmssp->password.data;
+       ts_passwoFRDP_creds->password.size = credssp->ntlmssp->password.length;
 
        /* get size ASN.1 encoded TSPasswordCreds */
-       enc_rval = der_encode(&asn_DEF_TSPasswordCreds, ts_password_creds, asn1_write, 0);
+       enc_rval = der_encode(&asn_DEF_TSPasswordCreds, ts_passwoFRDP_creds, asn1_write, 0);
 
        if (enc_rval.encoded != -1)
        {
-               datablob_alloc(&ts_password_creds_buffer, enc_rval.encoded);
+               datablob_alloc(&ts_passwoFRDP_creds_buffer, enc_rval.encoded);
 
-               enc_rval = der_encode_to_buffer(&asn_DEF_TSPasswordCreds, ts_password_creds,
-                       ts_password_creds_buffer.data, ts_password_creds_buffer.length);
+               enc_rval = der_encode_to_buffer(&asn_DEF_TSPasswordCreds, ts_passwoFRDP_creds,
+                       ts_passwoFRDP_creds_buffer.data, ts_passwoFRDP_creds_buffer.length);
        }
 
-       ts_credentials->credentials.buf = ts_password_creds_buffer.data;
-       ts_credentials->credentials.size = ts_password_creds_buffer.length;
+       ts_credentials->credentials.buf = ts_passwoFRDP_creds_buffer.data;
+       ts_credentials->credentials.size = ts_passwoFRDP_creds_buffer.length;
 
        /* get size ASN.1 encoded TSCredentials */
        enc_rval = der_encode(&asn_DEF_TSCredentials, ts_credentials, asn1_write, 0);
@@ -335,9 +335,9 @@ void credssp_encode_ts_credentials(rdpCredssp *credssp)
                        credssp->ts_credentials.data, credssp->ts_credentials.length);
        }
 
-       datablob_free(&ts_password_creds_buffer);
+       datablob_free(&ts_passwoFRDP_creds_buffer);
        free(ts_credentials);
-       free(ts_password_creds);
+       free(ts_passwoFRDP_creds);
 }
 
 /**
diff --git a/libfreerdp-gdi/CMakeLists.txt b/libfreerdp-gdi/CMakeLists.txt
new file mode 100644 (file)
index 0000000..de4ef70
--- /dev/null
@@ -0,0 +1,45 @@
+# libfreerdp-gdi
+
+include_directories(.)
+include_directories(../include)
+
+set(FREERDP_GDI_SRCS
+       color.c
+       color.h
+       decode.c
+       decode.h
+       gdi_8bpp.c
+       gdi_8bpp.h
+       gdi_16bpp.c
+       gdi_16bpp.h
+       gdi_32bpp.c
+       gdi_32bpp.h
+       gdi_bitmap.c
+       gdi_bitmap.h
+       gdi_brush.c
+       gdi_brush.h
+       gdi_clipping.c
+       gdi_clipping.h
+       gdi_dc.c
+       gdi_dc.h
+       gdi_drawing.c
+       gdi_drawing.h
+       gdi_line.c
+       gdi_line.h
+       gdi_palette.c
+       gdi_palette.h
+       gdi_pen.c
+       gdi_pen.h
+       gdi_region.c
+       gdi_region.h
+       gdi_shape.c
+       gdi_shape.h
+       gdi.c
+       gdi.h)
+
+add_library(freerdp-gdi SHARED ${FREERDP_GDI_SRCS})
+
+set_target_properties(freerdp-gdi PROPERTIES VERSION ${FREERDP_VERSION_FULL} SOVERSION ${FREERDP_VERSION})
+
+install(TARGETS freerdp-gdi DESTINATION lib)
+
diff --git a/libfreerdp-gdi/color.c b/libfreerdp-gdi/color.c
new file mode 100644 (file)
index 0000000..23d098a
--- /dev/null
@@ -0,0 +1,723 @@
+/**
+ * FreeRDP: A Remote Desktop Protocol Client
+ * GDI Color Conversion Routines
+ *
+ * Copyright 2010 Marc-Andre Moreau <marcandre.moreau@gmail.com>
+ *
+ * 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 <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <freerdp/freerdp.h>
+
+#include "color.h"
+
+uint32 gdi_color_convert_rgb(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv)
+{
+       uint8 red = 0;
+       uint8 green = 0;
+       uint8 blue = 0;
+       uint8 alpha = 0xFF;
+       int dstColor = 0;
+
+       switch (srcBpp)
+       {
+               case 32:
+                       if (clrconv->alpha)
+                       {
+                               GetABGR32(alpha, red, green, blue, srcColor);
+                       }
+                       else
+                       {
+                               GetBGR32(red, green, blue, srcColor);
+                       }
+                       break;
+               case 24:
+                       GetBGR24(red, green, blue, srcColor);
+                       break;
+               case 16:
+                       GetRGB16(red, green, blue, srcColor);
+                       break;
+               case 15:
+                       GetRGB15(red, green, blue, srcColor);
+                       break;
+               case 8:
+                       srcColor &= 0xFF;
+                       red = clrconv->palette->entries[srcColor].red;
+                       green = clrconv->palette->entries[srcColor].green;
+                       blue = clrconv->palette->entries[srcColor].blue;
+                       break;
+               case 1:
+                       if (srcColor != 0)
+                       {
+                               red = 0xFF;
+                               green = 0xFF;
+                               blue = 0xFF;
+                       }
+                       break;
+               default:
+                       break;
+       }
+       switch (dstBpp)
+       {
+               case 32:
+                       dstColor = ARGB32(alpha, red, green, blue);
+                       break;
+               case 24:
+                       dstColor = BGR24(red, green, blue);
+                       break;
+               case 16:
+                       if(clrconv->rgb555)
+                       {
+                               dstColor = RGB15(red, green, blue);
+                       }
+                       else
+                       {
+                               dstColor = RGB16(red, green, blue);
+                       }
+                       break;
+               case 15:
+                       dstColor = RGB15(red, green, blue);
+                       break;
+               case 8:
+                       srcColor &= 0xFF;
+                       red = clrconv->palette->entries[srcColor].red;
+                       green = clrconv->palette->entries[srcColor].green;
+                       blue = clrconv->palette->entries[srcColor].blue;
+                       break;
+               case 1:
+                       if ((red != 0) || (green != 0) || (blue != 0))
+                               dstColor = 1;
+                       break;
+               default:
+                       break;
+       }
+
+       return dstColor;
+}
+
+uint32 gdi_color_convert_bgr(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv)
+{
+       uint8 red = 0;
+       uint8 green = 0;
+       uint8 blue = 0;
+       uint8 alpha = 0xFF;
+       int dstColor = 0;
+
+       switch (srcBpp)
+       {
+               case 32:
+                       if (clrconv->alpha)
+                       {
+                               GetABGR32(alpha, red, green, blue, srcColor);
+                       }
+                       else
+                       {
+                               GetBGR32(red, green, blue, srcColor);
+                       }
+                       break;
+               case 24:
+                       GetBGR24(red, green, blue, srcColor);
+                       break;
+               case 16:
+                       GetRGB16(red, green, blue, srcColor);
+                       break;
+               case 15:
+                       GetRGB15(red, green, blue, srcColor);
+                       break;
+               case 8:
+                       srcColor &= 0xFF;
+                       red = clrconv->palette->entries[srcColor].red;
+                       green = clrconv->palette->entries[srcColor].green;
+                       blue = clrconv->palette->entries[srcColor].blue;
+                       break;
+               case 1:
+                       if (srcColor != 0)
+                       {
+                               red = 0xFF;
+                               green = 0xFF;
+                               blue = 0xFF;
+                       }
+                       break;
+               default:
+                       break;
+       }
+       switch (dstBpp)
+       {
+               case 32:
+                       dstColor = ABGR32(alpha, red, green, blue);
+                       break;
+               case 24:
+                       dstColor = BGR24(red, green, blue);
+                       break;
+               case 16:
+                       if(clrconv->rgb555)
+                       {
+                               dstColor = BGR15(red, green, blue);
+                       }
+                       else
+                       {
+                               dstColor = BGR16(red, green, blue);
+                       }
+                       break;
+               case 15:
+                       dstColor = BGR15(red, green, blue);
+                       break;
+               case 8:
+                       srcColor &= 0xFF;
+                       red = clrconv->palette->entries[srcColor].red;
+                       green = clrconv->palette->entries[srcColor].green;
+                       blue = clrconv->palette->entries[srcColor].blue;
+                       break;
+               case 1:
+                       if ((red != 0) || (green != 0) || (blue != 0))
+                               dstColor = 1;
+                       break;
+               default:
+                       break;
+       }
+
+       return dstColor;
+}
+
+uint32 gdi_color_convert(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv)
+{
+       if (clrconv->invert)
+               return gdi_color_convert_bgr(srcColor, srcBpp, dstBpp, clrconv);
+       else
+               return gdi_color_convert_rgb(srcColor, srcBpp, dstBpp, clrconv);
+}
+
+uint8* gdi_image_convert_8bpp(uint8* srcData, uint8* dstData, int width, int height, int srcBpp, int dstBpp, HCLRCONV clrconv)
+{
+       int i;
+       uint8 red;
+       uint8 green;
+       uint8 blue;
+       uint32 pixel;
+       uint8 *src8;
+       uint16 *dst16;
+       uint32 *dst32;
+
+       if (dstBpp == 8)
+       {
+               if (dstData == NULL)
+                       dstData = (uint8*) malloc(width * height);
+
+               memcpy(dstData, srcData, width * height);
+               return dstData;
+       }
+       else if (dstBpp == 15 || (dstBpp == 16 && clrconv->rgb555))
+       {
+               if (dstData == NULL)
+                       dstData = (uint8*) malloc(width * height * 2);
+               
+               dst16 = (uint16 *) dstData;
+               for (i = width * height; i > 0; i--)
+               {
+                       pixel = *srcData;
+                       srcData++;
+                       red = clrconv->palette->entries[pixel].red;
+                       green = clrconv->palette->entries[pixel].green;
+                       blue = clrconv->palette->entries[pixel].blue;
+                       pixel = RGB15(red, green, blue);
+                       *dst16 = pixel;
+                       dst16++;
+               }
+               return dstData;
+       }
+       else if (dstBpp == 16)
+       {
+               if (dstData == NULL)
+                       dstData = (uint8*) malloc(width * height * 2);
+               
+               dst16 = (uint16 *) dstData;
+               for (i = width * height; i > 0; i--)
+               {
+                       pixel = *srcData;
+                       srcData++;
+                       red = clrconv->palette->entries[pixel].red;
+                       green = clrconv->palette->entries[pixel].green;
+                       blue = clrconv->palette->entries[pixel].blue;
+                       pixel = RGB16(red, green, blue);
+                       *dst16 = pixel;
+                       dst16++;
+               }
+               return dstData;
+       }
+       else if (dstBpp == 32)
+       {
+               if (dstData == NULL)
+                       dstData = (uint8*) malloc(width * height * 4);
+               
+               src8 = (uint8*) srcData;
+               dst32 = (uint32*) dstData;
+               for (i = width * height; i > 0; i--)
+               {
+                       pixel = *src8;
+                       src8++;
+                       red = clrconv->palette->entries[pixel].red;
+                       green = clrconv->palette->entries[pixel].green;
+                       blue = clrconv->palette->entries[pixel].blue;
+                       pixel = BGR32(red, green, blue);
+                       *dst32 = pixel;
+                       dst32++;
+               }
+               return dstData;
+       }
+
+       return srcData;
+}
+
+uint8* gdi_image_convert_15bpp(uint8* srcData, uint8* dstData, int width, int height, int srcBpp, int dstBpp, HCLRCONV clrconv)
+{
+       int i;
+       uint8 red;
+       uint8 green;
+       uint8 blue;
+       uint32 pixel;
+       uint16 *src16;
+       uint16 *dst16;
+       uint32 *dst32;
+
+       if (dstBpp == 15 || (dstBpp == 16 && clrconv->rgb555))
+       {
+               if (dstData == NULL)
+                       dstData = (uint8*) malloc(width * height * 2);
+
+               memcpy(dstData, srcData, width * height * 2);
+
+               return dstData;
+       }
+       else if (dstBpp == 32)
+       {
+               if (dstData == NULL)
+                       dstData = (uint8*) malloc(width * height * 4);
+               
+               src16 = (uint16 *) srcData;
+               dst32 = (uint32 *) dstData;
+               for (i = width * height; i > 0; i--)
+               {
+                       pixel = *src16;
+                       src16++;
+                       GetBGR16(red, green, blue, pixel);
+                       pixel = BGR32(red, green, blue);
+                       *dst32 = pixel;
+                       dst32++;
+               }
+               return dstData;
+       }
+       else if (dstBpp == 16)
+       {
+               if (dstData == NULL)
+                       dstData = (uint8*) malloc(width * height * 2);
+       
+               src16 = (uint16 *) srcData;
+               dst16 = (uint16 *) dstData;
+               for (i = width * height; i > 0; i--)
+               {
+                       pixel = *src16;
+                       src16++;
+                       GetRGB_555(red, green, blue, pixel);
+                       RGB_555_565(red, green, blue);
+                       pixel = RGB565(red, green, blue);
+                       *dst16 = pixel;
+                       dst16++;
+               }
+               return dstData;
+       }
+
+       return srcData;
+}
+
+uint8* gdi_image_convert_16bpp(uint8* srcData, uint8* dstData, int width, int height, int srcBpp, int dstBpp, HCLRCONV clrconv)
+{
+       if (srcBpp == 15)
+               return gdi_image_convert_15bpp(srcData, dstData, width, height, srcBpp, dstBpp, clrconv);
+
+       if (dstBpp == 16)
+       {
+               if (dstData == NULL)
+                       dstData = (uint8*) malloc(width * height * 2);
+
+               if(clrconv->rgb555)
+               {
+                       int i;
+                       uint8 red, green, blue;
+                       uint16* src16 = (uint16 *) srcData;
+                       uint16* dst16 = (uint16 *) dstData;
+
+                       for (i = width * height; i > 0; i--)
+                       {
+                               GetRGB_565(red, green, blue, (*src16));
+                               RGB_565_555(red, green, blue);
+                               (*dst16) = RGB555(red, green, blue);
+                               src16++;
+                               dst16++;
+                       }
+               }
+               else
+               {
+                       memcpy(dstData, srcData, width * height * 2);
+               }
+
+               return dstData;
+       }
+       else if (dstBpp == 24)
+       {
+               int i;
+               uint8 *dst8;
+               uint16 *src16;
+               uint8 red, green, blue;
+
+               if (dstData == NULL)
+                       dstData = (uint8*) malloc(width * height * 3);
+
+               dst8 = (uint8 *) dstData;
+               src16 = (uint16 *) srcData;
+               for (i = width * height; i > 0; i--)
+               {
+                       GetBGR16(red, green, blue, *src16);
+                       src16++;
+
+                       if (clrconv->invert)
+                       {
+                               *dst8++ = blue;
+                               *dst8++ = green;
+                               *dst8++ = red;
+                       }
+                       else
+                       {
+                               *dst8++ = red;
+                               *dst8++ = green;
+                               *dst8++ = blue;
+                       }
+               }
+               return dstData;
+       }
+       else if (dstBpp == 32)
+       {
+               int i;
+               uint32 pixel;
+               uint16 *src16;
+               uint32 *dst32;
+               uint8 red, green, blue;
+
+               if (dstData == NULL)
+                       dstData = (uint8*) malloc(width * height * 4);
+
+               src16 = (uint16 *) srcData;
+               dst32 = (uint32 *) dstData;
+               for (i = width * height; i > 0; i--)
+               {
+                       pixel = *src16;
+                       src16++;
+                       GetBGR16(red, green, blue, pixel);
+                       pixel = BGR32(red, green, blue);
+                       *dst32 = pixel;
+                       dst32++;
+               }
+               return dstData;
+       }
+
+       return srcData;
+}
+
+uint8* gdi_image_convert_24bpp(uint8* srcData, uint8* dstData, int width, int height, int srcBpp, int dstBpp, HCLRCONV clrconv)
+{
+       int i;
+       uint8 red;
+       uint8 green;
+       uint8 blue;
+       uint32 pixel;
+       uint32 *dst32;
+
+       if (dstBpp == 32)
+       {
+               if (dstData == NULL)
+                       dstData = (uint8*) malloc(width * height * 4);
+               
+               dst32 = (uint32 *) dstData;
+               for (i = width * height; i > 0; i--)
+               {
+                       red = *(srcData++);
+                       green = *(srcData++);
+                       blue = *(srcData++);
+                       pixel = BGR24(red, green, blue);
+                       *dst32 = pixel;
+                       dst32++;
+               }
+               return dstData;
+       }
+
+       return srcData;
+}
+
+uint8* gdi_image_convert_32bpp(uint8* srcData, uint8* dstData, int width, int height, int srcBpp, int dstBpp, HCLRCONV clrconv)
+{
+       if (dstBpp == 16)
+       {
+               int index;
+               uint16 *dst16;
+               uint32 *src32;
+               uint8 red, green, blue;
+
+               if (dstData == NULL)
+                       dstData = (uint8*) malloc(width * height * 2);
+
+               dst16 = (uint16*) dstData;
+               src32 = (uint32*) srcData;
+
+               for (index = 0; index < width * height; index++)
+               {
+                       GetBGR32(blue, green, red, *src32);
+                       *dst16 = RGB16(red, green, blue);
+                       src32++;
+                       dst16++;
+               }
+               return dstData;
+       }
+       else if (dstBpp == 24)
+       {
+               int index;
+               uint8 red, green, blue;
+
+               if (dstData == NULL)
+                       dstData = (uint8*) malloc(width * height * 3);
+
+               for (index = 0; index < width * height; index++)
+               {
+                       red = *(srcData++);
+                       green = *(srcData++);
+                       blue = *(srcData++);
+
+                       if (clrconv->invert)
+                       {
+                               *dstData++ = blue;
+                               *dstData++ = green;
+                               *dstData++ = red;
+                       }
+                       else
+                       {
+                               *dstData++ = red;
+                               *dstData++ = green;
+                               *dstData++ = blue;
+                       }
+
+                       srcData++;
+               }
+               return dstData;
+       }
+       else if (dstBpp == 32)
+       {
+               if (clrconv->alpha)
+               {
+                       int x, y;
+                       uint8 *dstp;
+
+                       if (dstData == NULL)
+                               dstData = (uint8*) malloc(width * height * 4);
+
+                       memcpy(dstData, srcData, width * height * 4);
+
+                       dstp = dstData;
+                       for (y = 0; y < height; y++)
+                       {
+                               for (x = 0; x < width * 4; x += 4)
+                               {
+                                       dstp += 3;
+                                       *dstp = 0xFF;
+                                       dstp++;
+                               }
+                       }
+               }
+               else
+               {
+                       if (dstData == NULL)
+                               dstData = (uint8*) malloc(width * height * 4);
+
+                       memcpy(dstData, srcData, width * height * 4);
+               }
+               
+               return dstData;
+       }
+
+       return srcData;
+}
+
+p_gdi_image_convert gdi_image_convert_[5] =
+{
+       NULL,
+       gdi_image_convert_8bpp,
+       gdi_image_convert_16bpp,
+       gdi_image_convert_24bpp,
+       gdi_image_convert_32bpp
+};
+
+uint8* gdi_image_convert(uint8* srcData, uint8* dstData, int width, int height, int srcBpp, int dstBpp, HCLRCONV clrconv)
+{
+       p_gdi_image_convert _p_gdi_image_convert = gdi_image_convert_[IBPP(srcBpp)];
+
+       if (_p_gdi_image_convert != NULL)
+               return _p_gdi_image_convert(srcData, dstData, width, height, srcBpp, dstBpp, clrconv);
+       else
+               return 0;
+}
+
+uint8*
+gdi_glyph_convert(int width, int height, uint8* data)
+{
+       int x, y;
+       uint8 *srcp;
+       uint8 *dstp;
+       uint8 *dstData;
+       int scanline;
+
+       /*
+        * converts a 1-bit-per-pixel glyph to a one-byte-per-pixel glyph:
+        * this approach uses a little more memory, but provides faster
+        * means of accessing individual pixels in blitting operations
+        */
+
+       scanline = (width + 7) / 8;
+       dstData = (uint8*) malloc(width * height);
+       memset(dstData, 0, width * height);
+       dstp = dstData;
+
+       for (y = 0; y < height; y++)
+       {
+               srcp = data + (y * scanline);
+
+               for (x = 0; x < width; x++)
+               {
+                       if ((*srcp & (0x80 >> (x % 8))) != 0)
+                               *dstp = 0xFF;
+                       dstp++;
+
+                       if (((x + 1) % 8 == 0) && x != 0)
+                               srcp++;
+               }
+       }
+
+       return dstData;
+}
+
+uint8* gdi_mono_image_convert(uint8* srcData, int width, int height, int srcBpp, int dstBpp, uint32 bgcolor, uint32 fgcolor, HCLRCONV clrconv)
+{
+       int index;
+       uint16* dst16;
+       uint32* dst32;
+       uint8* dstData;
+       uint8 bitMask;
+       int bitIndex;
+       uint8 redBg, greenBg, blueBg;
+       uint8 redFg, greenFg, blueFg;
+
+       switch (srcBpp)
+       {
+               case 8:
+                       bgcolor &= 0xFF;
+                       redBg = clrconv->palette->entries[bgcolor].red;
+                       greenBg = clrconv->palette->entries[bgcolor].green;
+                       blueBg = clrconv->palette->entries[bgcolor].blue;
+
+                       fgcolor &= 0xFF;
+                       redFg = clrconv->palette->entries[fgcolor].red;
+                       greenFg = clrconv->palette->entries[fgcolor].green;
+                       blueFg = clrconv->palette->entries[fgcolor].blue;
+                       break;
+               case 16:
+                       GetRGB16(redBg, greenBg, blueBg, bgcolor);
+                       GetRGB16(redFg, greenFg, blueFg, fgcolor);
+                       break;
+               case 15:
+                       GetRGB15(redBg, greenBg, blueBg, bgcolor);
+                       GetRGB15(redFg, greenFg, blueFg, fgcolor);
+                       break;
+               default:
+                       GetRGB32(redBg, greenBg, blueBg, bgcolor);
+                       GetRGB32(redFg, greenFg, blueFg, fgcolor);
+       }
+
+       if(dstBpp == 16)
+       {
+               if(clrconv->rgb555)
+               {
+                       if(srcBpp == 16)
+                       {
+                               /* convert 15-bit colors to 16-bit colors */
+                               RGB16_RGB15(redBg, greenBg, blueBg, bgcolor);
+                               RGB16_RGB15(redFg, greenFg, blueFg, fgcolor);
+                       }
+               }
+               else
+               {
+                       if(srcBpp == 15)
+                       {
+                               /* convert 15-bit colors to 16-bit colors */
+                               RGB15_RGB16(redBg, greenBg, blueBg, bgcolor);
+                               RGB15_RGB16(redFg, greenFg, blueFg, fgcolor);
+                       }
+               }
+
+               dstData = (uint8*) malloc(width * height * 2);
+               dst16 = (uint16*) dstData;
+               for(index = height; index > 0; index--)
+               {
+                       /* each bit encodes a pixel */
+                       bitMask = *srcData;
+                       for(bitIndex = 7; bitIndex >= 0; bitIndex--)
+                       {
+                               if((bitMask >> bitIndex) & 0x01)
+                               {
+                                       *dst16 = bgcolor;
+                               }
+                               else
+                               {
+                                       *dst16 = fgcolor;
+                               }
+                               dst16++;
+                       }
+                       srcData++;
+               }
+               return dstData;
+       }
+       else if(dstBpp == 32)
+       {
+               dstData = (uint8*) malloc(width * height * 4);
+               dst32 = (uint32*) dstData;
+               for(index = height; index > 0; index--)
+               {
+                       /* each bit encodes a pixel */
+                       bitMask = *srcData;
+                       for(bitIndex = 7; bitIndex >= 0; bitIndex--)
+                       {
+                               if((bitMask >> bitIndex) & 0x01)
+                               {
+                                       *dst32 = RGB32(redBg, greenBg, blueBg);
+                               }
+                               else
+                               {
+                                       *dst32 = RGB32(redFg, greenFg, blueFg);
+                               }
+                               dst32++;
+                       }
+                       srcData++;
+               }
+               return dstData;
+       }
+
+       return srcData;
+}
diff --git a/libfreerdp-gdi/color.h b/libfreerdp-gdi/color.h
new file mode 100644 (file)
index 0000000..931f0c3
--- /dev/null
@@ -0,0 +1,247 @@
+/**
+ * FreeRDP: A Remote Desktop Protocol Client
+ * GDI Color Conversion Routines
+ *
+ * Copyright 2010 Marc-Andre Moreau <marcandre.moreau@gmail.com>
+ *
+ * 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 __COLOR_H
+#define __COLOR_H
+
+#include <freerdp/freerdp.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Color Space Conversions: http://msdn.microsoft.com/en-us/library/ff566496/ */
+
+/* Color Space Conversion */
+#define RGB_555_565(_r, _g, _b) \
+       _r = _r; \
+       _g = (_g << 1 & ~0x1) | (_g >> 4); \
+       _b = _b;
+
+#define RGB_565_555(_r, _g, _b) \
+       _r = _r; \
+       _g = (_g >> 1); \
+       _b = _b;
+
+#define RGB_555_888(_r, _g, _b) \
+       _r = (_r << 3 & ~0x7) | (_r >> 2); \
+       _g = (_g << 3 & ~0x7) | (_g >> 2); \
+       _b = (_b << 3 & ~0x7) | (_b >> 2);
+
+#define RGB_565_888(_r, _g, _b) \
+       _r = (_r << 3 & ~0x7) | (_r >> 2); \
+       _g = (_g << 2 & ~0x3) | (_g >> 4); \
+       _b = (_b << 3 & ~0x7) | (_b >> 2);
+
+#define RGB_888_565(_r, _g, _b) \
+       _r = (_r >> 3); \
+       _g = (_g >> 2); \
+       _b = (_b >> 3);
+
+#define RGB_888_555(_r, _g, _b) \
+       _r = (_r >> 3); \
+       _g = (_g >> 3); \
+       _b = (_b >> 3);
+
+/* RGB 15 (RGB_555) */
+
+#define RGB555(_r, _g, _b)  \
+       ((_r & 0x1F) << 10) | ((_g & 0x1F) << 5) | (_b & 0x1F);
+
+#define RGB15(_r, _g, _b)  \
+       (((_r >> 3) & 0x1F) << 10) | (((_g >> 3) & 0x1F) << 5) | ((_b >> 3) & 0x1F);
+
+#define GetRGB_555(_r, _g, _b, _p) \
+       _r = (_p & 0x7C00) >> 10; \
+       _g = (_p & 0x3E0) >> 5; \
+       _b = (_p & 0x1F);
+
+#define GetRGB15(_r, _g, _b, _p) \
+       GetRGB_555(_r, _g, _b, _p); \
+       RGB_555_888(_r, _g, _b);
+
+/* BGR 15 (BGR_555) */
+
+#define BGR555(_r, _g, _b)  \
+       ((_b & 0x1F) << 10) | ((_g & 0x1F) << 5) | (_r & 0x1F);
+
+#define BGR15(_r, _g, _b)  \
+       (((_b >> 3) & 0x1F) << 10) | (((_g >> 3) & 0x1F) << 5) | ((_r >> 3) & 0x1F);
+
+#define GetBGR_555(_r, _g, _b, _p) \
+       _b = (_p & 0x7C00) >> 10; \
+       _g = (_p & 0x3E0) >> 5; \
+       _r = (_p & 0x1F);
+
+#define GetBGR15(_r, _g, _b, _p) \
+       GetBGR_555(_r, _g, _b, _p); \
+       RGB_555_888(_r, _g, _b);
+
+/* RGB 16 (RGB_565) */
+
+#define RGB565(_r, _g, _b)  \
+       ((_r & 0x1F) << 11) | ((_g & 0x3F) << 5) | (_b & 0x1F);
+
+#define RGB16(_r, _g, _b)  \
+       (((_r >> 3) & 0x1F) << 11) | (((_g >> 2) & 0x3F) << 5) | ((_b >> 3) & 0x1F);
+
+#define GetRGB_565(_r, _g, _b, _p) \
+       _r = (_p & 0xF800) >> 11; \
+       _g = (_p & 0x7E0) >> 5; \
+       _b = (_p & 0x1F);
+
+#define GetRGB16(_r, _g, _b, _p) \
+       GetRGB_565(_r, _g, _b, _p); \
+       RGB_565_888(_r, _g, _b);
+
+/* BGR 16 (BGR_565) */
+
+#define BGR565(_r, _g, _b)  \
+       ((_b & 0x1F) << 11) | ((_g & 0x3F) << 5) | (_r & 0x1F);
+
+#define BGR16(_r, _g, _b)  \
+       (((_b >> 3) & 0x1F) << 11) | (((_g >> 2) & 0x3F) << 5) | ((_r >> 3) & 0x1F);
+
+#define GetBGR_565(_r, _g, _b, _p) \
+       _b = (_p & 0xF800) >> 11; \
+       _g = (_p & 0x7E0) >> 5; \
+       _r = (_p & 0x1F);
+#define GetBGR16(_r, _g, _b, _p) \
+       GetBGR_565(_r, _g, _b, _p); \
+       RGB_565_888(_r, _g, _b);
+
+/* RGB 24 (RGB_888) */
+
+#define RGB24(_r, _g, _b)  \
+       (_r << 16) | (_g << 8) | _b;
+
+#define GetRGB24(_r, _g, _b, _p) \
+       _r = (_p & 0xFF0000) >> 16; \
+       _g = (_p & 0xFF00) >> 8; \
+       _b = (_p & 0xFF);
+
+/* BGR 24 (BGR_888) */
+
+#define BGR24(_r, _g, _b)  \
+       (_b << 16) | (_g << 8) | _r;
+
+#define GetBGR24(_r, _g, _b, _p) \
+       _b = (_p & 0xFF0000) >> 16; \
+       _g = (_p & 0xFF00) >> 8; \
+       _r = (_p & 0xFF);
+
+/* RGB 32 (ARGB_8888), alpha ignored */
+
+#define RGB32(_r, _g, _b)  \
+       (_r << 16) | (_g << 8) | _b;
+
+#define GetRGB32(_r, _g, _b, _p) \
+       _r = (_p & 0xFF0000) >> 16; \
+       _g = (_p & 0xFF00) >> 8; \
+       _b = (_p & 0xFF);
+
+/* ARGB 32 (ARGB_8888) */
+
+#define ARGB32(_a,_r, _g, _b)  \
+       (_a << 24) | (_r << 16) | (_g << 8) | _b;
+
+#define GetARGB32(_a, _r, _g, _b, _p) \
+       _a = (_p & 0xFF000000) >> 24; \
+       _r = (_p & 0xFF0000) >> 16; \
+       _g = (_p & 0xFF00) >> 8; \
+       _b = (_p & 0xFF);
+
+/* BGR 32 (ABGR_8888), alpha ignored */
+
+#define BGR32(_r, _g, _b)  \
+       (_b << 16) | (_g << 8) | _r;
+
+#define GetBGR32(_r, _g, _b, _p) \
+       _b = (_p & 0xFF0000) >> 16; \
+       _g = (_p & 0xFF00) >> 8; \
+       _r = (_p & 0xFF);
+
+/* BGR 32 (ABGR_8888) */
+
+#define ABGR32(_a, _r, _g, _b)  \
+       (_a << 24) | (_b << 16) | (_g << 8) | _r;
+
+#define GetABGR32(_a, _r, _g, _b, _p) \
+       _a = (_p & 0xFF000000) >> 24; \
+       _b = (_p & 0xFF0000) >> 16; \
+       _g = (_p & 0xFF00) >> 8; \
+       _r = (_p & 0xFF);
+
+/* Color Conversion */
+
+#define BGR16_RGB32(_r, _g, _b, _p) \
+       GetBGR16(_r, _g, _b, _p); \
+       RGB_565_888(_r, _g, _b); \
+       _p = RGB32(_r, _g, _b);
+
+#define RGB32_RGB16(_r, _g, _b, _p) \
+       GetRGB32(_r, _g, _b, _p); \
+       RGB_888_565(_r, _g, _b); \
+       _p = RGB565(_r, _g, _b);
+
+#define RGB15_RGB16(_r, _g, _b, _p) \
+       GetRGB_555(_r, _g, _b, _p); \
+       _g = (_g << 1 & ~0x1) | (_g >> 4); \
+       _p = RGB565(_r, _g, _b);
+
+#define RGB16_RGB15(_r, _g, _b, _p) \
+       GetRGB_565(_r, _g, _b, _p); \
+       _g = (_g >> 1); \
+       _p = RGB555(_r, _g, _b);
+
+#define CLRCONV_ALPHA          1
+#define CLRCONV_INVERT         2
+/* if defined RGB555 format is used when rendering with a 16-bit frame buffer */
+#define CLRCONV_RGB555         4
+
+/* Supported Internal Buffer Formats */
+#define CLRBUF_16BPP           8
+#define        CLRBUF_32BPP            16
+
+struct _CLRCONV
+{
+       int alpha;
+       int invert;
+       int rgb555;
+       FRDP_PALETTE* palette;
+};
+typedef struct _CLRCONV CLRCONV;
+typedef CLRCONV* HCLRCONV;
+
+#define IBPP(_bpp) (((_bpp + 1)/ 8) % 5)
+
+typedef uint8* (*p_gdi_image_convert)(uint8* srcData, uint8* dstData, int width, int height, int srcBpp, int dstBpp, HCLRCONV clrconv);
+
+uint32 gdi_color_convert(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv);
+uint8* gdi_image_convert(uint8* srcData, uint8 *dstData, int width, int height, int srcBpp, int dstBpp, HCLRCONV clrconv);
+uint8* gdi_glyph_convert(int width, int height, uint8* data);
+uint8* gdi_mono_image_convert(uint8* srcData, int width, int height, int srcBpp, int dstBpp, uint32 bgcolor, uint32 fgcolor, HCLRCONV clrconv);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __COLOR_H */
diff --git a/libfreerdp-gdi/decode.c b/libfreerdp-gdi/decode.c
new file mode 100644 (file)
index 0000000..eaef36e
--- /dev/null
@@ -0,0 +1,40 @@
+/**
+ * FreeRDP: A Remote Desktop Protocol Client
+ * GDI RemoteFX Decoder
+ *
+ * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
+ *
+ * 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 <stdio.h>
+#include <stdlib.h>
+#include <freerdp/freerdp.h>
+#include <freerdp/utils/stream.h>
+
+#include "gdi.h"
+#include "gdi_bitmap.h"
+#include "gdi_region.h"
+#include "gdi_clipping.h"
+
+#include "decode.h"
+
+void gdi_decode_frame(GDI *gdi, int x, int y, uint8 * data, uint32 length)
+{
+
+}
+
+void gdi_decode_data(GDI *gdi, uint8 * data, int data_size)
+{
+
+}
diff --git a/libfreerdp-gdi/decode.h b/libfreerdp-gdi/decode.h
new file mode 100644 (file)
index 0000000..1505440
--- /dev/null
@@ -0,0 +1,30 @@
+/**
+ * FreeRDP: A Remote Desktop Protocol Client
+ * GDI RemoteFX Decoder
+ *
+ * Copyright 2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
+ *
+ * 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 __DECODE_H
+#define __DECODE_H
+
+#include <freerdp/freerdp.h>
+
+#include "gdi.h"
+
+void gdi_decode_frame(GDI *gdi, int x, int y, uint8 * data, uint32 length);
+void gdi_decode_data(GDI *gdi, uint8 * data, int data_size);
+
+#endif /* __DECODE_H */
diff --git a/libfreerdp-gdi/gdi.c b/libfreerdp-gdi/gdi.c
new file mode 100644 (file)
index 0000000..66babe7
--- /dev/null
@@ -0,0 +1,1195 @@
+/**
+ * FreeRDP: A Remote Desktop Protocol Client
+ * GDI Library
+ *
+ * Copyright 2010-2011 Marc-Andre Moreau <marcandre.moreau@gmail.com>
+ *
+ * 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 <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <freerdp/freerdp.h>
+
+#include "color.h"
+#include "decode.h"
+
+#include "gdi_dc.h"
+#include "gdi_pen.h"
+#include "gdi_line.h"
+#include "gdi_shape.h"
+#include "gdi_brush.h"
+#include "gdi_region.h"
+#include "gdi_bitmap.h"
+#include "gdi_palette.h"
+#include "gdi_drawing.h"
+#include "gdi_clipping.h"
+
+#include "gdi.h"
+
+/* Ternary Raster Operation Table */
+const uint32 rop3_code_table[] =
+{
+       0x00000042, /* 0 */
+       0x00010289, /* DPSoon */
+       0x00020C89, /* DPSona */
+       0x000300AA, /* PSon */
+       0x00040C88, /* SDPona */
+       0x000500A9, /* DPon */
+       0x00060865, /* PDSxnon */
+       0x000702C5, /* PDSaon */
+       0x00080F08, /* SDPnaa */
+       0x00090245, /* PDSxon */
+       0x000A0329, /* DPna */
+       0x000B0B2A, /* PSDnaon */
+       0x000C0324, /* SPna */
+       0x000D0B25, /* PDSnaon */
+       0x000E08A5, /* PDSonon */
+       0x000F0001, /* Pn */
+       0x00100C85, /* PDSona */
+       0x001100A6, /* DSon */
+       0x00120868, /* SDPxnon */
+       0x001302C8, /* SDPaon */
+       0x00140869, /* DPSxnon */
+       0x001502C9, /* DPSaon */
+       0x00165CCA, /* PSDPSanaxx */
+       0x00171D54, /* SSPxDSxaxn */
+       0x00180D59, /* SPxPDxa */
+       0x00191CC8, /* SDPSanaxn */
+       0x001A06C5, /* PDSPaox */
+       0x001B0768, /* SDPSxaxn */
+       0x001C06CA, /* PSDPaox */
+       0x001D0766, /* DSPDxaxn */
+       0x001E01A5, /* PDSox */
+       0x001F0385, /* PDSoan */
+       0x00200F09, /* DPSnaa */
+       0x00210248, /* SDPxon */
+       0x00220326, /* DSna */
+       0x00230B24, /* SPDnaon */
+       0x00240D55, /* SPxDSxa */
+       0x00251CC5, /* PDSPanaxn */
+       0x002606C8, /* SDPSaox */
+       0x00271868, /* SDPSxnox */
+       0x00280369, /* DPSxa */
+       0x002916CA, /* PSDPSaoxxn */
+       0x002A0CC9, /* DPSana */
+       0x002B1D58, /* SSPxPDxaxn */
+       0x002C0784, /* SPDSoax */
+       0x002D060A, /* PSDnox */
+       0x002E064A, /* PSDPxox */
+       0x002F0E2A, /* PSDnoan */
+       0x0030032A, /* PSna */
+       0x00310B28, /* SDPnaon */
+       0x00320688, /* SDPSoox */
+       0x00330008, /* Sn */
+       0x003406C4, /* SPDSaox */
+       0x00351864, /* SPDSxnox */
+       0x003601A8, /* SDPox */
+       0x00370388, /* SDPoan */
+       0x0038078A, /* PSDPoax */
+       0x00390604, /* SPDnox */
+       0x003A0644, /* SPDSxox */
+       0x003B0E24, /* SPDnoan */
+       0x003C004A, /* PSx */
+       0x003D18A4, /* SPDSonox */
+       0x003E1B24, /* SPDSnaox */
+       0x003F00EA, /* PSan */
+       0x00400F0A, /* PSDnaa */
+       0x00410249, /* DPSxon */
+       0x00420D5D, /* SDxPDxa */
+       0x00431CC4, /* SPDSanaxn */
+       0x00440328, /* SDna */
+       0x00450B29, /* DPSnaon */
+       0x004606C6, /* DSPDaox */
+       0x0047076A, /* PSDPxaxn */
+       0x00480368, /* SDPxa */
+       0x004916C5, /* PDSPDaoxxn */
+       0x004A0789, /* DPSDoax */
+       0x004B0605, /* PDSnox */
+       0x004C0CC8, /* SDPana */
+       0x004D1954, /* SSPxDSxoxn */
+       0x004E0645, /* PDSPxox */
+       0x004F0E25, /* PDSnoan */
+       0x00500325, /* PDna */
+       0x00510B26, /* DSPnaon */
+       0x005206C9, /* DPSDaox */
+       0x00530764, /* SPDSxaxn */
+       0x005408A9, /* DPSonon */
+       0x00550009, /* Dn */
+       0x005601A9, /* DPSox */
+       0x00570389, /* DPSoan */
+       0x00580785, /* PDSPoax */
+       0x00590609, /* DPSnox */
+       0x005A0049, /* DPx */
+       0x005B18A9, /* DPSDonox */
+       0x005C0649, /* DPSDxox */
+       0x005D0E29, /* DPSnoan */
+       0x005E1B29, /* DPSDnaox */
+       0x005F00E9, /* DPan */
+       0x00600365, /* PDSxa */
+       0x006116C6, /* DSPDSaoxxn */
+       0x00620786, /* DSPDoax */
+       0x00630608, /* SDPnox */
+       0x00640788, /* SDPSoax */
+       0x00650606, /* DSPnox */
+       0x00660046, /* DSx */
+       0x006718A8, /* SDPSonox */
+       0x006858A6, /* DSPDSonoxxn */
+       0x00690145, /* PDSxxn */
+       0x006A01E9, /* DPSax */
+       0x006B178A, /* PSDPSoaxxn */
+       0x006C01E8, /* SDPax */
+       0x006D1785, /* PDSPDoaxxn */
+       0x006E1E28, /* SDPSnoax */
+       0x006F0C65, /* PDSxnan */
+       0x00700CC5, /* PDSana */
+       0x00711D5C, /* SSDxPDxaxn */
+       0x00720648, /* SDPSxox */
+       0x00730E28, /* SDPnoan */
+       0x00740646, /* DSPDxox */
+       0x00750E26, /* DSPnoan */
+       0x00761B28, /* SDPSnaox */
+       0x007700E6, /* DSan */
+       0x007801E5, /* PDSax */
+       0x00791786, /* DSPDSoaxxn */
+       0x007A1E29, /* DPSDnoax */
+       0x007B0C68, /* SDPxnan */
+       0x007C1E24, /* SPDSnoax */
+       0x007D0C69, /* DPSxnan */
+       0x007E0955, /* SPxDSxo */
+       0x007F03C9, /* DPSaan */
+       0x008003E9, /* DPSaa */
+       0x00810975, /* SPxDSxon */
+       0x00820C49, /* DPSxna */
+       0x00831E04, /* SPDSnoaxn */
+       0x00840C48, /* SDPxna */
+       0x00851E05, /* PDSPnoaxn */
+       0x008617A6, /* DSPDSoaxx */
+       0x008701C5, /* PDSaxn */
+       0x008800C6, /* DSa */
+       0x00891B08, /* SDPSnaoxn */
+       0x008A0E06, /* DSPnoa */
+       0x008B0666, /* DSPDxoxn */
+       0x008C0E08, /* SDPnoa */
+       0x008D0668, /* SDPSxoxn */
+       0x008E1D7C, /* SSDxPDxax */
+       0x008F0CE5, /* PDSanan */
+       0x00900C45, /* PDSxna */
+       0x00911E08, /* SDPSnoaxn */
+       0x009217A9, /* DPSDPoaxx */
+       0x009301C4, /* SPDaxn */
+       0x009417AA, /* PSDPSoaxx */
+       0x009501C9, /* DPSaxn */
+       0x00960169, /* DPSxx */
+       0x0097588A, /* PSDPSonoxx */
+       0x00981888, /* SDPSonoxn */
+       0x00990066, /* DSxn */
+       0x009A0709, /* DPSnax */
+       0x009B07A8, /* SDPSoaxn */
+       0x009C0704, /* SPDnax */
+       0x009D07A6, /* DSPDoaxn */
+       0x009E16E6, /* DSPDSaoxx */
+       0x009F0345, /* PDSxan */
+       0x00A000C9, /* DPa */
+       0x00A11B05, /* PDSPnaoxn */
+       0x00A20E09, /* DPSnoa */
+       0x00A30669, /* DPSDxoxn */
+       0x00A41885, /* PDSPonoxn */
+       0x00A50065, /* PDxn */
+       0x00A60706, /* DSPnax */
+       0x00A707A5, /* PDSPoaxn */
+       0x00A803A9, /* DPSoa */
+       0x00A90189, /* DPSoxn */
+       0x00AA0029, /* D */
+       0x00AB0889, /* DPSono */
+       0x00AC0744, /* SPDSxax */
+       0x00AD06E9, /* DPSDaoxn */
+       0x00AE0B06, /* DSPnao */
+       0x00AF0229, /* DPno */
+       0x00B00E05, /* PDSnoa */
+       0x00B10665, /* PDSPxoxn */
+       0x00B21974, /* SSPxDSxox */
+       0x00B30CE8, /* SDPanan */
+       0x00B4070A, /* PSDnax */
+       0x00B507A9, /* DPSDoaxn */
+       0x00B616E9, /* DPSDPaoxx */
+       0x00B70348, /* SDPxan */
+       0x00B8074A, /* PSDPxax */
+       0x00B906E6, /* DSPDaoxn */
+       0x00BA0B09, /* DPSnao */
+       0x00BB0226, /* DSno */
+       0x00BC1CE4, /* SPDSanax */
+       0x00BD0D7D, /* SDxPDxan */
+       0x00BE0269, /* DPSxo */
+       0x00BF08C9, /* DPSano */
+       0x00C000CA, /* PSa */
+       0x00C11B04, /* SPDSnaoxn */
+       0x00C21884, /* SPDSonoxn */
+       0x00C3006A, /* PSxn */
+       0x00C40E04, /* SPDnoa */
+       0x00C50664, /* SPDSxoxn */
+       0x00C60708, /* SDPnax */
+       0x00C707AA, /* PSDPoaxn */
+       0x00C803A8, /* SDPoa */
+       0x00C90184, /* SPDoxn */
+       0x00CA0749, /* DPSDxax */
+       0x00CB06E4, /* SPDSaoxn */
+       0x00CC0020, /* S */
+       0x00CD0888, /* SDPono */
+       0x00CE0B08, /* SDPnao */
+       0x00CF0224, /* SPno */
+       0x00D00E0A, /* PSDnoa */
+       0x00D1066A, /* PSDPxoxn */
+       0x00D20705, /* PDSnax */
+       0x00D307A4, /* SPDSoaxn */
+       0x00D41D78, /* SSPxPDxax */
+       0x00D50CE9, /* DPSanan */
+       0x00D616EA, /* PSDPSaoxx */
+       0x00D70349, /* DPSxan */
+       0x00D80745, /* PDSPxax */
+       0x00D906E8, /* SDPSaoxn */
+       0x00DA1CE9, /* DPSDanax */
+       0x00DB0D75, /* SPxDSxan */
+       0x00DC0B04, /* SPDnao */
+       0x00DD0228, /* SDno */
+       0x00DE0268, /* SDPxo */
+       0x00DF08C8, /* SDPano */
+       0x00E003A5, /* PDSoa */
+       0x00E10185, /* PDSoxn */
+       0x00E20746, /* DSPDxax */
+       0x00E306EA, /* PSDPaoxn */
+       0x00E40748, /* SDPSxax */
+       0x00E506E5, /* PDSPaoxn */
+       0x00E61CE8, /* SDPSanax */
+       0x00E70D79, /* SPxPDxan */
+       0x00E81D74, /* SSPxDSxax */
+       0x00E95CE6, /* DSPDSanaxxn */
+       0x00EA02E9, /* DPSao */
+       0x00EB0849, /* DPSxno */
+       0x00EC02E8, /* SDPao */
+       0x00ED0848, /* SDPxno */
+       0x00EE0086, /* DSo */
+       0x00EF0A08, /* SDPnoo */
+       0x00F00021, /* P */
+       0x00F10885, /* PDSono */
+       0x00F20B05, /* PDSnao */
+       0x00F3022A, /* PSno */
+       0x00F40B0A, /* PSDnao */
+       0x00F50225, /* PDno */
+       0x00F60265, /* PDSxo */
+       0x00F708C5, /* PDSano */
+       0x00F802E5, /* PDSao */
+       0x00F90845, /* PDSxno */
+       0x00FA0089, /* DPo */
+       0x00FB0A09, /* DPSnoo */
+       0x00FC008A, /* PSo */
+       0x00FD0A0A, /* PSDnoo */
+       0x00FE02A9, /* DPSoo */
+       0x00FF0062  /* 1 */
+};
+
+/* GDI Helper Functions */
+
+uint32
+gdi_rop3_code(uint8 code)
+{
+       return rop3_code_table[code];
+}
+
+void
+gdi_copy_mem(uint8 * d, uint8 * s, int n)
+{
+       memcpy(d, s, n);
+}
+
+void
+gdi_copy_mem_backwards(uint8 * d, uint8 * s, int n)
+{
+       d = (d + n) - 1;
+       s = (s + n) - 1;
+       
+       while (n & (~7))
+       {
+               *(d--) = *(s--);
+               *(d--) = *(s--);
+               *(d--) = *(s--);
+               *(d--) = *(s--);
+               *(d--) = *(s--);
+               *(d--) = *(s--);
+               *(d--) = *(s--);
+               *(d--) = *(s--);
+               n = n - 8;
+       }
+
+       while (n > 0)
+       {
+               *(d--) = *(s--);
+               n--;
+       }
+}
+
+uint8*
+gdi_get_bitmap_pointer(HGDI_DC hdcBmp, int x, int y)
+{
+       uint8 * p;
+       HGDI_BITMAP hBmp = (HGDI_BITMAP) hdcBmp->selectedObject;
+       
+       if (x >= 0 && x < hBmp->width && y >= 0 && y < hBmp->height)
+       {
+               p = hBmp->data + (y * hBmp->width * hdcBmp->bytesPerPixel) + (x * hdcBmp->bytesPerPixel);
+               return p;
+       }
+       else
+       {
+               printf("gdi_get_bitmap_pointer: requesting invalid pointer: (%d,%d) in %dx%d\n", x, y, hBmp->width, hBmp->height);
+               return 0;
+       }
+}
+
+uint8*
+gdi_get_brush_pointer(HGDI_DC hdcBrush, int x, int y)
+{
+       uint8 * p;
+
+       if (hdcBrush->brush != NULL)
+       {
+               if (hdcBrush->brush->style == GDI_BS_PATTERN)
+               {
+                       HGDI_BITMAP hBmpBrush = hdcBrush->brush->pattern;
+       
+                       if (x >= 0 && y >= 0)
+                       {
+                               x = x % hBmpBrush->width;
+                               y = y % hBmpBrush->height;
+                               p = hBmpBrush->data + (y * hBmpBrush->scanline) + (x * hBmpBrush->bytesPerPixel);
+                               return p;
+                       }
+               }
+       }
+
+       p = (uint8*) &(hdcBrush->textColor);
+       return p;
+}
+
+int
+gdi_is_mono_pixel_set(uint8* data, int x, int y, int width)
+{
+       int byte;
+       int shift;
+
+       width = (width + 7) / 8;
+       byte = (y * width) + (x / 8);
+       shift = x % 8;
+
+       return (data[byte] & (0x80 >> shift)) != 0;
+}
+
+HGDI_BITMAP
+gdi_create_bitmap(GDI* gdi, int width, int height, int bpp, uint8* data)
+{
+       uint8* bmpData;
+       HGDI_BITMAP bitmap;
+       
+       bmpData = gdi_image_convert(data, NULL, width, height, gdi->srcBpp, bpp, gdi->clrconv);
+       bitmap = gdi_CreateBitmap(width, height, gdi->dstBpp, bmpData);
+       
+       return bitmap;
+}
+
+GDI_IMAGE*
+gdi_bitmap_new(GDI *gdi, int width, int height, int bpp, uint8* data)
+{
+       GDI_IMAGE *gdi_bmp;
+       
+       gdi_bmp = (GDI_IMAGE*) malloc(sizeof(GDI_IMAGE));
+       gdi_bmp->hdc = gdi_CreateCompatibleDC(gdi->hdc);
+       
+       DEBUG_GDI("gdi_bitmap_new: width:%d height:%d bpp:%d", width, height, bpp);
+
+       if (data == NULL)
+       {
+               gdi_bmp->bitmap = gdi_CreateCompatibleBitmap(gdi->hdc, width, height);
+       }
+       else
+       {
+               gdi_bmp->bitmap = gdi_create_bitmap(gdi, width, height, bpp, data);
+       }
+       
+       gdi_SelectObject(gdi_bmp->hdc, (HGDIOBJECT) gdi_bmp->bitmap);
+       gdi_bmp->org_bitmap = NULL;
+
+       return gdi_bmp;
+}
+
+void
+gdi_bitmap_free(GDI_IMAGE *gdi_bmp)
+{
+       if (gdi_bmp != 0)
+       {
+               gdi_SelectObject(gdi_bmp->hdc, (HGDIOBJECT) gdi_bmp->org_bitmap);
+               gdi_DeleteObject((HGDIOBJECT) gdi_bmp->bitmap);
+               gdi_DeleteDC(gdi_bmp->hdc);
+               free(gdi_bmp);
+       }
+}
+
+/* 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;
+}
+
+/**
+ * Register GDI callbacks with libfreerdp.
+ * @param inst current instance
+ * @return
+ */
+
+static int
+gdi_register_callbacks(rdpInst * inst)
+{
+       inst->ui_desktop_save = gdi_ui_desktop_save;
+       inst->ui_desktop_restore = gdi_ui_desktop_restore;
+       inst->ui_create_bitmap = gdi_ui_create_bitmap;
+       inst->ui_paint_bitmap = gdi_ui_paint_bitmap;
+       inst->ui_destroy_bitmap = gdi_ui_destroy_bitmap;
+       inst->ui_line = gdi_ui_line;
+       inst->ui_rect = gdi_ui_rect;
+       inst->ui_polygon = gdi_ui_polygon;
+       inst->ui_polyline = gdi_ui_polyline;
+       inst->ui_ellipse = gdi_ui_ellipse;
+       inst->ui_start_draw_glyphs = gdi_ui_start_draw_glyphs;
+       inst->ui_draw_glyph = gdi_ui_draw_glyph;
+       inst->ui_end_draw_glyphs = gdi_ui_end_draw_glyphs;
+       inst->ui_destblt = gdi_ui_destblt;
+       inst->ui_patblt = gdi_ui_patblt;
+       inst->ui_screenblt = gdi_ui_screenblt;
+       inst->ui_memblt = gdi_ui_memblt;
+       inst->ui_triblt = gdi_ui_mem3blt;
+       inst->ui_create_palette = gdi_ui_create_palette;
+       inst->ui_set_palette = gdi_ui_set_palette;
+       inst->ui_create_glyph = gdi_ui_create_glyph;
+       inst->ui_destroy_glyph = gdi_ui_destroy_glyph;
+       inst->ui_set_clip = gdi_ui_set_clipping_region;
+       inst->ui_reset_clip = gdi_ui_reset_clipping_region;
+       inst->ui_create_surface = gdi_ui_create_surface;
+       inst->ui_set_surface = gdi_ui_switch_surface;
+       inst->ui_destroy_surface = gdi_ui_destroy_surface;
+       inst->ui_decode = gdi_ui_decode;
+       return 0;
+}
+
+/**
+ * Initialize GDI
+ * @param inst current instance
+ * @return
+ */
+
+int
+gdi_init(rdpInst * inst, uint32 flags)
+{
+       GDI *gdi = (GDI*) malloc(sizeof(GDI));
+       memset(gdi, 0, sizeof(GDI));
+       SET_GDI(inst, gdi);
+
+       gdi->width = inst->settings->width;
+       gdi->height = inst->settings->height;
+       gdi->srcBpp = inst->settings->server_depth;
+
+       /* default internal buffer format */
+       gdi->dstBpp = 32;
+       gdi->bytesPerPixel = 4;
+
+       if (gdi->srcBpp > 16)
+       {
+               if (flags & CLRBUF_32BPP)
+               {
+                       gdi->dstBpp = 32;
+                       gdi->bytesPerPixel = 4;
+               }
+               else if (flags & CLRBUF_16BPP)
+               {
+                       gdi->dstBpp = 16;
+                       gdi->bytesPerPixel = 2;
+               }
+       }
+       else
+       {
+               if (flags & CLRBUF_16BPP)
+               {
+                       gdi->dstBpp = 16;
+                       gdi->bytesPerPixel = 2;
+               }
+               else if (flags & CLRBUF_32BPP)
+               {
+                       gdi->dstBpp = 32;
+                       gdi->bytesPerPixel = 4;
+               }
+       }
+       
+       gdi->hdc = gdi_GetDC();
+       gdi->hdc->bitsPerPixel = gdi->dstBpp;
+       gdi->hdc->bytesPerPixel = gdi->bytesPerPixel;
+
+       gdi->clrconv = (HCLRCONV) malloc(sizeof(CLRCONV));
+       gdi->clrconv->palette = NULL;
+       gdi->clrconv->alpha = (flags & CLRCONV_ALPHA) ? 1 : 0;
+       gdi->clrconv->invert = (flags & CLRCONV_INVERT) ? 1 : 0;
+       gdi->clrconv->rgb555 = (flags & CLRCONV_RGB555) ? 1 : 0;
+
+       gdi->hdc->alpha = gdi->clrconv->alpha;
+       gdi->hdc->invert = gdi->clrconv->invert;
+       gdi->hdc->rgb555 = gdi->clrconv->rgb555;
+
+       gdi->primary = gdi_bitmap_new(gdi, gdi->width, gdi->height, gdi->dstBpp, NULL);
+       gdi->primary_buffer = gdi->primary->bitmap->data;
+       gdi->drawing = gdi->primary;
+
+       gdi->primary->hdc->hwnd = (HGDI_WND) malloc(sizeof(GDI_WND));
+       gdi->primary->hdc->hwnd->invalid = gdi_CreateRectRgn(0, 0, 0, 0);
+       gdi->primary->hdc->hwnd->invalid->null = 1;
+
+       gdi->tile = gdi_bitmap_new(gdi, 64, 64, 32, NULL);
+
+       gdi_register_callbacks(inst);
+
+       return 0;
+}
+
+void gdi_free(rdpInst* inst)
+{
+       GDI *gdi = GET_GDI(inst);
+
+       if (gdi)
+       {
+               gdi_bitmap_free(gdi->primary);
+               gdi_DeleteObject((HGDIOBJECT) gdi->hdc);
+               free(gdi->clrconv);
+               free(gdi);
+       }
+       
+       SET_GDI(inst, NULL);
+}
index 472077e..b4d58ba 100644 (file)
  * limitations under the License.
  */
 
-#ifdef HAVE_CONFIG_H
-#include "config.h"
-#endif
-
 #ifndef __GDI_H
 #define __GDI_H
 
 #include "color.h"
-#include <freerdp/rfx.h>
 #include <freerdp/freerdp.h>
 #include <freerdp/utils/debug.h>
 
@@ -252,7 +247,7 @@ typedef struct _GDI GDI;
 
 uint32 gdi_rop3_code(uint8 code);
 void gdi_copy_mem(uint8 *d, uint8 *s, int n);
-void gdi_copy_memb(uint8 *d, uint8 *s, int n);
+void gdi_copy_mem_backwards(uint8 *d, uint8 *s, int n);
 uint8* gdi_get_bitmap_pointer(HGDI_DC hdcBmp, int x, int y);
 uint8* gdi_get_brush_pointer(HGDI_DC hdcBrush, int x, int y);
 int gdi_is_mono_pixel_set(uint8* data, int x, int y, int width);
index b4d07b5..f4fbc3f 100644 (file)
@@ -192,7 +192,7 @@ static int BitBlt_SRCCOPY_16bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
 
                        if (srcp != 0 && dstp != 0)
                        {
-                               gdi_copy_memb(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
+                               gdi_copy_mem_backwards(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
                        }
                }
        }
index 0888386..36f53f8 100644 (file)
@@ -209,7 +209,7 @@ static int BitBlt_SRCCOPY_32bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWi
 
                        if (srcp != 0 && dstp != 0)
                        {
-                               gdi_copy_memb(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
+                               gdi_copy_mem_backwards(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
                        }
                }
        }
index 704dbaf..7c93f62 100644 (file)
@@ -131,7 +131,7 @@ static int BitBlt_SRCCOPY_8bpp(HGDI_DC hdcDest, int nXDest, int nYDest, int nWid
 
                        if (srcp != 0 && dstp != 0)
                        {
-                               gdi_copy_memb(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
+                               gdi_copy_mem_backwards(dstp, srcp, nWidth * hdcDest->bytesPerPixel);
                        }
                }
        }
index 7fe974e..6b5fa38 100644 (file)
@@ -19,8 +19,8 @@
 
 /* Microsoft Windows Virtual Key Codes: http://msdn.microsoft.com/en-us/library/ms645540.aspx */
 
-#ifndef __KEYBOARD_H
-#define __KEYBOARD_H
+#ifndef __KEYBOAFRDP_H
+#define __KEYBOAFRDP_H
 
 #include <stddef.h>
 
@@ -584,4 +584,4 @@ static const virtualKey virtualKeyboard[256 + 2] =
        { 0x1C, 1, ""                    , "KPEN" },
 };
 
-#endif /* __KEYBOARD_H */
+#endif /* __KEYBOAFRDP_H */
index 6fcecc2..fbb22f5 100644 (file)
@@ -230,7 +230,7 @@ keyboardIME keyboardIMEs[] =
 
 
 rdpKeyboardLayout *
-get_keyboard_layouts(int types)
+get_keyboaFRDP_layouts(int types)
 {
        rdpKeyboardLayout * layouts;
        int num;
@@ -240,7 +240,7 @@ get_keyboard_layouts(int types)
        num = 0;
        layouts = (rdpKeyboardLayout *) malloc((num + 1) * sizeof(rdpKeyboardLayout));
 
-       if ((types & RDP_KEYBOARD_LAYOUT_TYPE_STANDARD) != 0)
+       if ((types & RDP_KEYBOAFRDP_LAYOUT_TYPE_STANDARD) != 0)
        {
                len = sizeof(keyboardLayouts) / sizeof(keyboardLayout);
                layouts = (rdpKeyboardLayout *) realloc(layouts, (num + len + 1) * sizeof(rdpKeyboardLayout));
@@ -250,7 +250,7 @@ get_keyboard_layouts(int types)
                        strcpy(layouts[num].name, keyboardLayouts[i].name);
                }
        }
-       if ((types & RDP_KEYBOARD_LAYOUT_TYPE_VARIANT) != 0)
+       if ((types & RDP_KEYBOAFRDP_LAYOUT_TYPE_VARIANT) != 0)
        {
                len = sizeof(keyboardLayoutVariants) / sizeof(keyboardLayoutVariant);
                layouts = (rdpKeyboardLayout *) realloc(layouts, (num + len + 1) * sizeof(rdpKeyboardLayout));
@@ -260,7 +260,7 @@ get_keyboard_layouts(int types)
                        strcpy(layouts[num].name, keyboardLayoutVariants[i].name);
                }
        }
-       if ((types & RDP_KEYBOARD_LAYOUT_TYPE_IME) != 0)
+       if ((types & RDP_KEYBOAFRDP_LAYOUT_TYPE_IME) != 0)
        {
                len = sizeof(keyboardIMEs) / sizeof(keyboardIME);
                layouts = (rdpKeyboardLayout *) realloc(layouts, (num + len + 1) * sizeof(rdpKeyboardLayout));
index 8af8cc6..6680493 100644 (file)
 #define KBD_CHINESE_TRADITIONAL_ALPHANUMERIC                   0xE00F0404
 
 rdpKeyboardLayout *
-get_keyboard_layouts(int types);
+get_keyboaFRDP_layouts(int types);
 
 char *
 get_layout_name(unsigned int keyboardLayoutID);
index 14f0d20..cf79d5b 100644 (file)
@@ -21,7 +21,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include "config.h"
 #include "libkbd.h"
 #include "keyboard.h"
 #include "x_layout_id_table.h"
@@ -58,10 +57,10 @@ comma_substring(char *s, int n)
 }
 
 unsigned int
-detect_keyboard_layout_from_xkb(void *dpy)
+detect_keyboaFRDP_layout_from_xkb(void *dpy)
 {
        char *layout, *variant;
-       unsigned int keyboard_layout = 0, group = 0;
+       unsigned int keyboaFRDP_layout = 0, group = 0;
        XkbRF_VarDefsRec rules_names;
        XKeyboardState coreKbdState;
        XkbStateRec state;
@@ -83,7 +82,7 @@ detect_keyboard_layout_from_xkb(void *dpy)
                DEBUG_KBD("layout: %s", layout);
                DEBUG_KBD("variant: %s", variant);
 
-               keyboard_layout = find_keyboard_layout_in_xorg_rules(layout, variant);
+               keyboaFRDP_layout = find_keyboaFRDP_layout_in_xorg_rules(layout, variant);
 
                free(rules_names.model);
                free(rules_names.layout);
@@ -91,7 +90,7 @@ detect_keyboard_layout_from_xkb(void *dpy)
                free(rules_names.options);
        }
 
-       return keyboard_layout;
+       return keyboaFRDP_layout;
 }
 
 int
@@ -359,7 +358,7 @@ load_xkb_keyboard(KeycodeToVkcode map, char* kbd)
 }
 
 void
-load_keyboard_map(KeycodeToVkcode keycodeToVkcode, char *xkbfile)
+load_keyboaFRDP_map(KeycodeToVkcode keycodeToVkcode, char *xkbfile)
 {
        char* kbd;
        char* xkbfileEnd;
index a6a39d9..92d32b6 100644 (file)
@@ -20,8 +20,6 @@
 #ifndef __LAYOUTS_XKB_H
 #define __LAYOUTS_XKB_H
 
-#include "config.h"
-
 typedef unsigned char KeycodeToVkcode[256];
 
 typedef struct
@@ -39,7 +37,7 @@ int
 init_xkb(void *dpy);
 
 unsigned int
-detect_keyboard_layout_from_xkb(void *dpy);
+detect_keyboaFRDP_layout_from_xkb(void *dpy);
 
 int
 init_keycodes_from_xkb(void *dpy, RdpKeycodes x_keycode_to_rdp_keycode);
@@ -47,7 +45,7 @@ init_keycodes_from_xkb(void *dpy, RdpKeycodes x_keycode_to_rdp_keycode);
 #else
 
 void
-load_keyboard_map(KeycodeToVkcode keycodeToVkcode, char *xkbfile);
+load_keyboaFRDP_map(KeycodeToVkcode keycodeToVkcode, char *xkbfile);
 
 #endif
 
index 839d0c0..f208d50 100644 (file)
@@ -21,9 +21,9 @@
 #include <stdlib.h>
 #include <string.h>
 
-#include <freerdp/freerdp.h>
 #include <freerdp/kbd.h>
-#include "config.h"
+#include <freerdp/types/base.h>
+
 #include "locales.h"
 #include "layout_ids.h"
 #include "layouts_xkb.h"
@@ -52,15 +52,15 @@ detect_keyboard(void *dpy, unsigned int keyboardLayoutID, char *xkbfile, size_t
 #if defined(sun)
        if(keyboardLayoutID == 0)
        {
-               keyboardLayoutID = detect_keyboard_type_and_layout_sunos(xkbfile, xkbfilelength);
-               DEBUG_KBD("detect_keyboard_type_and_layout_sunos: %X %s", keyboardLayoutID, xkbfile);
+               keyboardLayoutID = detect_keyboaFRDP_type_and_layout_sunos(xkbfile, xkbfilelength);
+               DEBUG_KBD("detect_keyboaFRDP_type_and_layout_sunos: %X %s", keyboardLayoutID, xkbfile);
        }
 #endif
 
        if(keyboardLayoutID == 0)
        {
-               keyboardLayoutID = detect_keyboard_layout_from_locale();
-               DEBUG_KBD("detect_keyboard_layout_from_locale: %X", keyboardLayoutID);
+               keyboardLayoutID = detect_keyboaFRDP_layout_from_locale();
+               DEBUG_KBD("detect_keyboaFRDP_layout_from_locale: %X", keyboardLayoutID);
        }
 
        if (keyboardLayoutID == 0)
@@ -86,7 +86,7 @@ detect_keyboard(void *dpy, unsigned int keyboardLayoutID, char *xkbfile, size_t
  */
 
 unsigned int
-freerdp_kbd_init(void *dpy, unsigned int keyboard_layout_id)
+freerdp_kbd_init(void *dpy, unsigned int keyboaFRDP_layout_id)
 {
 #ifdef WITH_XKBFILE
        if (!init_xkb(dpy))
@@ -94,10 +94,10 @@ freerdp_kbd_init(void *dpy, unsigned int keyboard_layout_id)
                DEBUG_KBD("Error initializing xkb");
                return 0;
        }
-       if (!keyboard_layout_id)
+       if (!keyboaFRDP_layout_id)
        {
-               keyboard_layout_id = detect_keyboard_layout_from_xkb(dpy);
-               DEBUG_KBD("detect_keyboard_layout_from_xkb: %X", keyboard_layout_id);
+               keyboaFRDP_layout_id = detect_keyboaFRDP_layout_from_xkb(dpy);
+               DEBUG_KBD("detect_keyboaFRDP_layout_from_xkb: %X", keyboaFRDP_layout_id);
        }
        init_keycodes_from_xkb(dpy, x_keycode_to_rdp_keycode);
 #else
@@ -105,11 +105,11 @@ freerdp_kbd_init(void *dpy, unsigned int keyboard_layout_id)
        KeycodeToVkcode keycodeToVkcode;
        int keycode;
 
-       keyboard_layout_id = detect_keyboard(dpy, keyboard_layout_id, xkbfile, sizeof(xkbfile));
+       keyboaFRDP_layout_id = detect_keyboard(dpy, keyboaFRDP_layout_id, xkbfile, sizeof(xkbfile));
        DEBUG_KBD("Using keyboard layout 0x%X with xkb name %s and xkbfile %s",
-                       keyboard_layout_id, get_layout_name(keyboard_layout_id), xkbfile);
+                       keyboaFRDP_layout_id, get_layout_name(keyboaFRDP_layout_id), xkbfile);
 
-       load_keyboard_map(keycodeToVkcode, xkbfile);
+       load_keyboaFRDP_map(keycodeToVkcode, xkbfile);
 
        for (keycode=0; keycode<256; keycode++)
        {
@@ -126,17 +126,17 @@ freerdp_kbd_init(void *dpy, unsigned int keyboard_layout_id)
        }
 #endif
 
-       return keyboard_layout_id;
+       return keyboaFRDP_layout_id;
 }
 
 rdpKeyboardLayout *
 freerdp_kbd_get_layouts(int types)
 {
-       return get_keyboard_layouts(types);
+       return get_keyboaFRDP_layouts(types);
 }
 
 uint8
-freerdp_kbd_get_scancode_by_keycode(uint8 keycode, RD_BOOL * extended)
+freerdp_kbd_get_scancode_by_keycode(uint8 keycode, FRDP_BOOL * extended)
 {
        DEBUG_KBD("%2x %4s -> %d/%d", keycode, x_keycode_to_rdp_keycode[keycode].keyname,
                        x_keycode_to_rdp_keycode[keycode].extended, x_keycode_to_rdp_keycode[keycode].keycode);
@@ -145,7 +145,7 @@ freerdp_kbd_get_scancode_by_keycode(uint8 keycode, RD_BOOL * extended)
 }
 
 uint8
-freerdp_kbd_get_scancode_by_virtualkey(int vkcode, RD_BOOL * extended)
+freerdp_kbd_get_scancode_by_virtualkey(int vkcode, FRDP_BOOL * extended)
 {
        *extended = virtualKeyboard[vkcode].extended;
        return virtualKeyboard[vkcode].scancode;
index 32b0f3a..cd0041a 100644 (file)
@@ -422,7 +422,7 @@ static const localeAndKeyboardLayout defaultKeyboardLayouts[] =
 };
 
 unsigned int
-detect_keyboard_layout_from_locale()
+detect_keyboaFRDP_layout_from_locale()
 {
        int i;
        int j;
index 60e6d64..96a8761 100644 (file)
@@ -321,6 +321,6 @@ Time zones, taken from Windows Server 2008
 */
 
 unsigned int
-detect_keyboard_layout_from_locale();
+detect_keyboaFRDP_layout_from_locale();
 
 #endif /* __LOCALES_H */
index 59e6a36..3b083f2 100644 (file)
@@ -1076,7 +1076,7 @@ SunOSKeyboard SunOSKeyboards[] =
 };
 
 unsigned int
-find_keyboard_layout_in_xorg_rules(char* layout, char* variant)
+find_keyboaFRDP_layout_in_xorg_rules(char* layout, char* variant)
 {
        int i;
        int j;
@@ -1108,7 +1108,7 @@ find_keyboard_layout_in_xorg_rules(char* layout, char* variant)
 #if defined(sun)
 
 unsigned int
-detect_keyboard_type_and_layout_sunos(char* xkbfile, int length)
+detect_keyboaFRDP_type_and_layout_sunos(char* xkbfile, int length)
 {
        FILE* kbd;
 
index 440a9e8..bfc54e3 100644 (file)
 #define __LAYOUTS_X_H
 
 unsigned int
-find_keyboard_layout_in_xorg_rules(char* layout, char* variant);
+find_keyboaFRDP_layout_in_xorg_rules(char* layout, char* variant);
 
 #if defined(sun)
 unsigned int
-detect_keyboard_type_and_layout_sunos(char* xkbfile, int length);
+detect_keyboaFRDP_type_and_layout_sunos(char* xkbfile, int length);
 #endif
 
 #endif
index 5be3ed5..c906ecc 100644 (file)
@@ -17,7 +17,6 @@
  * limitations under the License.
  */
 
-#include "config.h"
 #include <errno.h>
 #include <freerdp/utils/memory.h>