[client,x11] remove hardware bitmap

This commit is contained in:
akallabeth 2023-11-29 11:47:44 +01:00 committed by Martin Fleisz
parent 78d736b481
commit f02375e4ec
4 changed files with 4 additions and 212 deletions

View File

@ -403,11 +403,8 @@ static BOOL xf_paint(xfContext* xfc, const GDI_RGN* region)
}
else
{
const BOOL sw =
freerdp_settings_get_bool(xfc->common.context.settings, FreeRDP_SoftwareGdi);
if (sw)
XPutImage(xfc->display, xfc->primary, xfc->gc, xfc->image, region->x, region->y,
region->x, region->y, region->w, region->h);
XPutImage(xfc->display, xfc->primary, xfc->gc, xfc->image, region->x, region->y, region->x,
region->y, region->w, region->h);
xf_draw_screen(xfc, region->x, region->y, region->w, region->h);
}
return TRUE;
@ -421,8 +418,7 @@ static BOOL xf_end_paint(rdpContext* context)
if (gdi->suppressOutput)
return TRUE;
const BOOL sw = freerdp_settings_get_bool(context->settings, FreeRDP_SoftwareGdi);
HGDI_DC hdc = sw ? gdi->primary->hdc : xfc->hdc;
HGDI_DC hdc = gdi->primary->hdc;
if (!xfc->complex_regions)
{
@ -494,33 +490,6 @@ out:
return ret;
}
static BOOL xf_hw_desktop_resize(rdpContext* context)
{
rdpGdi* gdi;
xfContext* xfc = (xfContext*)context;
rdpSettings* settings;
BOOL ret = FALSE;
WINPR_ASSERT(xfc);
gdi = context->gdi;
WINPR_ASSERT(gdi);
settings = context->settings;
WINPR_ASSERT(settings);
xf_lock_x11(xfc);
if (!gdi_resize(gdi, freerdp_settings_get_uint32(settings, FreeRDP_DesktopWidth),
freerdp_settings_get_uint32(settings, FreeRDP_DesktopHeight)))
goto out;
ret = xf_desktop_resize(context);
out:
xf_unlock_x11(xfc);
return ret;
}
static BOOL xf_process_x_events(freerdp* instance)
{
BOOL status = TRUE;
@ -630,12 +599,6 @@ BOOL xf_create_window(xfContext* xfc)
xfc->invert = FALSE;
}
if (!xfc->hdc)
{
if (!(xfc->hdc = gdi_CreateDC(xf_get_local_color_format(xfc, TRUE))))
return FALSE;
}
if (!xfc->remote_app)
{
xfc->attribs.background_pixel = BlackPixelOfScreen(xfc->screen);
@ -755,12 +718,6 @@ static void xf_window_free(xfContext* xfc)
xfc->window = NULL;
}
if (xfc->hdc)
{
gdi_DeleteDC(xfc->hdc);
xfc->hdc = NULL;
}
#if defined(CHANNEL_TSMF_CLIENT)
if (xfc->xv_context)
{
@ -1380,15 +1337,6 @@ static BOOL xf_post_connect(freerdp* instance)
if (!xf_register_pointer(context->graphics))
return FALSE;
if (!freerdp_settings_get_bool(settings, FreeRDP_SoftwareGdi))
{
if (!xf_register_graphics(context->graphics))
{
WLog_ERR(TAG, "failed to register graphics");
return FALSE;
}
}
#ifdef WITH_XRENDER
xfc->scaledWidth = freerdp_settings_get_uint32(settings, FreeRDP_DesktopWidth);
xfc->scaledHeight = freerdp_settings_get_uint32(settings, FreeRDP_DesktopHeight);
@ -1413,11 +1361,7 @@ static BOOL xf_post_connect(freerdp* instance)
}
}
if (freerdp_settings_get_bool(settings, FreeRDP_SoftwareGdi))
update->DesktopResize = xf_sw_desktop_resize;
else
update->DesktopResize = xf_hw_desktop_resize;
update->EndPaint = xf_end_paint;
update->PlaySound = xf_play_sound;
update->SetKeyboardIndicators = xf_keyboard_set_indicators;

View File

