summaryrefslogtreecommitdiffstats
path: root/xrdp/xrdp_bitmap.c
diff options
context:
space:
mode:
authorjsorg71 <jsorg71>2005-01-15 20:53:02 +0000
committerjsorg71 <jsorg71>2005-01-15 20:53:02 +0000
commitcf3e17cb73984b093ac8e3138a6e3d98171c5253 (patch)
treebc5d3ff0ed6994710aa2b38af6dc4782c160416b /xrdp/xrdp_bitmap.c
parent520301d70aafd53287b0f4d153a2b27dc025ea76 (diff)
downloadxrdp-proprietary-cf3e17cb73984b093ac8e3138a6e3d98171c5253.tar.gz
xrdp-proprietary-cf3e17cb73984b093ac8e3138a6e3d98171c5253.zip
changed the way the palette works in 8 bpp and changed some parameter passing
Diffstat (limited to 'xrdp/xrdp_bitmap.c')
-rw-r--r--xrdp/xrdp_bitmap.c35
1 files changed, 15 insertions, 20 deletions
diff --git a/xrdp/xrdp_bitmap.c b/xrdp/xrdp_bitmap.c
index 3b74db34..d157700d 100644
--- a/xrdp/xrdp_bitmap.c
+++ b/xrdp/xrdp_bitmap.c
@@ -80,7 +80,7 @@ int g_crc_table[256] =
/*****************************************************************************/
struct xrdp_bitmap* xrdp_bitmap_create(int width, int height, int bpp,
- int type)
+ int type, struct xrdp_wm* wm)
{
struct xrdp_bitmap* self;
int Bpp;
@@ -113,12 +113,14 @@ struct xrdp_bitmap* xrdp_bitmap_create(int width, int height, int bpp,
self->data_list = xrdp_list_create();
self->data_list->auto_free = 1;
}
+ self->wm = wm;
return self;
}
/*****************************************************************************/
struct xrdp_bitmap* xrdp_bitmap_create_with_data(int width, int height,
- int bpp, char* data)
+ int bpp, char* data,
+ struct xrdp_wm* wm)
{
struct xrdp_bitmap* self;
@@ -129,6 +131,7 @@ struct xrdp_bitmap* xrdp_bitmap_create_with_data(int width, int height,
self->bpp = bpp;
self->data = data;
self->do_not_free_data = 1;
+ self->wm = wm;
return self;
}
@@ -254,25 +257,17 @@ int xrdp_bitmap_set_focus(struct xrdp_bitmap* self, int focused)
/*****************************************************************************/
int xrdp_bitmap_get_index(struct xrdp_bitmap* self, int* palette, int color)
{
- int i;
+ int r;
+ int g;
+ int b;
- for (i = 0; i < 256; i++)
- {
- if (color == palette[i])
- {
- return i;
- }
- }
- for (i = 1; i < 256; i++)
- {
- if (palette[i] == 0)
- {
- palette[i] = color;
- return i;
- }
- }
- g_printf("color %8.8x not found\n\r", color);
- return 255;
+ r = (color & 0xff0000) >> 16;
+ g = (color & 0x00ff00) >> 8;
+ b = (color & 0x0000ff) >> 0;
+ r = (r >> 5) << 0;
+ g = (g >> 5) << 3;
+ b = (b >> 6) << 6;
+ return (b | g | r);
}
/*****************************************************************************/