update: move primary orders into sub-interface
authorMarc-André Moreau <marcandre.moreau@gmail.com>
Mon, 21 Nov 2011 23:11:43 +0000 (18:11 -0500)
committerMarc-André Moreau <marcandre.moreau@gmail.com>
Mon, 21 Nov 2011 23:11:43 +0000 (18:11 -0500)
client/X11/xf_gdi.c
cunit/test_orders.c
include/freerdp/primary.h
include/freerdp/update.h
libfreerdp-cache/bitmap.c
libfreerdp-cache/brush.c
libfreerdp-cache/glyph.c
libfreerdp-core/freerdp.c
libfreerdp-core/orders.c
libfreerdp-core/update.c
libfreerdp-gdi/gdi.c

index b136e0f..30d6b91 100644 (file)
@@ -288,9 +288,9 @@ void xf_gdi_set_bounds(rdpUpdate* update, BOUNDS* bounds)
        }
 }
 
-void xf_gdi_dstblt(rdpUpdate* update, DSTBLT_ORDER* dstblt)
+void xf_gdi_dstblt(rdpContext* context, DSTBLT_ORDER* dstblt)
 {
-       xfInfo* xfi = ((xfContext*) update->context)->xfi;
+       xfInfo* xfi = ((xfContext*) context)->xfi;
 
        xf_set_rop3(xfi, gdi_rop3_code(dstblt->bRop));
 
@@ -312,13 +312,13 @@ void xf_gdi_dstblt(rdpUpdate* update, DSTBLT_ORDER* dstblt)
        XSetFunction(xfi->display, xfi->gc, GXcopy);
 }
 
-void xf_gdi_patblt(rdpUpdate* update, PATBLT_ORDER* patblt)
+void xf_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
 {
        Pixmap pattern;
        rdpBrush* brush;
        uint32 foreColor;
        uint32 backColor;
-       xfInfo* xfi = ((xfContext*) update->context)->xfi;
+       xfInfo* xfi = ((xfContext*) context)->xfi;
 
        brush = &patblt->brush;
        xf_set_rop3(xfi, gdi_rop3_code(patblt->bRop));
@@ -385,9 +385,9 @@ void xf_gdi_patblt(rdpUpdate* update, PATBLT_ORDER* patblt)
        XSetFunction(xfi->display, xfi->gc, GXcopy);
 }
 
-void xf_gdi_scrblt(rdpUpdate* update, SCRBLT_ORDER* scrblt)
+void xf_gdi_scrblt(rdpContext* context, SCRBLT_ORDER* scrblt)
 {
-       xfInfo* xfi = ((xfContext*) update->context)->xfi;
+       xfInfo* xfi = ((xfContext*) context)->xfi;
 
        xf_set_rop3(xfi, gdi_rop3_code(scrblt->bRop));
 
@@ -419,10 +419,10 @@ void xf_gdi_scrblt(rdpUpdate* update, SCRBLT_ORDER* scrblt)
        XSetFunction(xfi->display, xfi->gc, GXcopy);
 }
 
-void xf_gdi_opaque_rect(rdpUpdate* update, OPAQUE_RECT_ORDER* opaque_rect)
+void xf_gdi_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect)
 {
        uint32 color;
-       xfInfo* xfi = ((xfContext*) update->context)->xfi;
+       xfInfo* xfi = ((xfContext*) context)->xfi;
 
        color = freerdp_color_convert(opaque_rect->color, xfi->srcBpp, 32, xfi->clrconv);
 
@@ -446,12 +446,12 @@ void xf_gdi_opaque_rect(rdpUpdate* update, OPAQUE_RECT_ORDER* opaque_rect)
        }
 }
 
-void xf_gdi_multi_opaque_rect(rdpUpdate* update, MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect)
+void xf_gdi_multi_opaque_rect(rdpContext* context, MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect)
 {
        int i;
        uint32 color;
        DELTA_RECT* rectangle;
-       xfInfo* xfi = ((xfContext*) update->context)->xfi;
+       xfInfo* xfi = ((xfContext*) context)->xfi;
 
        color = freerdp_color_convert(multi_opaque_rect->color, xfi->srcBpp, 32, xfi->clrconv);
 
@@ -480,10 +480,10 @@ void xf_gdi_multi_opaque_rect(rdpUpdate* update, MULTI_OPAQUE_RECT_ORDER* multi_
        }
 }
 
-void xf_gdi_line_to(rdpUpdate* update, LINE_TO_ORDER* line_to)
+void xf_gdi_line_to(rdpContext* context, LINE_TO_ORDER* line_to)
 {
        uint32 color;
-       xfInfo* xfi = ((xfContext*) update->context)->xfi;
+       xfInfo* xfi = ((xfContext*) context)->xfi;
 
        xf_set_rop2(xfi, line_to->bRop2);
        color = freerdp_color_convert(line_to->penColor, xfi->srcBpp, 32, xfi->clrconv);
@@ -519,7 +519,7 @@ void xf_gdi_line_to(rdpUpdate* update, LINE_TO_ORDER* line_to)
        XSetFunction(xfi->display, xfi->gc, GXcopy);
 }
 
-void xf_gdi_polyline(rdpUpdate* update, POLYLINE_ORDER* polyline)
+void xf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline)
 {
        int i;
        int x, y;
@@ -529,7 +529,7 @@ void xf_gdi_polyline(rdpUpdate* update, POLYLINE_ORDER* polyline)
        uint32 color;
        XPoint* points;
        int width, height;
-       xfInfo* xfi = ((xfContext*) update->context)->xfi;
+       xfInfo* xfi = ((xfContext*) context)->xfi;
 
        xf_set_rop2(xfi, polyline->bRop2);
        color = freerdp_color_convert(polyline->penColor, xfi->srcBpp, 32, xfi->clrconv);
@@ -581,10 +581,10 @@ void xf_gdi_polyline(rdpUpdate* update, POLYLINE_ORDER* polyline)
        xfree(points);
 }
 
-void xf_gdi_memblt(rdpUpdate* update, MEMBLT_ORDER* memblt)
+void xf_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt)
 {
        xfBitmap* bitmap;
-       xfInfo* xfi = ((xfContext*) update->context)->xfi;
+       xfInfo* xfi = ((xfContext*) context)->xfi;
 
        bitmap = (xfBitmap*) memblt->bitmap;
        xf_set_rop3(xfi, gdi_rop3_code(memblt->bRop));
@@ -608,7 +608,7 @@ void xf_gdi_memblt(rdpUpdate* update, MEMBLT_ORDER* memblt)
        XSetFunction(xfi->display, xfi->gc, GXcopy);
 }
 
