libfreerdp-core: refactoring of callback prefix
authorMarc-André Moreau <marcandre.moreau@gmail.com>
Fri, 21 Oct 2011 03:15:18 +0000 (23:15 -0400)
committerMarc-André Moreau <marcandre.moreau@gmail.com>
Fri, 21 Oct 2011 03:15:18 +0000 (23:15 -0400)
22 files changed:
client/DirectFB/dfreerdp.c
client/Windows/wfreerdp.c
client/X11/xf_gdi.c
client/X11/xfreerdp.c
client/test/freerdp.c
include/freerdp/cache/bitmap.h
include/freerdp/cache/brush.h
include/freerdp/freerdp.h
include/freerdp/gdi/bitmap.h
include/freerdp/gdi/brush.h
include/freerdp/gdi/line.h
include/freerdp/gdi/shape.h
include/freerdp/input.h
include/freerdp/update.h
libfreerdp-cache/brush.c
libfreerdp-core/freerdp.c
libfreerdp-core/orders.h
libfreerdp-gdi/bitmap.c
libfreerdp-gdi/brush.c
libfreerdp-gdi/gdi.c
libfreerdp-gdi/line.c
libfreerdp-gdi/shape.c

index 214ad4e..a34abc9 100644 (file)
@@ -39,18 +39,12 @@ struct thread_data
        freerdp* instance;
 };
 
-void df_context_size(freerdp* instance, uint32* size)
+void df_context_new(freerdp* instance, rdpContext* context)
 {
-       *size = sizeof(dfContext);
+       context->channels = freerdp_channels_new();
 }
 
-void df_context_new(freerdp* instance, dfContext* context)
-{
-       rdpContext* _context = (rdpContext*) context;
-       _context->channels = freerdp_channels_new();
-}
-
-void df_context_free(freerdp* instance, dfContext* context)
+void df_context_free(freerdp* instance, rdpContext* context)
 {
 
 }
@@ -440,9 +434,9 @@ int main(int argc, char* argv[])
        instance->VerifyCertificate = df_verify_certificate;
        instance->ReceiveChannelData = df_receive_channel_data;
 
-       instance->ContextSize = (pcContextSize) df_context_size;
-       instance->ContextNew = (pcContextNew) df_context_new;
-       instance->ContextFree = (pcContextFree) df_context_free;
+       instance->context_size = sizeof(dfContext);
+       instance->ContextNew = df_context_new;
+       instance->ContextFree = df_context_free;
        freerdp_context_new(instance);
 
        context = (dfContext*) instance->context;
index 813693c..270eb7e 100644 (file)
@@ -645,7 +645,7 @@ INT WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine
        instance->VerifyCertificate = wf_verify_certificate;
        instance->ReceiveChannelData = wf_receive_channel_data;
 
-       instance->ContextSize = (pcContextSize) wf_context_size;
+       instance->ContextSize = (pContextSize) wf_context_size;
        instance->ContextNew = (pcContextNew) wf_context_new;
        instance->ContextFree = (pcContextFree) wf_context_free;
        freerdp_context_new(instance);
index 49bb910..2ac246d 100644 (file)
@@ -217,29 +217,6 @@ Pixmap xf_brush_new(xfInfo* xfi, int width, int height, int bpp, uint8* data)
        return bitmap;
 }
 
-Pixmap xf_offscreen_new(xfInfo* xfi, int width, int height, int bpp, uint8* data)
-{
-       Pixmap bitmap;
-       uint8* cdata;
-       XImage* image;
-
-       bitmap = XCreatePixmap(xfi->display, xfi->drawable, width, height, xfi->depth);
-
-       if(data != NULL)
-       {
-               cdata = freerdp_image_convert(data, NULL, width, height, bpp, xfi->bpp, xfi->clrconv);
-               image = XCreateImage(xfi->display, xfi->visual, xfi->depth,
-                                               ZPixmap, 0, (char*) cdata, width, height, xfi->scanline_pad, 0);
-
-               XPutImage(xfi->display, bitmap, xfi->gc, image, 0, 0, 0, 0, width, height);
-               XFree(image);
-               if (cdata != data)
-                       xfree(cdata);
-       }
-
-       return bitmap;
-}
-
 Pixmap xf_mono_bitmap_new(xfInfo* xfi, int width, int height, uint8* data)
 {
        int scanline;
@@ -336,7 +313,6 @@ void xf_gdi_patblt(rdpUpdate* update, PATBLT_ORDER* patblt)
        rdpBrush* brush;
        uint32 foreColor;
        uint32 backColor;
-       rdpCache* cache = update->context->cache;
        xfInfo* xfi = ((xfContext*) update->context)->xfi;
 
        brush = &patblt->brush;
@@ -345,12 +321,6 @@ void xf_gdi_patblt(rdpUpdate* update, PATBLT_ORDER* patblt)
        foreColor = freerdp_color_convert(patblt->foreColor, xfi->srcBpp, 32, xfi->clrconv);
        backColor = freerdp_color_convert(patblt->backColor, xfi->srcBpp, 32, xfi->clrconv);
 
-       if (brush->style & CACHED_BRUSH)
-       {
-               brush->data = brush_cache_get(cache->brush, brush->index, &brush->bpp);
-               brush->style = GDI_BS_PATTERN;
-       }
-
        if (brush->style == GDI_BS_SOLID)
        {
                XSetFillStyle(xfi->display, xfi->gc, FillSolid);
@@ -406,6 +376,7 @@ void xf_gdi_patblt(rdpUpdate* update, PATBLT_ORDER* patblt)
 
                gdi_InvalidateRegion(xfi->hdc, patblt->nLeftRect, patblt->nTopRect, patblt->nWidth, patblt->nHeight);
        }
+
        XSetFunction(xfi->display, xfi->gc, GXcopy);
 }
 
@@ -439,6 +410,7 @@ void xf_gdi_scrblt(rdpUpdate* update, SCRBLT_ORDER* scrblt)
 
                gdi_InvalidateRegion(xfi->hdc, scrblt->nXSrc, scrblt->nYSrc, scrblt->nWidth, scrblt->nHeight);
        }
+
        XSetFunction(xfi->display, xfi->gc, GXcopy);
 }
 
@@ -538,6 +510,7 @@ void xf_gdi_line_to(rdpUpdate* update, LINE_TO_ORDER* line_to)
                        gdi_InvalidateRegion(xfi->hdc, line_to->nXStart, line_to->nYStart, width, height);
                }
        }
+
        XSetFunction(xfi->display, xfi->gc, GXcopy);
 }
 
@@ -626,6 +599,7 @@ void xf_gdi_memblt(rdpUpdate* update, MEMBLT_ORDER* memblt)
 
                gdi_InvalidateRegion(xfi->hdc, memblt->nLeftRect, memblt->nTopRect, memblt->nWidth, memblt->nHeight);
        }
+
        XSetFunction(xfi->display, xfi->gc, GXcopy);
 }
 
