XPixmapFormatValues *pfs;
XWindowAttributes window_attributes;
pfs = XListPixmapFormats(xfc->display, &pf_count);
- if(pfs == NULL)
+
+ if (pfs == NULL)
{
WLog_ERR(TAG, "XListPixmapFormats failed");
return 1;
}
- for(i = 0; i < pf_count; i++)
+
+ for (i = 0; i < pf_count; i++)
{
pf = pfs + i;
- if(pf->depth == xfc->depth)
+
+ if (pf->depth == xfc->depth)
{
xfc->bpp = pf->bits_per_pixel;
xfc->scanline_pad = pf->scanline_pad;
break;
}
}
+
XFree(pfs);
+
ZeroMemory(&template, sizeof(template));
template.class = TrueColor;
template.screen = xfc->screen_number;
- if(XGetWindowAttributes(xfc->display, RootWindowOfScreen(xfc->screen), &window_attributes) == 0)
+
+ if (XGetWindowAttributes(xfc->display, RootWindowOfScreen(xfc->screen), &window_attributes) == 0)
{
WLog_ERR(TAG, "XGetWindowAttributes failed");
return FALSE;
}
+
vis = XGetVisualInfo(xfc->display, VisualClassMask | VisualScreenMask, &template, &vi_count);
- if(vis == NULL)
+
+ if (vis == NULL)
{
WLog_ERR(TAG, "XGetVisualInfo failed");
return FALSE;
}
+
vi = NULL;
- for(i = 0; i < vi_count; i++)
+
+ for (i = 0; i < vi_count; i++)
{
vi = vis + i;
if(vi->visual == window_attributes.visual)
break;
}
}
- if(vi)
+
+ if (vi)
{
/*
* Detect if the server visual has an inverted colormap
* (BGR vs RGB, or red being the least significant byte)
*/
- if(vi->red_mask & 0xFF)
+ if (vi->red_mask & 0xFF)
{
- xfc->clrconv->invert = TRUE;
+ xfc->invert = TRUE;
}
}
+
XFree(vis);
- if((xfc->visual == NULL) || (xfc->scanline_pad == 0))
+
+ if ((xfc->visual == NULL) || (xfc->scanline_pad == 0))
{
return FALSE;
}
+
return TRUE;
}
xf_keyboard_init(xfc);
- xfc->clrconv = freerdp_clrconv_new(CLRCONV_ALPHA);
instance->context->cache = cache_new(instance->settings);
xfc->xfds = ConnectionNumber(xfc->display);
*/
BOOL xf_post_connect(freerdp *instance)
{
+ UINT32 flags;
XGCValues gcv;
rdpCache* cache;
rdpChannels* channels;
xf_register_graphics(instance->context->graphics);
+ flags = CLRCONV_ALPHA;
+
+ if (xfc->bpp > 16)
+ flags |= CLRBUF_32BPP;
+ else
+ flags |= CLRBUF_16BPP;
+
if (settings->SoftwareGdi)
{
rdpGdi* gdi;
- UINT32 flags;
- flags = CLRCONV_ALPHA;
-
- if (xfc->bpp > 16)
- flags |= CLRBUF_32BPP;
- else
- flags |= CLRBUF_16BPP;
gdi_init(instance, flags, NULL);
{
xfc->srcBpp = settings->ColorDepth;
xf_gdi_register_update_callbacks(instance->update);
- xfc->hdc = gdi_CreateDC(xfc->clrconv, xfc->bpp);
+ xfc->hdc = gdi_CreateDC(flags, xfc->bpp);
}
xfc->originalWidth = settings->DesktopWidth;
context->rail = NULL;
}
- if (xfc->clrconv)
- {
- freerdp_clrconv_free(xfc->clrconv);
- xfc->clrconv = NULL;
- }
-
if (xfc->hdc)
{
gdi_DeleteDC(xfc->hdc);
xf_lock_x11(xfc, FALSE);
- CopyMemory(xfc->clrconv->palette, palette, sizeof(rdpPalette));
-
palette32 = (UINT32*) xfc->palette;
for (index = 0; index < palette->number; index++)
xfc = (xfContext*) rail->extra;
xfw = (xfWindow*) window->extra;
icon->extra = freerdp_icon_convert(icon->entry->bitsColor, NULL, icon->entry->bitsMask,
- icon->entry->width, icon->entry->height, icon->entry->bpp, rail->clrconv);
+ icon->entry->width, icon->entry->height, icon->entry->bpp, rail->clrconv);
xf_SetWindowIcon(xfc, xfw, icon);
}
int current_desktop;
BOOL remote_app;
BOOL disconnect;
- HCLRCONV clrconv;
HANDLE mutex;
BOOL UseXThreads;
BOOL cursorHidden;
#include <freerdp/gdi/gdi.h>
FREERDP_API HGDI_DC gdi_GetDC(void);
-FREERDP_API HGDI_DC gdi_CreateDC(HCLRCONV clrconv, int bpp);
+FREERDP_API HGDI_DC gdi_CreateDC(UINT32 flags, int bpp);
FREERDP_API HGDI_DC gdi_CreateCompatibleDC(HGDI_DC hdc);
FREERDP_API HGDIOBJECT gdi_SelectObject(HGDI_DC hdc, HGDIOBJECT hgdiobject);
FREERDP_API int gdi_DeleteObject(HGDIOBJECT hgdiobject);
BOOL invert;
HGDI_DC hdc;
UINT32 format;
- HCLRCONV clrconv;
gdiBitmap* primary;
gdiBitmap* drawing;
UINT32 bitmap_size;
* @return new device context
*/
-HGDI_DC gdi_CreateDC(HCLRCONV clrconv, int bpp)
+HGDI_DC gdi_CreateDC(UINT32 flags, int bpp)
{
HGDI_DC hDC = (HGDI_DC) malloc(sizeof(GDI_DC));
hDC->bitsPerPixel = bpp;
hDC->bytesPerPixel = bpp / 8;
- hDC->alpha = clrconv->alpha;
- hDC->invert = clrconv->invert;
- hDC->rgb555 = clrconv->rgb555;
+ hDC->alpha = (flags & CLRCONV_ALPHA) ? TRUE : FALSE;
+ hDC->invert = (flags & CLRCONV_INVERT) ? TRUE : FALSE;
+ hDC->rgb555 = (flags & CLRCONV_RGB555) ? TRUE : FALSE;
hDC->hwnd = (HGDI_WND) malloc(sizeof(GDI_WND));
hDC->hwnd->invalid = gdi_CreateRectRgn(0, 0, 0, 0);
UINT32* palette32;
rdpGdi* gdi = context->gdi;
- CopyMemory(gdi->clrconv->palette, palette, sizeof(rdpPalette));
-
palette32 = (UINT32*) gdi->palette;
for (index = 0; index < palette->number; index++)
gdi->hdc->bitsPerPixel = gdi->dstBpp;
gdi->hdc->bytesPerPixel = gdi->bytesPerPixel;
- gdi->clrconv = (HCLRCONV) malloc(sizeof(CLRCONV));
-
- if (!gdi->clrconv)
- return -1;
-
- gdi->clrconv->alpha = (flags & CLRCONV_ALPHA) ? TRUE : FALSE;
- gdi->clrconv->invert = (flags & CLRCONV_INVERT) ? TRUE : FALSE;
- gdi->clrconv->rgb555 = (flags & CLRCONV_RGB555) ? TRUE : FALSE;
- gdi->clrconv->palette = (rdpPalette*) malloc(sizeof(rdpPalette));
-
- if (!gdi->clrconv->palette)
- return -1;
-
- gdi->hdc->alpha = gdi->clrconv->alpha;
- gdi->hdc->invert = gdi->clrconv->invert;
- gdi->hdc->rgb555 = gdi->clrconv->rgb555;
+ gdi->hdc->alpha = (flags & CLRCONV_ALPHA) ? TRUE : FALSE;
+ gdi->hdc->invert = (flags & CLRCONV_INVERT) ? TRUE : FALSE;
+ gdi->hdc->rgb555 = (flags & CLRCONV_RGB555) ? TRUE : FALSE;
gdi_init_primary(gdi);
gdi_bitmap_free_ex(gdi->image);
gdi_DeleteDC(gdi->hdc);
_aligned_free(gdi->bitmap_buffer);
- free(gdi->clrconv->palette);
- free(gdi->clrconv);
free(gdi);
}