libfreerdp-gdi: fix 8bpp mode

This commit is contained in:
Marc-André Moreau 2014-09-17 18:30:09 -04:00
parent 3b02eccc06
commit 73471eb1f0
17 changed files with 505 additions and 99 deletions

View File

@ -404,7 +404,7 @@ void wf_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
freerdp_client_codecs_prepare(codecs, FREERDP_CODEC_INTERLEAVED);
status = interleaved_decompress(codecs->interleaved, pSrcData, SrcSize, bitsPerPixel,
&pDstData, PIXEL_FORMAT_XRGB32, nWidth * 4, 0, 0, nWidth, nHeight);
&pDstData, PIXEL_FORMAT_XRGB32, nWidth * 4, 0, 0, nWidth, nHeight, NULL);
}
else
{

View File

@ -171,7 +171,7 @@ void wf_Bitmap_Decompress(wfContext* wfc, rdpBitmap* bitmap,
freerdp_client_codecs_prepare(wfc->codecs, FREERDP_CODEC_INTERLEAVED);
status = interleaved_decompress(wfc->codecs->interleaved, pSrcData, SrcSize, bpp,
&pDstData, PIXEL_FORMAT_XRGB32, width * 4, 0, 0, width, height);
&pDstData, PIXEL_FORMAT_XRGB32, width * 4, 0, 0, width, height, NULL);
}
else
{
@ -192,7 +192,7 @@ void wf_Bitmap_Decompress(wfContext* wfc, rdpBitmap* bitmap,
SrcFormat = gdi_get_pixel_format(bpp, TRUE);
status = freerdp_image_copy(pDstData, PIXEL_FORMAT_XRGB32, width * 4, 0, 0,
width, height, pSrcData, SrcFormat, width * bytesPerPixel, 0, 0);
width, height, pSrcData, SrcFormat, width * bytesPerPixel, 0, 0, NULL);
}
bitmap->compressed = FALSE;

View File

@ -347,7 +347,7 @@ void xf_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
freerdp_client_codecs_prepare(codecs, FREERDP_CODEC_INTERLEAVED);
status = interleaved_decompress(codecs->interleaved, pSrcData, SrcSize, bitsPerPixel,
&pDstData, xfc->format, -1, 0, 0, nWidth, nHeight);
&pDstData, xfc->format, -1, 0, 0, nWidth, nHeight, xfc->palette);
}
else
{
@ -370,7 +370,7 @@ void xf_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
pDstData = xfc->bitmap_buffer;
status = freerdp_image_copy(pDstData, xfc->format, -1, 0, 0,
nWidth, nHeight, pSrcData, SrcFormat, -1, 0, 0);
nWidth, nHeight, pSrcData, SrcFormat, -1, 0, 0, xfc->palette);
pSrcData = xfc->bitmap_buffer;
}
@ -398,12 +398,23 @@ void xf_gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
void xf_gdi_palette_update(rdpContext* context, PALETTE_UPDATE* palette)
{
int index;
PALETTE_ENTRY* pe;
UINT32* palette32;
xfContext* xfc = (xfContext*) context;
xf_lock_x11(xfc, FALSE);
CopyMemory(xfc->clrconv->palette, palette, sizeof(rdpPalette));
palette32 = (UINT32*) xfc->palette;
for (index = 0; index < palette->number; index++)
{
pe = &(palette->entries[index]);
palette32[index] = RGB32(pe->red, pe->green, pe->blue);
}
xf_unlock_x11(xfc, FALSE);
}
@ -470,9 +481,9 @@ void xf_gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
brush = &patblt->brush;
xf_set_rop3(xfc, gdi_rop3_code(patblt->bRop));
foreColor = freerdp_convert_gdi_order_color(patblt->foreColor, context->settings->ColorDepth, PIXEL_FORMAT_XRGB32);
foreColor = freerdp_convert_gdi_order_color(patblt->foreColor, context->settings->ColorDepth, xfc->format, xfc->palette);
foreColor = xf_gdi_get_color(xfc, foreColor);
backColor = freerdp_convert_gdi_order_color(patblt->backColor, context->settings->ColorDepth, PIXEL_FORMAT_XRGB32);
backColor = freerdp_convert_gdi_order_color(patblt->backColor, context->settings->ColorDepth, xfc->format, xfc->palette);
backColor = xf_gdi_get_color(xfc, backColor);
if (brush->style == GDI_BS_SOLID)
@ -592,7 +603,7 @@ void xf_gdi_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect)
xf_lock_x11(xfc, FALSE);
color = freerdp_convert_gdi_order_color(opaque_rect->color, context->settings->ColorDepth, PIXEL_FORMAT_XRGB32);
color = freerdp_convert_gdi_order_color(opaque_rect->color, context->settings->ColorDepth, xfc->format, xfc->palette);
color = xf_gdi_get_color(xfc, color);
XSetFunction(xfc->display, xfc->gc, GXcopy);
@ -628,7 +639,7 @@ void xf_gdi_multi_opaque_rect(rdpContext* context, MULTI_OPAQUE_RECT_ORDER* mult
xf_lock_x11(xfc, FALSE);
color = freerdp_convert_gdi_order_color(multi_opaque_rect->color, context->settings->ColorDepth, PIXEL_FORMAT_XRGB32);
color = freerdp_convert_gdi_order_color(multi_opaque_rect->color, context->settings->ColorDepth, xfc->format, xfc->palette);
color = xf_gdi_get_color(xfc, color);
XSetFunction(xfc->display, xfc->gc, GXcopy);
@ -671,7 +682,7 @@ void xf_gdi_line_to(rdpContext* context, LINE_TO_ORDER* line_to)
xf_lock_x11(xfc, FALSE);
xf_set_rop2(xfc, line_to->bRop2);
color = freerdp_convert_gdi_order_color(line_to->penColor, context->settings->ColorDepth, PIXEL_FORMAT_XRGB32);
color = freerdp_convert_gdi_order_color(line_to->penColor, context->settings->ColorDepth, xfc->format, xfc->palette);
color = xf_gdi_get_color(xfc, color);
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
@ -722,7 +733,7 @@ void xf_gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline)
xf_lock_x11(xfc, FALSE);
xf_set_rop2(xfc, polyline->bRop2);
color = freerdp_convert_gdi_order_color(polyline->penColor, context->settings->ColorDepth, PIXEL_FORMAT_XRGB32);
color = freerdp_convert_gdi_order_color(polyline->penColor, context->settings->ColorDepth, xfc->format, xfc->palette);
color = xf_gdi_get_color(xfc, color);
XSetFillStyle(xfc->display, xfc->gc, FillSolid);
@ -820,9 +831,9 @@ void xf_gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
brush = &mem3blt->brush;
bitmap = (xfBitmap*) mem3blt->bitmap;
xf_set_rop3(xfc, gdi_rop3_code(mem3blt->bRop));
foreColor = freerdp_convert_gdi_order_color(mem3blt->foreColor, context->settings->ColorDepth, PIXEL_FORMAT_XRGB32);
foreColor = freerdp_convert_gdi_order_color(mem3blt->foreColor, context->settings->ColorDepth, xfc->format, xfc->palette);
foreColor = xf_gdi_get_color(xfc, foreColor);
backColor = freerdp_convert_gdi_order_color(mem3blt->backColor, context->settings->ColorDepth, PIXEL_FORMAT_XRGB32);
backColor = freerdp_convert_gdi_order_color(mem3blt->backColor, context->settings->ColorDepth, xfc->format, xfc->palette);
backColor = xf_gdi_get_color(xfc, backColor);
if (brush->style == GDI_BS_PATTERN)
@ -895,7 +906,7 @@ void xf_gdi_polygon_sc(rdpContext* context, POLYGON_SC_ORDER* polygon_sc)
xf_lock_x11(xfc, FALSE);
xf_set_rop2(xfc, polygon_sc->bRop2);
brush_color = freerdp_convert_gdi_order_color(polygon_sc->brushColor, context->settings->ColorDepth, PIXEL_FORMAT_XRGB32);
brush_color = freerdp_convert_gdi_order_color(polygon_sc->brushColor, context->settings->ColorDepth, xfc->format, xfc->palette);
brush_color = xf_gdi_get_color(xfc, brush_color);
npoints = polygon_sc->numPoints + 1;
@ -957,9 +968,9 @@ void xf_gdi_polygon_cb(rdpContext* context, POLYGON_CB_ORDER* polygon_cb)
brush = &(polygon_cb->brush);
xf_set_rop2(xfc, polygon_cb->bRop2);
foreColor = freerdp_convert_gdi_order_color(polygon_cb->foreColor, context->settings->ColorDepth, PIXEL_FORMAT_XRGB32);
foreColor = freerdp_convert_gdi_order_color(polygon_cb->foreColor, context->settings->ColorDepth, xfc->format, xfc->palette);
foreColor = xf_gdi_get_color(xfc, foreColor);
backColor = freerdp_convert_gdi_order_color(polygon_cb->backColor, context->settings->ColorDepth, PIXEL_FORMAT_XRGB32);
backColor = freerdp_convert_gdi_order_color(polygon_cb->backColor, context->settings->ColorDepth, xfc->format, xfc->palette);
backColor = xf_gdi_get_color(xfc, backColor);
npoints = polygon_cb->numPoints + 1;
@ -1178,7 +1189,7 @@ void xf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
pDstData = xfc->bitmap_buffer;
freerdp_image_copy(pDstData, xfc->format, -1, 0, 0,
64, 64, pSrcData, PIXEL_FORMAT_XRGB32, -1, 0, 0);
64, 64, pSrcData, PIXEL_FORMAT_XRGB32, -1, 0, 0, xfc->palette);
}
image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0,
@ -1231,7 +1242,7 @@ void xf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
pDstData = xfc->bitmap_buffer;
freerdp_image_copy(pDstData, xfc->format, -1, 0, 0,
cmd->width, cmd->height, pSrcData, PIXEL_FORMAT_XRGB32_VF, -1, 0, 0);
cmd->width, cmd->height, pSrcData, PIXEL_FORMAT_XRGB32_VF, -1, 0, 0, xfc->palette);
image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0,
(char*) pDstData, cmd->width, cmd->height, xfc->scanline_pad, 0);
@ -1270,7 +1281,7 @@ void xf_gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
pDstData = xfc->bitmap_buffer;
freerdp_image_copy(pDstData, xfc->format, -1, 0, 0,
cmd->width, cmd->height, pSrcData, PIXEL_FORMAT_XRGB32_VF, -1, 0, 0);
cmd->width, cmd->height, pSrcData, PIXEL_FORMAT_XRGB32_VF, -1, 0, 0, xfc->palette);
image = XCreateImage(xfc->display, xfc->visual, xfc->depth, ZPixmap, 0,
(char*) pDstData, cmd->width, cmd->height, xfc->scanline_pad, 0);

