256 color support.

This commit is contained in:
Armin Novak 2016-04-19 22:11:12 +02:00 committed by Armin Novak
parent 48d1b4ee13
commit 716c5c53e9
17 changed files with 182 additions and 251 deletions

View File

@ -1237,7 +1237,7 @@ BOOL xf_post_connect(freerdp* instance)
}
else
{
xfc->palette = xfc->palette_hwgdi;
xfc->palette = context->gdi->palette;
xf_gdi_register_update_callbacks(update);
}

View File

@ -257,12 +257,9 @@ UINT32 xf_convert_rdp_order_color(xfContext* xfc, UINT32 color)
case 8:
color = (color >> 16) & (UINT32) 0xFF;
if (xfc->palette)
{
UINT32 dstColor = xfc->palette[color];
SplitColor(dstColor, xfc->format, &r, &g, &b,
NULL, NULL);
}
UINT32 dstColor = xfc->palette.palette[color];
SplitColor(dstColor, xfc->format, &r, &g, &b,
NULL, NULL);
break;
@ -289,7 +286,8 @@ Pixmap xf_brush_new(xfContext* xfc, int width, int height, int bpp, BYTE* data)
brushFormat = gdi_get_pixel_format(bpp, FALSE);
cdata = (BYTE*) _aligned_malloc(width * height * 4, 16);
freerdp_image_copy(cdata, xfc->format, -1, 0, 0,
width, height, data, brushFormat, -1, 0, 0, xfc->palette);
width, height, data, brushFormat, -1, 0, 0,
&xfc->palette);
image = XCreateImage(xfc->display, xfc->visual, xfc->depth,
ZPixmap, 0, (char*) cdata, width, height, xfc->scanline_pad, 0);
gc = XCreateGC(xfc->display, xfc->drawable, 0, NULL);
@ -373,7 +371,7 @@ BOOL xf_gdi_bitmap_update(rdpContext* context,
xfc->format, -1,
0, 0,
nWidth, nHeight,
xfc->palette);
&xfc->palette);
}
else
{
@ -396,7 +394,8 @@ BOOL xf_gdi_bitmap_update(rdpContext* context,
{
pDstData = xfc->bitmap_buffer;
status = freerdp_image_copy(pDstData, xfc->format, -1, 0, 0,
nWidth, nHeight, pSrcData, SrcFormat, -1, 0, 0, xfc->palette);
nWidth, nHeight, pSrcData, SrcFormat,
-1, 0, 0, &xfc->palette);
pSrcData = xfc->bitmap_buffer;
}
@ -431,15 +430,14 @@ static BOOL xf_gdi_palette_update(rdpContext* context,
{
int index;
const PALETTE_ENTRY* pe;
UINT32* palette32;
xfContext* xfc = (xfContext*) context;
xf_lock_x11(xfc, FALSE);
palette32 = (UINT32*) xfc->palette;
xfc->palette.format = xfc->format;
for (index = 0; index < palette->number; index++)
{
pe = &(palette->entries[index]);
palette32[index] = GetColor(xfc->format,
xfc->palette.palette[index] = GetColor(xfc->format,
pe->red, pe->green, pe->blue, 0xFF);
}
@ -1204,7 +1202,7 @@ static BOOL xf_gdi_surface_bits(rdpContext* context,
pDstData = xfc->bitmap_buffer;
freerdp_image_copy(pDstData, xfc->format, -1, 0, 0,
cmd->width, cmd->height, pSrcData,
PIXEL_FORMAT_BGRX32_VF, -1, 0, 0, xfc->palette);
PIXEL_FORMAT_BGRX32_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);
XPutImage(xfc->display, xfc->primary, xfc->gc, image, 0, 0,

View File

@ -76,7 +76,7 @@ static BOOL xf_Bitmap_New(rdpContext* context, rdpBitmap* bitmap)
freerdp_image_copy(data, xfc->format, -1, 0, 0,
bitmap->width, bitmap->height,
bitmap->data, SrcFormat,
-1, 0, 0, xfc->palette);
-1, 0, 0, &xfc->palette);
_aligned_free(bitmap->data);
bitmap->data = data;
@ -175,7 +175,7 @@ static BOOL xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
pSrcData, SrcSize, bpp,
pDstData, xfc->format,
-1, 0, 0, width, height,
xfc->palette);
&xfc->palette);
}
else
{
@ -200,7 +200,7 @@ static BOOL xf_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
status = freerdp_image_copy(pDstData, xfc->format, -1, 0, 0,
width, height, pSrcData,
SrcFormat, -1, 0, 0, xfc->palette);
SrcFormat, -1, 0, 0, &xfc->palette);
}
bitmap->compressed = FALSE;
@ -252,7 +252,7 @@ static BOOL xf_Pointer_New(rdpContext* context, rdpPointer* pointer)
pointer->width * 4, 0, 0, pointer->width, pointer->height,
pointer->xorMaskData, pointer->lengthXorMask,
pointer->andMaskData, pointer->lengthAndMask,
pointer->xorBpp, xfc->palette) < 0)
pointer->xorBpp, &xfc->palette) < 0)
{
free(ci.pixels);
xf_unlock_x11(xfc, FALSE);

View File

@ -136,8 +136,7 @@ struct xf_context
HANDLE mutex;
BOOL UseXThreads;
BOOL cursorHidden;
UINT32* palette;
UINT32 palette_hwgdi[256];
gdiPalette palette;
HGDI_DC hdc;
UINT32 bitmap_size;

View File

@ -1663,6 +1663,17 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
CommandLineSwitchCase(arg, "bpp")
{
settings->ColorDepth = atoi(arg->Value);
switch(settings->ColorDepth)
{
case 32:
case 24:
case 16:
case 15:
case 8:
break;
default:
return COMMAND_LINE_ERROR_UNEXPECTED_VALUE;
}
}
CommandLineSwitchCase(arg, "admin")
{

View File

@ -74,7 +74,8 @@ FREERDP_API int clear_compress(CLEAR_CONTEXT* clear, BYTE* pSrcData, UINT32 SrcS
FREERDP_API INT32 clear_decompress(CLEAR_CONTEXT* clear, const BYTE* pSrcData,
UINT32 SrcSize, UINT32 nWidth, UINT32 nHeight,
BYTE* pDstData, UINT32 DstFormat, UINT32 nDstStep,
UINT32 nXDst, UINT32 nYDst, UINT32 nDstWidth, UINT32 nDstHeight);
UINT32 nXDst, UINT32 nYDst, UINT32 nDstWidth, UINT32 nDstHeight,
const gdiPalette* palette);
FREERDP_API BOOL clear_context_reset(CLEAR_CONTEXT* clear);

View File

@ -23,7 +23,6 @@
#define FREERDP_CODEC_COLOR_H
#include <freerdp/api.h>
#include <freerdp/freerdp.h>
#include <winpr/wlog.h>
#define FREERDP_PIXEL_FORMAT_TYPE_A 0
@ -128,6 +127,13 @@
#define PIXEL_FORMAT_MONO PIXEL_FORMAT_A1_F(0)
#define PIXEL_FORMAT_MONO_VF PIXEL_FORMAT_A1_F(1)
struct gdi_palette
{
UINT32 format;
UINT32 palette[256];
};
typedef struct gdi_palette gdiPalette;
#ifdef __cplusplus
extern "C" {
#endif
@ -263,7 +269,7 @@ static const char* GetColorFormatName(UINT32 format)
}
static INLINE void SplitColor(UINT32 color, UINT32 format, BYTE* _r, BYTE* _g,
BYTE* _b, BYTE* _a, const UINT32* palette)
BYTE* _b, BYTE* _a, const gdiPalette* palette)
{
UINT32 tmp;
@ -515,8 +521,11 @@ static INLINE void SplitColor(UINT32 color, UINT32 format, BYTE* _r, BYTE* _g,
/* 8bpp formats */
case PIXEL_FORMAT_RGB8:
tmp = palette[color];
SplitColor(tmp, PIXEL_FORMAT_ARGB32, _r, _g, _b, _a, NULL);
if (color <= 0xFF)
{
tmp = palette->palette[color];
SplitColor(tmp, palette->format, _r, _g, _b, _a, NULL);
}
break;
/* 1bpp formats */
@ -709,7 +718,7 @@ static INLINE BOOL WriteColor(BYTE* dst, UINT32 format, UINT32 color)
}
static INLINE UINT32 ConvertColor(UINT32 color, UINT32 srcFormat,
UINT32 dstFormat, const UINT32* palette)
UINT32 dstFormat, const gdiPalette* palette)
{
BYTE r = 0;
BYTE g = 0;
@ -733,21 +742,21 @@ FREERDP_API BOOL freerdp_image_copy_from_monochrome(BYTE* pDstData,
UINT32 nWidth, UINT32 nHeight,
const BYTE* pSrcData,
UINT32 backColor, UINT32 foreColor,
const UINT32* palette);
const gdiPalette* palette);
FREERDP_API BOOL freerdp_image_copy_from_pointer_data(
BYTE* pDstData, UINT32 DstFormat, UINT32 nDstStep,
UINT32 nXDst, UINT32 nYDst, UINT32 nWidth, UINT32 nHeight,
const BYTE* xorMask, UINT32 xorMaskLength,
const BYTE* andMask, UINT32 andMaskLength,
UINT32 xorBpp, const UINT32* palette);
UINT32 xorBpp, const gdiPalette* palette);
FREERDP_API BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat,
INT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
UINT32 nWidth, UINT32 nHeight,
const BYTE* pSrcData, DWORD SrcFormat,
INT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc,
const UINT32* palette);
const gdiPalette* palette);
FREERDP_API BOOL freerdp_image_fill(BYTE* pDstData, DWORD DstFormat,
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,

View File

@ -48,14 +48,14 @@ FREERDP_API INT32 interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved
BYTE* pDstData, UINT32 DstFormat,
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
UINT32 nWidth, UINT32 nHeight,
const UINT32* palette);
const gdiPalette* palette);
FREERDP_API BOOL interleaved_compress(BITMAP_INTERLEAVED_CONTEXT* interleaved,
BYTE* pDstData, UINT32* pDstSize,
UINT32 nWidth, UINT32 nHeight,
const BYTE* pSrcData, UINT32 SrcFormat,
UINT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc,
const UINT32* palette, UINT32 bpp);
const gdiPalette* palette, UINT32 bpp);
FREERDP_API BOOL bitmap_interleaved_context_reset(BITMAP_INTERLEAVED_CONTEXT* interleaved);

