Merge branch 'master' of github.com:FreeRDP/FreeRDP

This commit is contained in:
Marc-André Moreau 2011-09-07 13:46:21 -04:00
commit c8a1c59271
13 changed files with 128 additions and 20 deletions

View File

@ -129,16 +129,44 @@ void xf_end_paint(rdpUpdate* update)
void xf_desktop_resize(rdpUpdate* update)
{
GDI* gdi;
xfInfo* xfi;
boolean same;
rdpSettings* settings;
xfi = GET_XFI(update);
gdi = GET_GDI(update);
settings = xfi->instance->settings;
xfi->width = settings->width;
xfi->height = settings->height;
if (xfi->window)
xf_ResizeDesktopWindow(xfi, xfi->window, settings->width, settings->height);
if (!xfi->fullscreen)
{
xfi->width = settings->width;
xfi->height = settings->height;
if (xfi->window)
xf_ResizeDesktopWindow(xfi, xfi->window, settings->width, settings->height);
if (xfi->primary)
{
same = (xfi->primary == xfi->drawing ? True : False);
XFreePixmap(xfi->display, xfi->primary);
xfi->primary = XCreatePixmap(xfi->display, DefaultRootWindow(xfi->display),
xfi->width, xfi->height, xfi->depth);
if (same)
xfi->drawing = xfi->primary;
}
if (gdi)
gdi_resize(gdi, xfi->width, xfi->height);
if (gdi && xfi->image)
{
xfi->image->data = NULL;
XDestroyImage(xfi->image);
xfi->image = XCreateImage(xfi->display, xfi->visual, xfi->depth, ZPixmap, 0,
(char*) gdi->primary_buffer, gdi->width, gdi->height, xfi->scanline_pad, 0);
}
}
}
boolean xf_get_fds(freerdp* instance, void** rfds, int* rcount, void** wfds, int* wcount)
@ -308,7 +336,7 @@ boolean xf_pre_connect(freerdp* instance)
xf_kbd_init(xfi);
xfi->clrconv = (HCLRCONV) malloc(sizeof(CLRCONV));
xfi->clrconv = xnew(CLRCONV);
xfi->clrconv->palette = NULL;
xfi->clrconv->alpha = 1;
xfi->clrconv->invert = 0;
@ -527,6 +555,22 @@ void xf_window_free(xfInfo* xfi)
XFreePixmap(xfi->display, xfi->primary);
xfi->primary = 0;
}
if (xfi->image)
{
xfi->image->data = NULL;
XDestroyImage(xfi->image);
xfi->image = NULL;
}
if (xfi->cache)
{
cache_free(xfi->cache);
xfi->cache = NULL;
}
xfree(xfi->clrconv);
rail_free(xfi->rail);
}
void xf_free(xfInfo* xfi)
@ -631,6 +675,7 @@ int xfreerdp_run(freerdp* instance)
freerdp_chanman_close(chanman, instance);
freerdp_chanman_free(chanman);
instance->Disconnect(instance);
gdi_free(instance);
freerdp_free(instance);
xf_free(xfi);

View File