View File

@ -78,10 +78,7 @@ int xf_OutputUpdate(xfContext* xfc)
if (surface->stage)
{
freerdp_image_copy(surface->stage, xfc->format, surface->stageStep, 0, 0,
surface->width, surface->height, surface->data, surface->format, surface->scanline, 0, 0);
//freerdp_image_copy(surface->stage, xfc->format, surface->stageStep, extents->left, extents->top,
// width, height, surface->data, surface->format, surface->scanline, extents->left, extents->top);
surface->width, surface->height, surface->data, surface->format, surface->scanline, 0, 0, NULL);
}
XPutImage(xfc->display, xfc->drawable, xfc->gc, surface->image,
@ -143,7 +140,7 @@ int xf_SurfaceCommand_Uncompressed(xfContext* xfc, RdpgfxClientContext* context,
return -1;
freerdp_image_copy(surface->data, surface->format, surface->scanline, cmd->left, cmd->top,
cmd->width, cmd->height, cmd->data, PIXEL_FORMAT_XRGB32, cmd->width * 4, 0, 0);
cmd->width, cmd->height, cmd->data, PIXEL_FORMAT_XRGB32, -1, 0, 0, NULL);
invalidRect.left = cmd->left;
invalidRect.top = cmd->top;
@ -223,7 +220,7 @@ int xf_SurfaceCommand_RemoteFX(xfContext* xfc, RdpgfxClientContext* context, RDP
freerdp_image_copy(surface->data, surface->format, surface->scanline,
nXDst, nYDst, nWidth, nHeight,
tile->data, PIXEL_FORMAT_XRGB32, 64 * 4, 0, 0);
tile->data, PIXEL_FORMAT_XRGB32, 64 * 4, 0, 0, NULL);
region16_union_rect(&(xfc->invalidRegion), &(xfc->invalidRegion), &updateRects[j]);
}
@ -470,7 +467,7 @@ int xf_SurfaceCommand_Progressive(xfContext* xfc, RdpgfxClientContext* context,
freerdp_image_copy(surface->data, PIXEL_FORMAT_XRGB32,
surface->scanline, nXDst, nYDst, nWidth, nHeight,
tile->data, PIXEL_FORMAT_XRGB32, 64 * 4, nXSrc, nYSrc);
tile->data, PIXEL_FORMAT_XRGB32, 64 * 4, nXSrc, nYSrc, NULL);
region16_union_rect(&(xfc->invalidRegion), &(xfc->invalidRegion), &updateRects[j]);
}
@ -701,7 +698,7 @@ int xf_SurfaceToSurface(RdpgfxClientContext* context, RDPGFX_SURFACE_TO_SURFACE_
{
freerdp_image_copy(surfaceDst->data, surfaceDst->format, surfaceDst->scanline,
destPt->x, destPt->y, nWidth, nHeight, surfaceSrc->data, surfaceSrc->format,
surfaceSrc->scanline, rectSrc->left, rectSrc->top);
surfaceSrc->scanline, rectSrc->left, rectSrc->top, NULL);
}
invalidRect.left = destPt->x;
@ -756,7 +753,7 @@ int xf_SurfaceToCache(RdpgfxClientContext* context, RDPGFX_SURFACE_TO_CACHE_PDU*
freerdp_image_copy(cacheEntry->data, cacheEntry->format, cacheEntry->scanline,
0, 0, cacheEntry->width, cacheEntry->height, surface->data,
surface->format, surface->scanline, rect->left, rect->top);
surface->format, surface->scanline, rect->left, rect->top, NULL);
context->SetCacheSlotData(context, surfaceToCache->cacheSlot, (void*) cacheEntry);
@ -784,7 +781,7 @@ int xf_CacheToSurface(RdpgfxClientContext* context, RDPGFX_CACHE_TO_SURFACE_PDU*
freerdp_image_copy(surface->data, surface->format, surface->scanline,
destPt->x, destPt->y, cacheEntry->width, cacheEntry->height,
cacheEntry->data, cacheEntry->format, cacheEntry->scanline, 0, 0);
cacheEntry->data, cacheEntry->format, cacheEntry->scanline, 0, 0, NULL);
invalidRect.left = destPt->x;
invalidRect.top = destPt->y;

View File