-void xf_gdi_mem3blt(rdpUpdate* update, MEM3BLT_ORDER* mem3blt)
+void xf_gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
 {
 
 }
@@ -738,30 +738,33 @@ void xf_gdi_surface_bits(rdpUpdate* update, SURFACE_BITS_COMMAND* surface_bits_c
 
 void xf_gdi_register_update_callbacks(rdpUpdate* update)
 {
+       rdpPrimaryUpdate* primary = update->primary;
+
        update->Palette = xf_gdi_palette_update;
        update->SetBounds = xf_gdi_set_bounds;
-       update->DstBlt = xf_gdi_dstblt;
-       update->PatBlt = xf_gdi_patblt;
-       update->ScrBlt = xf_gdi_scrblt;
-       update->OpaqueRect = xf_gdi_opaque_rect;
-       update->DrawNineGrid = NULL;
-       update->MultiDstBlt = NULL;
-       update->MultiPatBlt = NULL;
-       update->MultiScrBlt = NULL;
-       update->MultiOpaqueRect = xf_gdi_multi_opaque_rect;
-       update->MultiDrawNineGrid = NULL;
-       update->LineTo = xf_gdi_line_to;
-       update->Polyline = xf_gdi_polyline;
-       update->MemBlt = xf_gdi_memblt;
-       update->Mem3Blt = xf_gdi_mem3blt;
-       update->SaveBitmap = NULL;
-       update->GlyphIndex = NULL;
-       update->FastIndex = NULL;
-       update->FastGlyph = NULL;
-       update->PolygonSC = NULL;
-       update->PolygonCB = NULL;
-       update->EllipseSC = NULL;
-       update->EllipseCB = NULL;
+
+       primary->DstBlt = xf_gdi_dstblt;
+       primary->PatBlt = xf_gdi_patblt;
+       primary->ScrBlt = xf_gdi_scrblt;
+       primary->OpaqueRect = xf_gdi_opaque_rect;
+       primary->DrawNineGrid = NULL;
+       primary->MultiDstBlt = NULL;
+       primary->MultiPatBlt = NULL;
+       primary->MultiScrBlt = NULL;
+       primary->MultiOpaqueRect = xf_gdi_multi_opaque_rect;
+       primary->MultiDrawNineGrid = NULL;
+       primary->LineTo = xf_gdi_line_to;
+       primary->Polyline = xf_gdi_polyline;
+       primary->MemBlt = xf_gdi_memblt;
+       primary->Mem3Blt = xf_gdi_mem3blt;
+       primary->SaveBitmap = NULL;
+       primary->GlyphIndex = NULL;
+       primary->FastIndex = NULL;
+       primary->FastGlyph = NULL;
+       primary->PolygonSC = NULL;
+       primary->PolygonCB = NULL;
+       primary->EllipseSC = NULL;
+       primary->EllipseCB = NULL;
 
        update->SurfaceBits = xf_gdi_surface_bits;
 }
index bc35b96..4d60c1e 100644 (file)
@@ -739,17 +739,17 @@ uint8 orders_update_2[] =
        "\x50\x01\x01\x01\x55\x01\x50\xff\xff\xff\x16\x00\x17\x00\xea\x03"
        "\xea\x03\x02\x00\x85\x02\x16\x00\x02\x00\x00\x00\x03\x00\x14\xb2";
 
-void test_opaque_rect(rdpUpdate* update, OPAQUE_RECT_ORDER* opaque_rect)
+void test_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect)
 {
        opaque_rect_count++;
 }
 
-void test_polyline(rdpUpdate* update, POLYLINE_ORDER* polyline)
+void test_polyline(rdpContext* context, POLYLINE_ORDER* polyline)
 {
        polyline_count++;
 }
 
-void test_patblt(rdpUpdate* update, PATBLT_ORDER* patblt)
+void test_patblt(rdpContext* context, PATBLT_ORDER* patblt)
 {
        patblt_count++;
 }
@@ -766,9 +766,9 @@ void test_update_recv_orders(void)
        polyline_count = 0;
        patblt_count = 0;
 
-       update->OpaqueRect = test_opaque_rect;
-       update->Polyline = test_polyline;
-       update->PatBlt = test_patblt;
+       update->primary->OpaqueRect = test_opaque_rect;
+       update->primary->Polyline = test_polyline;
+       update->primary->PatBlt = test_patblt;
 
        s->p = s->data = orders_update_1;
 
@@ -777,7 +777,7 @@ void test_update_recv_orders(void)
        CU_ASSERT(opaque_rect_count == 5);
        CU_ASSERT(polyline_count == 2);
 
-       update->order_info.orderType = ORDER_TYPE_PATBLT;
+       update->primary->order_info.orderType = ORDER_TYPE_PATBLT;
        s->p = s->data = orders_update_2;
 
        update_recv(update, s);
index a1033b1..0adcb6e 100644 (file)
@@ -411,28 +411,28 @@ struct _ELLIPSE_CB_ORDER
 };
 typedef struct _ELLIPSE_CB_ORDER ELLIPSE_CB_ORDER;
 
