Merge pull request #2091 from ptsekov/software-gdi-improvements
authorMarc-André Moreau <marcandre.moreau@gmail.com>
Thu, 11 Sep 2014 17:52:16 +0000 (13:52 -0400)
committerMarc-André Moreau <marcandre.moreau@gmail.com>
Thu, 11 Sep 2014 17:52:16 +0000 (13:52 -0400)
Fix #2090

client/Windows/wf_graphics.c
client/Windows/wf_interface.c

index 039f197..67a44d0 100644 (file)
@@ -281,16 +281,25 @@ void wf_Pointer_SetDefault(wfContext* wfc)
 
 void wf_register_graphics(rdpGraphics* graphics)
 {
-       rdpBitmap bitmap;
+       wfContext* wfc;
        rdpPointer pointer;
 
-       ZeroMemory(&bitmap, sizeof(rdpBitmap));
-       bitmap.size = sizeof(wfBitmap);
-       bitmap.New = (pBitmap_New) wf_Bitmap_New;
-       bitmap.Free = (pBitmap_Free) wf_Bitmap_Free;
-       bitmap.Paint = (pBitmap_Paint) wf_Bitmap_Paint;
-       bitmap.Decompress = (pBitmap_Decompress) wf_Bitmap_Decompress;
-       bitmap.SetSurface = (pBitmap_SetSurface) wf_Bitmap_SetSurface;
+       wfc = (wfContext*) graphics->context;
+
+       if (wfc->sw_gdi == FALSE)
+       {
+               rdpBitmap bitmap;
+
+               ZeroMemory(&bitmap, sizeof(rdpBitmap));
+               bitmap.size = sizeof(wfBitmap);
+               bitmap.New = (pBitmap_New) wf_Bitmap_New;
+               bitmap.Free = (pBitmap_Free) wf_Bitmap_Free;
+               bitmap.Paint = (pBitmap_Paint) wf_Bitmap_Paint;
+               bitmap.Decompress = (pBitmap_Decompress) wf_Bitmap_Decompress;
+               bitmap.SetSurface = (pBitmap_SetSurface) wf_Bitmap_SetSurface;
+
+               graphics_register_bitmap(graphics, &bitmap);
+       }
 
        ZeroMemory(&pointer, sizeof(rdpPointer));
        pointer.size = sizeof(wfPointer);
@@ -300,6 +309,5 @@ void wf_register_graphics(rdpGraphics* graphics)
        pointer.SetNull = (pPointer_SetNull) wf_Pointer_SetNull;
        pointer.SetDefault = (pPointer_SetDefault) wf_Pointer_SetDefault;
 
-       graphics_register_bitmap(graphics, &bitmap);
        graphics_register_pointer(graphics, &pointer);
 }
index 6ed2df7..1b5caeb 100644 (file)
@@ -347,10 +347,12 @@ BOOL wf_post_connect(freerdp* instance)
 
        if (wfc->sw_gdi)
        {
-               gdi_init(instance, CLRCONV_ALPHA | CLRCONV_INVERT | CLRBUF_32BPP, NULL);
+               wfc->primary = wf_image_new(wfc, wfc->width, wfc->height, wfc->dstBpp, NULL);
+
+               gdi_init(instance, CLRCONV_ALPHA | CLRBUF_32BPP, wfc->primary->pdata);
+
                gdi = instance->context->gdi;
                wfc->hdc = gdi->primary->hdc;
-               wfc->primary = wf_image_new(wfc, wfc->width, wfc->height, wfc->dstBpp, gdi->primary_buffer);
        }
        else
        {