@ -68,7 +68,7 @@ void xf_Bitmap_New(rdpContext* context, rdpBitmap* bitmap)
SrcFormat = gdi_get_pixel_format(bitmap->bpp, TRUE);
freerdp_image_copy(data, xfc->format, -1, 0, 0,
bitmap->width, bitmap->height, bitmap->data, SrcFormat, -1, 0, 0);
bitmap->width, bitmap->height, bitmap->data, SrcFormat, -1, 0, 0, xfc->palette);
_aligned_free(bitmap->data);
bitmap->data = data;
@ -156,7 +156,7 @@ void xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
freerdp_client_codecs_prepare(xfc->codecs, FREERDP_CODEC_INTERLEAVED);
status = interleaved_decompress(xfc->codecs->interleaved, pSrcData, SrcSize, bpp,
&pDstData, xfc->format, -1, 0, 0, width, height);
&pDstData, xfc->format, -1, 0, 0, width, height, xfc->palette);
}
else
{
@ -177,7 +177,7 @@ void xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
SrcFormat = gdi_get_pixel_format(bpp, TRUE);
status = freerdp_image_copy(pDstData, xfc->format, -1, 0, 0,
width, height, pSrcData, SrcFormat, -1, 0, 0);
width, height, pSrcData, SrcFormat, -1, 0, 0, xfc->palette);
}
bitmap->compressed = FALSE;
@ -377,8 +377,8 @@ void xf_Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int height
{
xfContext* xfc = (xfContext*) context;
bgcolor = freerdp_convert_gdi_order_color(bgcolor, context->settings->ColorDepth, PIXEL_FORMAT_XRGB32);
fgcolor = freerdp_convert_gdi_order_color(fgcolor, context->settings->ColorDepth, PIXEL_FORMAT_XRGB32);
bgcolor = freerdp_convert_gdi_order_color(bgcolor, context->settings->ColorDepth, xfc->format, xfc->palette);
fgcolor = freerdp_convert_gdi_order_color(fgcolor, context->settings->ColorDepth, xfc->format, xfc->palette);
xf_lock_x11(xfc, FALSE);

View File

@ -113,6 +113,7 @@ struct xf_context
HANDLE mutex;
BOOL UseXThreads;
BOOL cursorHidden;
BYTE palette[256 * 4];
HGDI_DC hdc;
UINT32 bitmap_size;

View File

@ -447,13 +447,24 @@ FREERDP_API UINT32 freerdp_color_convert_rgb_bgr(UINT32 srcColor, int srcBpp, in
FREERDP_API UINT32 freerdp_color_convert_bgr_rgb(UINT32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv);
FREERDP_API UINT32 freerdp_color_convert_var_rgb(UINT32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv);
FREERDP_API UINT32 freerdp_color_convert_var_bgr(UINT32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv);
FREERDP_API UINT32 freerdp_convert_gdi_order_color(UINT32 color, int bpp, UINT32 format);
FREERDP_API UINT32 freerdp_convert_gdi_order_color(UINT32 color, int bpp, UINT32 format, BYTE* palette);
FREERDP_API HCLRCONV freerdp_clrconv_new(UINT32 flags);
FREERDP_API void freerdp_clrconv_free(HCLRCONV clrconv);
FREERDP_API int freerdp_image8_copy(BYTE* pDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst,
int nWidth, int nHeight, BYTE* pSrcData, DWORD SrcFormat, int nSrcStep, int nXSrc, int nYSrc, BYTE* palette);
FREERDP_API int freerdp_image15_copy(BYTE* pDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst,
int nWidth, int nHeight, BYTE* pSrcData, DWORD SrcFormat, int nSrcStep, int nXSrc, int nYSrc, BYTE* palette);
FREERDP_API int freerdp_image16_copy(BYTE* pDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst,
int nWidth, int nHeight, BYTE* pSrcData, DWORD SrcFormat, int nSrcStep, int nXSrc, int nYSrc, BYTE* palette);
FREERDP_API int freerdp_image24_copy(BYTE* pDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst,
int nWidth, int nHeight, BYTE* pSrcData, DWORD SrcFormat, int nSrcStep, int nXSrc, int nYSrc, BYTE* palette);
FREERDP_API int freerdp_image32_copy(BYTE* pDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst,
int nWidth, int nHeight, BYTE* pSrcData, DWORD SrcFormat, int nSrcStep, int nXSrc, int nYSrc, BYTE* palette);
FREERDP_API int freerdp_image_copy(BYTE* pDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst,
int nWidth, int nHeight, BYTE* pSrcData, DWORD SrcFormat, int nSrcStep, int nXSrc, int nYSrc);
int nWidth, int nHeight, BYTE* pSrcData, DWORD SrcFormat, int nSrcStep, int nXSrc, int nYSrc, BYTE* palette);
FREERDP_API int freerdp_image_move(BYTE* pData, DWORD Format, int nStep, int nXDst, int nYDst,
int nWidth, int nHeight, int nXSrc, int nYSrc);
FREERDP_API int freerdp_image_fill(BYTE* pDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst,

View File

@ -37,7 +37,7 @@ struct _BITMAP_INTERLEAVED_CONTEXT
};
FREERDP_API int interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved, BYTE* pSrcData, UINT32 SrcSize, int bpp,
BYTE** ppDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst, int nWidth, int nHeight);
BYTE** ppDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst, int nWidth, int nHeight, BYTE* palette);
FREERDP_API int bitmap_interleaved_context_reset(BITMAP_INTERLEAVED_CONTEXT* interleaved);

View File

@ -294,6 +294,7 @@ struct rdp_gdi
BYTE* bitmap_buffer;
BYTE* primary_buffer;
GDI_COLOR textColor;
BYTE palette[256 * 4];
gdiBitmap* tile;
gdiBitmap* image;

View File