@ -25,6 +25,6 @@ install(DIRECTORY freerdp/chanman DESTINATION include/freerdp FILES_MATCHING PAT
install(DIRECTORY freerdp/cache DESTINATION include/freerdp FILES_MATCHING PATTERN "*.h")
install(DIRECTORY freerdp/gdi DESTINATION include/freerdp FILES_MATCHING PATTERN "*.h")
install(DIRECTORY freerdp/kbd DESTINATION include/freerdp FILES_MATCHING PATTERN "*.h")
install(DIRECTORY freerdp/rali DESTINATION include/freerdp FILES_MATCHING PATTERN "*.h")
install(DIRECTORY freerdp/rail DESTINATION include/freerdp FILES_MATCHING PATTERN "*.h")
install(DIRECTORY freerdp/rfx DESTINATION include/freerdp FILES_MATCHING PATTERN "*.h")
install(DIRECTORY freerdp/plugins DESTINATION include/freerdp FILES_MATCHING PATTERN "*.h")

View File

@ -262,6 +262,7 @@ FREERDP_API uint8* gdi_get_brush_pointer(HGDI_DC hdcBrush, int x, int y);
FREERDP_API int gdi_is_mono_pixel_set(uint8* data, int x, int y, int width);
FREERDP_API GDI_IMAGE* gdi_bitmap_new(GDI *gdi, int width, int height, int bpp, uint8* data);
FREERDP_API void gdi_bitmap_free(GDI_IMAGE *gdi_bmp);
FREERDP_API void gdi_resize(GDI* gdi, int width, int height);
FREERDP_API int gdi_init(freerdp* instance, uint32 flags);
FREERDP_API void gdi_free(freerdp* instance);

View File

@ -40,7 +40,9 @@ enum _RFX_PIXEL_FORMAT
RFX_PIXEL_FORMAT_BGRA,
RFX_PIXEL_FORMAT_RGBA,
RFX_PIXEL_FORMAT_BGR,
RFX_PIXEL_FORMAT_RGB
RFX_PIXEL_FORMAT_RGB,
RFX_PIXEL_FORMAT_BGR565_LE,
RFX_PIXEL_FORMAT_RGB565_LE
};
typedef enum _RFX_PIXEL_FORMAT RFX_PIXEL_FORMAT;

View File

@ -108,6 +108,8 @@ void brush_free(rdpBrush* brush)
{
if (brush != NULL)
{
xfree(brush->entries);
xfree(brush->monoEntries);
xfree(brush);
}
}

View File

@ -76,6 +76,7 @@ void color_table_free(rdpColorTable* color_table)
{
if (color_table != NULL)
{
xfree(color_table->entries);
xfree(color_table);
}
}

View File

@ -148,5 +148,9 @@ freerdp* freerdp_new()
void freerdp_free(freerdp* freerdp)
{
xfree(freerdp);
if (freerdp)
{
rdp_free(freerdp->rdp);
xfree(freerdp);
}
}

View File

@ -63,7 +63,7 @@ void tcp_get_ip_address(rdpTcp * tcp)
tcp->ip_address[sizeof(tcp->ip_address) - 1] = 0;
tcp->settings->ipv6 = 0;
tcp->settings->ip_address = tcp->ip_address;
tcp->settings->ip_address = xstrdup(tcp->ip_address);
}
void tcp_get_mac_address(rdpTcp * tcp)

View File

