xfreerdp: improved window icon support
This commit is contained in:
parent
00733ab128
commit
f46d3d51c6
@ -21,7 +21,6 @@
|
||||
#include <freerdp/utils/hexdump.h>
|
||||
#include <freerdp/rail/rail.h>
|
||||
|
||||
|
||||
#include "xf_window.h"
|
||||
#include "xf_rail.h"
|
||||
|
||||
@ -120,6 +119,9 @@ void xf_rail_SetWindowIcon(rdpRail* rail, rdpWindow* window, rdpIcon* icon)
|
||||
xfi = (xfInfo*) rail->extra;
|
||||
xfw = (xfWindow*) window->extra;
|
||||
|
||||
icon->extra = gdi_icon_convert(icon->entry->bitsColor, NULL, icon->entry->bitsMask,
|
||||
icon->entry->width, icon->entry->height, icon->entry->bpp, rail->clrconv);
|
||||
|
||||
xf_SetWindowIcon(xfi, xfw, icon);
|
||||
}
|
||||
|
||||
|
@ -319,7 +319,7 @@ void xf_SetWindowIcon(xfInfo* xfi, xfWindow* window, rdpIcon* icon)
|
||||
long* dstp;
|
||||
uint32* srcp;
|
||||
|
||||
if ((icon->big != True) || (icon->entry->bpp != 32))
|
||||
if (icon->big != True)
|
||||
return;
|
||||
|
||||
pixels = icon->entry->width * icon->entry->height;
|
||||
@ -329,7 +329,7 @@ void xf_SetWindowIcon(xfInfo* xfi, xfWindow* window, rdpIcon* icon)
|
||||
propdata[0] = icon->entry->width;
|
||||
propdata[1] = icon->entry->height;
|
||||
dstp = &(propdata[2]);
|
||||
srcp = (uint32*) icon->entry->bitsColor;
|
||||
srcp = (uint32*) icon->extra;
|
||||
|
||||
for (y = 0; y < icon->entry->height; y++)
|
||||
{
|
||||
|
@ -239,6 +239,8 @@ typedef uint8* (*p_gdi_image_convert)(uint8* srcData, uint8* dstData, int width,
|
||||
FREERDP_API uint32 gdi_color_convert(uint32 srcColor, int srcBpp, int dstBpp, HCLRCONV clrconv);
|
||||
FREERDP_API uint8* gdi_image_convert(uint8* srcData, uint8 *dstData, int width, int height, int srcBpp, int dstBpp, HCLRCONV clrconv);
|
||||
FREERDP_API uint8* gdi_glyph_convert(int width, int height, uint8* data);
|
||||
FREERDP_API uint8* gdi_image_invert(uint8* srcData, uint8* dstData, int width, int height, int bpp);
|
||||
FREERDP_API uint8* gdi_icon_convert(uint8* srcData, uint8* dstData, uint8* mask, int width, int height, int bpp, HCLRCONV clrconv);
|
||||
FREERDP_API uint8* gdi_mono_image_convert(uint8* srcData, int width, int height, int srcBpp, int dstBpp, uint32 bgcolor, uint32 fgcolor, HCLRCONV clrconv);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
@ -24,6 +24,7 @@
|
||||
#include <freerdp/rail.h>
|
||||
#include <freerdp/types.h>
|
||||
#include <freerdp/update.h>
|
||||
#include <freerdp/gdi/color.h>
|
||||
#include <freerdp/utils/stream.h>
|
||||
|
||||
typedef struct rdp_rail rdpRail;
|
||||
@ -42,6 +43,7 @@ struct rdp_rail
|
||||
{
|
||||
void* extra;
|
||||
UNICONV* uniconv;
|
||||
CLRCONV* clrconv;
|
||||
rdpIconCache* cache;
|
||||
rdpWindowList* list;
|
||||
rdpSettings* settings;
|
||||
|
@ -575,8 +575,74 @@ uint8* gdi_image_convert(uint8* srcData, uint8* dstData, int width, int height,
|
||||
return 0;
|
||||
}
|
||||
|
||||
uint8*
|
||||
gdi_glyph_convert(int width, int height, uint8* data)
|
||||
uint8* gdi_image_invert(uint8* srcData, uint8* dstData, int width, int height, int bpp)
|
||||
{
|
||||
int y;
|
||||
uint8* srcp;
|
||||
uint8* dstp;
|
||||
int scanline;
|
||||
|
||||
scanline = width * (bpp / 8);
|
||||
|
||||
if (dstData == NULL)
|
||||
dstData = (uint8*) malloc(width * height * (bpp / 8));
|
||||
|
||||
dstp = dstData;
|
||||
srcp = &srcData[scanline * (height - 1)];
|
||||
|
||||
for (y = height - 1; y >= 0; y--)
|
||||
{
|
||||
memcpy(dstp, srcp, scanline);
|
||||
dstp += scanline;
|
||||
srcp -= scanline;
|
||||
}
|
||||
|
||||
return dstData;
|
||||
}
|
||||
|
||||
uint8* gdi_icon_convert(uint8* srcData, uint8* dstData, uint8* mask, int width, int height, int bpp, HCLRCONV clrconv)
|
||||
{
|
||||
int x, y;
|
||||
int pixel;
|
||||
uint8* data;
|
||||
uint8 bmask;
|
||||
uint32 pmask;
|
||||
uint32* icon;
|
||||
|
||||
pixel = 0;
|
||||
data = gdi_image_invert(srcData, dstData, width, height, bpp);
|
||||
dstData = gdi_image_convert(data, NULL, width, height, bpp, 32, clrconv);
|
||||
|
||||
free(data);
|
||||
bmask = mask[pixel];
|
||||
icon = (uint32*) dstData;
|
||||
|
||||
if (bpp < 32)
|
||||
{
|
||||
for (y = 0; y < height; y++)
|
||||
{
|
||||
for (x = 0; x < width; x++)
|
||||
{
|
||||
if (pixel % 8 == 0)
|
||||
bmask = mask[pixel / 8];
|
||||
else
|
||||
bmask <<= 1;
|
||||
|
||||
pmask = (bmask & 0x80) ? 0x00000000 : 0xFF000000;
|
||||
|
||||
*icon++ |= pmask;
|
||||
|
||||
pixel++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
free(mask);
|
||||
|
||||
return dstData;
|
||||
}
|
||||
|
||||
uint8* gdi_glyph_convert(int width, int height, uint8* data)
|
||||
{
|
||||
int x, y;
|
||||
uint8 *srcp;
|
||||
|
@ -103,6 +103,7 @@ rdpRail* rail_new(rdpSettings* settings)
|
||||
rail->cache = icon_cache_new(rail);
|
||||
rail->list = window_list_new(rail);
|
||||
rail->uniconv = freerdp_uniconv_new();
|
||||
rail->clrconv = (CLRCONV*) xzalloc(sizeof(CLRCONV));
|
||||
}
|
||||
|
||||
return rail;
|
||||
|
Loading…
Reference in New Issue
Block a user