@ -87,15 +87,13 @@ rdpPaletteCache* palette_cache_new(rdpSettings* settings)
{
rdpPaletteCache* paletteCache;
paletteCache = (rdpPaletteCache*) malloc(sizeof(rdpPaletteCache));
ZeroMemory(paletteCache, sizeof(rdpPaletteCache));
paletteCache = (rdpPaletteCache*) calloc(1, sizeof(rdpPaletteCache));
if (paletteCache)
{
paletteCache->settings = settings;
paletteCache->maxEntries = 6;
paletteCache->entries = (PALETTE_TABLE_ENTRY*) malloc(sizeof(PALETTE_TABLE_ENTRY) * paletteCache->maxEntries);
ZeroMemory(paletteCache->entries, sizeof(PALETTE_TABLE_ENTRY) * paletteCache->maxEntries);
paletteCache->entries = (PALETTE_TABLE_ENTRY*) calloc(paletteCache->maxEntries, sizeof(PALETTE_TABLE_ENTRY));
}
return paletteCache;

View File

@ -379,9 +379,11 @@ UINT32 freerdp_color_convert_var_bgr(UINT32 srcColor, int srcBpp, int dstBpp, HC
return freerdp_color_convert_rgb_bgr(srcColor, srcBpp, dstBpp, clrconv);
}
UINT32 freerdp_convert_gdi_order_color(UINT32 color, int bpp, UINT32 format)
UINT32 freerdp_convert_gdi_order_color(UINT32 color, int bpp, UINT32 format, BYTE* palette)
{
UINT32 r, g, b;
UINT32 r = 0;
UINT32 g = 0;
UINT32 b = 0;
switch (bpp)
{
@ -405,9 +407,12 @@ UINT32 freerdp_convert_gdi_order_color(UINT32 color, int bpp, UINT32 format)
case 8:
color = (color >> 16) & (UINT32) 0xFF;
//r = clrconv->palette->entries[color].red;
//g = clrconv->palette->entries[color].green;
//b = clrconv->palette->entries[color].blue;
if (palette)
{
r = palette[(color * 4) + 2];
g = palette[(color * 4) + 1];
b = palette[(color * 4) + 0];
}
break;
case 1:
@ -1304,8 +1309,353 @@ void freerdp_clrconv_free(HCLRCONV clrconv)
}
}
int freerdp_image8_copy(BYTE* pDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst,
int nWidth, int nHeight, BYTE* pSrcData, DWORD SrcFormat, int nSrcStep, int nXSrc, int nYSrc, BYTE* palette)
{
BYTE* pe;
int x, y;
int srcFlip;
int dstFlip;
int nSrcPad;
int nDstPad;
int srcBitsPerPixel;
int srcBytesPerPixel;
int dstBitsPerPixel;
int dstBytesPerPixel;
BOOL vFlip = FALSE;
BOOL invert = FALSE;
if (!palette)
return -1;
srcBitsPerPixel = FREERDP_PIXEL_FORMAT_DEPTH(SrcFormat);
srcBytesPerPixel = (FREERDP_PIXEL_FORMAT_BPP(SrcFormat) / 8);
srcFlip = FREERDP_PIXEL_FORMAT_FLIP(SrcFormat);
dstBitsPerPixel = FREERDP_PIXEL_FORMAT_DEPTH(DstFormat);
dstBytesPerPixel = (FREERDP_PIXEL_FORMAT_BPP(DstFormat) / 8);
dstFlip = FREERDP_PIXEL_FORMAT_FLIP(DstFormat);
if (nSrcStep < 0)
nSrcStep = srcBytesPerPixel * nWidth;
if (nDstStep < 0)
nDstStep = dstBytesPerPixel * nWidth;
nSrcPad = (nSrcStep - (nWidth * srcBytesPerPixel));
nDstPad = (nDstStep - (nWidth * dstBytesPerPixel));
if (srcFlip != dstFlip)
vFlip = TRUE;
invert = FREERDP_PIXEL_FORMAT_IS_ABGR(DstFormat) ? TRUE : FALSE;
if (dstBytesPerPixel == 4)
{
if ((dstBitsPerPixel == 32) || (dstBitsPerPixel == 24))
{
BYTE* pSrcPixel;
UINT32* pDstPixel;
if (!invert)
{
if (!vFlip)
{
pSrcPixel = &pSrcData[(nYSrc * nSrcStep) + nXSrc];
pDstPixel = (UINT32*) &pDstData[(nYDst * nDstStep) + (nXDst * 4)];
for (y = 0; y < nHeight; y++)
{
for (x = 0; x < nWidth; x++)
{
pe = &palette[*pSrcPixel * 4];
*pDstPixel++ = RGB32(pe[2], pe[1], pe[0]);
pSrcPixel++;
}
pSrcPixel = &pSrcPixel[nSrcPad];
pDstPixel = (UINT32*) &((BYTE*) pDstPixel)[nDstPad];
}
}
else
{
pSrcPixel = &pSrcData[((nYSrc + nHeight - 1) * nSrcStep) + nXSrc];
pDstPixel = (UINT32*) &pDstData[(nYDst * nDstStep) + (nXDst * 4)];
for (y = 0; y < nHeight; y++)
{
for (x = 0; x < nWidth; x++)
{
pe = &palette[*pSrcPixel * 4];
*pDstPixel++ = RGB32(pe[2], pe[1], pe[0]);
pSrcPixel++;
}
pSrcPixel = &pSrcPixel[-((nSrcStep - nSrcPad) + nSrcStep)];
pDstPixel = (UINT32*) &((BYTE*) pDstPixel)[nDstPad];
}
}
}
else
{
if (!vFlip)
{
pSrcPixel = &pSrcData[(nYSrc * nSrcStep) + nXSrc];
pDstPixel = (UINT32*) &pDstData[(nYDst * nDstStep) + (nXDst * 4)];
for (y = 0; y < nHeight; y++)
{
for (x = 0; x < nWidth; x++)
{
pe = &palette[*pSrcPixel * 4];
*pDstPixel++ = BGR32(pe[2], pe[1], pe[0]);
pSrcPixel++;
}
pSrcPixel = &pSrcPixel[nSrcPad];
pDstPixel = (UINT32*) &((BYTE*) pDstPixel)[nDstPad];
}
}
else
{
pSrcPixel = &pSrcData[((nYSrc + nHeight - 1) * nSrcStep) + nXSrc];
pDstPixel = (UINT32*) &pDstData[(nYDst * nDstStep) + (nXDst * 4)];
for (y = 0; y < nHeight; y++)
{
for (x = 0; x < nWidth; x++)
{
pe = &palette[*pSrcPixel * 4];
*pDstPixel++ = BGR32(pe[2], pe[1], pe[0]);
pSrcPixel++;
}
pSrcPixel = &pSrcPixel[-((nSrcStep - nSrcPad) + nSrcStep)];
pDstPixel = (UINT32*) &((BYTE*) pDstPixel)[nDstPad];
}
}
}
return 1;
}
}
else if (dstBytesPerPixel == 3)
{
}
else if (dstBytesPerPixel == 2)
{
if (dstBitsPerPixel == 16)
{
BYTE* pSrcPixel;
UINT16* pDstPixel;
if (!invert)
{
if (!vFlip)
{
pSrcPixel = &pSrcData[(nYSrc * nSrcStep) + nXSrc];
pDstPixel = (UINT16*) &pDstData[(nYDst * nDstStep) + (nXDst * 2)];
for (y = 0; y < nHeight; y++)
{
for (x = 0; x < nWidth; x++)
{
pe = &palette[*pSrcPixel * 4];
*pDstPixel++ = RGB16(pe[2], pe[1], pe[0]);
pSrcPixel++;
}
pSrcPixel = &pSrcPixel[nSrcPad];
pDstPixel = (UINT16*) &((BYTE*) pDstPixel)[nDstPad];
}
}
else
{
pSrcPixel = &pSrcData[((nYSrc + nHeight - 1) * nSrcStep) + nXSrc];
pDstPixel = (UINT16*) &pDstData[(nYDst * nDstStep) + (nXDst * 2)];
for (y = 0; y < nHeight; y++)
{
for (x = 0; x < nWidth; x++)
{
pe = &palette[*pSrcPixel * 4];
*pDstPixel++ = RGB16(pe[2], pe[1], pe[0]);
pSrcPixel++;
}
pSrcPixel = &pSrcPixel[-((nSrcStep - nSrcPad) + nSrcStep)];
pDstPixel = (UINT16*) &((BYTE*) pDstPixel)[nDstPad];
}
}
}
else
{
if (!vFlip)
{
pSrcPixel = &pSrcData[(nYSrc * nSrcStep) + nXSrc];
pDstPixel = (UINT16*) &pDstData[(nYDst * nDstStep) + (nXDst * 2)];
for (y = 0; y < nHeight; y++)
{
for (x = 0; x < nWidth; x++)
{
pe = &palette[*pSrcPixel * 4];
*pDstPixel++ = BGR16(pe[2], pe[1], pe[0]);
pSrcPixel++;
}
pSrcPixel = &pSrcPixel[nSrcPad];
pDstPixel = (UINT16*) &((BYTE*) pDstPixel)[nDstPad];
}
}
else
{
pSrcPixel = &pSrcData[((nYSrc + nHeight - 1) * nSrcStep) + nXSrc];
pDstPixel = (UINT16*) &pDstData[(nYDst * nDstStep) + (nXDst * 2)];
for (y = 0; y < nHeight; y++)
{
for (x = 0; x < nWidth; x++)
{
pe = &palette[*pSrcPixel * 4];
*pDstPixel++ = BGR16(pe[2], pe[1], pe[0]);
pSrcPixel++;
}
pSrcPixel = &pSrcPixel[-((nSrcStep - nSrcPad) + nSrcStep)];
pDstPixel = (UINT16*) &((BYTE*) pDstPixel)[nDstPad];
}
}
}
return 1;
}
else if (dstBitsPerPixel == 15)
{
BYTE* pSrcPixel;
UINT16* pDstPixel;
if (!invert)
{
if (!vFlip)
{
pSrcPixel = &pSrcData[(nYSrc * nSrcStep) + nXSrc];
pDstPixel = (UINT16*) &pDstData[(nYDst * nDstStep) + (nXDst * 2)];
for (y = 0; y < nHeight; y++)
{
for (x = 0; x < nWidth; x++)
{
pe = &palette[*pSrcPixel * 4];
*pDstPixel++ = RGB15(pe[2], pe[1], pe[0]);
pSrcPixel++;
}
pSrcPixel = &pSrcPixel[nSrcPad];
pDstPixel = (UINT16*) &((BYTE*) pDstPixel)[nDstPad];
}
}
else
{
pSrcPixel = &pSrcData[((nYSrc + nHeight - 1) * nSrcStep) + nXSrc];
pDstPixel = (UINT16*) &pDstData[(nYDst * nDstStep) + (nXDst * 2)];
for (y = 0; y < nHeight; y++)
{
for (x = 0; x < nWidth; x++)
{
pe = &palette[*pSrcPixel * 4];
*pDstPixel++ = RGB15(pe[2], pe[1], pe[0]);
pSrcPixel++;
}
pSrcPixel = &pSrcPixel[-((nSrcStep - nSrcPad) + nSrcStep)];
pDstPixel = (UINT16*) &((BYTE*) pDstPixel)[nDstPad];
}
}
}
else
{
if (!vFlip)
{
pSrcPixel = &pSrcData[(nYSrc * nSrcStep) + nXSrc];
pDstPixel = (UINT16*) &pDstData[(nYDst * nDstStep) + (nXDst * 2)];
for (y = 0; y < nHeight; y++)
{
for (x = 0; x < nWidth; x++)
{
pe = &palette[*pSrcPixel * 4];
*pDstPixel++ = BGR15(pe[2], pe[1], pe[0]);
pSrcPixel++;
}
pSrcPixel = &pSrcPixel[nSrcPad];
pDstPixel = (UINT16*) &((BYTE*) pDstPixel)[nDstPad];
}
}
else
{
pSrcPixel = &pSrcData[((nYSrc + nHeight - 1) * nSrcStep) + nXSrc];
pDstPixel = (UINT16*) &pDstData[(nYDst * nDstStep) + (nXDst * 2)];
for (y = 0; y < nHeight; y++)
{
for (x = 0; x < nWidth; x++)
{
pe = &palette[*pSrcPixel * 4];
*pDstPixel++ = BGR15(pe[2], pe[1], pe[0]);
pSrcPixel++;
}
pSrcPixel = &pSrcPixel[-((nSrcStep - nSrcPad) + nSrcStep)];
pDstPixel = (UINT16*) &((BYTE*) pDstPixel)[nDstPad];
}
}
}
return 1;
}
}
else if (dstBytesPerPixel == 1)
{
BYTE* pSrcPixel;
BYTE* pDstPixel;
if (!vFlip)
{
pSrcPixel = &pSrcData[(nYSrc * nSrcStep) + nXSrc];
pDstPixel = &pDstData[(nYDst * nDstStep) + nXDst];
for (y = 0; y < nHeight; y++)
{
CopyMemory(pDstPixel, pSrcPixel, nWidth);
pSrcPixel = &pSrcPixel[nSrcStep];
pDstPixel = &pDstPixel[nDstStep];
}
}
else
{
pSrcPixel = &pSrcData[((nYSrc + nHeight - 1) * nSrcStep) + nXSrc];
pDstPixel = &pDstData[(nYDst * nDstStep) + nXDst];
for (y = 0; y < nHeight; y++)
{
CopyMemory(pDstPixel, pSrcPixel, nWidth);
pSrcPixel = &pSrcPixel[-nSrcStep];
pDstPixel = &pDstPixel[nDstStep];
}
}
return 1;
}
return -1;
}
int freerdp_image15_copy(BYTE* pDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst,
int nWidth, int nHeight, BYTE* pSrcData, DWORD SrcFormat, int nSrcStep, int nXSrc, int nYSrc)
int nWidth, int nHeight, BYTE* pSrcData, DWORD SrcFormat, int nSrcStep, int nXSrc, int nYSrc, BYTE* palette)
{
int x, y;
int srcFlip;
@ -1331,6 +1681,12 @@ int freerdp_image15_copy(BYTE* pDstData, DWORD DstFormat, int nDstStep, int nXDs
dstFlip = FREERDP_PIXEL_FORMAT_FLIP(DstFormat);
dstType = FREERDP_PIXEL_FORMAT_TYPE(DstFormat);
if (nSrcStep < 0)
nSrcStep = srcBytesPerPixel * nWidth;
if (nDstStep < 0)
nDstStep = dstBytesPerPixel * nWidth;
nSrcPad = (nSrcStep - (nWidth * srcBytesPerPixel));
nDstPad = (nDstStep - (nWidth * dstBytesPerPixel));
@ -1631,7 +1987,7 @@ int freerdp_image15_copy(BYTE* pDstData, DWORD DstFormat, int nDstStep, int nXDs
}
int freerdp_image16_copy(BYTE* pDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst,
int nWidth, int nHeight, BYTE* pSrcData, DWORD SrcFormat, int nSrcStep, int nXSrc, int nYSrc)
int nWidth, int nHeight, BYTE* pSrcData, DWORD SrcFormat, int nSrcStep, int nXSrc, int nYSrc, BYTE* palette)
{
int x, y;
int srcFlip;
@ -1657,6 +2013,12 @@ int freerdp_image16_copy(BYTE* pDstData, DWORD DstFormat, int nDstStep, int nXDs
dstFlip = FREERDP_PIXEL_FORMAT_FLIP(DstFormat);
dstType = FREERDP_PIXEL_FORMAT_TYPE(DstFormat);
if (nSrcStep < 0)
nSrcStep = srcBytesPerPixel * nWidth;
if (nDstStep < 0)
nDstStep = dstBytesPerPixel * nWidth;
nSrcPad = (nSrcStep - (nWidth * srcBytesPerPixel));
nDstPad = (nDstStep - (nWidth * dstBytesPerPixel));
@ -1943,7 +2305,7 @@ int freerdp_image16_copy(BYTE* pDstData, DWORD DstFormat, int nDstStep, int nXDs
}
int freerdp_image24_copy(BYTE* pDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst,
int nWidth, int nHeight, BYTE* pSrcData, DWORD SrcFormat, int nSrcStep, int nXSrc, int nYSrc)
int nWidth, int nHeight, BYTE* pSrcData, DWORD SrcFormat, int nSrcStep, int nXSrc, int nYSrc, BYTE* palette)
{
int x, y;
int srcFlip;
@ -1971,6 +2333,12 @@ int freerdp_image24_copy(BYTE* pDstData, DWORD DstFormat, int nDstStep, int nXDs
nSrcPad = (nSrcStep - (nWidth * srcBytesPerPixel));
nDstPad = (nDstStep - (nWidth * dstBytesPerPixel));
if (nSrcStep < 0)
nSrcStep = srcBytesPerPixel * nWidth;
if (nDstStep < 0)
nDstStep = dstBytesPerPixel * nWidth;
if (srcFlip != dstFlip)
vFlip = TRUE;
@ -2252,7 +2620,7 @@ int freerdp_image24_copy(BYTE* pDstData, DWORD DstFormat, int nDstStep, int nXDs
}
int freerdp_image32_copy(BYTE* pDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst,
int nWidth, int nHeight, BYTE* pSrcData, DWORD SrcFormat, int nSrcStep, int nXSrc, int nYSrc)
int nWidth, int nHeight, BYTE* pSrcData, DWORD SrcFormat, int nSrcStep, int nXSrc, int nYSrc, BYTE* palette)
{
int x, y;
int srcFlip;
@ -2278,6 +2646,12 @@ int freerdp_image32_copy(BYTE* pDstData, DWORD DstFormat, int nDstStep, int nXDs
dstFlip = FREERDP_PIXEL_FORMAT_FLIP(DstFormat);
dstType = FREERDP_PIXEL_FORMAT_TYPE(DstFormat);
if (nSrcStep < 0)
nSrcStep = srcBytesPerPixel * nWidth;
if (nDstStep < 0)
nDstStep = dstBytesPerPixel * nWidth;
nSrcPad = (nSrcStep - (nWidth * srcBytesPerPixel));
nDstPad = (nDstStep - (nWidth * dstBytesPerPixel));
@ -2503,52 +2877,52 @@ int freerdp_image32_copy(BYTE* pDstData, DWORD DstFormat, int nDstStep, int nXDs
}
int freerdp_image_copy(BYTE* pDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst,
int nWidth, int nHeight, BYTE* pSrcData, DWORD SrcFormat, int nSrcStep, int nXSrc, int nYSrc)
int nWidth, int nHeight, BYTE* pSrcData, DWORD SrcFormat, int nSrcStep, int nXSrc, int nYSrc, BYTE* palette)
{
int status = -1;
int srcBitsPerPixel;
int srcBytesPerPixel;
int dstBitsPerPixel;
int dstBytesPerPixel;
srcBitsPerPixel = FREERDP_PIXEL_FORMAT_DEPTH(SrcFormat);
srcBytesPerPixel = (FREERDP_PIXEL_FORMAT_BPP(SrcFormat) / 8);
if (nSrcStep < 0)
nSrcStep = srcBytesPerPixel * nWidth;
dstBitsPerPixel = FREERDP_PIXEL_FORMAT_DEPTH(DstFormat);
dstBytesPerPixel = (FREERDP_PIXEL_FORMAT_BPP(DstFormat) / 8);
if (nDstStep < 0)
nDstStep = dstBytesPerPixel * nWidth;
if (srcBytesPerPixel == 4)
{
status = freerdp_image32_copy(pDstData, DstFormat, nDstStep, nXDst, nYDst,
nWidth, nHeight, pSrcData, SrcFormat, nSrcStep, nXSrc, nYSrc);
nWidth, nHeight, pSrcData, SrcFormat, nSrcStep, nXSrc, nYSrc, palette);
}
else if (srcBytesPerPixel == 3)
{
status = freerdp_image24_copy(pDstData, DstFormat, nDstStep, nXDst, nYDst,
nWidth, nHeight, pSrcData, SrcFormat, nSrcStep, nXSrc, nYSrc);
nWidth, nHeight, pSrcData, SrcFormat, nSrcStep, nXSrc, nYSrc, palette);
}
else if (srcBytesPerPixel == 2)
{
if (srcBitsPerPixel == 16)
{
status = freerdp_image16_copy(pDstData, DstFormat, nDstStep, nXDst, nYDst,
nWidth, nHeight, pSrcData, SrcFormat, nSrcStep, nXSrc, nYSrc);
nWidth, nHeight, pSrcData, SrcFormat, nSrcStep, nXSrc, nYSrc, palette);
}
else if (srcBitsPerPixel == 15)
{
status = freerdp_image15_copy(pDstData, DstFormat, nDstStep, nXDst, nYDst,
nWidth, nHeight, pSrcData, SrcFormat, nSrcStep, nXSrc, nYSrc);
nWidth, nHeight, pSrcData, SrcFormat, nSrcStep, nXSrc, nYSrc, palette);
}
}
else if (srcBytesPerPixel == 1)
{
status = freerdp_image8_copy(pDstData, DstFormat, nDstStep, nXDst, nYDst,
nWidth, nHeight, pSrcData, SrcFormat, nSrcStep, nXSrc, nYSrc, palette);
}
if (status < 0)
{
int dstBitsPerPixel;
int dstBytesPerPixel;
dstBitsPerPixel = FREERDP_PIXEL_FORMAT_DEPTH(DstFormat);
dstBytesPerPixel = (FREERDP_PIXEL_FORMAT_BPP(DstFormat) / 8);
fprintf(stderr, "freerdp_image_copy failure: src: %d/%d dst: %d/%d\n",
srcBitsPerPixel, srcBytesPerPixel, dstBitsPerPixel, dstBytesPerPixel);
}

View File

@ -236,7 +236,7 @@ static INLINE UINT32 ExtractRunLength(UINT32 code, BYTE* pbOrderHdr, UINT32* adv
#include "include/bitmap.c"
int interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved, BYTE* pSrcData, UINT32 SrcSize, int bpp,
BYTE** ppDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst, int nWidth, int nHeight)
BYTE** ppDstData, DWORD DstFormat, int nDstStep, int nXDst, int nYDst, int nWidth, int nHeight, BYTE* palette)
{
int status;
BOOL vFlip;
@ -283,7 +283,7 @@ int interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved, BYTE* pSrcDa
RleDecompress24to24(pSrcData, SrcSize, interleaved->TempBuffer, scanline, nWidth, nHeight);
status = freerdp_image_copy(pDstData, DstFormat, nDstStep, nXDst, nYDst,
nWidth, nHeight, interleaved->TempBuffer, SrcFormat, scanline, 0, 0);
nWidth, nHeight, interleaved->TempBuffer, SrcFormat, scanline, 0, 0, palette);
}
else if ((bpp == 16) || (bpp == 15))
{
@ -310,7 +310,7 @@ int interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved, BYTE* pSrcDa
RleDecompress16to16(pSrcData, SrcSize, interleaved->TempBuffer, scanline, nWidth, nHeight);
status = freerdp_image_copy(pDstData, DstFormat, nDstStep, nXDst, nYDst,
nWidth, nHeight, interleaved->TempBuffer, SrcFormat, scanline, 0, 0);
nWidth, nHeight, interleaved->TempBuffer, SrcFormat, scanline, 0, 0, palette);
}
else if (bpp == 8)
{
@ -337,7 +337,7 @@ int interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved, BYTE* pSrcDa
RleDecompress8to8(pSrcData, SrcSize, interleaved->TempBuffer, scanline, nWidth, nHeight);
status = freerdp_image_copy(pDstData, DstFormat, nDstStep, nXDst, nYDst,
nWidth, nHeight, interleaved->TempBuffer, SrcFormat, scanline, 0, 0);
nWidth, nHeight, interleaved->TempBuffer, SrcFormat, scanline, 0, 0, palette);
}
else
{

View File

@ -606,7 +606,7 @@ int planar_decompress(BITMAP_PLANAR_CONTEXT* planar, BYTE* pSrcData, UINT32 SrcS
pDstData = *ppDstData;
status = freerdp_image_copy(pDstData, DstFormat, -1, 0, 0, nWidth, nHeight,
planar->TempBuffer, PIXEL_FORMAT_XRGB32, -1, 0, 0);
planar->TempBuffer, PIXEL_FORMAT_XRGB32, -1, 0, 0, NULL);
}
return status;