View File

@ -189,6 +189,7 @@ struct _GDI_PEN
UINT32 posY;
UINT32 color;
UINT32 format;
gdiPalette* palette;
};
typedef struct _GDI_PEN GDI_PEN;
typedef GDI_PEN* HGDI_PEN;
@ -295,7 +296,7 @@ struct rdp_gdi
BYTE* bitmap_buffer;
BYTE* primary_buffer;
UINT32 textColor;
UINT32 palette[256];
gdiPalette palette;
gdiBitmap* image;
void (*free)(void*);

View File

@ -28,7 +28,7 @@
#endif
FREERDP_API HGDI_PEN gdi_CreatePen(UINT32 fnPenStyle, UINT32 nWidth,
UINT32 crColor, UINT32 format);
UINT32 crColor, UINT32 format, const gdiPalette* palette);
FREERDP_API UINT32 gdi_GetPenColor(HGDI_PEN pen, UINT32 format);
#ifdef __cplusplus

View File

@ -58,7 +58,7 @@ static BYTE CLEAR_8BIT_MASKS[9] =
static void convert_color(BYTE* dst, UINT32 nDstStep, UINT32 DstFormat,
UINT32 nXDst, UINT32 nYDst, UINT32 nWidth, UINT32 nHeight,
const BYTE* src, UINT32 nSrcStep, UINT32 SrcFormat,
UINT32 nDstWidth, UINT32 nDstHeight)
UINT32 nDstWidth, UINT32 nDstHeight, const gdiPalette* palette)
{
UINT32 x, y;
@ -80,7 +80,7 @@ static void convert_color(BYTE* dst, UINT32 nDstStep, UINT32 DstFormat,
&pDstLine[(nXDst + x) * GetBytesPerPixel(DstFormat)];
UINT32 color = ReadColor(pSrcPixel, SrcFormat);
color = ConvertColor(color, SrcFormat,
DstFormat, NULL);
DstFormat, palette);
WriteColor(pDstPixel, DstFormat, color);
}
}
@ -234,7 +234,9 @@ static BOOL clear_decompress_residual_data(CLEAR_CONTEXT* clear,
UINT32 residualByteCount, UINT32 SrcSize,
UINT32 nWidth, UINT32 nHeight,
BYTE* pDstData, UINT32 DstFormat, UINT32 nDstStep,
UINT32 nXDst, UINT32 nYDst, UINT32 nDstWidth, UINT32 nDstHeight)
UINT32 nXDst, UINT32 nYDst,
UINT32 nDstWidth, UINT32 nDstHeight,
const gdiPalette* palette)
{
UINT32 i;
UINT32 nSrcStep;
@ -305,7 +307,7 @@ static BOOL clear_decompress_residual_data(CLEAR_CONTEXT* clear,
convert_color(pDstData, nDstStep, DstFormat,
nXDst, nYDst, nWidth, nHeight,
clear->TempBuffer, nSrcStep, clear->format,
nDstWidth, nDstHeight);
nDstWidth, nDstHeight, palette);
return TRUE;
}
@ -584,7 +586,8 @@ static BOOL clear_decompress_bands_data(CLEAR_CONTEXT* clear,
INT32 clear_decompress(CLEAR_CONTEXT* clear, const BYTE* pSrcData,
UINT32 SrcSize, UINT32 nWidth, UINT32 nHeight,
BYTE* pDstData, UINT32 DstFormat, UINT32 nDstStep,
UINT32 nXDst, UINT32 nYDst, UINT32 nDstWidth, UINT32 nDstHeight)
UINT32 nXDst, UINT32 nYDst, UINT32 nDstWidth,
UINT32 nDstHeight, const gdiPalette* palette)
{
BYTE seqNumber;
BYTE glyphFlags;
@ -657,7 +660,7 @@ INT32 clear_decompress(CLEAR_CONTEXT* clear, const BYTE* pSrcData,
convert_color(pDstData, nDstStep, DstFormat,
nXDst, nYDst, nWidth, nHeight,
glyphData, nSrcStep, clear->format,
nDstWidth, nDstHeight);
nDstWidth, nDstHeight, palette);
return 1; /* Finish */
}
}
@ -677,7 +680,7 @@ INT32 clear_decompress(CLEAR_CONTEXT* clear, const BYTE* pSrcData,
&pSrcData[offset], residualByteCount,
SrcSize - offset, nWidth, nHeight,
pDstData, DstFormat, nDstStep, nXDst, nYDst,
nDstWidth, nDstHeight))
nDstWidth, nDstHeight, palette))
return -1111;
offset += residualByteCount;
@ -764,7 +767,7 @@ INT32 clear_decompress(CLEAR_CONTEXT* clear, const BYTE* pSrcData,
nXDstRel, nYDstRel, width, height,
bitmapData, nSrcStep,
PIXEL_FORMAT_BGR24,
nDstWidth, nDstHeight);
nDstWidth, nDstHeight, palette);
}
else if (subcodecId == 1) /* NSCodec */
{
@ -821,7 +824,7 @@ INT32 clear_decompress(CLEAR_CONTEXT* clear, const BYTE* pSrcData,
convert_color(pDstData, nDstStep, DstFormat,
nXDst, nYDst, nWidth, nHeight,
glyphData, nSrcStep, clear->format,
nDstWidth, nDstHeight);
nDstWidth, nDstHeight, palette);
}
if (offset != SrcSize)