@@ -790,12 +764,6 @@ void xf_gdi_cache_glyph_v2(rdpUpdate* update, CACHE_GLYPH_V2_ORDER* cache_glyph_
 
 }
 
-void xf_gdi_cache_brush(rdpUpdate* update, CACHE_BRUSH_ORDER* cache_brush)
-{
-       rdpCache* cache = update->context->cache;
-       brush_cache_put(cache->brush, cache_brush->index, cache_brush->data, cache_brush->bpp);
-}
-
 void xf_gdi_surface_bits(rdpUpdate* update, SURFACE_BITS_COMMAND* surface_bits_command)
 {
        int i, tx, ty;
@@ -949,7 +917,6 @@ void xf_gdi_register_update_callbacks(rdpUpdate* update)
        update->CacheColorTable = xf_gdi_cache_color_table;
        update->CacheGlyph = xf_gdi_cache_glyph;
        update->CacheGlyphV2 = xf_gdi_cache_glyph_v2;
-       update->CacheBrush = xf_gdi_cache_brush;
 
        update->SurfaceBits = xf_gdi_surface_bits;
 }
index d42344c..b64e69f 100644 (file)
@@ -79,18 +79,12 @@ struct thread_data
 int xf_process_client_args(rdpSettings* settings, const char* opt, const char* val, void* user_data);
 int xf_process_plugin_args(rdpSettings* settings, const char* name, RDP_PLUGIN_DATA* plugin_data, void* user_data);
 
-void xf_context_size(freerdp* instance, uint32* size)
+void xf_context_new(freerdp* instance, rdpContext* context)
 {
-       *size = sizeof(xfContext);
+       context->channels = freerdp_channels_new();
 }
 
-void xf_context_new(freerdp* instance, xfContext* context)
-{
-       rdpContext* _context = &context->_p;
-       _context->channels = freerdp_channels_new();
-}
-
-void xf_context_free(freerdp* instance, xfContext* context)
+void xf_context_free(freerdp* instance, rdpContext* context)
 {
 
 }
@@ -622,6 +616,7 @@ boolean xf_post_connect(freerdp* instance)
 
        if (xfi->sw_gdi != True)
        {
+               brush_cache_register_callbacks(instance->update);
                bitmap_cache_register_callbacks(instance->update);
                offscreen_cache_register_callbacks(instance->update);
        }
@@ -967,9 +962,9 @@ int main(int argc, char* argv[])
        instance->VerifyCertificate = xf_verify_certificate;
        instance->ReceiveChannelData = xf_receive_channel_data;
 
-       instance->ContextSize = (pcContextSize) xf_context_size;
-       instance->ContextNew = (pcContextNew) xf_context_new;
-       instance->ContextFree = (pcContextFree) xf_context_free;
+       instance->context_size = sizeof(xfContext);
+       instance->ContextNew = (pContextNew) xf_context_new;
+       instance->ContextFree = (pContextFree) xf_context_free;
        freerdp_context_new(instance);
 
        instance->context->argc = argc;
index b5a32ff..60b28dc 100644 (file)
@@ -50,7 +50,6 @@ struct tf_context
        rdpContext _p;
 
        tfInfo* tfi;
-       rdpChannels* channels;
 };
 typedef struct tf_context tfContext;
 
@@ -65,17 +64,12 @@ struct thread_data
 #include <freerdp/freerdp.h>
 #include <freerdp/utils/args.h>
 
-void tf_context_size(freerdp* instance, uint32* size)
-{
-       *size = sizeof(tfContext);
-}
-
-void tf_context_new(freerdp* instance, tfContext* context)
+void tf_context_new(freerdp* instance, rdpContext* context)
 {
        context->channels = freerdp_channels_new();
 }
 
-void tf_context_free(freerdp* instance, tfContext* context)
+void tf_context_free(freerdp* instance, rdpContext* context)
 {
 
 }
@@ -179,7 +173,7 @@ boolean tf_pre_connect(freerdp* instance)
        settings->order_support[NEG_ELLIPSE_SC_INDEX] = True;
        settings->order_support[NEG_ELLIPSE_CB_INDEX] = True;
 
-       freerdp_channels_pre_connect(context->channels, instance);
+       freerdp_channels_pre_connect(instance->context->channels, instance);
 
        return True;
 }
@@ -187,9 +181,6 @@ boolean tf_pre_connect(freerdp* instance)
 boolean tf_post_connect(freerdp* instance)
 {
        rdpGdi* gdi;
-       tfContext* context;
-
-       context = (tfContext*) instance->context;
 
        gdi_init(instance, CLRCONV_ALPHA | CLRBUF_16BPP | CLRBUF_32BPP, NULL);
        gdi = instance->context->gdi;
@@ -197,7 +188,7 @@ boolean tf_post_connect(freerdp* instance)
        instance->update->BeginPaint = tf_begin_paint;
        instance->update->EndPaint = tf_end_paint;
 
-       freerdp_channels_post_connect(context->channels, instance);
+       freerdp_channels_post_connect(instance->context->channels, instance);
 
        return True;
 }
@@ -213,14 +204,12 @@ int tfreerdp_run(freerdp* instance)
        void* wfds[32];
        fd_set rfds_set;
        fd_set wfds_set;
-       tfContext* context;
        rdpChannels* channels;
 
        memset(rfds, 0, sizeof(rfds));
        memset(wfds, 0, sizeof(wfds));
 
-       context = (tfContext*) instance->context;
-       channels = context->channels;
+       channels = instance->context->channels;
 
        freerdp_connect(instance);
 