View File

@ -910,7 +910,7 @@ int test_progressive_decode(PROGRESSIVE_CONTEXT* progressive, EGFX_SAMPLE_FILE f
freerdp_image_copy(g_DstData, PIXEL_FORMAT_XRGB32, g_DstStep,
nXDst, nYDst, nWidth, nHeight, tile->data,
PIXEL_FORMAT_XRGB32, 64 * 4, nXSrc, nYSrc);
PIXEL_FORMAT_XRGB32, 64 * 4, nXSrc, nYSrc, NULL);
}
size = bitmaps[pass].size;

View File

@ -542,7 +542,7 @@ void gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
freerdp_client_codecs_prepare(codecs, FREERDP_CODEC_INTERLEAVED);
status = interleaved_decompress(codecs->interleaved, pSrcData, SrcSize, bitsPerPixel,
&pDstData, gdi->format, -1, 0, 0, nWidth, nHeight);
&pDstData, gdi->format, -1, 0, 0, nWidth, nHeight, gdi->palette);
}
else
{
@ -566,7 +566,7 @@ void gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
SrcFormat = gdi_get_pixel_format(bitsPerPixel, TRUE);
status = freerdp_image_copy(pDstData, gdi->format, -1, 0, 0,
nWidth, nHeight, pSrcData, SrcFormat, -1, 0, 0);
nWidth, nHeight, pSrcData, SrcFormat, -1, 0, 0, gdi->palette);
pSrcData = gdi->bitmap_buffer;
}
@ -578,7 +578,7 @@ void gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
nHeight = bitmap->destBottom - bitmap->destTop + 1; /* clip height */
status = freerdp_image_copy(pDstData, gdi->format, nDstStep, nXDst, nYDst,
nWidth, nHeight, pSrcData, gdi->format, -1, nXSrc, nYSrc);
nWidth, nHeight, pSrcData, gdi->format, -1, nXSrc, nYSrc, gdi->palette);
gdi_InvalidateRegion(gdi->primary->hdc, nXDst, nYDst, nWidth, nHeight);
}
@ -586,8 +586,21 @@ void gdi_bitmap_update(rdpContext* context, BITMAP_UPDATE* bitmapUpdate)
void gdi_palette_update(rdpContext* context, PALETTE_UPDATE* palette)
{
int index;
BYTE r, g, b;
PALETTE_ENTRY* pe;
UINT32* palette32;
rdpGdi* gdi = context->gdi;
CopyMemory(gdi->clrconv->palette, palette, sizeof(rdpPalette));
palette32 = (UINT32*) gdi->palette;
for (index = 0; index < palette->number; index++)
{
pe = &(palette->entries[index]);
palette32[index] = RGB32(pe->red, pe->green, pe->blue);
}
}
void gdi_set_bounds(rdpContext* context, rdpBounds* bounds)
@ -625,8 +638,8 @@ void gdi_patblt(rdpContext* context, PATBLT_ORDER* patblt)
brush = &patblt->brush;
foreColor = freerdp_convert_gdi_order_color(patblt->foreColor, gdi->srcBpp, gdi->format);
backColor = freerdp_convert_gdi_order_color(patblt->backColor, gdi->srcBpp, gdi->format);
foreColor = freerdp_convert_gdi_order_color(patblt->foreColor, gdi->srcBpp, gdi->format, gdi->palette);
backColor = freerdp_convert_gdi_order_color(patblt->backColor, gdi->srcBpp, gdi->format, gdi->palette);
originalColor = gdi_SetTextColor(gdi->drawing->hdc, foreColor);
@ -712,7 +725,7 @@ void gdi_opaque_rect(rdpContext* context, OPAQUE_RECT_ORDER* opaque_rect)
gdi_CRgnToRect(opaque_rect->nLeftRect, opaque_rect->nTopRect,
opaque_rect->nWidth, opaque_rect->nHeight, &rect);
brush_color = freerdp_convert_gdi_order_color(opaque_rect->color, gdi->srcBpp, gdi->format);
brush_color = freerdp_convert_gdi_order_color(opaque_rect->color, gdi->srcBpp, gdi->format, gdi->palette);
hBrush = gdi_CreateSolidBrush(brush_color);
gdi_FillRect(gdi->drawing->hdc, &rect, hBrush);
@ -736,7 +749,7 @@ void gdi_multi_opaque_rect(rdpContext* context, MULTI_OPAQUE_RECT_ORDER* multi_o
gdi_CRgnToRect(rectangle->left, rectangle->top,
rectangle->width, rectangle->height, &rect);
brush_color = freerdp_convert_gdi_order_color(multi_opaque_rect->color, gdi->srcBpp, gdi->format);
brush_color = freerdp_convert_gdi_order_color(multi_opaque_rect->color, gdi->srcBpp, gdi->format, gdi->palette);
hBrush = gdi_CreateSolidBrush(brush_color);
gdi_FillRect(gdi->drawing->hdc, &rect, hBrush);
@ -751,7 +764,7 @@ void gdi_line_to(rdpContext* context, LINE_TO_ORDER* lineTo)
HGDI_PEN hPen;
rdpGdi* gdi = context->gdi;
color = freerdp_convert_gdi_order_color(lineTo->penColor, gdi->srcBpp, gdi->format);
color = freerdp_convert_gdi_order_color(lineTo->penColor, gdi->srcBpp, gdi->format, gdi->palette);
hPen = gdi_CreatePen(lineTo->penStyle, lineTo->penWidth, (GDI_COLOR) color);
gdi_SelectObject(gdi->drawing->hdc, (HGDIOBJECT) hPen);
gdi_SetROP2(gdi->drawing->hdc, lineTo->bRop2);
@ -772,7 +785,7 @@ void gdi_polyline(rdpContext* context, POLYLINE_ORDER* polyline)
DELTA_POINT* points;
rdpGdi* gdi = context->gdi;
color = freerdp_convert_gdi_order_color(polyline->penColor, gdi->srcBpp, gdi->format);
color = freerdp_convert_gdi_order_color(polyline->penColor, gdi->srcBpp, gdi->format, gdi->palette);
hPen = gdi_CreatePen(GDI_PS_SOLID, 1, (GDI_COLOR) color);
gdi_SelectObject(gdi->drawing->hdc, (HGDIOBJECT) hPen);
gdi_SetROP2(gdi->drawing->hdc, polyline->bRop2);
@ -819,8 +832,8 @@ void gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
brush = &mem3blt->brush;
bitmap = (gdiBitmap*) mem3blt->bitmap;
foreColor = freerdp_convert_gdi_order_color(mem3blt->foreColor, gdi->srcBpp, gdi->format);
backColor = freerdp_convert_gdi_order_color(mem3blt->backColor, gdi->srcBpp, gdi->format);
foreColor = freerdp_convert_gdi_order_color(mem3blt->foreColor, gdi->srcBpp, gdi->format, gdi->palette);
backColor = freerdp_convert_gdi_order_color(mem3blt->backColor, gdi->srcBpp, gdi->format, gdi->palette);
originalColor = gdi_SetTextColor(gdi->drawing->hdc, foreColor);
@ -953,7 +966,7 @@ void gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
else
{
freerdp_image_copy(pDstData, gdi->format, -1, 0, 0,
64, 64, pSrcData, PIXEL_FORMAT_XRGB32, -1, 0, 0);
64, 64, pSrcData, PIXEL_FORMAT_XRGB32, -1, 0, 0, gdi->palette);
}
for (j = 0; j < message->numRects; j++)
@ -991,7 +1004,7 @@ void gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
pSrcData = gdi->codecs->nsc->BitmapData;
freerdp_image_copy(pDstData, gdi->format, -1, 0, 0,
cmd->width, cmd->height, pSrcData, PIXEL_FORMAT_XRGB32_VF, -1, 0, 0);
cmd->width, cmd->height, pSrcData, PIXEL_FORMAT_XRGB32_VF, -1, 0, 0, gdi->palette);
gdi->image->bitmap->width = cmd->width;
gdi->image->bitmap->height = cmd->height;
@ -1016,7 +1029,7 @@ void gdi_surface_bits(rdpContext* context, SURFACE_BITS_COMMAND* cmd)
pSrcData = cmd->bitmapData;
freerdp_image_copy(pDstData, gdi->format, -1, 0, 0,
cmd->width, cmd->height, pSrcData, PIXEL_FORMAT_XRGB32_VF, -1, 0, 0);
cmd->width, cmd->height, pSrcData, PIXEL_FORMAT_XRGB32_VF, -1, 0, 0, gdi->palette);
gdi->image->bitmap->width = cmd->width;
gdi->image->bitmap->height = cmd->height;