-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 (*pDstBlt)(rdpContext* context, DSTBLT_ORDER* dstblt);
+typedef void (*pPatBlt)(rdpContext* context, PATBLT_ORDER* patblt);
+typedef void (*pScrBlt)(rdpContext* context, SCRBLT_ORDER* scrblt);
+typedef void (*pOpaqueRect)(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect);
+typedef void (*pDrawNineGrid)(rdpContext* context, DRAW_NINE_GRID_ORDER* draw_nine_grid);
+typedef void (*pMultiDstBlt)(rdpContext* context, MULTI_DSTBLT_ORDER* multi_dstblt);
+typedef void (*pMultiPatBlt)(rdpContext* context, MULTI_PATBLT_ORDER* multi_patblt);
+typedef void (*pMultiScrBlt)(rdpContext* context, MULTI_SCRBLT_ORDER* multi_scrblt);
+typedef void (*pMultiOpaqueRect)(rdpContext* context, MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect);
+typedef void (*pMultiDrawNineGrid)(rdpContext* context, MULTI_DRAW_NINE_GRID_ORDER* multi_draw_nine_grid);
+typedef void (*pLineTo)(rdpContext* context, LINE_TO_ORDER* line_to);
+typedef void (*pPolyline)(rdpContext* context, POLYLINE_ORDER* polyline);
+typedef void (*pMemBlt)(rdpContext* context, MEMBLT_ORDER* memblt);
+typedef void (*pMem3Blt)(rdpContext* context, MEM3BLT_ORDER* memblt);
+typedef void (*pSaveBitmap)(rdpContext* context, SAVE_BITMAP_ORDER* save_bitmap);
+typedef void (*pGlyphIndex)(rdpContext* context, GLYPH_INDEX_ORDER* glyph_index);
+typedef void (*pFastIndex)(rdpContext* context, FAST_INDEX_ORDER* fast_index);
+typedef void (*pFastGlyph)(rdpContext* context, FAST_GLYPH_ORDER* fast_glyph);
+typedef void (*pPolygonSC)(rdpContext* context, POLYGON_SC_ORDER* polygon_sc);
+typedef void (*pPolygonCB)(rdpContext* context, POLYGON_CB_ORDER* polygon_cb);
+typedef void (*pEllipseSC)(rdpContext* context, ELLIPSE_SC_ORDER* ellipse_sc);
+typedef void (*pEllipseCB)(rdpContext* context, ELLIPSE_CB_ORDER* ellipse_cb);
 
 struct rdp_primary_update
 {
index fcae5dd..cbcb767 100644 (file)
@@ -148,29 +148,8 @@ struct rdp_update
        rdpPointerUpdate* pointer; /* 32 */
        uint32 paddingC[48 - 33]; /* 33 */
 
-       pDstBlt DstBlt; /* 48 */
-       pPatBlt PatBlt; /* 49 */
-       pScrBlt ScrBlt; /* 50 */
-       pOpaqueRect OpaqueRect; /* 51 */
-       pDrawNineGrid DrawNineGrid; /* 52 */
-       pMultiDstBlt MultiDstBlt; /* 53 */
-       pMultiPatBlt MultiPatBlt; /* 54 */
-       pMultiScrBlt MultiScrBlt; /* 55 */
-       pMultiOpaqueRect MultiOpaqueRect; /* 56 */
-       pMultiDrawNineGrid MultiDrawNineGrid; /* 57 */
-       pLineTo LineTo; /* 58 */
-       pPolyline Polyline; /* 59 */
-       pMemBlt MemBlt; /* 60 */
-       pMem3Blt Mem3Blt; /* 61 */
-       pSaveBitmap SaveBitmap; /* 62 */
-       pGlyphIndex GlyphIndex; /* 63 */
-       pFastIndex FastIndex; /* 64 */
-       pFastGlyph FastGlyph; /* 65 */
-       pPolygonSC PolygonSC; /* 66 */
-       pPolygonCB PolygonCB; /* 67 */
-       pEllipseSC EllipseSC; /* 68 */
-       pEllipseCB EllipseCB; /* 69 */
-       uint32 paddingD[80 - 70]; /* 70 */
+       rdpPrimaryUpdate* primary; /* 48 */
+       uint32 paddingD[80 - 49]; /* 49 */
 
        pCacheBitmap CacheBitmap; /* 80 */
        pCacheBitmapV2 CacheBitmapV2; /* 81 */
@@ -227,30 +206,6 @@ struct rdp_update
        PALETTE_UPDATE palette_update;
        PLAY_SOUND_UPDATE play_sound;
 
-       ORDER_INFO order_info;
-       DSTBLT_ORDER dstblt;
-       PATBLT_ORDER patblt;
-       SCRBLT_ORDER scrblt;
-       OPAQUE_RECT_ORDER opaque_rect;
-       DRAW_NINE_GRID_ORDER draw_nine_grid;
-       MULTI_DSTBLT_ORDER multi_dstblt;
-       MULTI_PATBLT_ORDER multi_patblt;
-       MULTI_SCRBLT_ORDER multi_scrblt;
-       MULTI_OPAQUE_RECT_ORDER multi_opaque_rect;
-       MULTI_DRAW_NINE_GRID_ORDER multi_draw_nine_grid;
-       LINE_TO_ORDER line_to;
-       POLYLINE_ORDER polyline;
-       MEMBLT_ORDER memblt;
-       MEM3BLT_ORDER mem3blt;
-       SAVE_BITMAP_ORDER save_bitmap;
-       GLYPH_INDEX_ORDER glyph_index;
-       FAST_INDEX_ORDER fast_index;
-       FAST_GLYPH_ORDER fast_glyph;
-       POLYGON_SC_ORDER polygon_sc;
-       POLYGON_CB_ORDER polygon_cb;
-       ELLIPSE_SC_ORDER ellipse_sc;
-       ELLIPSE_CB_ORDER ellipse_cb;
-
        CACHE_BITMAP_ORDER cache_bitmap_order;
        CACHE_BITMAP_V2_ORDER cache_bitmap_v2_order;
        CACHE_BITMAP_V3_ORDER cache_bitmap_v3_order;
index 4e64b5c..43f85ce 100644 (file)
 
 #include <freerdp/cache/bitmap.h>
 
-void update_gdi_memblt(rdpUpdate* update, MEMBLT_ORDER* memblt)
+void update_gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt)
 {
        rdpBitmap* bitmap;
-       rdpCache* cache = update->context->cache;
+       rdpCache* cache = context->cache;
 
        if (memblt->cacheId == 0xFF)
                bitmap = offscreen_cache_get(cache->offscreen, memblt->cacheIndex);
@@ -34,13 +34,13 @@ void update_gdi_memblt(rdpUpdate* update, MEMBLT_ORDER* memblt)
                bitmap = bitmap_cache_get(cache->bitmap, (uint8) memblt->cacheId, memblt->cacheIndex);
 
        memblt->bitmap = bitmap;
-       IFCALL(cache->bitmap->MemBlt, update, memblt);
+       IFCALL(cache->bitmap->MemBlt, context, memblt);
 }
 
-void update_gdi_mem3blt(rdpUpdate* update, MEM3BLT_ORDER* mem3blt)
+void update_gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
 {
        rdpBitmap* bitmap;
-       rdpCache* cache = update->context->cache;
+       rdpCache* cache = context->cache;
 
        if (mem3blt->cacheId == 0xFF)
                bitmap = offscreen_cache_get(cache->offscreen, mem3blt->cacheIndex);
@@ -48,7 +48,7 @@ void update_gdi_mem3blt(rdpUpdate* update, MEM3BLT_ORDER* mem3blt)
                bitmap = bitmap_cache_get(cache->bitmap, (uint8) mem3blt->cacheId, mem3blt->cacheIndex);
 
        mem3blt->bitmap = bitmap;
-       IFCALL(cache->bitmap->Mem3Blt, update, mem3blt);
+       IFCALL(cache->bitmap->Mem3Blt, context, mem3blt);
 }
 
 void update_gdi_cache_bitmap(rdpUpdate* update, CACHE_BITMAP_ORDER* cache_bitmap)