@ -98,139 +98,6 @@ BOOL xf_decode_color(xfContext* xfc, const UINT32 srcColor, XColor* color)
return TRUE;
}
/* Bitmap Class */
static BOOL xf_Bitmap_New(rdpContext* context, rdpBitmap* bitmap)
{
BOOL rc = FALSE;
UINT32 depth;
BYTE* data;
rdpGdi* gdi;
xfBitmap* xbitmap = (xfBitmap*)bitmap;
xfContext* xfc = (xfContext*)context;
if (!context || !bitmap || !context->gdi)
return FALSE;
gdi = context->gdi;
xf_lock_x11(xfc);
depth = FreeRDPGetBitsPerPixel(bitmap->format);
WINPR_ASSERT(xfc->depth != 0);
xbitmap->pixmap =
XCreatePixmap(xfc->display, xfc->drawable, bitmap->width, bitmap->height, xfc->depth);
if (!xbitmap->pixmap)
goto unlock;
if (bitmap->data)
{
XSetFunction(xfc->display, xfc->gc, GXcopy);
if ((INT64)depth != xfc->depth)
{
if (!(data = winpr_aligned_malloc(bitmap->width * bitmap->height * 4ULL, 16)))
goto unlock;
if (!freerdp_image_copy(data, gdi->dstFormat, 0, 0, 0, bitmap->width, bitmap->height,
bitmap->data, bitmap->format, 0, 0, 0, &context->gdi->palette,
FREERDP_FLIP_NONE))
{
winpr_aligned_free(data);
goto unlock;
}
winpr_aligned_free(bitmap->data);
bitmap->data = data;
bitmap->format = gdi->dstFormat;
}
WINPR_ASSERT(xfc->depth != 0);
xbitmap->image =
XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0, (char*)bitmap->data,
bitmap->width, bitmap->height, xfc->scanline_pad, 0);
if (!xbitmap->image)
goto unlock;
xbitmap->image->byte_order = LSBFirst;
xbitmap->image->bitmap_bit_order = LSBFirst;
XPutImage(xfc->display, xbitmap->pixmap, xfc->gc, xbitmap->image, 0, 0, 0, 0, bitmap->width,
bitmap->height);
}
rc = TRUE;
unlock:
xf_unlock_x11(xfc);
return rc;
}
static void xf_Bitmap_Free(rdpContext* context, rdpBitmap* bitmap)
{
xfContext* xfc = (xfContext*)context;
xfBitmap* xbitmap = (xfBitmap*)bitmap;
if (!xfc || !xbitmap)
return;
xf_lock_x11(xfc);
if (xbitmap->pixmap != 0)
{
XFreePixmap(xfc->display, xbitmap->pixmap);
xbitmap->pixmap = 0;
}
if (xbitmap->image)
{
xbitmap->image->data = NULL;
XDestroyImage(xbitmap->image);
xbitmap->image = NULL;
}
xf_unlock_x11(xfc);
winpr_aligned_free(bitmap->data);
free(xbitmap);
}
static BOOL xf_Bitmap_Paint(rdpContext* context, rdpBitmap* bitmap)
{
int width, height;
xfContext* xfc = (xfContext*)context;
xfBitmap* xbitmap = (xfBitmap*)bitmap;
BOOL ret;
if (!context || !xbitmap)
return FALSE;
width = bitmap->right - bitmap->left + 1;
height = bitmap->bottom - bitmap->top + 1;
xf_lock_x11(xfc);
XSetFunction(xfc->display, xfc->gc, GXcopy);
XPutImage(xfc->display, xfc->primary, xfc->gc, xbitmap->image, 0, 0, bitmap->left, bitmap->top,
width, height);
ret = gdi_InvalidateRegion(xfc->hdc, bitmap->left, bitmap->top, width, height);
xf_unlock_x11(xfc);
return ret;
}
static BOOL xf_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap, BOOL primary)
{
xfContext* xfc = (xfContext*)context;
if (!context || (!bitmap && !primary))
return FALSE;
xf_lock_x11(xfc);
if (primary)
xfc->drawing = xfc->primary;
else
xfc->drawing = ((xfBitmap*)bitmap)->pixmap;
xf_unlock_x11(xfc);
return TRUE;
}
static BOOL xf_Pointer_GetCursorForCurrentScale(rdpContext* context, rdpPointer* pointer,
Cursor* cursor)
{
@ -630,23 +497,6 @@ BOOL xf_register_pointer(rdpGraphics* graphics)
return TRUE;
}
BOOL xf_register_graphics(rdpGraphics* graphics)
{
rdpBitmap bitmap;
if (!graphics || !graphics->Bitmap_Prototype || !graphics->Glyph_Prototype)
return FALSE;
bitmap = *graphics->Bitmap_Prototype;
bitmap.size = sizeof(xfBitmap);
bitmap.New = xf_Bitmap_New;
bitmap.Free = xf_Bitmap_Free;
bitmap.Paint = xf_Bitmap_Paint;
bitmap.SetSurface = xf_Bitmap_SetSurface;
graphics_register_bitmap(graphics, &bitmap);
return TRUE;
}
UINT32 xf_get_local_color_format(xfContext* xfc, BOOL aligned)
{
UINT32 DstFormat;

View File

@ -24,7 +24,6 @@
#include "xfreerdp.h"
BOOL xf_register_pointer(rdpGraphics* graphics);
BOOL xf_register_graphics(rdpGraphics* graphics);
BOOL xf_decode_color(xfContext* xfc, const UINT32 srcColor, XColor* color);
UINT32 xf_get_local_color_format(xfContext* xfc, BOOL aligned);

View File

@ -177,7 +177,6 @@ struct xf_context
BOOL UseXThreads;
BOOL cursorHidden;
HGDI_DC hdc;
UINT32 bitmap_size;
BYTE* bitmap_buffer;