mirror of https://github.com/FreeRDP/FreeRDP
xfreerdp: improved 8bpp support
This commit is contained in:
parent
55b32a9ea9
commit
9165505e0d
|
@ -261,7 +261,9 @@ Pixmap xf_glyph_new(xfInfo* xfi, int width, int height, uint8* data)
|
|||
|
||||
void xf_gdi_palette_update(rdpUpdate* update, PALETTE_UPDATE* palette)
|
||||
{
|
||||
|
||||
xfInfo* xfi = ((xfContext*) update->context)->xfi;
|
||||
xfi->clrconv->palette->count = palette->number;
|
||||
xfi->clrconv->palette->entries = palette->entries;
|
||||
}
|
||||
|
||||
void xf_gdi_set_bounds(rdpUpdate* update, BOUNDS* bounds)
|
||||
|
|
|
@ -487,10 +487,10 @@ boolean xf_pre_connect(freerdp* instance)
|
|||
xf_kbd_init(xfi);
|
||||
|
||||
xfi->clrconv = xnew(CLRCONV);
|
||||
xfi->clrconv->palette = NULL;
|
||||
xfi->clrconv->alpha = 1;
|
||||
xfi->clrconv->invert = 0;
|
||||
xfi->clrconv->rgb555 = 0;
|
||||
xfi->clrconv->palette = xnew(rdpPalette);
|
||||
|
||||
instance->context->cache = cache_new(instance->settings);
|
||||
|
||||
|
|
|
@ -1510,7 +1510,7 @@ void test_gdi_LineTo(void)
|
|||
HGDI_BITMAP hBmp_LineTo_R2_MERGEPENNOT;
|
||||
HGDI_BITMAP hBmp_LineTo_R2_MERGEPEN;
|
||||
HGDI_BITMAP hBmp_LineTo_R2_WHITE;
|
||||
RDP_PALETTE* hPalette;
|
||||
rdpPalette* hPalette;
|
||||
HCLRCONV clrconv;
|
||||
int bitsPerPixel = 8;
|
||||
int bytesPerPixel = 1;
|
||||
|
@ -1526,7 +1526,7 @@ void test_gdi_LineTo(void)
|
|||
hBmp = gdi_CreateCompatibleBitmap(hdc, 16, 16);
|
||||
gdi_SelectObject(hdc, (HGDIOBJECT) hBmp);
|
||||
|
||||
hPalette = (RDP_PALETTE*) gdi_GetSystemPalette();
|
||||
hPalette = (rdpPalette*) gdi_GetSystemPalette();
|
||||
|
||||
clrconv = (HCLRCONV) malloc(sizeof(CLRCONV));
|
||||
clrconv->alpha = 1;
|
||||
|
@ -1828,7 +1828,7 @@ void test_gdi_Ellipse(void)
|
|||
HGDI_BITMAP hBmp_Ellipse_1;
|
||||
HGDI_BITMAP hBmp_Ellipse_2;
|
||||
HGDI_BITMAP hBmp_Ellipse_3;
|
||||
RDP_PALETTE* hPalette;
|
||||
rdpPalette* hPalette;
|
||||
HCLRCONV clrconv;
|
||||
int bitsPerPixel = 8;
|
||||
int bytesPerPixel = 1;
|
||||
|
@ -1844,7 +1844,7 @@ void test_gdi_Ellipse(void)
|
|||
hBmp = gdi_CreateCompatibleBitmap(hdc, 16, 16);
|
||||
gdi_SelectObject(hdc, (HGDIOBJECT) hBmp);
|
||||
|
||||
hPalette = (RDP_PALETTE*) gdi_GetSystemPalette();
|
||||
hPalette = (rdpPalette*) gdi_GetSystemPalette();
|
||||
|
||||
clrconv = (HCLRCONV) malloc(sizeof(CLRCONV));
|
||||
clrconv->alpha = 1;
|
||||
|
@ -1988,7 +1988,7 @@ void test_gdi_BitBlt_32bpp(void)
|
|||
HGDI_BITMAP hBmp_PATPAINT;
|
||||
HGDI_BITMAP hBmp_PATINVERT;
|
||||
HGDI_BITMAP hBmpDstOriginal;
|
||||
RDP_PALETTE* hPalette;
|
||||
rdpPalette* hPalette;
|
||||
HCLRCONV clrconv;
|
||||
|
||||
int bytesPerPixel = 4;
|
||||
|
@ -2002,7 +2002,7 @@ void test_gdi_BitBlt_32bpp(void)
|
|||
hdcDst->bytesPerPixel = bytesPerPixel;
|
||||
hdcDst->bitsPerPixel = bitsPerPixel;
|
||||
|
||||
hPalette = (RDP_PALETTE*) gdi_GetSystemPalette();
|
||||
hPalette = (rdpPalette*) gdi_GetSystemPalette();
|
||||
|
||||
clrconv = (HCLRCONV) malloc(sizeof(CLRCONV));
|
||||
clrconv->alpha = 1;
|
||||
|
@ -2242,7 +2242,7 @@ void test_gdi_BitBlt_16bpp(void)
|
|||
HGDI_BITMAP hBmp_PATPAINT;
|
||||
HGDI_BITMAP hBmp_PATINVERT;
|
||||
HGDI_BITMAP hBmpDstOriginal;
|
||||
RDP_PALETTE* hPalette;
|
||||
rdpPalette* hPalette;
|
||||
HCLRCONV clrconv;
|
||||
|
||||
int bytesPerPixel = 2;
|
||||
|
@ -2256,7 +2256,7 @@ void test_gdi_BitBlt_16bpp(void)
|
|||
hdcDst->bytesPerPixel = bytesPerPixel;
|
||||
hdcDst->bitsPerPixel = bitsPerPixel;
|
||||
|
||||
hPalette = (RDP_PALETTE*) gdi_GetSystemPalette();
|
||||
hPalette = (rdpPalette*) gdi_GetSystemPalette();
|
||||
|
||||
clrconv = (HCLRCONV) malloc(sizeof(CLRCONV));
|
||||
clrconv->alpha = 1;
|
||||
|
@ -2496,7 +2496,7 @@ void test_gdi_BitBlt_8bpp(void)
|
|||
HGDI_BITMAP hBmp_PATPAINT;
|
||||
HGDI_BITMAP hBmp_PATINVERT;
|
||||
HGDI_BITMAP hBmpDstOriginal;
|
||||
RDP_PALETTE* hPalette;
|
||||
rdpPalette* hPalette;
|
||||
HCLRCONV clrconv;
|
||||
|
||||
int bytesPerPixel = 1;
|
||||
|
@ -2510,7 +2510,7 @@ void test_gdi_BitBlt_8bpp(void)
|
|||
hdcDst->bytesPerPixel = bytesPerPixel;
|
||||
hdcDst->bitsPerPixel = bitsPerPixel;
|
||||
|
||||
hPalette = (RDP_PALETTE*) gdi_GetSystemPalette();
|
||||
hPalette = (rdpPalette*) gdi_GetSystemPalette();
|
||||
|
||||
clrconv = (HCLRCONV) malloc(sizeof(CLRCONV));
|
||||
clrconv->alpha = 1;
|
||||
|
|
|
@ -228,7 +228,7 @@ struct _CLRCONV
|
|||
int alpha;
|
||||
int invert;
|
||||
int rgb555;
|
||||
RDP_PALETTE* palette;
|
||||
rdpPalette* palette;
|
||||
};
|
||||
typedef struct _CLRCONV CLRCONV;
|
||||
typedef CLRCONV* HCLRCONV;
|
||||
|
|
|
@ -65,21 +65,6 @@ typedef int boolean;
|
|||
|
||||
#include <freerdp/settings.h>
|
||||
|
||||
struct _RDP_PALETTEENTRY
|
||||
{
|
||||
uint8 red;
|
||||
uint8 green;
|
||||
uint8 blue;
|
||||
};
|
||||
typedef struct _RDP_PALETTEENTRY RDP_PALETTEENTRY;
|
||||
|
||||
struct _RDP_PALETTE
|
||||
{
|
||||
uint16 count;
|
||||
RDP_PALETTEENTRY* entries;
|
||||
};
|
||||
typedef struct _RDP_PALETTE RDP_PALETTE;
|
||||
|
||||
struct _RDP_PLUGIN_DATA
|
||||
{
|
||||
uint16 size;
|
||||
|
|
|
@ -97,13 +97,28 @@ typedef struct _BITMAP_UPDATE BITMAP_UPDATE;
|
|||
|
||||
/* Palette Updates */
|
||||
|
||||
struct _PALETTE_ENTRY
|
||||
{
|
||||
uint8 red;
|
||||
uint8 green;
|
||||
uint8 blue;
|
||||
};
|
||||
typedef struct _PALETTE_ENTRY PALETTE_ENTRY;
|
||||
|
||||
struct _PALETTE_UPDATE
|
||||
{
|
||||
uint32 number;
|
||||
uint32 entries[256];
|
||||
PALETTE_ENTRY entries[256];
|
||||
};
|
||||
typedef struct _PALETTE_UPDATE PALETTE_UPDATE;
|
||||
|
||||
struct rdp_palette
|
||||
{
|
||||
uint16 count;
|
||||
PALETTE_ENTRY* entries;
|
||||
};
|
||||
typedef struct rdp_palette rdpPalette;
|
||||
|
||||
/* Pointer Updates */
|
||||
|
||||
struct _POINTER_POSITION_UPDATE
|
||||
|
@ -343,6 +358,7 @@ typedef struct _POLYLINE_ORDER POLYLINE_ORDER;
|
|||
struct _MEMBLT_ORDER
|
||||
{
|
||||
uint16 cacheId;
|
||||
uint8 colorIndex;
|
||||
sint16 nLeftRect;
|
||||
sint16 nTopRect;
|
||||
sint16 nWidth;
|
||||
|
@ -358,6 +374,7 @@ typedef struct _MEMBLT_ORDER MEMBLT_ORDER;
|
|||
struct _MEM3BLT_ORDER
|
||||
{
|
||||
uint16 cacheId;
|
||||
uint8 colorIndex;
|
||||
sint16 nLeftRect;
|
||||
sint16 nTopRect;
|
||||
sint16 nWidth;
|
||||
|
|
|
@ -977,6 +977,9 @@ void update_read_memblt_order(STREAM* s, ORDER_INFO* orderInfo, MEMBLT_ORDER* me
|
|||
|
||||
if (orderInfo->fieldFlags & ORDER_FIELD_09)
|
||||
stream_read_uint16(s, memblt->cacheIndex);
|
||||
|
||||
memblt->colorIndex = (memblt->cacheId >> 8);
|
||||
memblt->cacheId = (memblt->cacheId & 0xFF);
|
||||
}
|
||||
|
||||
void update_read_mem3blt_order(STREAM* s, ORDER_INFO* orderInfo, MEM3BLT_ORDER* mem3blt)
|
||||
|
@ -1015,6 +1018,9 @@ void update_read_mem3blt_order(STREAM* s, ORDER_INFO* orderInfo, MEM3BLT_ORDER*
|
|||
|
||||
if (orderInfo->fieldFlags & ORDER_FIELD_16)
|
||||
stream_read_uint16(s, mem3blt->cacheIndex);
|
||||
|
||||
mem3blt->colorIndex = (mem3blt->cacheId >> 8);
|
||||
mem3blt->cacheId = (mem3blt->cacheId & 0xFF);
|
||||
}
|
||||
|
||||
void update_read_save_bitmap_order(STREAM* s, ORDER_INFO* orderInfo, SAVE_BITMAP_ORDER* save_bitmap)
|
||||
|
|
|
@ -111,8 +111,7 @@ void update_read_bitmap(rdpUpdate* update, STREAM* s, BITMAP_UPDATE* bitmap_upda
|
|||
void update_read_palette(rdpUpdate* update, STREAM* s, PALETTE_UPDATE* palette_update)
|
||||
{
|
||||
int i;
|
||||
uint8 byte;
|
||||
uint32 color;
|
||||
PALETTE_ENTRY* entry;
|
||||
|
||||
stream_seek_uint16(s); /* pad2Octets (2 bytes) */
|
||||
stream_read_uint32(s, palette_update->number); /* numberColors (4 bytes), must be set to 256 */
|
||||
|
@ -123,13 +122,11 @@ void update_read_palette(rdpUpdate* update, STREAM* s, PALETTE_UPDATE* palette_u
|
|||
/* paletteEntries */
|
||||
for (i = 0; i < (int) palette_update->number; i++)
|
||||
{
|
||||
stream_read_uint8(s, byte);
|
||||
color = byte;
|
||||
stream_read_uint8(s, byte);
|
||||
color |= (byte << 8);
|
||||
stream_read_uint8(s, byte);
|
||||
color |= (byte << 16);
|
||||
palette_update->entries[i] = color;
|
||||
entry = &palette_update->entries[i];
|
||||
|
||||
stream_read_uint8(s, entry->blue);
|
||||
stream_read_uint8(s, entry->green);
|
||||
stream_read_uint8(s, entry->red);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -432,7 +432,9 @@ void gdi_bitmap_free_ex(gdiBitmap* bitmap)
|
|||
|
||||
void gdi_palette_update(rdpUpdate* update, PALETTE_UPDATE* palette)
|
||||
{
|
||||
|
||||
rdpGdi* gdi = update->context->gdi;
|
||||
gdi->clrconv->palette->count = palette->number;
|
||||
gdi->clrconv->palette->entries = palette->entries;
|
||||
}
|
||||
|
||||
void gdi_set_bounds(rdpUpdate* update, BOUNDS* bounds)
|
||||
|
@ -726,7 +728,6 @@ void gdi_fast_index(rdpUpdate* update, FAST_INDEX_ORDER* fast_index)
|
|||
void gdi_cache_color_table(rdpUpdate* update, CACHE_COLOR_TABLE_ORDER* cache_color_table)
|
||||
{
|
||||
rdpCache* cache = update->context->cache;
|
||||
|
||||
color_table_put(cache->color_table, cache_color_table->cacheIndex, (void*) cache_color_table->colorTable);
|
||||
}
|
||||
|
||||
|
@ -1025,10 +1026,10 @@ int gdi_init(freerdp* instance, uint32 flags, uint8* buffer)
|
|||
gdi->hdc->bytesPerPixel = gdi->bytesPerPixel;
|
||||
|
||||
gdi->clrconv = (HCLRCONV) malloc(sizeof(CLRCONV));
|
||||
gdi->clrconv->palette = NULL;
|
||||
gdi->clrconv->alpha = (flags & CLRCONV_ALPHA) ? 1 : 0;
|
||||
gdi->clrconv->invert = (flags & CLRCONV_INVERT) ? 1 : 0;
|
||||
gdi->clrconv->rgb555 = (flags & CLRCONV_RGB555) ? 1 : 0;
|
||||
gdi->clrconv->palette = (rdpPalette*) malloc(sizeof(rdpPalette));
|
||||
|
||||
gdi->hdc->alpha = gdi->clrconv->alpha;
|
||||
gdi->hdc->invert = gdi->clrconv->invert;
|
||||
|
|
Loading…
Reference in New Issue