View File

@ -83,7 +83,7 @@ int gdi_OutputUpdate(rdpGdi* gdi)
update->BeginPaint(gdi->context);
freerdp_image_copy(pDstData, gdi->format, nDstStep, nXDst, nYDst, nWidth, nHeight,
surface->data, surface->format, surface->scanline, nXSrc, nYSrc);
surface->data, surface->format, surface->scanline, nXSrc, nYSrc, NULL);
gdi_InvalidateRegion(gdi->primary->hdc, nXDst, nYDst, nWidth, nHeight);
@ -142,7 +142,7 @@ int gdi_SurfaceCommand_Uncompressed(rdpGdi* gdi, RdpgfxClientContext* context, R
return -1;
freerdp_image_copy(surface->data, surface->format, surface->scanline, cmd->left, cmd->top,
cmd->width, cmd->height, cmd->data, PIXEL_FORMAT_XRGB32, cmd->width * 4, 0, 0);
cmd->width, cmd->height, cmd->data, PIXEL_FORMAT_XRGB32, cmd->width * 4, 0, 0, NULL);
invalidRect.left = cmd->left;
invalidRect.top = cmd->top;
@ -222,7 +222,7 @@ int gdi_SurfaceCommand_RemoteFX(rdpGdi* gdi, RdpgfxClientContext* context, RDPGF
freerdp_image_copy(surface->data, surface->format, surface->scanline,
nXDst, nYDst, nWidth, nHeight,
tile->data, PIXEL_FORMAT_XRGB32, 64 * 4, 0, 0);
tile->data, PIXEL_FORMAT_XRGB32, 64 * 4, 0, 0, NULL);
region16_union_rect(&(gdi->invalidRegion), &(gdi->invalidRegion), &updateRects[j]);
}
@ -470,7 +470,7 @@ int gdi_SurfaceCommand_Progressive(rdpGdi* gdi, RdpgfxClientContext* context, RD
freerdp_image_copy(surface->data, surface->format,
surface->scanline, nXDst, nYDst, nWidth, nHeight,
tile->data, PIXEL_FORMAT_XRGB32, 64 * 4, nXSrc, nYSrc);
tile->data, PIXEL_FORMAT_XRGB32, 64 * 4, nXSrc, nYSrc, NULL);
region16_union_rect(&(gdi->invalidRegion), &(gdi->invalidRegion), &updateRects[j]);
}
@ -673,7 +673,7 @@ int gdi_SurfaceToSurface(RdpgfxClientContext* context, RDPGFX_SURFACE_TO_SURFACE
{
freerdp_image_copy(surfaceDst->data, surfaceDst->format, surfaceDst->scanline,
destPt->x, destPt->y, nWidth, nHeight, surfaceSrc->data, surfaceSrc->format,
surfaceSrc->scanline, rectSrc->left, rectSrc->top);
surfaceSrc->scanline, rectSrc->left, rectSrc->top, NULL);
}
invalidRect.left = destPt->x;
@ -723,7 +723,7 @@ int gdi_SurfaceToCache(RdpgfxClientContext* context, RDPGFX_SURFACE_TO_CACHE_PDU
freerdp_image_copy(cacheEntry->data, cacheEntry->format, cacheEntry->scanline,
0, 0, cacheEntry->width, cacheEntry->height, surface->data,
surface->format, surface->scanline, rect->left, rect->top);
surface->format, surface->scanline, rect->left, rect->top, NULL);
context->SetCacheSlotData(context, surfaceToCache->cacheSlot, (void*) cacheEntry);
@ -751,7 +751,7 @@ int gdi_CacheToSurface(RdpgfxClientContext* context, RDPGFX_CACHE_TO_SURFACE_PDU
freerdp_image_copy(surface->data, surface->format, surface->scanline,
destPt->x, destPt->y, cacheEntry->width, cacheEntry->height,
cacheEntry->data, cacheEntry->format, cacheEntry->scanline, 0, 0);
cacheEntry->data, cacheEntry->format, cacheEntry->scanline, 0, 0, NULL);
invalidRect.left = destPt->x;
invalidRect.top = destPt->y;