@@ -312,7 +301,6 @@ int main(int argc, char* argv[])
 {
        pthread_t thread;
        freerdp* instance;
-       tfContext* context;
        struct thread_data* data;
        rdpChannels* channels;
 
@@ -325,14 +313,12 @@ int main(int argc, char* argv[])
        instance->PostConnect = tf_post_connect;
        instance->ReceiveChannelData = tf_receive_channel_data;
 
-       instance->ContextSize = (pcContextSize) tf_context_size;
-       instance->ContextNew = (pcContextNew) tf_context_new;
-       instance->ContextFree = (pcContextFree) tf_context_free;
+       instance->context_size = sizeof(tfContext);
+       instance->ContextNew = tf_context_new;
+       instance->ContextFree = tf_context_free;
        freerdp_context_new(instance);
 
-       context = (tfContext*) instance->context;
-       channels = context->channels;
-
+       channels = instance->context->channels;
        freerdp_parse_args(instance->settings, argc, argv, tf_process_plugin_args, channels, NULL, NULL);
 
        data = (struct thread_data*) xzalloc(sizeof(struct thread_data));
index b57d43b..61a20c9 100644 (file)
@@ -39,14 +39,14 @@ struct _BITMAP_V2_CELL
 
 struct rdp_bitmap_cache
 {
-       pcMemBlt MemBlt;
-       pcMem3Blt Mem3Blt;
+       pMemBlt MemBlt;
+       pMem3Blt Mem3Blt;
 
-       pcCacheBitmap CacheBitmap;
-       pcCacheBitmapV2 CacheBitmapV2;
-       pcCacheBitmapV3 CacheBitmapV3;
+       pCacheBitmap CacheBitmap;
+       pCacheBitmapV2 CacheBitmapV2;
+       pCacheBitmapV3 CacheBitmapV3;
 
-       pcBitmapUpdate BitmapUpdate;
+       pBitmapUpdate BitmapUpdate;
 
        uint8 maxCells;
        rdpBitmap* bitmap;
index 2d53bb5..6d743a0 100644 (file)
 
 #include <freerdp/api.h>
 #include <freerdp/types.h>
+#include <freerdp/freerdp.h>
+#include <freerdp/update.h>
 #include <freerdp/utils/stream.h>
 
+typedef struct _BRUSH_ENTRY BRUSH_ENTRY;
+typedef struct rdp_brush_cache rdpBrushCache;
+
+#include <freerdp/cache/cache.h>
+
 struct _BRUSH_ENTRY
 {
        uint8 bpp;
        void* entry;
 };
-typedef struct _BRUSH_ENTRY BRUSH_ENTRY;
 
 struct rdp_brush_cache
 {
+       pPatBlt PatBlt;
+
+       pCacheBrush CacheBrush;
+
        rdpSettings* settings;
        uint8 maxEntries;
        uint8 maxMonoEntries;
        BRUSH_ENTRY* entries;
        BRUSH_ENTRY* monoEntries;
 };
-typedef struct rdp_brush_cache rdpBrushCache;
 
 FREERDP_API void* brush_cache_get(rdpBrushCache* brush, uint8 index, uint8* bpp);
 FREERDP_API void brush_cache_put(rdpBrushCache* brush, uint8 index, void* entry, uint8 bpp);
 
+FREERDP_API void brush_cache_register_callbacks(rdpUpdate* update);
+
 FREERDP_API rdpBrushCache* brush_cache_new(rdpSettings* settings);
 FREERDP_API void brush_cache_free(rdpBrushCache* brush);
 
index e061a3f..5bbe0ae 100644 (file)
@@ -43,17 +43,17 @@ typedef struct rdp_freerdp_peer freerdp_peer;
 extern "C" {
 #endif
 
-typedef void (*pcContextSize)(freerdp* instance, uint32* size);
-typedef void (*pcContextNew)(freerdp* instance, rdpContext* context);
-typedef void (*pcContextFree)(freerdp* instance, rdpContext* context);
+typedef void (*pContextSize)(freerdp* instance, uint32* size);
+typedef void (*pContextNew)(freerdp* instance, rdpContext* context);
+typedef void (*pContextFree)(freerdp* instance, rdpContext* context);
 
-typedef boolean (*pcPreConnect)(freerdp* instance);
-typedef boolean (*pcPostConnect)(freerdp* instance);
-typedef boolean (*pcAuthenticate)(freerdp* instance, char** username, char** password, char** domain);
-typedef boolean (*pcVerifyCertificate)(freerdp* instance, char* subject, char* issuer, char* fingerprint);
+typedef boolean (*pPreConnect)(freerdp* instance);
+typedef boolean (*pPostConnect)(freerdp* instance);
+typedef boolean (*pAuthenticate)(freerdp* instance, char** username, char** password, char** domain);
+typedef boolean (*pVerifyCertificate)(freerdp* instance, char* subject, char* issuer, char* fingerprint);
 
-typedef int (*pcSendChannelData)(freerdp* instance, int channelId, uint8* data, int size);
-typedef int (*pcReceiveChannelData)(freerdp* instance, int channelId, uint8* data, int size, int flags, int total_size);
+typedef int (*pSendChannelData)(freerdp* instance, int channelId, uint8* data, int size);
+typedef int (*pReceiveChannelData)(freerdp* instance, int channelId, uint8* data, int size, int flags, int total_size);
 
 struct rdp_context
 {
@@ -79,17 +79,17 @@ struct rdp_freerdp
        rdpUpdate* update;
        rdpSettings* settings;
 
-       pcContextSize ContextSize;
-       pcContextNew ContextNew;
-       pcContextFree ContextFree;
+       size_t context_size;
+       pContextNew ContextNew;
+       pContextFree ContextFree;
 
-       pcPreConnect PreConnect;
-       pcPostConnect PostConnect;
-       pcAuthenticate Authenticate;
-       pcVerifyCertificate VerifyCertificate;
+       pPreConnect PreConnect;
+       pPostConnect PostConnect;
+       pAuthenticate Authenticate;
+       pVerifyCertificate VerifyCertificate;
 
-       pcSendChannelData SendChannelData;
-       pcReceiveChannelData ReceiveChannelData;
+       pSendChannelData SendChannelData;
+       pReceiveChannelData ReceiveChannelData;
 };
 
 FREERDP_API void freerdp_context_new(freerdp* instance);
index a0ddb7b..75a9dee 100644 (file)
@@ -38,6 +38,6 @@ FREERDP_API HGDI_BITMAP gdi_CreateBitmap(int nWidth, int nHeight, int cBitsPerPi
 FREERDP_API HGDI_BITMAP gdi_CreateCompatibleBitmap(HGDI_DC hdc, int nWidth, int nHeight);
 FREERDP_API int gdi_BitBlt(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc, int rop);
 
-typedef int (*pBitBlt)(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc, int rop);
+typedef int (*p_BitBlt)(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc, int rop);
 
 #endif /* __GDI_BITMAP_H */
index acafc2a..5055059 100644 (file)
@@ -27,6 +27,6 @@ FREERDP_API HGDI_BRUSH gdi_CreateSolidBrush(GDI_COLOR crColor);
 FREERDP_API HGDI_BRUSH gdi_CreatePatternBrush(HGDI_BITMAP hbmp);
 FREERDP_API int gdi_PatBlt(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, int rop);
 
-typedef int (*pPatBlt)(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, int rop);
+typedef int (*p_PatBlt)(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, int rop);
 
 #endif /* __GDI_BRUSH_H */
index 3c4ed5e..35a19fa 100644 (file)
@@ -29,6 +29,6 @@ FREERDP_API int gdi_Polyline(HGDI_DC hdc, GDI_POINT *lppt, int cPoints);
 FREERDP_API int gdi_PolyPolyline(HGDI_DC hdc, GDI_POINT *lppt, int *lpdwPolyPoints, int cCount);
 FREERDP_API int gdi_MoveToEx(HGDI_DC hdc, int X, int Y, HGDI_POINT lpPoint);
 
-typedef int (*pLineTo)(HGDI_DC hdc, int nXEnd, int nYEnd);
+typedef int (*p_LineTo)(HGDI_DC hdc, int nXEnd, int nYEnd);
 
 #endif /* __GDI_LINE_H */
index daa916e..4ec28e6 100644 (file)
@@ -29,6 +29,6 @@ FREERDP_API int gdi_Polygon(HGDI_DC hdc, GDI_POINT *lpPoints, int nCount);
 FREERDP_API int gdi_PolyPolygon(HGDI_DC hdc, GDI_POINT *lpPoints, int *lpPolyCounts, int nCount);
 FREERDP_API int gdi_Rectangle(HGDI_DC hdc, int nLeftRect, int nTopRect, int nRightRect, int nBottomRect);
 
-typedef int (*pFillRect)(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr);
+typedef int (*p_FillRect)(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr);
 
 #endif /* __GDI_SHAPE_H */
index 98a15e0..5c40553 100644 (file)
@@ -52,21 +52,21 @@ typedef struct rdp_input rdpInput;
 
 #define RDP_CLIENT_INPUT_PDU_HEADER_LENGTH     4
 
-typedef void (*pcSynchronizeEvent)(rdpInput* input, uint32 flags);
-typedef void (*pcKeyboardEvent)(rdpInput* input, uint16 flags, uint16 code);
-typedef void (*pcUnicodeKeyboardEvent)(rdpInput* input, uint16 code);
-typedef void (*pcMouseEvent)(rdpInput* input, uint16 flags, uint16 x, uint16 y);
-typedef void (*pcExtendedMouseEvent)(rdpInput* input, uint16 flags, uint16 x, uint16 y);
+typedef void (*pSynchronizeEvent)(rdpInput* input, uint32 flags);
+typedef void (*pKeyboardEvent)(rdpInput* input, uint16 flags, uint16 code);
+typedef void (*pUnicodeKeyboardEvent)(rdpInput* input, uint16 code);
+typedef void (*pMouseEvent)(rdpInput* input, uint16 flags, uint16 x, uint16 y);
+typedef void (*pExtendedMouseEvent)(rdpInput* input, uint16 flags, uint16 x, uint16 y);
 
 struct rdp_input
 {
        rdpContext* context;
 
-       pcSynchronizeEvent SynchronizeEvent;
-       pcKeyboardEvent KeyboardEvent;
-       pcUnicodeKeyboardEvent UnicodeKeyboardEvent;
-       pcMouseEvent MouseEvent;
-       pcExtendedMouseEvent ExtendedMouseEvent;
+       pSynchronizeEvent SynchronizeEvent;
+       pKeyboardEvent KeyboardEvent;
+       pUnicodeKeyboardEvent UnicodeKeyboardEvent;
+       pMouseEvent MouseEvent;
+       pExtendedMouseEvent ExtendedMouseEvent;
 
        void* param1;
 };
index a16e3d7..b674516 100644 (file)
@@ -1056,154 +1056,154 @@ typedef struct _SURFACE_BITS_COMMAND SURFACE_BITS_COMMAND;
 
 /* Update Interface */
 
-typedef void (*pcBeginPaint)(rdpUpdate* update);
-typedef void (*pcEndPaint)(rdpUpdate* update);
-typedef void (*pcSetBounds)(rdpUpdate* update, BOUNDS* bounds);
-typedef void (*pcSynchronize)(rdpUpdate* update);
-typedef void (*pcDesktopResize)(rdpUpdate* update);
-typedef void (*pcBitmapUpdate)(rdpUpdate* update, BITMAP_UPDATE* bitmap);
-typedef void (*pcPalette)(rdpUpdate* update, PALETTE_UPDATE* palette);
-typedef void (*pcPlaySound)(rdpUpdate* update, PLAY_SOUND_UPDATE* play_sound);
-
-typedef void (*pcPointerPosition)(rdpUpdate* update, POINTER_POSITION_UPDATE* pointer_position);
-typedef void (*pcPointerSystem)(rdpUpdate* update, POINTER_SYSTEM_UPDATE* pointer_system);
-typedef void (*pcPointerColor)(rdpUpdate* update, POINTER_COLOR_UPDATE* pointer_color);
-typedef void (*pcPointerNew)(rdpUpdate* update, POINTER_NEW_UPDATE* pointer_new);
-typedef void (*pcPointerCached)(rdpUpdate* update, POINTER_CACHED_UPDATE* pointer_cached);
-
-typedef void (*pcDstBlt)(rdpUpdate* update, DSTBLT_ORDER* dstblt);
-typedef void (*pcPatBlt)(rdpUpdate* update, PATBLT_ORDER* patblt);
-typedef void (*pcScrBlt)(rdpUpdate* update, SCRBLT_ORDER* scrblt);
-typedef void (*pcOpaqueRect)(rdpUpdate* update, OPAQUE_RECT_ORDER* opaque_rect);
-typedef void (*pcDrawNineGrid)(rdpUpdate* update, DRAW_NINE_GRID_ORDER* draw_nine_grid);
-typedef void (*pcMultiDstBlt)(rdpUpdate* update, MULTI_DSTBLT_ORDER* multi_dstblt);
-typedef void (*pcMultiPatBlt)(rdpUpdate* update, MULTI_PATBLT_ORDER* multi_patblt);
-typedef void (*pcMultiScrBlt)(rdpUpdate* update, MULTI_SCRBLT_ORDER* multi_scrblt);
-typedef void (*pcMultiOpaqueRect)(rdpUpdate* update, MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect);
-typedef void (*pcMultiDrawNineGrid)(rdpUpdate* update, MULTI_DRAW_NINE_GRID_ORDER* multi_draw_nine_grid);
-typedef void (*pcLineTo)(rdpUpdate* update, LINE_TO_ORDER* line_to);
-typedef void (*pcPolyline)(rdpUpdate* update, POLYLINE_ORDER* polyline);
-typedef void (*pcMemBlt)(rdpUpdate* update, MEMBLT_ORDER* memblt);
-typedef void (*pcMem3Blt)(rdpUpdate* update, MEM3BLT_ORDER* memblt);
-typedef void (*pcSaveBitmap)(rdpUpdate* update, SAVE_BITMAP_ORDER* save_bitmap);
-typedef void (*pcGlyphIndex)(rdpUpdate* update, GLYPH_INDEX_ORDER* glyph_index);
-typedef void (*pcFastIndex)(rdpUpdate* update, FAST_INDEX_ORDER* fast_index);
-typedef void (*pcFastGlyph)(rdpUpdate* update, FAST_GLYPH_ORDER* fast_glyph);
-typedef void (*pcPolygonSC)(rdpUpdate* update, POLYGON_SC_ORDER* polygon_sc);
-typedef void (*pcPolygonCB)(rdpUpdate* update, POLYGON_CB_ORDER* polygon_cb);
-typedef void (*pcEllipseSC)(rdpUpdate* update, ELLIPSE_SC_ORDER* ellipse_sc);
-typedef void (*pcEllipseCB)(rdpUpdate* update, ELLIPSE_CB_ORDER* ellipse_cb);
-
-typedef void (*pcCacheBitmap)(rdpUpdate* update, CACHE_BITMAP_ORDER* cache_bitmap_order);
-typedef void (*pcCacheBitmapV2)(rdpUpdate* update, CACHE_BITMAP_V2_ORDER* cache_bitmap_v2_order);
-typedef void (*pcCacheBitmapV3)(rdpUpdate* update, CACHE_BITMAP_V3_ORDER* cache_bitmap_v3_order);
-typedef void (*pcCacheColorTable)(rdpUpdate* update, CACHE_COLOR_TABLE_ORDER* cache_color_table_order);
-typedef void (*pcCacheGlyph)(rdpUpdate* update, CACHE_GLYPH_ORDER* cache_glyph_order);
-typedef void (*pcCacheGlyphV2)(rdpUpdate* update, CACHE_GLYPH_V2_ORDER* cache_glyph_v2_order);
-typedef void (*pcCacheBrush)(rdpUpdate* update, CACHE_BRUSH_ORDER* cache_brush_order);
-
-typedef void (*pcCreateOffscreenBitmap)(rdpUpdate* update, CREATE_OFFSCREEN_BITMAP_ORDER* create_offscreen_bitmap);
-typedef void (*pcSwitchSurface)(rdpUpdate* update, SWITCH_SURFACE_ORDER* switch_surface);
-typedef void (*pcCreateNineGridBitmap)(rdpUpdate* update, CREATE_NINE_GRID_BITMAP_ORDER* create_nine_grid_bitmap);
-typedef void (*pcFrameMarker)(rdpUpdate* update, FRAME_MARKER_ORDER* frame_marker);
-typedef void (*pcStreamBitmapFirst)(rdpUpdate* update, STREAM_BITMAP_FIRST_ORDER* stream_bitmap_first);
-typedef void (*pcStreamBitmapNext)(rdpUpdate* update, STREAM_BITMAP_FIRST_ORDER* stream_bitmap_next);
-typedef void (*pcDrawGdiPlusFirst)(rdpUpdate* update, DRAW_GDIPLUS_FIRST_ORDER* draw_gdiplus_first);
-typedef void (*pcDrawGdiPlusNext)(rdpUpdate* update, DRAW_GDIPLUS_NEXT_ORDER* draw_gdiplus_next);
-typedef void (*pcDrawGdiPlusEnd)(rdpUpdate* update, DRAW_GDIPLUS_END_ORDER* draw_gdiplus_end);
-typedef void (*pcDrawGdiPlusCacheFirst)(rdpUpdate* update, DRAW_GDIPLUS_CACHE_FIRST_ORDER* draw_gdiplus_cache_first);
-typedef void (*pcDrawGdiPlusCacheNext)(rdpUpdate* update, DRAW_GDIPLUS_CACHE_NEXT_ORDER* draw_gdiplus_cache_next);
-typedef void (*pcDrawGdiPlusCacheEnd)(rdpUpdate* update, DRAW_GDIPLUS_CACHE_END_ORDER* draw_gdiplus_cache_end);
-
-typedef void (*pcWindowCreate)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* window_state);
-typedef void (*pcWindowUpdate)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* window_state);
-typedef void (*pcWindowIcon)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo, WINDOW_ICON_ORDER* window_icon);
-typedef void (*pcWindowCachedIcon)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo, WINDOW_CACHED_ICON_ORDER* window_cached_icon);
-typedef void (*pcWindowDelete)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo);
-typedef void (*pcNotifyIconCreate)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notify_icon_state);
-typedef void (*pcNotifyIconUpdate)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notify_icon_state);
-typedef void (*pcNotifyIconDelete)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo);
-typedef void (*pcMonitoredDesktop)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo, MONITORED_DESKTOP_ORDER* monitored_desktop);
-typedef void (*pcNonMonitoredDesktop)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo);
-
-typedef void (*pcSurfaceBits)(rdpUpdate* update, SURFACE_BITS_COMMAND* surface_bits_command);
-typedef void (*pcSurfaceCommand)(rdpUpdate* update, STREAM* s);
+typedef void (*pBeginPaint)(rdpUpdate* update);
+typedef void (*pEndPaint)(rdpUpdate* update);
+typedef void (*pSetBounds)(rdpUpdate* update, BOUNDS* bounds);
+typedef void (*pSynchronize)(rdpUpdate* update);
+typedef void (*pDesktopResize)(rdpUpdate* update);
+typedef void (*pBitmapUpdate)(rdpUpdate* update, BITMAP_UPDATE* bitmap);
+typedef void (*pPalette)(rdpUpdate* update, PALETTE_UPDATE* palette);
+typedef void (*pPlaySound)(rdpUpdate* update, PLAY_SOUND_UPDATE* play_sound);
+
+typedef void (*pPointerPosition)(rdpUpdate* update, POINTER_POSITION_UPDATE* pointer_position);
+typedef void (*pPointerSystem)(rdpUpdate* update, POINTER_SYSTEM_UPDATE* pointer_system);
+typedef void (*pPointerColor)(rdpUpdate* update, POINTER_COLOR_UPDATE* pointer_color);
+typedef void (*pPointerNew)(rdpUpdate* update, POINTER_NEW_UPDATE* pointer_new);
+typedef void (*pPointerCached)(rdpUpdate* update, POINTER_CACHED_UPDATE* pointer_cached);
+
+typedef void (*pDstBlt)(rdpUpdate* update, DSTBLT_ORDER* dstblt);
+typedef void (*pPatBlt)(rdpUpdate* update, PATBLT_ORDER* patblt);
+typedef void (*pScrBlt)(rdpUpdate* update, SCRBLT_ORDER* scrblt);
+typedef void (*pOpaqueRect)(rdpUpdate* update, OPAQUE_RECT_ORDER* opaque_rect);
+typedef void (*pDrawNineGrid)(rdpUpdate* update, DRAW_NINE_GRID_ORDER* draw_nine_grid);
+typedef void (*pMultiDstBlt)(rdpUpdate* update, MULTI_DSTBLT_ORDER* multi_dstblt);
+typedef void (*pMultiPatBlt)(rdpUpdate* update, MULTI_PATBLT_ORDER* multi_patblt);
+typedef void (*pMultiScrBlt)(rdpUpdate* update, MULTI_SCRBLT_ORDER* multi_scrblt);
+typedef void (*pMultiOpaqueRect)(rdpUpdate* update, MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect);
+typedef void (*pMultiDrawNineGrid)(rdpUpdate* update, MULTI_DRAW_NINE_GRID_ORDER* multi_draw_nine_grid);
+typedef void (*pLineTo)(rdpUpdate* update, LINE_TO_ORDER* line_to);
+typedef void (*pPolyline)(rdpUpdate* update, POLYLINE_ORDER* polyline);
+typedef void (*pMemBlt)(rdpUpdate* update, MEMBLT_ORDER* memblt);
+typedef void (*pMem3Blt)(rdpUpdate* update, MEM3BLT_ORDER* memblt);
+typedef void (*pSaveBitmap)(rdpUpdate* update, SAVE_BITMAP_ORDER* save_bitmap);
+typedef void (*pGlyphIndex)(rdpUpdate* update, GLYPH_INDEX_ORDER* glyph_index);
+typedef void (*pFastIndex)(rdpUpdate* update, FAST_INDEX_ORDER* fast_index);
+typedef void (*pFastGlyph)(rdpUpdate* update, FAST_GLYPH_ORDER* fast_glyph);
+typedef void (*pPolygonSC)(rdpUpdate* update, POLYGON_SC_ORDER* polygon_sc);
+typedef void (*pPolygonCB)(rdpUpdate* update, POLYGON_CB_ORDER* polygon_cb);
+typedef void (*pEllipseSC)(rdpUpdate* update, ELLIPSE_SC_ORDER* ellipse_sc);
+typedef void (*pEllipseCB)(rdpUpdate* update, ELLIPSE_CB_ORDER* ellipse_cb);
+
+typedef void (*pCacheBitmap)(rdpUpdate* update, CACHE_BITMAP_ORDER* cache_bitmap_order);
+typedef void (*pCacheBitmapV2)(rdpUpdate* update, CACHE_BITMAP_V2_ORDER* cache_bitmap_v2_order);
+typedef void (*pCacheBitmapV3)(rdpUpdate* update, CACHE_BITMAP_V3_ORDER* cache_bitmap_v3_order);
+typedef void (*pCacheColorTable)(rdpUpdate* update, CACHE_COLOR_TABLE_ORDER* cache_color_table_order);
+typedef void (*pCacheGlyph)(rdpUpdate* update, CACHE_GLYPH_ORDER* cache_glyph_order);
+typedef void (*pCacheGlyphV2)(rdpUpdate* update, CACHE_GLYPH_V2_ORDER* cache_glyph_v2_order);
+typedef void (*pCacheBrush)(rdpUpdate* update, CACHE_BRUSH_ORDER* cache_brush_order);
+
+typedef void (*pCreateOffscreenBitmap)(rdpUpdate* update, CREATE_OFFSCREEN_BITMAP_ORDER* create_offscreen_bitmap);
+typedef void (*pSwitchSurface)(rdpUpdate* update, SWITCH_SURFACE_ORDER* switch_surface);
+typedef void (*pCreateNineGridBitmap)(rdpUpdate* update, CREATE_NINE_GRID_BITMAP_ORDER* create_nine_grid_bitmap);
+typedef void (*pFrameMarker)(rdpUpdate* update, FRAME_MARKER_ORDER* frame_marker);
+typedef void (*pStreamBitmapFirst)(rdpUpdate* update, STREAM_BITMAP_FIRST_ORDER* stream_bitmap_first);
+typedef void (*pStreamBitmapNext)(rdpUpdate* update, STREAM_BITMAP_FIRST_ORDER* stream_bitmap_next);
+typedef void (*pDrawGdiPlusFirst)(rdpUpdate* update, DRAW_GDIPLUS_FIRST_ORDER* draw_gdiplus_first);
+typedef void (*pDrawGdiPlusNext)(rdpUpdate* update, DRAW_GDIPLUS_NEXT_ORDER* draw_gdiplus_next);
+typedef void (*pDrawGdiPlusEnd)(rdpUpdate* update, DRAW_GDIPLUS_END_ORDER* draw_gdiplus_end);
+typedef void (*pDrawGdiPlusCacheFirst)(rdpUpdate* update, DRAW_GDIPLUS_CACHE_FIRST_ORDER* draw_gdiplus_cache_first);
+typedef void (*pDrawGdiPlusCacheNext)(rdpUpdate* update, DRAW_GDIPLUS_CACHE_NEXT_ORDER* draw_gdiplus_cache_next);
+typedef void (*pDrawGdiPlusCacheEnd)(rdpUpdate* update, DRAW_GDIPLUS_CACHE_END_ORDER* draw_gdiplus_cache_end);
+
+typedef void (*pWindowCreate)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* window_state);
+typedef void (*pWindowUpdate)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo, WINDOW_STATE_ORDER* window_state);
+typedef void (*pWindowIcon)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo, WINDOW_ICON_ORDER* window_icon);
+typedef void (*pWindowCachedIcon)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo, WINDOW_CACHED_ICON_ORDER* window_cached_icon);
+typedef void (*pWindowDelete)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo);
+typedef void (*pNotifyIconCreate)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notify_icon_state);
+typedef void (*pNotifyIconUpdate)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo, NOTIFY_ICON_STATE_ORDER* notify_icon_state);
+typedef void (*pNotifyIconDelete)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo);
+typedef void (*pMonitoredDesktop)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo, MONITORED_DESKTOP_ORDER* monitored_desktop);
+typedef void (*pNonMonitoredDesktop)(rdpUpdate* update, WINDOW_ORDER_INFO* orderInfo);
+
+typedef void (*pSurfaceBits)(rdpUpdate* update, SURFACE_BITS_COMMAND* surface_bits_command);
+typedef void (*pSurfaceCommand)(rdpUpdate* update, STREAM* s);
 
 struct rdp_update
 {
        rdpContext* context;
 
-       pcBeginPaint BeginPaint;
-       pcEndPaint EndPaint;
-       pcSetBounds SetBounds;
-       pcSynchronize Synchronize;
-       pcDesktopResize DesktopResize;
-       pcBitmapUpdate BitmapUpdate;
-       pcPalette Palette;
-       pcPlaySound PlaySound;
-       pcPointerPosition PointerPosition;
-       pcPointerSystem PointerSystem;
-       pcPointerColor PointerColor;
-       pcPointerNew PointerNew;
-       pcPointerCached PointerCached;
-
-       pcDstBlt DstBlt;
-       pcPatBlt PatBlt;
-       pcScrBlt ScrBlt;
-       pcOpaqueRect OpaqueRect;
-       pcDrawNineGrid DrawNineGrid;
-       pcMultiDstBlt MultiDstBlt;
-       pcMultiPatBlt MultiPatBlt;
-       pcMultiScrBlt MultiScrBlt;
-       pcMultiOpaqueRect MultiOpaqueRect;
-       pcMultiDrawNineGrid MultiDrawNineGrid;
-       pcLineTo LineTo;
-       pcPolyline Polyline;
-       pcMemBlt MemBlt;
-       pcMem3Blt Mem3Blt;
-       pcSaveBitmap SaveBitmap;
-       pcGlyphIndex GlyphIndex;
-       pcFastIndex FastIndex;
-       pcFastGlyph FastGlyph;
-       pcPolygonSC PolygonSC;
-       pcPolygonCB PolygonCB;
-       pcEllipseSC EllipseSC;
-       pcEllipseCB EllipseCB;
-
-       pcCacheBitmap CacheBitmap;
-       pcCacheBitmapV2 CacheBitmapV2;
-       pcCacheBitmapV3 CacheBitmapV3;
-       pcCacheColorTable CacheColorTable;
-       pcCacheGlyph CacheGlyph;
-       pcCacheGlyphV2 CacheGlyphV2;
-       pcCacheBrush CacheBrush;
-
-       pcCreateOffscreenBitmap CreateOffscreenBitmap;
-       pcSwitchSurface SwitchSurface;
-       pcCreateNineGridBitmap CreateNineGridBitmap;
-       pcFrameMarker FrameMarker;
-       pcStreamBitmapFirst StreamBitmapFirst;
-       pcStreamBitmapNext StreamBitmapNext;
-       pcDrawGdiPlusFirst DrawGdiPlusFirst;
-       pcDrawGdiPlusNext DrawGdiPlusNext;
-       pcDrawGdiPlusEnd DrawGdiPlusEnd;
-       pcDrawGdiPlusCacheFirst DrawGdiPlusCacheFirst;
-       pcDrawGdiPlusCacheNext DrawGdiPlusCacheNext;
-       pcDrawGdiPlusCacheEnd DrawGdiPlusCacheEnd;
-
-       pcWindowCreate WindowCreate;
-       pcWindowUpdate WindowUpdate;
-       pcWindowIcon WindowIcon;
-       pcWindowCachedIcon WindowCachedIcon;
-       pcWindowDelete WindowDelete;
-       pcNotifyIconCreate NotifyIconCreate;
-       pcNotifyIconUpdate NotifyIconUpdate;
-       pcNotifyIconDelete NotifyIconDelete;
-       pcMonitoredDesktop MonitoredDesktop;
-       pcNonMonitoredDesktop NonMonitoredDesktop;
-
-       pcSurfaceBits SurfaceBits;
-       pcSurfaceCommand SurfaceCommand;
+       pBeginPaint BeginPaint;
+       pEndPaint EndPaint;
+       pSetBounds SetBounds;
+       pSynchronize Synchronize;
+       pDesktopResize DesktopResize;
+       pBitmapUpdate BitmapUpdate;
+       pPalette Palette;
+       pPlaySound PlaySound;
+       pPointerPosition PointerPosition;
+       pPointerSystem PointerSystem;
+       pPointerColor PointerColor;
+       pPointerNew PointerNew;
+       pPointerCached PointerCached;
+
+       pDstBlt DstBlt;
+       pPatBlt PatBlt;
+       pScrBlt ScrBlt;
+       pOpaqueRect OpaqueRect;
+       pDrawNineGrid DrawNineGrid;
+       pMultiDstBlt MultiDstBlt;
+       pMultiPatBlt MultiPatBlt;
+       pMultiScrBlt MultiScrBlt;
+       pMultiOpaqueRect MultiOpaqueRect;
+       pMultiDrawNineGrid MultiDrawNineGrid;
+       pLineTo LineTo;
+       pPolyline Polyline;
+       pMemBlt MemBlt;
+       pMem3Blt Mem3Blt;
+       pSaveBitmap SaveBitmap;
+       pGlyphIndex GlyphIndex;
+       pFastIndex FastIndex;
+       pFastGlyph FastGlyph;
+       pPolygonSC PolygonSC;
+       pPolygonCB PolygonCB;
+       pEllipseSC EllipseSC;
+       pEllipseCB EllipseCB;
+
+       pCacheBitmap CacheBitmap;
+       pCacheBitmapV2 CacheBitmapV2;
+       pCacheBitmapV3 CacheBitmapV3;
+       pCacheColorTable CacheColorTable;
+       pCacheGlyph CacheGlyph;
+       pCacheGlyphV2 CacheGlyphV2;
+       pCacheBrush CacheBrush;
+
+       pCreateOffscreenBitmap CreateOffscreenBitmap;
+       pSwitchSurface SwitchSurface;
+       pCreateNineGridBitmap CreateNineGridBitmap;
+       pFrameMarker FrameMarker;
+       pStreamBitmapFirst StreamBitmapFirst;
+       pStreamBitmapNext StreamBitmapNext;
+       pDrawGdiPlusFirst DrawGdiPlusFirst;
+       pDrawGdiPlusNext DrawGdiPlusNext;
+       pDrawGdiPlusEnd DrawGdiPlusEnd;
+       pDrawGdiPlusCacheFirst DrawGdiPlusCacheFirst;
+       pDrawGdiPlusCacheNext DrawGdiPlusCacheNext;
+       pDrawGdiPlusCacheEnd DrawGdiPlusCacheEnd;
+
+       pWindowCreate WindowCreate;
+       pWindowUpdate WindowUpdate;
+       pWindowIcon WindowIcon;
+       pWindowCachedIcon WindowCachedIcon;
+       pWindowDelete WindowDelete;
+       pNotifyIconCreate NotifyIconCreate;
+       pNotifyIconUpdate NotifyIconUpdate;
+       pNotifyIconDelete NotifyIconDelete;
+       pMonitoredDesktop MonitoredDesktop;
+       pNonMonitoredDesktop NonMonitoredDesktop;
+
+       pSurfaceBits SurfaceBits;
+       pSurfaceCommand SurfaceCommand;
 
        boolean glyph_v2;
 
index 4ae83f8..587a615 100644 (file)
  * limitations under the License.
  */
 
+#include <freerdp/update.h>
+#include <freerdp/freerdp.h>
 #include <freerdp/utils/stream.h>
 #include <freerdp/utils/memory.h>
 
 #include <freerdp/cache/brush.h>
 
+void update_gdi_patblt(rdpUpdate* update, PATBLT_ORDER* patblt)
+{
+       rdpBrush* brush = &patblt->brush;
+       rdpCache* cache = update->context->cache;
+
+       if (brush->style & CACHED_BRUSH)
+       {
+               brush->data = brush_cache_get(cache->brush, brush->index, &brush->bpp);
+               brush->style = 0x03;
+       }
+
+       IFCALL(cache->brush->PatBlt, update, patblt);
+}
+
+void update_gdi_cache_brush(rdpUpdate* update, CACHE_BRUSH_ORDER* cache_brush)
+{
+       rdpCache* cache = update->context->cache;
+       brush_cache_put(cache->brush, cache_brush->index, cache_brush->data, cache_brush->bpp);
+}
+
 void* brush_cache_get(rdpBrushCache* brush, uint8 index, uint8* bpp)
 {
        void* entry;
@@ -84,6 +106,16 @@ void brush_cache_put(rdpBrushCache* brush, uint8 index, void* entry, uint8 bpp)
        }
 }
 