@@ -174,11 +174,11 @@ void bitmap_cache_register_callbacks(rdpUpdate* update)
 {
        rdpCache* cache = update->context->cache;
 
-       cache->bitmap->MemBlt = update->MemBlt;
-       cache->bitmap->Mem3Blt = update->Mem3Blt;
+       cache->bitmap->MemBlt = update->primary->MemBlt;
+       cache->bitmap->Mem3Blt = update->primary->Mem3Blt;
 
-       update->MemBlt = update_gdi_memblt;
-       update->Mem3Blt = update_gdi_mem3blt;
+       update->primary->MemBlt = update_gdi_memblt;
+       update->primary->Mem3Blt = update_gdi_mem3blt;
        update->CacheBitmap = update_gdi_cache_bitmap;
        update->CacheBitmapV2 = update_gdi_cache_bitmap_v2;
        update->BitmapUpdate = update_gdi_bitmap_update;
index 587a615..5b5fe15 100644 (file)
 
 #include <freerdp/cache/brush.h>
 
-void update_gdi_patblt(rdpUpdate* update, PATBLT_ORDER* patblt)
+void update_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
 {
        rdpBrush* brush = &patblt->brush;
-       rdpCache* cache = update->context->cache;
+       rdpCache* cache = context->cache;
 
        if (brush->style & CACHED_BRUSH)
        {
@@ -35,7 +35,7 @@ void update_gdi_patblt(rdpUpdate* update, PATBLT_ORDER* patblt)
                brush->style = 0x03;
        }
 
-       IFCALL(cache->brush->PatBlt, update, patblt);
+       IFCALL(cache->brush->PatBlt, context, patblt);
 }
 
 void update_gdi_cache_brush(rdpUpdate* update, CACHE_BRUSH_ORDER* cache_brush)
@@ -110,9 +110,9 @@ void brush_cache_register_callbacks(rdpUpdate* update)
 {
        rdpCache* cache = update->context->cache;
 
-       cache->brush->PatBlt = update->PatBlt;
+       cache->brush->PatBlt = update->primary->PatBlt;
 
-       update->PatBlt = update_gdi_patblt;
+       update->primary->PatBlt = update_gdi_patblt;
        update->CacheBrush = update_gdi_cache_brush;
 }
 
index 44c13ab..a89ab60 100644 (file)
@@ -23,7 +23,7 @@
 
 #include <freerdp/cache/glyph.h>
 
-void update_process_glyph(rdpUpdate* update, uint8* data, int* index,
+void update_process_glyph(rdpContext* context, uint8* data, int* index,
                int* x, int* y, uint8 cacheId, uint8 ulCharInc, uint8 flAccel)
 {
        int offset;
@@ -32,8 +32,8 @@ void update_process_glyph(rdpUpdate* update, uint8* data, int* index,
        rdpGraphics* graphics;
        rdpGlyphCache* glyph_cache;
 
-       graphics = update->context->graphics;
-       glyph_cache = update->context->cache->glyph;
+       graphics = context->graphics;
+       glyph_cache = context->cache->glyph;
 
        cacheIndex = data[(*index)++];
 
@@ -58,14 +58,14 @@ void update_process_glyph(rdpUpdate* update, uint8* data, int* index,
 
        if (glyph != NULL)
        {
-               Glyph_Draw(update->context, glyph, glyph->x + *x, glyph->y + *y);
+               Glyph_Draw(context, glyph, glyph->x + *x, glyph->y + *y);
 
                if (flAccel & SO_CHAR_INC_EQUAL_BM_BASE)
                        *x += glyph->cx;
        }
 }
 
-void update_process_glyph_fragments(rdpUpdate* update, uint8* data, uint8 length,
+void update_process_glyph_fragments(rdpContext* context, uint8* data, uint8 length,
                uint8 cacheId, uint8 ulCharInc, uint8 flAccel, uint32 bgcolor, uint32 fgcolor, int x, int y,
                int bkX, int bkY, int bkWidth, int bkHeight, int opX, int opY, int opWidth, int opHeight)
 {
@@ -77,13 +77,13 @@ void update_process_glyph_fragments(rdpUpdate* update, uint8* data, uint8 length
        rdpGraphics* graphics;
        rdpGlyphCache* glyph_cache;
 
-       graphics = update->context->graphics;
-       glyph_cache = update->context->cache->glyph;
+       graphics = context->graphics;
+       glyph_cache = context->cache->glyph;
 
        if (opWidth > 1)
-               Glyph_BeginDraw(update->context, opX, opY, opWidth, opHeight, bgcolor, fgcolor);
+               Glyph_BeginDraw(context, opX, opY, opWidth, opHeight, bgcolor, fgcolor);
        else
-               Glyph_BeginDraw(update->context, 0, 0, 0, 0, bgcolor, fgcolor);
+               Glyph_BeginDraw(context, 0, 0, 0, 0, bgcolor, fgcolor);
 
        while (index < length)
        {
@@ -115,7 +115,7 @@ void update_process_glyph_fragments(rdpUpdate* update, uint8* data, uint8 length
 
                                        for (n = 0; n < size; n++)
                                        {
-                                               update_process_glyph(update, fragments, &n, &x, &y, cacheId, ulCharInc, flAccel);
+                                               update_process_glyph(context, fragments, &n, &x, &y, cacheId, ulCharInc, flAccel);
                                        }
                                }
 
@@ -154,32 +154,32 @@ void update_process_glyph_fragments(rdpUpdate* update, uint8* data, uint8 length
                        default:
                                printf("GLYPH_FRAGMENT_NOP\n");
 
-                               update_process_glyph(update, data, &index, &x, &y, cacheId, ulCharInc, flAccel);
+                               update_process_glyph(context, data, &index, &x, &y, cacheId, ulCharInc, flAccel);
                                index++;
                                break;
                }
        }
 
        if (opWidth > 1)
-               Glyph_EndDraw(update->context, opX, opY, opWidth, opHeight, bgcolor, fgcolor);
+               Glyph_EndDraw(context, opX, opY, opWidth, opHeight, bgcolor, fgcolor);
        else
-               Glyph_EndDraw(update->context, bkX, bkY, bkWidth, bkHeight, bgcolor, fgcolor);
+               Glyph_EndDraw(context, bkX, bkY, bkWidth, bkHeight, bgcolor, fgcolor);
 }
 
-void update_gdi_glyph_index(rdpUpdate* update, GLYPH_INDEX_ORDER* glyph_index)
+void update_gdi_glyph_index(rdpContext* context, GLYPH_INDEX_ORDER* glyph_index)
 {
 
 }
 
-void update_gdi_fast_index(rdpUpdate* update, FAST_INDEX_ORDER* fast_index)
+void update_gdi_fast_index(rdpContext* context, FAST_INDEX_ORDER* fast_index)
 {
        rdpGlyphCache* glyph_cache;
 
-       glyph_cache = update->context->cache->glyph;
+       glyph_cache = context->cache->glyph;
 
        fast_index->x = fast_index->bkLeft;
 
-       update_process_glyph_fragments(update, fast_index->data, fast_index->cbData,
+       update_process_glyph_fragments(context, fast_index->data, fast_index->cbData,
                        fast_index->cacheId, fast_index->ulCharInc, fast_index->flAccel,
                        fast_index->backColor, fast_index->foreColor, fast_index->x, fast_index->y,
                        fast_index->bkLeft, fast_index->bkTop,
@@ -304,8 +304,8 @@ void glyph_cache_fragment_put(rdpGlyphCache* glyph_cache, uint8 index, uint8 siz
 
 void glyph_cache_register_callbacks(rdpUpdate* update)
 {
-       update->GlyphIndex = update_gdi_glyph_index;
-       update->FastIndex = update_gdi_fast_index;
+       update->primary->GlyphIndex = update_gdi_glyph_index;
+       update->primary->FastIndex = update_gdi_fast_index;
        update->CacheGlyph = update_gdi_cache_glyph;
        update->CacheGlyphV2 = update_gdi_cache_glyph_v2;
 }
index 8aca4d9..ab7f6b8 100644 (file)
@@ -146,6 +146,7 @@ void freerdp_context_new(freerdp* instance)
 
        instance->update->context = instance->context;
        instance->update->pointer->context = instance->context;
+       instance->update->primary->context = instance->context;
 
        instance->input->context = instance->context;
        input_register_client_callbacks(rdp->input);
index ea18c01..d30b017 100644 (file)
@@ -1659,7 +1659,11 @@ void update_read_bounds(STREAM* s, BOUNDS* bounds)
 
 void update_recv_primary_order(rdpUpdate* update, STREAM* s, uint8 flags)
 {
-       ORDER_INFO* orderInfo = &(update->order_info);
+       ORDER_INFO* orderInfo;
+       rdpContext* context = update->context;
+       rdpPrimaryUpdate* primary = update->primary;
+
+       orderInfo = &(primary->order_info);
 
        if (flags & ORDER_TYPE_CHANGE)
                stream_read_uint8(s, orderInfo->orderType); /* orderType (1 byte) */
@@ -1687,113 +1691,113 @@ void update_recv_primary_order(rdpUpdate* update, STREAM* s, uint8 flags)
        switch (orderInfo->orderType)
        {
                case ORDER_TYPE_DSTBLT:
-                       update_read_dstblt_order(s, orderInfo, &(update->dstblt));
-                       IFCALL(update->DstBlt, update, &update->dstblt);
+                       update_read_dstblt_order(s, orderInfo, &(primary->dstblt));
+                       IFCALL(primary->DstBlt, context, &primary->dstblt);
                        break;
 
                case ORDER_TYPE_PATBLT:
-                       update_read_patblt_order(s, orderInfo, &(update->patblt));
-                       IFCALL(update->PatBlt, update, &update->patblt);
+                       update_read_patblt_order(s, orderInfo, &(primary->patblt));
+                       IFCALL(primary->PatBlt, context, &primary->patblt);
                        break;
 
                case ORDER_TYPE_SCRBLT:
-                       update_read_scrblt_order(s, orderInfo, &(update->scrblt));
-                       IFCALL(update->ScrBlt, update, &update->scrblt);
+                       update_read_scrblt_order(s, orderInfo, &(primary->scrblt));
+                       IFCALL(primary->ScrBlt, context, &primary->scrblt);
                        break;
 
                case ORDER_TYPE_OPAQUE_RECT:
-                       update_read_opaque_rect_order(s, orderInfo, &(update->opaque_rect));
-                       IFCALL(update->OpaqueRect, update, &update->opaque_rect);
+                       update_read_opaque_rect_order(s, orderInfo, &(primary->opaque_rect));
+                       IFCALL(primary->OpaqueRect, context, &primary->opaque_rect);
                        break;
 
                case ORDER_TYPE_DRAW_NINE_GRID:
-                       update_read_draw_nine_grid_order(s, orderInfo, &(update->draw_nine_grid));
-                       IFCALL(update->DrawNineGrid, update, &update->draw_nine_grid);
+                       update_read_draw_nine_grid_order(s, orderInfo, &(primary->draw_nine_grid));
+                       IFCALL(primary->DrawNineGrid, context, &primary->draw_nine_grid);
                        break;
 
                case ORDER_TYPE_MULTI_DSTBLT:
-                       update_read_multi_dstblt_order(s, orderInfo, &(update->multi_dstblt));
-                       IFCALL(update->MultiDstBlt, update, &update->multi_dstblt);
+                       update_read_multi_dstblt_order(s, orderInfo, &(primary->multi_dstblt));
+                       IFCALL(primary->MultiDstBlt, context, &primary->multi_dstblt);
                        break;
 
                case ORDER_TYPE_MULTI_PATBLT:
-                       update_read_multi_patblt_order(s, orderInfo, &(update->multi_patblt));
-                       IFCALL(update->MultiPatBlt, update, &update->multi_patblt);
+                       update_read_multi_patblt_order(s, orderInfo, &(primary->multi_patblt));
+                       IFCALL(primary->MultiPatBlt, context, &primary->multi_patblt);
                        break;
 
                case ORDER_TYPE_MULTI_SCRBLT:
-                       update_read_multi_scrblt_order(s, orderInfo, &(update->multi_scrblt));
-                       IFCALL(update->MultiScrBlt, update, &update->multi_scrblt);
+                       update_read_multi_scrblt_order(s, orderInfo, &(primary->multi_scrblt));
+                       IFCALL(primary->MultiScrBlt, context, &primary->multi_scrblt);
                        break;
 
                case ORDER_TYPE_MULTI_OPAQUE_RECT:
-                       update_read_multi_opaque_rect_order(s, orderInfo, &(update->multi_opaque_rect));
-                       IFCALL(update->MultiOpaqueRect, update, &update->multi_opaque_rect);
+                       update_read_multi_opaque_rect_order(s, orderInfo, &(primary->multi_opaque_rect));
+                       IFCALL(primary->MultiOpaqueRect, context, &primary->multi_opaque_rect);
                        break;
 
                case ORDER_TYPE_MULTI_DRAW_NINE_GRID:
-                       update_read_multi_draw_nine_grid_order(s, orderInfo, &(update->multi_draw_nine_grid));
-                       IFCALL(update->MultiDrawNineGrid, update, &update->multi_draw_nine_grid);
+                       update_read_multi_draw_nine_grid_order(s, orderInfo, &(primary->multi_draw_nine_grid));
+                       IFCALL(primary->MultiDrawNineGrid, context, &primary->multi_draw_nine_grid);
                        break;
 
                case ORDER_TYPE_LINE_TO:
-                       update_read_line_to_order(s, orderInfo, &(update->line_to));
-                       IFCALL(update->LineTo, update, &update->line_to);
+                       update_read_line_to_order(s, orderInfo, &(primary->line_to));
+                       IFCALL(primary->LineTo, context, &primary->line_to);
                        break;
 
                case ORDER_TYPE_POLYLINE:
-                       update_read_polyline_order(s, orderInfo, &(update->polyline));
-                       IFCALL(update->Polyline, update, &update->polyline);
+                       update_read_polyline_order(s, orderInfo, &(primary->polyline));
+                       IFCALL(primary->Polyline, context, &primary->polyline);
                        break;
 
                case ORDER_TYPE_MEMBLT:
-                       update_read_memblt_order(s, orderInfo, &(update->memblt));
-                       IFCALL(update->MemBlt, update, &update->memblt);
+                       update_read_memblt_order(s, orderInfo, &(primary->memblt));
+                       IFCALL(primary->MemBlt, context, &primary->memblt);
                        break;
 
                case ORDER_TYPE_MEM3BLT:
-                       update_read_mem3blt_order(s, orderInfo, &(update->mem3blt));
-                       IFCALL(update->Mem3Blt, update, &update->mem3blt);
+                       update_read_mem3blt_order(s, orderInfo, &(primary->mem3blt));
+                       IFCALL(primary->Mem3Blt, context, &primary->mem3blt);
                        break;
 
                case ORDER_TYPE_SAVE_BITMAP:
-                       update_read_save_bitmap_order(s, orderInfo, &(update->save_bitmap));
-                       IFCALL(update->SaveBitmap, update, &update->save_bitmap);
+                       update_read_save_bitmap_order(s, orderInfo, &(primary->save_bitmap));
+                       IFCALL(primary->SaveBitmap, context, &primary->save_bitmap);
                        break;
 
                case ORDER_TYPE_GLYPH_INDEX:
-                       update_read_glyph_index_order(s, orderInfo, &(update->glyph_index));
-                       IFCALL(update->GlyphIndex, update, &update->glyph_index);
+                       update_read_glyph_index_order(s, orderInfo, &(primary->glyph_index));
+                       IFCALL(primary->GlyphIndex, context, &primary->glyph_index);
                        break;
 
                case ORDER_TYPE_FAST_INDEX:
-                       update_read_fast_index_order(s, orderInfo, &(update->fast_index));
-                       IFCALL(update->FastIndex, update, &update->fast_index);
+                       update_read_fast_index_order(s, orderInfo, &(primary->fast_index));
+                       IFCALL(primary->FastIndex, context, &primary->fast_index);
                        break;
 
                case ORDER_TYPE_FAST_GLYPH:
-                       update_read_fast_glyph_order(s, orderInfo, &(update->fast_glyph));
-                       IFCALL(update->FastGlyph, update, &update->fast_glyph);
+                       update_read_fast_glyph_order(s, orderInfo, &(primary->fast_glyph));
+                       IFCALL(primary->FastGlyph, context, &primary->fast_glyph);
                        break;
 
                case ORDER_TYPE_POLYGON_SC:
-                       update_read_polygon_sc_order(s, orderInfo, &(update->polygon_sc));
-                       IFCALL(update->PolygonSC, update, &update->polygon_sc);
+                       update_read_polygon_sc_order(s, orderInfo, &(primary->polygon_sc));
+                       IFCALL(primary->PolygonSC, context, &primary->polygon_sc);
                        break;
 
                case ORDER_TYPE_POLYGON_CB:
-                       update_read_polygon_cb_order(s, orderInfo, &(update->polygon_cb));
-                       IFCALL(update->PolygonCB, update, &update->polygon_cb);
+                       update_read_polygon_cb_order(s, orderInfo, &(primary->polygon_cb));
+                       IFCALL(primary->PolygonCB, context, &primary->polygon_cb);
                        break;
 
                case ORDER_TYPE_ELLIPSE_SC:
-                       update_read_ellipse_sc_order(s, orderInfo, &(update->ellipse_sc));
-                       IFCALL(update->EllipseSC, update, &update->ellipse_sc);
+                       update_read_ellipse_sc_order(s, orderInfo, &(primary->ellipse_sc));
+                       IFCALL(primary->EllipseSC, context, &primary->ellipse_sc);
                        break;
 
                case ORDER_TYPE_ELLIPSE_CB:
-                       update_read_ellipse_cb_order(s, orderInfo, &(update->ellipse_cb));
-                       IFCALL(update->EllipseCB, update, &update->ellipse_cb);
+                       update_read_ellipse_cb_order(s, orderInfo, &(primary->ellipse_cb));
+                       IFCALL(primary->EllipseCB, context, &primary->ellipse_cb);
                        break;
 
                default:
index c7123a1..fc75559 100644 (file)
@@ -299,31 +299,33 @@ void update_recv(rdpUpdate* update, STREAM* s)
 
 void update_reset_state(rdpUpdate* update)
 {
-       memset(&update->order_info, 0, sizeof(ORDER_INFO));
-       memset(&update->dstblt, 0, sizeof(DSTBLT_ORDER));
-       memset(&update->patblt, 0, sizeof(PATBLT_ORDER));
-       memset(&update->scrblt, 0, sizeof(SCRBLT_ORDER));
-       memset(&update->opaque_rect, 0, sizeof(OPAQUE_RECT_ORDER));
-       memset(&update->draw_nine_grid, 0, sizeof(DRAW_NINE_GRID_ORDER));
-       memset(&update->multi_dstblt, 0, sizeof(MULTI_DSTBLT_ORDER));
-       memset(&update->multi_patblt, 0, sizeof(MULTI_PATBLT_ORDER));
-       memset(&update->multi_scrblt, 0, sizeof(MULTI_SCRBLT_ORDER));
-       memset(&update->multi_opaque_rect, 0, sizeof(MULTI_OPAQUE_RECT_ORDER));
-       memset(&update->multi_draw_nine_grid, 0, sizeof(MULTI_DRAW_NINE_GRID_ORDER));
-       memset(&update->line_to, 0, sizeof(LINE_TO_ORDER));
-       memset(&update->polyline, 0, sizeof(POLYLINE_ORDER));
-       memset(&update->memblt, 0, sizeof(MEMBLT_ORDER));
-       memset(&update->mem3blt, 0, sizeof(MEM3BLT_ORDER));
-       memset(&update->save_bitmap, 0, sizeof(SAVE_BITMAP_ORDER));
-       memset(&update->glyph_index, 0, sizeof(GLYPH_INDEX_ORDER));
-       memset(&update->fast_index, 0, sizeof(FAST_INDEX_ORDER));
-       memset(&update->fast_glyph, 0, sizeof(FAST_GLYPH_ORDER));
-       memset(&update->polygon_sc, 0, sizeof(POLYGON_SC_ORDER));
-       memset(&update->polygon_cb, 0, sizeof(POLYGON_CB_ORDER));
-       memset(&update->ellipse_sc, 0, sizeof(ELLIPSE_SC_ORDER));
-       memset(&update->ellipse_cb, 0, sizeof(ELLIPSE_CB_ORDER));
-
-       update->order_info.orderType = ORDER_TYPE_PATBLT;
+       rdpPrimaryUpdate* primary = update->primary;
+
+       memset(&primary->order_info, 0, sizeof(ORDER_INFO));
+       memset(&primary->dstblt, 0, sizeof(DSTBLT_ORDER));
+       memset(&primary->patblt, 0, sizeof(PATBLT_ORDER));
+       memset(&primary->scrblt, 0, sizeof(SCRBLT_ORDER));
+       memset(&primary->opaque_rect, 0, sizeof(OPAQUE_RECT_ORDER));
+       memset(&primary->draw_nine_grid, 0, sizeof(DRAW_NINE_GRID_ORDER));
+       memset(&primary->multi_dstblt, 0, sizeof(MULTI_DSTBLT_ORDER));
+       memset(&primary->multi_patblt, 0, sizeof(MULTI_PATBLT_ORDER));
+       memset(&primary->multi_scrblt, 0, sizeof(MULTI_SCRBLT_ORDER));
+       memset(&primary->multi_opaque_rect, 0, sizeof(MULTI_OPAQUE_RECT_ORDER));
+       memset(&primary->multi_draw_nine_grid, 0, sizeof(MULTI_DRAW_NINE_GRID_ORDER));
+       memset(&primary->line_to, 0, sizeof(LINE_TO_ORDER));
+       memset(&primary->polyline, 0, sizeof(POLYLINE_ORDER));
+       memset(&primary->memblt, 0, sizeof(MEMBLT_ORDER));
+       memset(&primary->mem3blt, 0, sizeof(MEM3BLT_ORDER));
+       memset(&primary->save_bitmap, 0, sizeof(SAVE_BITMAP_ORDER));
+       memset(&primary->glyph_index, 0, sizeof(GLYPH_INDEX_ORDER));
+       memset(&primary->fast_index, 0, sizeof(FAST_INDEX_ORDER));
+       memset(&primary->fast_glyph, 0, sizeof(FAST_GLYPH_ORDER));
+       memset(&primary->polygon_sc, 0, sizeof(POLYGON_SC_ORDER));
+       memset(&primary->polygon_cb, 0, sizeof(POLYGON_CB_ORDER));
+       memset(&primary->ellipse_sc, 0, sizeof(ELLIPSE_SC_ORDER));
+       memset(&primary->ellipse_cb, 0, sizeof(ELLIPSE_CB_ORDER));
+
+       primary->order_info.orderType = ORDER_TYPE_PATBLT;
        update->switch_surface.bitmapId = SCREEN_BITMAP_SURFACE;
        IFCALL(update->SwitchSurface, update, &(update->switch_surface));
 }
@@ -410,10 +412,10 @@ static void update_send_desktop_resize(rdpUpdate* update)
        rdp_server_reactivate(rdp);
 }
 
-static void update_send_pointer_system(rdpUpdate* update, POINTER_SYSTEM_UPDATE* pointer_system)
+static void update_send_pointer_system(rdpContext* context, POINTER_SYSTEM_UPDATE* pointer_system)
 {
        STREAM* s;
-       rdpRdp* rdp = update->context->rdp;
+       rdpRdp* rdp = context->rdp;
 
        s = fastpath_update_pdu_init(rdp->fastpath);
        /* updateHeader (1 byte) */
@@ -450,6 +452,7 @@ rdpUpdate* update_new(rdpRdp* rdp)
                update->bitmap_update.rectangles = (BITMAP_DATA*) xzalloc(sizeof(BITMAP_DATA) * update->bitmap_update.count);
 
                update->pointer = xnew(rdpPointerUpdate);
+               update->primary = xnew(rdpPrimaryUpdate);
        }
 
        return update;
index 4e63686..d425ad9 100644 (file)
@@ -452,20 +452,20 @@ void gdi_set_bounds(rdpUpdate* update, BOUNDS* bounds)
        }
 }
 
-void gdi_dstblt(rdpUpdate* update, DSTBLT_ORDER* dstblt)
+void gdi_dstblt(rdpContext* context, DSTBLT_ORDER* dstblt)
 {
-       rdpGdi* gdi = update->context->gdi;
+       rdpGdi* gdi = context->gdi;
 
        gdi_BitBlt(gdi->drawing->hdc, dstblt->nLeftRect, dstblt->nTopRect,
                        dstblt->nWidth, dstblt->nHeight, NULL, 0, 0, gdi_rop3_code(dstblt->bRop));
 }
 
-void gdi_patblt(rdpUpdate* update, PATBLT_ORDER* patblt)
+void gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
 {
        uint8* data;
        rdpBrush* brush;
        HGDI_BRUSH originalBrush;
-       rdpGdi* gdi = update->context->gdi;
+       rdpGdi* gdi = context->gdi;
 
        brush = &patblt->brush;
 
@@ -514,21 +514,21 @@ void gdi_patblt(rdpUpdate* update, PATBLT_ORDER* patblt)
        }
 }
 
-void gdi_scrblt(rdpUpdate* update, SCRBLT_ORDER* scrblt)
+void gdi_scrblt(rdpContext* context, SCRBLT_ORDER* scrblt)
 {
-       rdpGdi* gdi = update->context->gdi;
+       rdpGdi* gdi = context->gdi;
 
        gdi_BitBlt(gdi->drawing->hdc, scrblt->nLeftRect, scrblt->nTopRect,
                        scrblt->nWidth, scrblt->nHeight, gdi->primary->hdc,
                        scrblt->nXSrc, scrblt->nYSrc, gdi_rop3_code(scrblt->bRop));
 }
 
-void gdi_opaque_rect(rdpUpdate* update, OPAQUE_RECT_ORDER* opaque_rect)
+void gdi_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect)
 {
        GDI_RECT rect;
        HGDI_BRUSH hBrush;
        uint32 brush_color;
-       rdpGdi *gdi = update->context->gdi;
+       rdpGdi *gdi = context->gdi;
 
        gdi_CRgnToRect(opaque_rect->nLeftRect, opaque_rect->nTopRect,
                        opaque_rect->nWidth, opaque_rect->nHeight, &rect);
@@ -541,14 +541,14 @@ void gdi_opaque_rect(rdpUpdate* update, OPAQUE_RECT_ORDER* opaque_rect)
        gdi_DeleteObject((HGDIOBJECT) hBrush);
 }
 
-void gdi_multi_opaque_rect(rdpUpdate* update, MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect)
+void gdi_multi_opaque_rect(rdpContext* context, MULTI_OPAQUE_RECT_ORDER* multi_opaque_rect)
 {
        int i;
        GDI_RECT rect;
        HGDI_BRUSH hBrush;
        uint32 brush_color;
        DELTA_RECT* rectangle;
-       rdpGdi *gdi = update->context->gdi;
+       rdpGdi *gdi = context->gdi;
 
        for (i = 1; i < multi_opaque_rect->numRectangles + 1; i++)
        {
@@ -566,11 +566,11 @@ void gdi_multi_opaque_rect(rdpUpdate* update, MULTI_OPAQUE_RECT_ORDER* multi_opa
        }
 }
 
-void gdi_line_to(rdpUpdate* update, LINE_TO_ORDER* line_to)
+void gdi_line_to(rdpContext* context, LINE_TO_ORDER* line_to)
 {
        uint32 color;
        HGDI_PEN hPen;
-       rdpGdi *gdi = update->context->gdi;
+       rdpGdi *gdi = context->gdi;
 
        color = freerdp_color_convert(line_to->penColor, gdi->srcBpp, 32, gdi->clrconv);
        hPen = gdi_CreatePen(line_to->penStyle, line_to->penWidth, (GDI_COLOR) color);
@@ -583,13 +583,13 @@ void gdi_line_to(rdpUpdate* update, LINE_TO_ORDER* line_to)
        gdi_DeleteObject((HGDIOBJECT) hPen);
 }
 
-void gdi_polyline(rdpUpdate* update, POLYLINE_ORDER* polyline)
+void gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline)
 {
        int i;
        uint32 color;
        HGDI_PEN hPen;
        DELTA_POINT* points;
-       rdpGdi* gdi = update->context->gdi;
+       rdpGdi* gdi = context->gdi;
 
        color = freerdp_color_convert(polyline->penColor, gdi->srcBpp, 32, gdi->clrconv);
        hPen = gdi_CreatePen(0, 1, (GDI_COLOR) color);
@@ -608,10 +608,10 @@ void gdi_polyline(rdpUpdate* update, POLYLINE_ORDER* polyline)
        gdi_DeleteObject((HGDIOBJECT) hPen);
 }
 
-void gdi_memblt(rdpUpdate* update, MEMBLT_ORDER* memblt)
+void gdi_memblt(rdpContext* context, MEMBLT_ORDER* memblt)
 {
        gdiBitmap* bitmap;
-       rdpGdi* gdi = update->context->gdi;
+       rdpGdi* gdi = context->gdi;
 
        bitmap = (gdiBitmap*) memblt->bitmap;
 
@@ -620,7 +620,7 @@ void gdi_memblt(rdpUpdate* update, MEMBLT_ORDER* memblt)
                        memblt->nXSrc, memblt->nYSrc, gdi_rop3_code(memblt->bRop));
 }
 
-void gdi_mem3blt(rdpUpdate* update, MEM3BLT_ORDER* mem3blt)
+void gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
 {
 
 }
@@ -746,30 +746,33 @@ void gdi_surface_bits(rdpUpdate* update, SURFACE_BITS_COMMAND* surface_bits_comm
 
 void gdi_register_update_callbacks(rdpUpdate* update)
 {
+       rdpPrimaryUpdate* primary = update->primary;
+
        update->Palette = gdi_palette_update;
        update->SetBounds = gdi_set_bounds;
-       update->DstBlt = gdi_dstblt;
-       update->PatBlt = gdi_patblt;
-       update->ScrBlt = gdi_scrblt;
-       update->OpaqueRect = gdi_opaque_rect;
-       update->DrawNineGrid = NULL;
-       update->MultiDstBlt = NULL;
-       update->MultiPatBlt = NULL;
-       update->MultiScrBlt = NULL;
-       update->MultiOpaqueRect = gdi_multi_opaque_rect;
-       update->MultiDrawNineGrid = NULL;
-       update->LineTo = gdi_line_to;
-       update->Polyline = NULL;
-       update->MemBlt = gdi_memblt;
-       update->Mem3Blt = gdi_mem3blt;
-       update->SaveBitmap = NULL;
-       update->GlyphIndex = NULL;
-       update->FastIndex = NULL;
-       update->FastGlyph = NULL;
-       update->PolygonSC = NULL;
-       update->PolygonCB = NULL;
-       update->EllipseSC = NULL;
-       update->EllipseCB = NULL;
+
+       primary->DstBlt = gdi_dstblt;
+       primary->PatBlt = gdi_patblt;
+       primary->ScrBlt = gdi_scrblt;
+       primary->OpaqueRect = gdi_opaque_rect;
+       primary->DrawNineGrid = NULL;
+       primary->MultiDstBlt = NULL;
+       primary->MultiPatBlt = NULL;
+       primary->MultiScrBlt = NULL;
+       primary->MultiOpaqueRect = gdi_multi_opaque_rect;
+       primary->MultiDrawNineGrid = NULL;
+       primary->LineTo = gdi_line_to;
+       primary->Polyline = NULL;
+       primary->MemBlt = gdi_memblt;
+       primary->Mem3Blt = gdi_mem3blt;
+       primary->SaveBitmap = NULL;
+       primary->GlyphIndex = NULL;
+       primary->FastIndex = NULL;
+       primary->FastGlyph = NULL;
+       primary->PolygonSC = NULL;
+       primary->PolygonCB = NULL;
+       primary->EllipseSC = NULL;
+       primary->EllipseCB = NULL;
 
        update->SurfaceBits = gdi_surface_bits;
 }