View File

@ -96,7 +96,7 @@ HGDI_BITMAP gdi_create_bitmap(rdpGdi* gdi, int nWidth, int nHeight, int bpp, BYT
nSrcStep = nWidth * bytesPerPixel;
freerdp_image_copy(pDstData, gdi->format, nDstStep, 0, 0,
nWidth, nHeight, pSrcData, SrcFormat, nSrcStep, 0, 0);
nWidth, nHeight, pSrcData, SrcFormat, nSrcStep, 0, 0, gdi->palette);
bitmap = gdi_CreateBitmap(nWidth, nHeight, gdi->dstBpp, pDstData);
@ -173,7 +173,7 @@ void gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
freerdp_client_codecs_prepare(gdi->codecs, FREERDP_CODEC_INTERLEAVED);
status = interleaved_decompress(gdi->codecs->interleaved, pSrcData, SrcSize, bpp,
&pDstData, gdi->format, -1, 0, 0, width, height);
&pDstData, gdi->format, -1, 0, 0, width, height, gdi->palette);
}
else
{
@ -194,7 +194,7 @@ void gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
SrcFormat = gdi_get_pixel_format(bpp, TRUE);
status = freerdp_image_copy(pDstData, gdi->format, -1, 0, 0,
width, height, pSrcData, SrcFormat, -1, 0, 0);
width, height, pSrcData, SrcFormat, -1, 0, 0, gdi->palette);
}
bitmap->compressed = FALSE;
@ -265,8 +265,8 @@ void gdi_Glyph_BeginDraw(rdpContext* context, int x, int y, int width, int heigh
HGDI_BRUSH brush;
rdpGdi* gdi = context->gdi;
bgcolor = freerdp_convert_gdi_order_color(bgcolor, gdi->srcBpp, gdi->format);
fgcolor = freerdp_convert_gdi_order_color(fgcolor, gdi->srcBpp, gdi->format);
bgcolor = freerdp_convert_gdi_order_color(bgcolor, gdi->srcBpp, gdi->format, gdi->palette);
fgcolor = freerdp_convert_gdi_order_color(fgcolor, gdi->srcBpp, gdi->format, gdi->palette);
gdi_CRgnToRect(x, y, width, height, &rect);
@ -281,7 +281,7 @@ void gdi_Glyph_EndDraw(rdpContext* context, int x, int y, int width, int height,
{
rdpGdi* gdi = context->gdi;
bgcolor = freerdp_convert_gdi_order_color(bgcolor, gdi->srcBpp, gdi->format);
bgcolor = freerdp_convert_gdi_order_color(bgcolor, gdi->srcBpp, gdi->format, gdi->palette);
gdi->textColor = gdi_SetTextColor(gdi->drawing->hdc, bgcolor);
}