@ -182,6 +182,7 @@ int gdi_DeleteDC(HGDI_DC hdc)
{
if (hdc->hwnd)
{
free(hdc->hwnd->cinvalid);
free(hdc->hwnd->invalid);
free(hdc->hwnd);
}

View File

@ -885,6 +885,8 @@ void gdi_surface_bits(rdpUpdate* update, SURFACE_BITS_COMMAND* surface_bits_comm
{
printf("Unsupported codecID %d\n", surface_bits_command->codecID);
}
xfree(tile_bitmap);
}
/**
@ -932,6 +934,40 @@ void gdi_register_update_callbacks(rdpUpdate* update)
update->SurfaceBits = gdi_surface_bits;
}
static void gdi_init_primary(GDI* gdi)
{
gdi->primary = gdi_bitmap_new(gdi, gdi->width, gdi->height, gdi->dstBpp, NULL);
gdi->primary_buffer = gdi->primary->bitmap->data;
if (gdi->drawing == NULL)
gdi->drawing = gdi->primary;
gdi->primary->hdc->hwnd = (HGDI_WND) malloc(sizeof(GDI_WND));
gdi->primary->hdc->hwnd->invalid = gdi_CreateRectRgn(0, 0, 0, 0);
gdi->primary->hdc->hwnd->invalid->null = 1;
gdi->primary->hdc->hwnd->count = 32;
gdi->primary->hdc->hwnd->cinvalid = (HGDI_RGN) malloc(sizeof(GDI_RGN) * gdi->primary->hdc->hwnd->count);
gdi->primary->hdc->hwnd->ninvalid = 0;
}
void gdi_resize(GDI* gdi, int width, int height)
{
if (gdi && gdi->primary)
{
if (gdi->width != width || gdi->height != height)
{
if (gdi->drawing == gdi->primary)
gdi->drawing = NULL;
gdi->width = width;
gdi->height = height;
gdi_bitmap_free(gdi->primary);
gdi_init_primary(gdi);
}
}
}
/**
* Initialize GDI
* @param inst current instance
@ -993,17 +1029,7 @@ int gdi_init(freerdp* instance, uint32 flags)
gdi->hdc->invert = gdi->clrconv->invert;
gdi->hdc->rgb555 = gdi->clrconv->rgb555;
gdi->primary = gdi_bitmap_new(gdi, gdi->width, gdi->height, gdi->dstBpp, NULL);
gdi->primary_buffer = gdi->primary->bitmap->data;
gdi->drawing = gdi->primary;
gdi->primary->hdc->hwnd = (HGDI_WND) malloc(sizeof(GDI_WND));
gdi->primary->hdc->hwnd->invalid = gdi_CreateRectRgn(0, 0, 0, 0);
gdi->primary->hdc->hwnd->invalid->null = 1;
gdi->primary->hdc->hwnd->count = 32;
gdi->primary->hdc->hwnd->cinvalid = (HGDI_RGN) malloc(sizeof(GDI_RGN) * gdi->primary->hdc->hwnd->count);
gdi->primary->hdc->hwnd->ninvalid = 0;
gdi_init_primary(gdi);
gdi->tile = gdi_bitmap_new(gdi, 64, 64, 32, NULL);
gdi->image = gdi_bitmap_new(gdi, 64, 64, 32, NULL);
@ -1024,7 +1050,10 @@ void gdi_free(freerdp* instance)
if (gdi)
{
gdi_bitmap_free(gdi->primary);
gdi_bitmap_free(gdi->tile);
gdi_bitmap_free(gdi->image);
gdi_DeleteDC(gdi->hdc);
cache_free(gdi->cache);
rfx_context_free((RFX_CONTEXT*)gdi->rfx_context);
free(gdi->clrconv);
free(gdi);

View File

@ -151,6 +151,7 @@ void rail_free(rdpRail* rail)
icon_cache_free(rail->cache);
window_list_free(rail->list);
freerdp_uniconv_free(rail->uniconv);
xfree(rail->clrconv);
xfree(rail);
}
}

View File

@ -189,6 +189,10 @@ void rfx_context_set_pixel_format(RFX_CONTEXT* context, RFX_PIXEL_FORMAT pixel_f
case RFX_PIXEL_FORMAT_RGB:
context->bytes_per_pixel = 3;
break;
case RFX_PIXEL_FORMAT_BGR565_LE:
case RFX_PIXEL_FORMAT_RGB565_LE:
context->bytes_per_pixel = 2;
break;
default:
context->bytes_per_pixel = 0;
break;

View File

@ -82,6 +82,24 @@ static void rfx_encode_format_rgb(const uint8* rgb_data, int width, int height,
*b_buf++ = (sint16) (*src++);
}
break;
case RFX_PIXEL_FORMAT_BGR565_LE:
for (x = 0; x < width; x++)
{
*b_buf++ = (sint16) (((*(src + 1)) & 0xF8) | ((*(src + 1)) >> 5));
*g_buf++ = (sint16) ((((*(src + 1)) & 0x07) << 5) | (((*src) & 0xE0) >> 3));
*r_buf++ = (sint16) ((((*src) & 0x1F) << 3) | (((*src) >> 2) & 0x07));
src += 2;
}
break;
case RFX_PIXEL_FORMAT_RGB565_LE:
for (x = 0; x < width; x++)
{
*r_buf++ = (sint16) (((*(src + 1)) & 0xF8) | ((*(src + 1)) >> 5));
*g_buf++ = (sint16) ((((*(src + 1)) & 0x07) << 5) | (((*src) & 0xE0) >> 3));
*b_buf++ = (sint16) ((((*src) & 0x1F) << 3) | (((*src) >> 2) & 0x07));
src += 2;
}
break;
default:
break;
}