+void brush_cache_register_callbacks(rdpUpdate* update)
+{
+       rdpCache* cache = update->context->cache;
+
+       cache->brush->PatBlt = update->PatBlt;
+
+       update->PatBlt = update_gdi_patblt;
+       update->CacheBrush = update_gdi_cache_brush;
+}
+
 rdpBrushCache* brush_cache_new(rdpSettings* settings)
 {
        rdpBrushCache* brush;
index 4879898..a50de67 100644 (file)
@@ -128,16 +128,13 @@ boolean freerdp_disconnect(freerdp* instance)
 void freerdp_context_new(freerdp* instance)
 {
        rdpRdp* rdp;
-       uint32 size = sizeof(rdpContext);
 
        rdp = rdp_new(instance);
        instance->input = rdp->input;
        instance->update = rdp->update;
        instance->settings = rdp->settings;
 
-       IFCALL(instance->ContextSize, instance, &size);
-
-       instance->context = (rdpContext*) xzalloc(size);
+       instance->context = (rdpContext*) xzalloc(instance->context_size);
        instance->context->graphics = graphics_new(instance->context);
        instance->context->instance = instance;
        instance->context->rdp = rdp;
@@ -162,6 +159,7 @@ freerdp* freerdp_new()
 
        if (instance != NULL)
        {
+               instance->context_size = sizeof(rdpContext);
                instance->SendChannelData = freerdp_send_channel_data;
        }
 
index 91d6ccf..89ed2b3 100644 (file)
@@ -232,6 +232,4 @@ void update_read_draw_gdiplus_cache_first_order(STREAM* s, DRAW_GDIPLUS_CACHE_FI
 void update_read_draw_gdiplus_cache_next_order(STREAM* s, DRAW_GDIPLUS_CACHE_NEXT_ORDER* draw_gdiplus_cache_next);
 void update_read_draw_gdiplus_cache_end_order(STREAM* s, DRAW_GDIPLUS_CACHE_END_ORDER* draw_gdiplus_cache_end);
 
-#define WITH_DEBUG_ORDERS      1
-
 #endif /* __ORDERS_H */
index 33f8d00..6c52149 100644 (file)
@@ -31,7 +31,7 @@
 
 #include <freerdp/gdi/bitmap.h>
 
-pBitBlt BitBlt_[5] =
+p_BitBlt BitBlt_[5] =
 {
        NULL,
        BitBlt_8bpp,
@@ -180,7 +180,7 @@ HGDI_BITMAP gdi_CreateCompatibleBitmap(HGDI_DC hdc, int nWidth, int nHeight)
 
 int gdi_BitBlt(HGDI_DC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HGDI_DC hdcSrc, int nXSrc, int nYSrc, int rop)
 {
-       pBitBlt _BitBlt = BitBlt_[IBPP(hdcDest->bitsPerPixel)];
+       p_BitBlt _BitBlt = BitBlt_[IBPP(hdcDest->bitsPerPixel)];
 
        if (_BitBlt != NULL)
                return _BitBlt(hdcDest, nXDest, nYDest, nWidth, nHeight, hdcSrc, nXSrc, nYSrc, rop);
index 8abc866..c93b29e 100644 (file)
@@ -32,7 +32,7 @@
 
 #include <freerdp/gdi/brush.h>
 
-pPatBlt PatBlt_[5] =
+p_PatBlt PatBlt_[5] =
 {
        NULL,
        PatBlt_8bpp,
@@ -87,7 +87,7 @@ HGDI_BRUSH gdi_CreatePatternBrush(HGDI_BITMAP hbmp)
 
 int gdi_PatBlt(HGDI_DC hdc, int nXLeft, int nYLeft, int nWidth, int nHeight, int rop)
 {
-       pPatBlt _PatBlt = PatBlt_[IBPP(hdc->bitsPerPixel)];
+       p_PatBlt _PatBlt = PatBlt_[IBPP(hdc->bitsPerPixel)];
 
        if (_PatBlt != NULL)
                return _PatBlt(hdc, nXLeft, nYLeft, nWidth, nHeight, rop);
index a47c4a2..ed3b2d0 100644 (file)
@@ -464,16 +464,9 @@ void gdi_patblt(rdpUpdate* update, PATBLT_ORDER* patblt)
        rdpBrush* brush;
        HGDI_BRUSH originalBrush;
        rdpGdi* gdi = update->context->gdi;
-       rdpCache* cache = update->context->cache;
 
        brush = &patblt->brush;
 
-       if (brush->style & CACHED_BRUSH)
-       {
-               brush->data = brush_cache_get(cache->brush, brush->index, &brush->bpp);
-               brush->style = GDI_BS_PATTERN;
-       }
-
        if (brush->style == GDI_BS_SOLID)
        {
                uint32 color;
@@ -782,12 +775,6 @@ void gdi_cache_glyph_v2(rdpUpdate* update, CACHE_GLYPH_V2_ORDER* cache_glyph_v2)
        }
 }
 
-void gdi_cache_brush(rdpUpdate* update, CACHE_BRUSH_ORDER* cache_brush)
-{
-       rdpCache* cache = update->context->cache;
-       brush_cache_put(cache->brush, cache_brush->index, cache_brush->data, cache_brush->bpp);
-}
-
 int tilenum = 0;
 
 void gdi_surface_bits(rdpUpdate* update, SURFACE_BITS_COMMAND* surface_bits_command)
@@ -937,7 +924,6 @@ void gdi_register_update_callbacks(rdpUpdate* update)
        update->CacheColorTable = gdi_cache_color_table;
        update->CacheGlyph = gdi_cache_glyph;
        update->CacheGlyphV2 = gdi_cache_glyph_v2;
-       update->CacheBrush = gdi_cache_brush;
 
        update->SurfaceBits = gdi_surface_bits;
 }
@@ -1061,6 +1047,7 @@ int gdi_init(freerdp* instance, uint32 flags, uint8* buffer)
 
        gdi_register_update_callbacks(instance->update);
 
+       brush_cache_register_callbacks(instance->update);
        bitmap_cache_register_callbacks(instance->update);
        offscreen_cache_register_callbacks(instance->update);
 
index b506d49..014e904 100644 (file)
@@ -30,7 +30,7 @@
 
 #include <freerdp/gdi/line.h>
 
-pLineTo LineTo_[5] =
+p_LineTo LineTo_[5] =
 {
        NULL,
        LineTo_8bpp,
@@ -50,7 +50,7 @@ pLineTo LineTo_[5] =
 
 int gdi_LineTo(HGDI_DC hdc, int nXEnd, int nYEnd)
 {
-       pLineTo _LineTo = LineTo_[IBPP(hdc->bitsPerPixel)];
+       p_LineTo _LineTo = LineTo_[IBPP(hdc->bitsPerPixel)];
 
        if (_LineTo != NULL)
                return _LineTo(hdc, nXEnd, nYEnd);
@@ -68,6 +68,7 @@ int gdi_LineTo(HGDI_DC hdc, int nXEnd, int nYEnd)
 int gdi_PolylineTo(HGDI_DC hdc, GDI_POINT *lppt, int cCount)
 {
        int i;
+
        for (i = 0; i < cCount; i++)
        {
                gdi_LineTo(hdc, lppt[i].x, lppt[i].y);
index 7a148a2..4ae449a 100644 (file)
@@ -30,7 +30,7 @@
 
 #include <freerdp/gdi/shape.h>
 
-pFillRect FillRect_[5] =
+p_FillRect FillRect_[5] =
 {
        NULL,
        FillRect_8bpp,
@@ -175,7 +175,7 @@ int gdi_Ellipse(HGDI_DC hdc, int nLeftRect, int nTopRect, int nRightRect, int nB
 
 int gdi_FillRect(HGDI_DC hdc, HGDI_RECT rect, HGDI_BRUSH hbr)
 {
-       pFillRect _FillRect = FillRect_[IBPP(hdc->bitsPerPixel)];
+       p_FillRect _FillRect = FillRect_[IBPP(hdc->bitsPerPixel)];
 
        if (_FillRect != NULL)
                return _FillRect(hdc, rect, hbr);