View File

@ -76,11 +76,11 @@ BYTE* freerdp_glyph_convert(UINT32 width, UINT32 height, const BYTE* data)
}
BOOL freerdp_image_copy_from_monochrome(BYTE* pDstData, UINT32 DstFormat,
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
UINT32 nWidth, UINT32 nHeight,
const BYTE* pSrcData,
UINT32 backColor, UINT32 foreColor,
const UINT32* palette)
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
UINT32 nWidth, UINT32 nHeight,
const BYTE* pSrcData,
UINT32 backColor, UINT32 foreColor,
const gdiPalette* palette)
{
UINT32 x, y;
BOOL vFlip;
@ -161,11 +161,11 @@ static INLINE UINT32 freerdp_image_inverted_pointer_color(UINT32 x, UINT32 y)
*/
BOOL freerdp_image_copy_from_pointer_data(
BYTE* pDstData, UINT32 DstFormat, UINT32 nDstStep,
UINT32 nXDst, UINT32 nYDst, UINT32 nWidth, UINT32 nHeight,
const BYTE* xorMask, UINT32 xorMaskLength,
const BYTE* andMask, UINT32 andMaskLength,
UINT32 xorBpp, const UINT32* palette)
BYTE* pDstData, UINT32 DstFormat, UINT32 nDstStep,
UINT32 nXDst, UINT32 nYDst, UINT32 nWidth, UINT32 nHeight,
const BYTE* xorMask, UINT32 xorMaskLength,
const BYTE* andMask, UINT32 andMaskLength,
UINT32 xorBpp, const gdiPalette* palette)
{
UINT32 x, y;
BOOL vFlip;
@ -220,7 +220,7 @@ BOOL freerdp_image_copy_from_pointer_data(
for (y = 0; y < nHeight; y++)
{
BYTE* pDstPixel = &pDstData[((nYDst + y) * nDstStep) +
(nXDst * GetBytesPerPixel(DstFormat))];
(nXDst * GetBytesPerPixel(DstFormat))];
xorBit = andBit = 0x80;
if (!vFlip)
@ -263,7 +263,7 @@ BOOL freerdp_image_copy_from_pointer_data(
color = freerdp_image_inverted_pointer_color(x, y); /* inverted */
color = ConvertColor(color, PIXEL_FORMAT_ABGR32,
DstFormat, NULL);
DstFormat, palette);
WriteColor(pDstPixel, DstFormat, color);
pDstPixel += GetBytesPerPixel(DstFormat);
}
@ -295,7 +295,7 @@ BOOL freerdp_image_copy_from_pointer_data(
for (y = 0; y < nHeight; y++)
{
BYTE* pDstPixel = &pDstData[((nYDst + y) * nDstStep) +
(nXDst * GetBytesPerPixel(DstFormat))];
(nXDst * GetBytesPerPixel(DstFormat))];
andBit = 0x80;
if (!vFlip)
@ -330,7 +330,7 @@ BOOL freerdp_image_copy_from_pointer_data(
xorPixel = ConvertColor(*(UINT16*)xorBits,
PIXEL_FORMAT_RGB16,
PIXEL_FORMAT_ARGB32,
NULL);
palette);
}
else if (xorBpp == 8)
{
@ -367,12 +367,13 @@ BOOL freerdp_image_copy_from_pointer_data(
else
color = xorPixel;
color = ConvertColor(color, PIXEL_FORMAT_ARGB32, DstFormat, NULL);
color = ConvertColor(color, PIXEL_FORMAT_ARGB32, DstFormat,
palette);
}
else
{
color = ConvertColor(xorPixel, PIXEL_FORMAT_ARGB32,
DstFormat, NULL);
DstFormat, palette);
}
WriteColor(pDstPixel, DstFormat, color);
@ -394,7 +395,7 @@ BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat,
UINT32 nWidth, UINT32 nHeight,
const BYTE* pSrcData, DWORD SrcFormat,
INT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc,
const UINT32* palette)
const gdiPalette* palette)
{
const UINT32 dstByte = GetBytesPerPixel(DstFormat);
const UINT32 srcByte = GetBytesPerPixel(SrcFormat);
@ -469,7 +470,7 @@ BOOL freerdp_image_copy(BYTE* pDstData, DWORD DstFormat,
}
if (FREERDP_PIXEL_FORMAT_FLIP_MASKED(SrcFormat) ==
FREERDP_PIXEL_FORMAT_FLIP_MASKED(DstFormat))
FREERDP_PIXEL_FORMAT_FLIP_MASKED(DstFormat))
{
UINT32 y;

View File

@ -252,7 +252,7 @@ INT32 interleaved_decompress(BITMAP_INTERLEAVED_CONTEXT* interleaved,
BYTE* pDstData, UINT32 DstFormat,
UINT32 nDstStep, UINT32 nXDst, UINT32 nYDst,
UINT32 nWidth, UINT32 nHeight,
const UINT32* palette)
const gdiPalette* palette)
{
INT32 status;
UINT32 scanline;
@ -336,7 +336,7 @@ BOOL interleaved_compress(BITMAP_INTERLEAVED_CONTEXT* interleaved,
UINT32 nWidth, UINT32 nHeight,
const BYTE* pSrcData, UINT32 SrcFormat,
UINT32 nSrcStep, UINT32 nXSrc, UINT32 nYSrc,
const UINT32* palette, UINT32 bpp)
const gdiPalette* palette, UINT32 bpp)
{
int status;
wStream* s;

View File

@ -388,7 +388,7 @@ INLINE BYTE* gdi_get_brush_pointer(HGDI_DC hdcBrush, int x, int y)
if (hdcBrush->brush != NULL)
{
if ((hdcBrush->brush->style == GDI_BS_PATTERN)
|| (hdcBrush->brush->style == GDI_BS_HATCHED))
|| (hdcBrush->brush->style == GDI_BS_HATCHED))
{
HGDI_BITMAP hBmpBrush = hdcBrush->brush->pattern;
@ -399,11 +399,11 @@ INLINE BYTE* gdi_get_brush_pointer(HGDI_DC hdcBrush, int x, int y)
if (x >= 0 && y >= 0)
{
x = (x + hBmpBrush->width - (hdcBrush->brush->nXOrg % hBmpBrush->width)) %
hBmpBrush->width;
hBmpBrush->width;
y = (y + hBmpBrush->height - (hdcBrush->brush->nYOrg % hBmpBrush->height)) %
hBmpBrush->height;
hBmpBrush->height;
p = hBmpBrush->data + (y * hBmpBrush->scanline) + (x * GetBytesPerPixel(
hBmpBrush->format));
hBmpBrush->format));
return p;
}
}
@ -414,7 +414,7 @@ INLINE BYTE* gdi_get_brush_pointer(HGDI_DC hdcBrush, int x, int y)
}
gdiBitmap* gdi_bitmap_new_ex(rdpGdi* gdi, int width, int height, int bpp,
BYTE* data)
BYTE* data)
{
gdiBitmap* bitmap;
bitmap = (gdiBitmap*) calloc(1, sizeof(gdiBitmap));
@ -458,19 +458,10 @@ void gdi_bitmap_free_ex(gdiBitmap* bitmap)
}
static BOOL gdi_bitmap_update(rdpContext* context,
const BITMAP_UPDATE* bitmapUpdate)
const BITMAP_UPDATE* bitmapUpdate)
{
int status;
UINT32 nWidth;
UINT32 nHeight;
UINT32 nSrcStep;
UINT32 nDstStep;
UINT32 index;
BYTE* pSrcData;
BYTE* pDstData;
UINT32 SrcSize;
BOOL compressed;
UINT32 bitsPerPixel;
rdpGdi* gdi = context->gdi;
rdpCodecs* codecs = context->codecs;
@ -492,25 +483,17 @@ static BOOL gdi_bitmap_update(rdpContext* context,
{
if (bitsPerPixel < 32)
{
if (!freerdp_client_codecs_prepare(
codecs, FREERDP_CODEC_INTERLEAVED))
return FALSE;
status = interleaved_decompress(codecs->interleaved,
pSrcData, SrcSize,
bitsPerPixel,
gdi->bitmap_buffer,
gdi->primary_buffer,
gdi->dstFormat,
gdi->bitmap_stride, 0, 0,
gdi->stride, nXDst, nYDst,
nWidth, nHeight,
gdi->palette);
}
else
{
if (!freerdp_client_codecs_prepare(
codecs, FREERDP_CODEC_PLANAR))
return FALSE;
status = planar_decompress(codecs->planar, pSrcData,
SrcSize, gdi->primary_buffer,
gdi->dstFormat,
@ -523,17 +506,16 @@ static BOOL gdi_bitmap_update(rdpContext* context,
WLog_ERR(TAG, "bitmap decompression failure");
return FALSE;
}
pSrcData = gdi->bitmap_buffer;
}
else
{
UINT32 SrcFormat = gdi_get_pixel_format(bitsPerPixel, TRUE);
UINT32 nSrcStep = nWidth * GetBytesPerPixel(SrcFormat);
nSrcStep = nWidth * GetBytesPerPixel(gdi->dstFormat);
pDstData = gdi->primary_buffer;
nDstStep = gdi->stride;
nWidth = MIN(bitmap->destRight,
gdi->width - 1) - bitmap->destLeft + 1; /* clip width */
nHeight = MIN(bitmap->destBottom,
gdi->height - 1) - bitmap->destTop + 1; /* clip height */
nWidth = MIN(bitmap->destRight,
gdi->width - 1) - bitmap->destLeft + 1; /* clip width */
nHeight = MIN(bitmap->destBottom,
gdi->height - 1) - bitmap->destTop + 1; /* clip height */
if (!freerdp_image_copy(gdi->primary_buffer, gdi->dstFormat, gdi->stride,
nXDst, nYDst, nWidth, nHeight,
@ -551,7 +533,7 @@ static BOOL gdi_bitmap_update(rdpContext* context,
}
static BOOL gdi_palette_update(rdpContext* context,
const PALETTE_UPDATE* palette)
const PALETTE_UPDATE* palette)
{
int index;
const PALETTE_ENTRY* pe;
@ -562,8 +544,8 @@ static BOOL gdi_palette_update(rdpContext* context,
for (index = 0; index < (int) palette->number; index++)
{
pe = &(palette->entries[index]);
palette32[index] = GetColor(gdi->dstFormat, pe->red, pe->green, pe->blue,
0xFF);
gdi->palette.palette[index] =
GetColor(gdi->dstFormat, pe->red, pe->green, pe->blue, 0xFF);
}
return TRUE;
@ -576,7 +558,7 @@ static BOOL gdi_set_bounds(rdpContext* context, const rdpBounds* bounds)
if (bounds)
{
gdi_SetClipRgn(gdi->drawing->hdc, bounds->left, bounds->top,
bounds->right - bounds->left + 1, bounds->bottom - bounds->top + 1);
bounds->right - bounds->left + 1, bounds->bottom - bounds->top + 1);
}
else
{
@ -761,7 +743,7 @@ static BOOL gdi_scrblt(rdpContext* context, const SCRBLT_ORDER* scrblt)
}
static BOOL gdi_opaque_rect(rdpContext* context,
const OPAQUE_RECT_ORDER* opaque_rect)
const OPAQUE_RECT_ORDER* opaque_rect)
{
GDI_RECT rect;
HGDI_BRUSH hBrush;
@ -770,7 +752,7 @@ static BOOL gdi_opaque_rect(rdpContext* context,
BOOL ret;
UINT32 SrcFormat = gdi_get_pixel_format(context->settings->ColorDepth, FALSE);
gdi_CRgnToRect(opaque_rect->nLeftRect, opaque_rect->nTopRect,
opaque_rect->nWidth, opaque_rect->nHeight, &rect);
opaque_rect->nWidth, opaque_rect->nHeight, &rect);
brush_color = ConvertColor(opaque_rect->color, SrcFormat,
gdi->dstFormat, gdi->palette);
@ -798,7 +780,7 @@ static BOOL gdi_multi_opaque_rect(rdpContext* context,
{
rectangle = &multi_opaque_rect->rectangles[i];
gdi_CRgnToRect(rectangle->left, rectangle->top,
rectangle->width, rectangle->height, &rect);
rectangle->width, rectangle->height, &rect);
brush_color = ConvertColor(multi_opaque_rect->color, SrcFormat,
gdi->dstFormat, gdi->palette);
hBrush = gdi_CreateSolidBrush(brush_color);
@ -933,8 +915,8 @@ static BOOL gdi_mem3blt(rdpContext* context, MEM3BLT_ORDER* mem3blt)
goto out_fail;
}
freerdp_image_copy(data, gdi->dstFormat, -1, 0, 0,
8, 8, brush->data, brushFormat, -1, 0, 0, gdi->palette);
freerdp_image_copy(data, gdi->dstFormat, 0, 0, 0,
8, 8, brush->data, brushFormat, 0, 0, 0, &gdi->palette);
}
else
{
@ -1014,13 +996,13 @@ static BOOL gdi_ellipse_cb(rdpContext* context,
}
static BOOL gdi_frame_marker(rdpContext* context,
const FRAME_MARKER_ORDER* frameMarker)
const FRAME_MARKER_ORDER* frameMarker)
{
return TRUE;
}
BOOL gdi_surface_frame_marker(rdpContext* context,
const SURFACE_FRAME_MARKER* surfaceFrameMarker)
const SURFACE_FRAME_MARKER* surfaceFrameMarker)
{
DEBUG_GDI("frameId %d frameAction %d",
surfaceFrameMarker->frameId,
@ -1035,7 +1017,7 @@ BOOL gdi_surface_frame_marker(rdpContext* context,
if (context->settings->FrameAcknowledge > 0)
{
IFCALL(context->update->SurfaceFrameAcknowledge, context,
surfaceFrameMarker->frameId);
surfaceFrameMarker->frameId);
}
break;
@ -1045,99 +1027,48 @@ BOOL gdi_surface_frame_marker(rdpContext* context,
}
static BOOL gdi_surface_bits(rdpContext* context,
const SURFACE_BITS_COMMAND* cmd)
const SURFACE_BITS_COMMAND* cmd)
{
BYTE* pSrcData;
BYTE* pDstData;
rdpGdi* gdi = context->gdi;
DEBUG_GDI("destLeft %d destTop %d destRight %d destBottom %d "
"bpp %d codecID %d width %d height %d length %d",
cmd->destLeft, cmd->destTop, cmd->destRight, cmd->destBottom,
cmd->bpp, cmd->codecID, cmd->width, cmd->height, cmd->bitmapDataLength);
gdi->bitmap_stride = (cmd->width + 64 - cmd->width % 64)
* GetBytesPerPixel(gdi->dstFormat);
if (gdi->bitmap_size < (gdi->bitmap_stride * cmd->height))
{
gdi->bitmap_size = gdi->bitmap_stride * cmd->height;
gdi->bitmap_buffer = (BYTE*) _aligned_realloc(gdi->bitmap_buffer,
gdi->bitmap_size, 16);
if (!gdi->bitmap_buffer)
return FALSE;
}
switch(cmd->codecID)
{
case RDP_CODEC_ID_REMOTEFX:
{
if (!freerdp_client_codecs_prepare(gdi->codecs, FREERDP_CODEC_REMOTEFX))
return FALSE;
pDstData = gdi->bitmap_buffer;
if (!rfx_process_message(gdi->codecs->rfx, cmd->bitmapData,
PIXEL_FORMAT_BGRX32,
cmd->bitmapDataLength,
0, 0,
pDstData, gdi->dstFormat,
gdi->bitmap_buffer, gdi->dstFormat,
cmd->width * GetBytesPerPixel(gdi->dstFormat),
cmd->height, NULL))
{
WLog_ERR(TAG, "Failed to process RemoteFX message");
return FALSE;
}
gdi_DeleteObject((HGDIOBJECT)gdi->image->bitmap);
gdi->image->bitmap = gdi_CreateBitmapEx(cmd->width, cmd->height,
gdi->dstFormat, 0,
pDstData, NULL);
gdi_SelectObject(gdi->image->hdc, (HGDIOBJECT) gdi->image->bitmap);
gdi_BitBlt(gdi->primary->hdc, cmd->destLeft, cmd->destTop,
cmd->width, cmd->height, gdi->image->hdc,0, 0,
GDI_SRCCOPY);
}
break;
case RDP_CODEC_ID_NSCODEC:
{
if (!freerdp_client_codecs_prepare(gdi->codecs, FREERDP_CODEC_NSCODEC))
return FALSE;
if (!nsc_process_message(gdi->codecs->nsc, cmd->bpp, cmd->width,
cmd->height, cmd->bitmapData,
cmd->bitmapDataLength, gdi->bitmap_buffer,
gdi->dstFormat,
0, 0, 0, cmd->width, cmd->height))
cmd->bitmapDataLength, gdi->primary_buffer,
gdi->dstFormat, gdi->stride, cmd->destLeft, cmd->destTop,
cmd->width, cmd->height))
return FALSE;
pDstData = gdi->bitmap_buffer;
gdi_DeleteObject((HGDIOBJECT)gdi->image->bitmap);
gdi->image->bitmap = gdi_CreateBitmapEx(cmd->width, cmd->height,
gdi->dstFormat, 0,
pDstData, NULL);
gdi_SelectObject(gdi->image->hdc, (HGDIOBJECT) gdi->image->bitmap);
gdi_BitBlt(gdi->primary->hdc, cmd->destLeft, cmd->destTop,
cmd->width, cmd->height, gdi->image->hdc, 0, 0,
GDI_SRCCOPY);
}
break;
case RDP_CODEC_ID_NONE:
{
pDstData = gdi->bitmap_buffer;
pSrcData = cmd->bitmapData;
if (!freerdp_image_copy(pDstData, gdi->dstFormat, -1, 0, 0,
cmd->width, cmd->height, pSrcData,
PIXEL_FORMAT_XRGB32_VF, -1, 0, 0, gdi->palette))
if (!freerdp_image_copy(gdi->primary_buffer, gdi->dstFormat, gdi->stride,
cmd->destLeft, cmd->destTop, cmd->width, cmd->height,
cmd->bitmapData, PIXEL_FORMAT_XRGB32_VF, 0, 0, 0,
&gdi->palette))
return FALSE;
gdi_DeleteObject((HGDIOBJECT)gdi->image->bitmap);
gdi->image->bitmap = gdi_CreateBitmapEx(cmd->width, cmd->height,
gdi->dstFormat,
0,
pDstData, NULL);
gdi_SelectObject(gdi->image->hdc, (HGDIOBJECT) gdi->image->bitmap);
gdi_BitBlt(gdi->primary->hdc, cmd->destLeft, cmd->destTop,
cmd->width, cmd->height, gdi->image->hdc, 0, 0, GDI_SRCCOPY);
}
break;
default:
@ -1187,7 +1118,7 @@ void gdi_register_update_callbacks(rdpUpdate* update)
}
static BOOL gdi_init_primary(rdpGdi* gdi, UINT32 stride, BYTE* buffer,
void (*pfree)(void*))
void (*pfree)(void*))
{
gdi->primary = (gdiBitmap*) calloc(1, sizeof(gdiBitmap));
@ -1205,9 +1136,9 @@ static BOOL gdi_init_primary(rdpGdi* gdi, UINT32 stride, BYTE* buffer,
else
{
gdi->primary->bitmap = gdi_CreateBitmapEx(gdi->width, gdi->height,
gdi->dstFormat,
gdi->stride,
gdi->primary_buffer, pfree);
gdi->dstFormat,
gdi->stride,
gdi->primary_buffer, pfree);
}
gdi->stride = gdi->primary->bitmap->scanline;
@ -1229,7 +1160,7 @@ static BOOL gdi_init_primary(rdpGdi* gdi, UINT32 stride, BYTE* buffer,
gdi->primary->hdc->hwnd->count = 32;
if (!(gdi->primary->hdc->hwnd->cinvalid = (HGDI_RGN) calloc(
gdi->primary->hdc->hwnd->count, sizeof(GDI_RGN))))
gdi->primary->hdc->hwnd->count, sizeof(GDI_RGN))))
goto fail_hwnd;
gdi->primary->hdc->hwnd->ninvalid = 0;
@ -1316,9 +1247,6 @@ BOOL gdi_init_ex(freerdp* instance, UINT32 format, UINT32 stride, BYTE* buffer,
if (!gdi_init_primary(gdi, stride, buffer, pfree))
goto fail_init_primary;
if (!(gdi->image = gdi_bitmap_new_ex(gdi, 64, 64, 32, NULL)))
goto fail_image_bitmap;
if (!instance->context->cache)
{
if (!(cache = cache_new(instance->settings)))
@ -1327,6 +1255,9 @@ BOOL gdi_init_ex(freerdp* instance, UINT32 format, UINT32 stride, BYTE* buffer,
instance->context->cache = cache;
}
if (!freerdp_client_codecs_reset(gdi->codecs, FREERDP_CODEC_ALL, gdi->width, gdi->height))
goto fail_register_graphics;
gdi_register_update_callbacks(instance->update);
brush_cache_register_callbacks(instance->update);
glyph_cache_register_callbacks(instance->update);
@ -1348,11 +1279,8 @@ fail_register_graphics:
}
fail_cache:
gdi_bitmap_free_ex(gdi->image);
fail_image_bitmap:
gdi_bitmap_free_ex(gdi->primary);
fail_init_primary:
gdi_DeleteDC(gdi->hdc);
fail_get_hdc:
free(gdi);
fail_gdi:
@ -1367,9 +1295,7 @@ void gdi_free(freerdp* instance)
if (gdi)
{
gdi_bitmap_free_ex(gdi->primary);
gdi_bitmap_free_ex(gdi->image);
gdi_DeleteDC(gdi->hdc);
_aligned_free(gdi->bitmap_buffer);
free(gdi);
}

View File

@ -35,7 +35,7 @@
* @return 0 on success, otherwise a Win32 error code
*/
static UINT gdi_ResetGraphics(RdpgfxClientContext* context,
const RDPGFX_RESET_GRAPHICS_PDU* resetGraphics)
const RDPGFX_RESET_GRAPHICS_PDU* resetGraphics)
{
UINT32 index;
UINT16 count;
@ -50,7 +50,7 @@ static UINT gdi_ResetGraphics(RdpgfxClientContext* context,
DesktopHeight = resetGraphics->height;
if ((DesktopWidth != settings->DesktopWidth)
|| (DesktopHeight != settings->DesktopHeight))
|| (DesktopHeight != settings->DesktopHeight))
{
settings->DesktopWidth = DesktopWidth;
settings->DesktopHeight = DesktopHeight;
@ -206,7 +206,7 @@ static UINT gdi_SurfaceCommand_Uncompressed(rdpGdi* gdi,
if (!freerdp_image_copy(surface->data, surface->format, surface->scanline,
cmd->left, cmd->top, cmd->width, cmd->height,
cmd->data, cmd->format, -1, 0, 0, NULL))
cmd->data, cmd->format, 0, 0, 0, NULL))
return ERROR_INTERNAL_ERROR;
invalidRect.left = cmd->left;
@ -214,7 +214,7 @@ static UINT gdi_SurfaceCommand_Uncompressed(rdpGdi* gdi,
invalidRect.right = cmd->right;
invalidRect.bottom = cmd->bottom;
region16_union_rect(&(surface->invalidRegion), &(surface->invalidRegion),
&invalidRect);
&invalidRect);
if (!gdi->inGfxFrame)
{
@ -241,9 +241,6 @@ static UINT gdi_SurfaceCommand_RemoteFX(rdpGdi* gdi,
if (!surface)
return ERROR_INTERNAL_ERROR;
if (!freerdp_client_codecs_prepare(surface->codecs, FREERDP_CODEC_REMOTEFX))
return ERROR_INTERNAL_ERROR;
if (!rfx_process_message(surface->codecs->rfx, cmd->data, cmd->format,
cmd->length,
cmd->left, cmd->top,
@ -281,13 +278,11 @@ static UINT gdi_SurfaceCommand_ClearCodec(rdpGdi* gdi,
if (!surface)
return ERROR_INTERNAL_ERROR;
if (!freerdp_client_codecs_prepare(gdi->codecs, FREERDP_CODEC_CLEARCODEC))
return ERROR_INTERNAL_ERROR;
rc = clear_decompress(gdi->codecs->clear, cmd->data, cmd->length,
surface->data, surface->format,
surface->scanline, cmd->left, cmd->top,
cmd->width, cmd->height);
cmd->width, cmd->height,
surface->data, surface->format,
surface->scanline, cmd->left, cmd->top,
surface->width, surface->height, &gdi->palette);
if (rc < 0)
{
@ -300,7 +295,7 @@ static UINT gdi_SurfaceCommand_ClearCodec(rdpGdi* gdi,
invalidRect.right = cmd->right;
invalidRect.bottom = cmd->bottom;
region16_union_rect(&(surface->invalidRegion), &(surface->invalidRegion),
&invalidRect);
&invalidRect);
if (!gdi->inGfxFrame)
{
@ -317,7 +312,7 @@ static UINT gdi_SurfaceCommand_ClearCodec(rdpGdi* gdi,
* @return 0 on success, otherwise a Win32 error code
*/
static UINT gdi_SurfaceCommand_Planar(rdpGdi* gdi, RdpgfxClientContext* context,
const RDPGFX_SURFACE_COMMAND* cmd)
const RDPGFX_SURFACE_COMMAND* cmd)
{
INT32 rc;
UINT status = CHANNEL_RC_OK;
@ -329,14 +324,11 @@ static UINT gdi_SurfaceCommand_Planar(rdpGdi* gdi, RdpgfxClientContext* context,
if (!surface)
return ERROR_INTERNAL_ERROR;
if (!freerdp_client_codecs_prepare(surface->codecs, FREERDP_CODEC_PLANAR))
return ERROR_INTERNAL_ERROR;
DstData = surface->data;
rc = planar_decompress(surface->codecs->planar, cmd->data, cmd->length,
&DstData, surface->format,
surface->scanline, cmd->left, cmd->top,
cmd->width, cmd->height, FALSE);
DstData, surface->format,
surface->scanline, cmd->left, cmd->top,
cmd->width, cmd->height, FALSE);
if (rc < 0)
return ERROR_INTERNAL_ERROR;
@ -346,7 +338,7 @@ static UINT gdi_SurfaceCommand_Planar(rdpGdi* gdi, RdpgfxClientContext* context,
invalidRect.right = cmd->right;
invalidRect.bottom = cmd->bottom;
region16_union_rect(&(surface->invalidRegion), &(surface->invalidRegion),
&invalidRect);
&invalidRect);
if (!gdi->inGfxFrame)
{
@ -363,8 +355,8 @@ static UINT gdi_SurfaceCommand_Planar(rdpGdi* gdi, RdpgfxClientContext* context,
* @return 0 on success, otherwise a Win32 error code
*/
static UINT gdi_SurfaceCommand_AVC420(rdpGdi* gdi,
RdpgfxClientContext* context,
const RDPGFX_SURFACE_COMMAND* cmd)
RdpgfxClientContext* context,
const RDPGFX_SURFACE_COMMAND* cmd)
{
INT32 rc;
UINT status = CHANNEL_RC_OK;
@ -377,9 +369,6 @@ static UINT gdi_SurfaceCommand_AVC420(rdpGdi* gdi,
if (!surface)
return ERROR_INTERNAL_ERROR;
if (!freerdp_client_codecs_prepare(surface->codecs, FREERDP_CODEC_AVC420))
return ERROR_INTERNAL_ERROR;
bs = (RDPGFX_AVC420_BITMAP_STREAM*) cmd->extra;
if (!bs)
@ -387,10 +376,10 @@ static UINT gdi_SurfaceCommand_AVC420(rdpGdi* gdi,
meta = &(bs->meta);
rc = avc420_decompress(surface->codecs->h264, bs->data, bs->length,
surface->data, surface->format,
surface->scanline, surface->width,
surface->height, meta->regionRects,
meta->numRegionRects);
surface->data, surface->format,
surface->scanline, surface->width,
surface->height, meta->regionRects,
meta->numRegionRects);
if (rc < 0)
{
@ -401,7 +390,7 @@ static UINT gdi_SurfaceCommand_AVC420(rdpGdi* gdi,
for (i = 0; i < meta->numRegionRects; i++)
{
region16_union_rect(&(surface->invalidRegion), &(surface->invalidRegion),
(RECTANGLE_16*) & (meta->regionRects[i]));
(RECTANGLE_16*) & (meta->regionRects[i]));
}
if (!gdi->inGfxFrame)
@ -419,7 +408,7 @@ static UINT gdi_SurfaceCommand_AVC420(rdpGdi* gdi,
* @return 0 on success, otherwise a Win32 error code
*/
static UINT gdi_SurfaceCommand_AVC444(rdpGdi* gdi, RdpgfxClientContext* context,
const RDPGFX_SURFACE_COMMAND* cmd)
const RDPGFX_SURFACE_COMMAND* cmd)
{
INT32 rc;
UINT status = CHANNEL_RC_OK;
@ -436,9 +425,6 @@ static UINT gdi_SurfaceCommand_AVC444(rdpGdi* gdi, RdpgfxClientContext* context,
if (!surface)
return ERROR_INTERNAL_ERROR;
if (!freerdp_client_codecs_prepare(surface->codecs, FREERDP_CODEC_AVC444))
return ERROR_INTERNAL_ERROR;
bs = (RDPGFX_AVC444_BITMAP_STREAM*) cmd->extra;
if (!bs)
@ -449,13 +435,13 @@ static UINT gdi_SurfaceCommand_AVC444(rdpGdi* gdi, RdpgfxClientContext* context,
meta1 = &avc1->meta;
meta2 = &avc2->meta;
rc = avc444_decompress(surface->codecs->h264, bs->LC,
meta1->regionRects, meta1->numRegionRects,
avc1->data, avc1->length,
meta2->regionRects, meta2->numRegionRects,
avc2->data, avc2->length,
surface->data, surface->format,
surface->scanline, surface->width,
surface->height);
meta1->regionRects, meta1->numRegionRects,
avc1->data, avc1->length,
meta2->regionRects, meta2->numRegionRects,
avc2->data, avc2->length,
surface->data, surface->format,
surface->scanline, surface->width,
surface->height);
if (rc < 0)
{
@ -493,7 +479,7 @@ static UINT gdi_SurfaceCommand_AVC444(rdpGdi* gdi, RdpgfxClientContext* context,
* @return 0 on success, otherwise a Win32 error code
*/
static UINT gdi_SurfaceCommand_Alpha(rdpGdi* gdi, RdpgfxClientContext* context,
const RDPGFX_SURFACE_COMMAND* cmd)
const RDPGFX_SURFACE_COMMAND* cmd)
{
UINT status = CHANNEL_RC_OK;
gdiGfxSurface* surface;
@ -503,9 +489,6 @@ static UINT gdi_SurfaceCommand_Alpha(rdpGdi* gdi, RdpgfxClientContext* context,
if (!surface)
return ERROR_INTERNAL_ERROR;
if (!freerdp_client_codecs_prepare(surface->codecs, FREERDP_CODEC_ALPHACODEC))
return ERROR_INTERNAL_ERROR;
WLog_DBG(TAG, "TODO gdi_SurfaceCommand_Alpha: status: %d", status);
/* fill with green for now to distinguish from the rest */
@ -518,7 +501,7 @@ static UINT gdi_SurfaceCommand_Alpha(rdpGdi* gdi, RdpgfxClientContext* context,
invalidRect.right = cmd->right;
invalidRect.bottom = cmd->bottom;
region16_union_rect(&(surface->invalidRegion), &(surface->invalidRegion),
&invalidRect);
&invalidRect);
if (!gdi->inGfxFrame)
{
@ -547,9 +530,6 @@ static UINT gdi_SurfaceCommand_Progressive(rdpGdi* gdi,
if (!surface)
return ERROR_INTERNAL_ERROR;
if (!freerdp_client_codecs_prepare(surface->codecs, FREERDP_CODEC_PROGRESSIVE))
return ERROR_INTERNAL_ERROR;
rc = progressive_create_surface_context(surface->codecs->progressive,
cmd->surfaceId,
surface->width, surface->height);
@ -576,7 +556,7 @@ static UINT gdi_SurfaceCommand_Progressive(rdpGdi* gdi,
invalidRect.right = cmd->right;
invalidRect.bottom = cmd->bottom;
region16_union_rect(&(surface->invalidRegion), &(surface->invalidRegion),
&invalidRect);
&invalidRect);
if (!gdi->inGfxFrame)
{
@ -593,7 +573,7 @@ static UINT gdi_SurfaceCommand_Progressive(rdpGdi* gdi,
* @return 0 on success, otherwise a Win32 error code
*/
static UINT gdi_SurfaceCommand(RdpgfxClientContext* context,
const RDPGFX_SURFACE_COMMAND* cmd)
const RDPGFX_SURFACE_COMMAND* cmd)
{
UINT status = CHANNEL_RC_OK;
rdpGdi* gdi = (rdpGdi*) context->custom;
@ -650,7 +630,7 @@ static UINT gdi_SurfaceCommand(RdpgfxClientContext* context,
* @return 0 on success, otherwise a Win32 error code
*/
static UINT gdi_DeleteEncodingContext(RdpgfxClientContext* context,
const RDPGFX_DELETE_ENCODING_CONTEXT_PDU* deleteEncodingContext)
const RDPGFX_DELETE_ENCODING_CONTEXT_PDU* deleteEncodingContext)
{
return CHANNEL_RC_OK;
}
@ -661,7 +641,7 @@ static UINT gdi_DeleteEncodingContext(RdpgfxClientContext* context,
* @return 0 on success, otherwise a Win32 error code
*/
static UINT gdi_CreateSurface(RdpgfxClientContext* context,
const RDPGFX_CREATE_SURFACE_PDU* createSurface)
const RDPGFX_CREATE_SURFACE_PDU* createSurface)
{
gdiGfxSurface* surface;
rdpGdi* gdi = (rdpGdi*) context->custom;
@ -725,7 +705,7 @@ static UINT gdi_CreateSurface(RdpgfxClientContext* context,
* @return 0 on success, otherwise a Win32 error code
*/
static UINT gdi_DeleteSurface(RdpgfxClientContext* context,
const RDPGFX_DELETE_SURFACE_PDU* deleteSurface)
const RDPGFX_DELETE_SURFACE_PDU* deleteSurface)
{
rdpCodecs* codecs = NULL;
gdiGfxSurface* surface = NULL;
@ -792,7 +772,7 @@ static UINT gdi_SolidFill(RdpgfxClientContext* context,
freerdp_image_fill(surface->data, surface->format, surface->scanline,
rect->left, rect->top, nWidth, nHeight, color);
region16_union_rect(&(surface->invalidRegion), &(surface->invalidRegion),
&invalidRect);
&invalidRect);
}
if (!gdi->inGfxFrame)
@ -824,13 +804,13 @@ static UINT gdi_SurfaceToSurface(RdpgfxClientContext* context,
rdpGdi* gdi = (rdpGdi*) context->custom;
rectSrc = &(surfaceToSurface->rectSrc);
surfaceSrc = (gdiGfxSurface*) context->GetSurfaceData(context,
surfaceToSurface->surfaceIdSrc);
surfaceToSurface->surfaceIdSrc);
sameSurface = (surfaceToSurface->surfaceIdSrc ==
surfaceToSurface->surfaceIdDest) ? TRUE : FALSE;
surfaceToSurface->surfaceIdDest) ? TRUE : FALSE;
if (!sameSurface)
surfaceDst = (gdiGfxSurface*) context->GetSurfaceData(context,
surfaceToSurface->surfaceIdDest);
surfaceToSurface->surfaceIdDest);
else
surfaceDst = surfaceSrc;
@ -854,7 +834,7 @@ static UINT gdi_SurfaceToSurface(RdpgfxClientContext* context,
invalidRect.right = destPt->x + rectSrc->right;
invalidRect.bottom = destPt->y + rectSrc->bottom;
region16_union_rect(&surfaceDst->invalidRegion, &surfaceDst->invalidRegion,
&invalidRect);
&invalidRect);
}
if (!gdi->inGfxFrame)
@ -872,7 +852,7 @@ static UINT gdi_SurfaceToSurface(RdpgfxClientContext* context,
* @return 0 on success, otherwise a Win32 error code
*/
static UINT gdi_SurfaceToCache(RdpgfxClientContext* context,
const RDPGFX_SURFACE_TO_CACHE_PDU* surfaceToCache)
const RDPGFX_SURFACE_TO_CACHE_PDU* surfaceToCache)
{
const RECTANGLE_16* rect;
gdiGfxSurface* surface;
@ -915,7 +895,7 @@ static UINT gdi_SurfaceToCache(RdpgfxClientContext* context,
* @return 0 on success, otherwise a Win32 error code
*/
static UINT gdi_CacheToSurface(RdpgfxClientContext* context,
const RDPGFX_CACHE_TO_SURFACE_PDU* cacheToSurface)
const RDPGFX_CACHE_TO_SURFACE_PDU* cacheToSurface)
{
UINT status = CHANNEL_RC_OK;
UINT16 index;
@ -927,7 +907,7 @@ static UINT gdi_CacheToSurface(RdpgfxClientContext* context,
surface = (gdiGfxSurface*) context->GetSurfaceData(context,
cacheToSurface->surfaceId);
cacheEntry = (gdiGfxCacheEntry*) context->GetCacheSlotData(context,
cacheToSurface->cacheSlot);
cacheToSurface->cacheSlot);
if (!surface || !cacheEntry)
return ERROR_INTERNAL_ERROR;
@ -943,7 +923,7 @@ static UINT gdi_CacheToSurface(RdpgfxClientContext* context,
invalidRect.right = destPt->x + cacheEntry->width - 1;
invalidRect.bottom = destPt->y + cacheEntry->height - 1;
region16_union_rect(&surface->invalidRegion, &surface->invalidRegion,
&invalidRect);
&invalidRect);
}
if (!gdi->inGfxFrame)
@ -976,7 +956,7 @@ static UINT gdi_EvictCacheEntry(RdpgfxClientContext* context,
{
gdiGfxCacheEntry* cacheEntry;
cacheEntry = (gdiGfxCacheEntry*) context->GetCacheSlotData(context,
evictCacheEntry->cacheSlot);
evictCacheEntry->cacheSlot);
if (cacheEntry)
{

View File

@ -149,8 +149,9 @@ static BOOL gdi_Bitmap_Decompress(rdpContext* context, rdpBitmap* bitmap,
}
else
{
status = planar_decompress(gdi->codecs->planar, pSrcData, SrcSize, pDstData,
gdi->dstFormat, -1, 0, 0, width, height, TRUE);
status = planar_decompress(gdi->codecs->planar, pSrcData, SrcSize,
pDstData, gdi->dstFormat, 0, 0, 0,
width, height, TRUE);
}
if (status < 0)

View File

@ -42,7 +42,7 @@
*/
HGDI_PEN gdi_CreatePen(UINT32 fnPenStyle, UINT32 nWidth, UINT32 crColor,
UINT32 format)
UINT32 format, const gdiPalette* palette)
{
HGDI_PEN hPen = (HGDI_PEN) calloc(1, sizeof(GDI_PEN));
if (!hPen)
@ -52,10 +52,11 @@ HGDI_PEN gdi_CreatePen(UINT32 fnPenStyle, UINT32 nWidth, UINT32 crColor,
hPen->color = crColor;
hPen->width = nWidth;
hPen->format = format;
hPen->palette = palette;
return hPen;
}
INLINE UINT32 gdi_GetPenColor(HGDI_PEN pen, UINT32 format)
{
return ConvertColor(pen->color, pen->format, format, NULL);
return ConvertColor(pen->color, pen->format, format, pen->palette);
}