Fixed windows software GDI issues.
This commit is contained in:
parent
66cf000efd
commit
d1a3362a8f
@ -197,7 +197,7 @@ static BOOL wf_hw_desktop_resize(rdpContext* context)
|
||||
wfc->primary = wf_image_new(wfc, settings->DesktopWidth, settings->DesktopHeight, format, NULL);
|
||||
|
||||
if (same)
|
||||
wfc->drawing = wfc->primary;
|
||||
wfc->drawing = wfc->primary;
|
||||
}
|
||||
|
||||
if (wfc->fullscreen != TRUE)
|
||||
@ -364,7 +364,7 @@ static BOOL wf_post_connect(freerdp* instance)
|
||||
cache = instance->context->cache;
|
||||
|
||||
UINT32 format = gdi_get_pixel_format(settings->ColorDepth, FALSE);
|
||||
wfc->format = PIXEL_FORMAT_RGBX32;
|
||||
wfc->format = PIXEL_FORMAT_BGRX32;
|
||||
wfc->primary = wf_image_new(wfc,settings->DesktopWidth, settings->DesktopHeight, format, NULL);
|
||||
|
||||
if (!gdi_init_ex(instance, wfc->format, 0, wfc->primary->pdata, wf_image_free))
|
||||
@ -373,7 +373,7 @@ static BOOL wf_post_connect(freerdp* instance)
|
||||
gdi = instance->context->gdi;
|
||||
if (!settings->SoftwareGdi)
|
||||
{
|
||||
UINT32 format = gdi_get_pixel_format(settings->ColorDepth, FALSE);
|
||||
UINT32 format = gdi_get_pixel_format(settings->ColorDepth, FALSE);
|
||||
wf_gdi_register_update_callbacks(instance->update);
|
||||
wfc->primary = wf_image_new(wfc, settings->DesktopWidth, settings->DesktopHeight, format, NULL);
|
||||
}
|
||||
@ -436,10 +436,14 @@ static BOOL wf_post_connect(freerdp* instance)
|
||||
|
||||
if (!settings->SoftwareGdi)
|
||||
{
|
||||
brush_cache_register_callbacks(instance->update);
|
||||
bitmap_cache_register_callbacks(instance->update);
|
||||
offscreen_cache_register_callbacks(instance->update);
|
||||
wf_register_graphics(context->graphics);
|
||||
|
||||
wf_gdi_register_update_callbacks(instance->update);
|
||||
brush_cache_register_callbacks(instance->update);
|
||||
glyph_cache_register_callbacks(instance->update);
|
||||
bitmap_cache_register_callbacks(instance->update);
|
||||
offscreen_cache_register_callbacks(instance->update);
|
||||
palette_cache_register_callbacks(instance->update);
|
||||
}
|
||||
|
||||
if (freerdp_channels_post_connect(context->channels, instance) != CHANNEL_RC_OK)
|
||||
|
@ -160,13 +160,45 @@ static BOOL wf_Bitmap_Paint(rdpContext* context, rdpBitmap* bitmap)
|
||||
return rc;
|
||||
}
|
||||
|
||||
static BOOL wf_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap,
|
||||
BOOL primary)
|
||||
{
|
||||
wfContext* wfc = (wfContext*)context;
|
||||
wfBitmap* bmp = (wfBitmap*) bitmap;
|
||||
rdpGdi* gdi = context->gdi;
|
||||
|
||||
if (!gdi || !wfc)
|
||||
return FALSE;
|
||||
|
||||
if (primary)
|
||||
wfc->drawing = wfc->primary;
|
||||
else if (!bmp)
|
||||
return FALSE;
|
||||
else
|
||||
wfc->drawing = bmp;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Pointer Class */
|
||||
|
||||
static BOOL flip_bitmap(const BYTE* src, BYTE* dst, UINT32 scanline, UINT32 nHeight)
|
||||
{
|
||||
UINT32 x;
|
||||
BYTE* bottomLine = dst + scanline * (nHeight - 1);
|
||||
|
||||
for (x=0; x<nHeight; x++)
|
||||
{
|
||||
memcpy(bottomLine, src, scanline);
|
||||
src += scanline;
|
||||
bottomLine -= scanline;
|
||||
}
|
||||
}
|
||||
|
||||
static BOOL wf_Pointer_New(rdpContext* context, rdpPointer* pointer)
|
||||
{
|
||||
HCURSOR hCur;
|
||||
ICONINFO info;
|
||||
BYTE *data;
|
||||
ICONINFO info;
|
||||
rdpGdi* gdi;
|
||||
|
||||
if (!context || !pointer)
|
||||
@ -180,44 +212,30 @@ static BOOL wf_Pointer_New(rdpContext* context, rdpPointer* pointer)
|
||||
info.xHotspot = pointer->xPos;
|
||||
info.yHotspot = pointer->yPos;
|
||||
|
||||
data = _aligned_malloc(GetBytesPerPixel(gdi->dstFormat) * pointer->width * pointer->height, 16);
|
||||
if (!data)
|
||||
return FALSE;
|
||||
|
||||
if (!freerdp_image_copy_from_pointer_data(data, gdi->dstFormat,
|
||||
0, 0, 0, pointer->width, pointer->height,
|
||||
pointer->xorMaskData, pointer->lengthXorMask,
|
||||
pointer->andMaskData, pointer->lengthAndMask,
|
||||
pointer->xorBpp, &context->gdi->palette))
|
||||
{
|
||||
_aligned_free(data);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (pointer->xorBpp == 1)
|
||||
{
|
||||
data = (BYTE*) malloc(pointer->lengthAndMask + pointer->lengthXorMask);
|
||||
CopyMemory(data, pointer->andMaskData, pointer->lengthAndMask);
|
||||
CopyMemory(data + pointer->lengthAndMask, pointer->xorMaskData, pointer->lengthXorMask);
|
||||
info.hbmMask = CreateBitmap(pointer->width, pointer->height * 2, 1, 1, data);
|
||||
free(data);
|
||||
info.hbmColor = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
data = (BYTE*) malloc(pointer->lengthAndMask);
|
||||
// freerdp_bitmap_flip(pointer->andMaskData, data, (pointer->width + 7) / 8, pointer->height);
|
||||
info.hbmMask = CreateBitmap(pointer->width, pointer->height, 1, 1, data);
|
||||
free(data);
|
||||
data = (BYTE*) malloc(pointer->lengthXorMask);
|
||||
// freerdp_image_flip(pointer->xorMaskData, data, pointer->width, pointer->height, pointer->xorBpp);
|
||||
info.hbmColor = CreateBitmap(pointer->width, pointer->height, 1, pointer->xorBpp, data);
|
||||
free(data);
|
||||
}
|
||||
hCur = CreateIconIndirect(&info);
|
||||
((wfPointer*) pointer)->cursor = hCur;
|
||||
{
|
||||
BYTE* pdata = (BYTE*) _aligned_malloc(pointer->lengthAndMask + pointer->lengthXorMask, 16);
|
||||
CopyMemory(pdata, pointer->andMaskData, pointer->lengthAndMask);
|
||||
CopyMemory(pdata + pointer->lengthAndMask, pointer->xorMaskData, pointer->lengthXorMask);
|
||||
info.hbmMask = CreateBitmap(pointer->width, pointer->height * 2, 1, 1, pdata);
|
||||
_aligned_free(pdata);
|
||||
info.hbmColor = NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
BYTE* pdata = (BYTE*) _aligned_malloc(pointer->lengthAndMask, 16);
|
||||
flip_bitmap(pointer->andMaskData, pdata, (pointer->width + 7) / 8, pointer->height);
|
||||
info.hbmMask = CreateBitmap(pointer->width, pointer->height, 1, 1, pdata);
|
||||
_aligned_free(pdata);
|
||||
|
||||
pdata = (BYTE*) _aligned_malloc(pointer->lengthXorMask, 16);
|
||||
flip_bitmap(pointer->xorMaskData, pdata, (pointer->width + 7) / 8, pointer->height);
|
||||
info.hbmColor = CreateBitmap(pointer->width, pointer->height, 1, pointer->xorBpp, pdata);
|
||||
_aligned_free(pdata);
|
||||
}
|
||||
hCur = CreateIconIndirect(&info);
|
||||
((wfPointer*) pointer)->cursor = hCur;
|
||||
|
||||
_aligned_free(data);
|
||||
if (info.hbmMask)
|
||||
DeleteObject(info.hbmMask);
|
||||
if (info.hbmColor)
|
||||
@ -300,19 +318,26 @@ BOOL wf_register_pointer(rdpGraphics* graphics)
|
||||
BOOL wf_register_graphics(rdpGraphics* graphics)
|
||||
{
|
||||
wfContext* wfc;
|
||||
rdpGlyph glyph;
|
||||
rdpBitmap bitmap;
|
||||
|
||||
|
||||
if (!graphics)
|
||||
return FALSE;
|
||||
|
||||
wfc = (wfContext*) graphics->context;
|
||||
|
||||
ZeroMemory(&bitmap, sizeof(rdpBitmap));
|
||||
bitmap = *graphics->Bitmap_Prototype;
|
||||
bitmap.size = sizeof(wfBitmap);
|
||||
bitmap.New = wf_Bitmap_New;
|
||||
bitmap.Free = wf_Bitmap_Free;
|
||||
bitmap.Paint = wf_Bitmap_Paint;
|
||||
bitmap.SetSurface = wf_Bitmap_SetSurface;
|
||||
|
||||
graphics_register_bitmap(graphics, &bitmap);
|
||||
graphics_register_bitmap(graphics, &bitmap);
|
||||
|
||||
glyph = *graphics->Glyph_Prototype;
|
||||
|
||||
graphics_register_glyph(graphics, &glyph);
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -328,7 +328,7 @@ INLINE BOOL gdi_decode_color(rdpGdi* gdi, const UINT32 srcColor,
|
||||
*format = SrcFormat;
|
||||
|
||||
*color = ConvertColor(srcColor, SrcFormat,
|
||||
gdi->drawing->hdc->format, &gdi->palette);
|
||||
gdi->dstFormat, &gdi->palette);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1194,11 +1194,11 @@ static BOOL gdi_init_primary(rdpGdi* gdi, UINT32 stride, UINT32 format,
|
||||
gdi->hdc, gdi->width, gdi->height);
|
||||
}
|
||||
else
|
||||
{
|
||||
{
|
||||
gdi->primary->bitmap = gdi_CreateBitmapEx(gdi->width, gdi->height,
|
||||
gdi->dstFormat,
|
||||
gdi->stride,
|
||||
gdi->primary_buffer, pfree);
|
||||
buffer, pfree);
|
||||
}
|
||||
|
||||
gdi->stride = gdi->primary->bitmap->scanline;
|
||||
|
Loading…
Reference in New Issue
Block a user