added wfp and a check before bliting

ulab-original
jsorg71 19 years ago
parent b56e3ad7e0
commit bb04b348e8

@ -532,7 +532,7 @@ bs_screenblt(int rop, int x, int y, int cx, int cy,
}
/*****************************************************************************/
void
int
bs_memblt(int opcode, int x, int y, int cx, int cy,
void * srcdata, int srcwidth, int srcheight,
int srcx, int srcy)
@ -540,13 +540,16 @@ bs_memblt(int opcode, int x, int y, int cx, int cy,
int i;
int j;
int p;
int rv;
char * dst;
char * src;
rv = 1;
if (bs_warp_coords(&x, &y, &cx, &cy, &srcx, &srcy))
{
if (opcode == 12) /* copy */
{
rv = 0;
if (g_bs_Bpp == 1)
{
src = (char *) (((unsigned char *) srcdata) + srcy * srcwidth + srcx);
@ -564,6 +567,13 @@ bs_memblt(int opcode, int x, int y, int cx, int cy,
dst = get_bs_ptr(x, y + i);
if (dst != 0)
{
if (!rv)
{
if (memcmp(dst, src, cx * g_bs_Bpp) != 0)
{
rv = 1;
}
}
bs_copy_mem(dst, src, cx * g_bs_Bpp);
src += srcwidth * g_bs_Bpp;
}
@ -609,6 +619,7 @@ bs_memblt(int opcode, int x, int y, int cx, int cy,
}
}
}
return rv;
}
/*****************************************************************************/

@ -1,49 +1,49 @@
/* -*- c-basic-offset: 8 -*-
rdesktop: A Remote Desktop Protocol client.
Generics backingstore operations
Copyright (C) Jay Sorg 2005-2006
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
int bs_get_pixel(int x, int y);
void bs_set_pixel(int x, int y, int pixel, int rop, int use_clip);
int bs_do_rop(int rop, int src, int dst);
void bs_init(void);
void bs_exit(void);
void bs_set_clip(int x, int y, int cx, int cy);
void bs_reset_clip(void);
void bs_set_pixel_on(char * data, int x, int y, int width, int bpp,
int pixel);
int bs_is_pixel_on(char * data, int x, int y, int width, int bpp);
void bs_copy_mem(char * d, char * s, int n);
void bs_copy_memb(char * d, char * s, int n);
int bs_warp_coords(int * x, int * y, int * cx, int * cy,
int * srcx, int * srcy);
void bs_rect(int x, int y, int cx, int cy, int colour, int rop);
void bs_screenblt(int opcode, int x, int y, int cx, int cy,
int srcx, int srcy);
void bs_memblt(int opcode, int x, int y, int cx, int cy,
void * srcdata, int srcwidth, int srcheight,
int srcx, int srcy);
void bs_copy_box(char * dst, int x, int y, int cx, int cy, int line_size);
void bs_draw_glyph(int x, int y, char * glyph_data, int glyph_width,
int glyph_height, int fgcolour);
void bs_line(int opcode, int startx, int starty, int endx, int endy,
int pen_width, int pen_style, int pen_colour);
void bs_patblt(int opcode, int x, int y, int cx, int cy,
int brush_style, char * brush_pattern,
int brush_x_org, int brush_y_org,
int bgcolour, int fgcolour);
/* -*- c-basic-offset: 8 -*-
rdesktop: A Remote Desktop Protocol client.
Generics backingstore operations
Copyright (C) Jay Sorg 2005-2006
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
int bs_get_pixel(int x, int y);
void bs_set_pixel(int x, int y, int pixel, int rop, int use_clip);
int bs_do_rop(int rop, int src, int dst);
void bs_init(void);
void bs_exit(void);
void bs_set_clip(int x, int y, int cx, int cy);
void bs_reset_clip(void);
void bs_set_pixel_on(char * data, int x, int y, int width, int bpp,
int pixel);
int bs_is_pixel_on(char * data, int x, int y, int width, int bpp);
void bs_copy_mem(char * d, char * s, int n);
void bs_copy_memb(char * d, char * s, int n);
int bs_warp_coords(int * x, int * y, int * cx, int * cy,
int * srcx, int * srcy);
void bs_rect(int x, int y, int cx, int cy, int colour, int rop);
void bs_screenblt(int opcode, int x, int y, int cx, int cy,
int srcx, int srcy);
int bs_memblt(int opcode, int x, int y, int cx, int cy,
void * srcdata, int srcwidth, int srcheight,
int srcx, int srcy);
void bs_copy_box(char * dst, int x, int y, int cx, int cy, int line_size);
void bs_draw_glyph(int x, int y, char * glyph_data, int glyph_width,
int glyph_height, int fgcolour);
void bs_line(int opcode, int startx, int starty, int endx, int endy,
int pen_width, int pen_style, int pen_colour);
void bs_patblt(int opcode, int x, int y, int cx, int cy,
int brush_style, char * brush_pattern,
int brush_x_org, int brush_y_org,
int bgcolour, int fgcolour);

@ -75,6 +75,17 @@ static int g_mouse_y = 0;
static IDirectFBSurface * g_s = 0;
static int g_wfpx = 0; /* wait for pixel stuff */
static int g_wfpy = 0;
static int g_wfpv = 0;
static int g_show_wfp = 0;
static int g_no_draw = 0; /* this means don't draw the screen but draw on
backingstore */
/* for transparent colour */
static int g_use_trans = 0;
static int g_trans_colour = 0;
//static IDirectFBDataBuffer * g_buffer = 0;
//static IDirectFBImageProvider * g_provider = 0;
@ -113,6 +124,14 @@ mi_create_window(void)
void
mi_update_screen(void)
{
int r;
int g;
int b;
if (g_no_draw)
{
return;
}
if (g_rect.w > 0 && g_rect.h > 0)
{
#ifdef USE_ORDERS_NOT
@ -129,6 +148,17 @@ mi_update_screen(void)
g_primary->Flip(g_primary, 0, 0);
#else
g_primary->Blit(g_primary, g_s, &g_rect, g_rect.x, g_rect.y);
if (g_use_trans)
{
r = (g_trans_colour >> 16) & 0xff;
g = (g_trans_colour >> 8) & 0xff;
b = g_trans_colour & 0xff;
g_primary->SetDrawingFlags(g_primary, DSDRAW_DST_COLORKEY);
g_primary->SetDstColorKey(g_primary, r, g, b);
g_primary->SetColor(g_primary, r, g, b, 0);
g_primary->FillRectangle(g_primary, g_rect.x, g_rect.y, g_rect.w, g_rect.h);
g_primary->SetDrawingFlags(g_primary, DSDRAW_NOFX);
}
#endif
#ifdef USE_ORDERS_NOT
g_primary->SetClip(g_primary, &g_reg);
@ -369,6 +399,7 @@ update_thread(void * arg)
}
/*****************************************************************************/
/* return boolean */
int
mi_create_bs(void)
{
@ -411,12 +442,29 @@ void
mi_end_update(void)
{
pthread_mutex_unlock(&g_mutex1);
if (g_show_wfp)
{
printf("pixel at %d %d is %d\n", g_wfpx, g_wfpy, bs_get_pixel(g_wfpx, g_wfpy));
}
if (g_no_draw)
{
if (g_wfpv == bs_get_pixel(g_wfpx, g_wfpy))
{
g_no_draw = 0;
mi_invalidate(0, 0, g_width, g_height);
}
}
}
/*****************************************************************************/
void
mi_fill_rect(int x, int y, int cx, int cy, int colour)
{
if (g_no_draw)
{
return;
}
#ifdef USE_ORDERS
int red;
int green;
@ -426,7 +474,14 @@ mi_fill_rect(int x, int y, int cx, int cy, int colour)
red = (colour & 0xff0000) >> 16;
green = (colour & 0xff00) >> 8;
blue = colour & 0xff;
g_primary->SetColor(g_primary, red, green, blue, 0xff);
if (g_use_trans && g_trans_colour == colour)
{
g_primary->SetColor(g_primary, red, green, blue, 0);
}
else
{
g_primary->SetColor(g_primary, red, green, blue, 0xff);
}
g_primary->FillRectangle(g_primary, x, y, cx, cy);
#else
mi_add_to(x, y, cx, cy);
@ -437,16 +492,27 @@ mi_fill_rect(int x, int y, int cx, int cy, int colour)
void
mi_line(int x1, int y1, int x2, int y2, int colour)
{
if (g_no_draw)
{
return;
}
#ifdef USE_ORDERS_TOO_SLOW
int r;
int g;
int b;
int red;
int green;
int blue;
mi_update_screen();
r = (colour >> 16) & 0xff;
g = (colour >> 8) & 0xff;
b = colour & 0xff;
g_primary->SetColor(g_primary, r, g, b, 0xff);
red = (colour >> 16) & 0xff;
green = (colour >> 8) & 0xff;
blue = colour & 0xff;
if (g_use_trans && g_trans_colour == colour)
{
g_primary->SetColor(g_primary, red, green, blue, 0);
}
else
{
g_primary->SetColor(g_primary, red, green, blue, 0xff);
}
g_primary->DrawLine(g_primary, x1, y1, x2, y2);
#else
int x;
@ -466,6 +532,10 @@ mi_line(int x1, int y1, int x2, int y2, int colour)
void
mi_screen_copy(int x, int y, int cx, int cy, int srcx, int srcy)
{
if (g_no_draw)
{
return;
}
#ifdef USE_ORDERS
DFBRectangle rect;
DFBSurfaceDescription dsc;
@ -573,6 +643,9 @@ out_params(void)
fprintf(stderr, " -d: domain\n");
fprintf(stderr, " -c: working directory\n");
fprintf(stderr, " -a: colour depth\n");
fprintf(stderr, " -wfp x y pixel: skip screen updates till x, y pixel is \
this colour\n");
fprintf(stderr, " -trans pixel: transparent colour\n");
fprintf(stderr, "\n");
}
@ -623,6 +696,25 @@ parse_parameters(int in_argc, char ** in_argv)
{
g_server_depth = atoi(in_argv[i + 1]);
}
else if (strcmp(in_argv[i], "-wfp") == 0)
{
g_wfpx = atoi(in_argv[i + 1]);
g_wfpy = atoi(in_argv[i + 2]);
g_wfpv = atoi(in_argv[i + 3]);
if (g_wfpv == 0)
{
g_show_wfp = 1;
}
else
{
g_no_draw = 1;
}
}
else if (strcmp(in_argv[i], "-trans") == 0)
{
g_use_trans = 1;
g_trans_colour = atoi(in_argv[i + 1]);
}
}
return 1;
}

@ -311,13 +311,13 @@ rdp_send_logon_info(uint32 flags, char *domain, char *user,
uint32 sec_flags = g_encryption ? (SEC_LOGON_INFO | SEC_ENCRYPT) : SEC_LOGON_INFO;
STREAM s;
time_t tzone;
#ifdef _WIN32
TIME_ZONE_INFORMATION tzi;
#else
time_t t = time(NULL);
#endif
#endif
if (!g_use_rdp5 || 1 == g_server_rdp_version)
{
DEBUG_RDP5(("Sending RDP4-style Logon packet\n"));
@ -611,10 +611,10 @@ rdp_out_general_caps(STREAM s)
out_uint16_le(s, g_use_rdp5 ? 0x40d : 0);
/* Pad, according to T.128. 0x40d seems to
trigger
the server to start sending RDP5 packets.
the server to start sending RDP5 packets.
However, the value is 0x1d04 with W2KTSK and
NT4MS. Hmm.. Anyway, thankyou, Microsoft,
for sending such information in a padding
for sending such information in a padding
field.. */
out_uint16(s, 0); /* Update capability */
out_uint16(s, 0); /* Remote unshare capability */

@ -154,6 +154,9 @@ convert_colour(int in_colour)
int g;
int b;
r = 0;
g = 0;
b = 0;
if (g_server_depth == 8)
{
r = (pal_entries[in_colour & 0xff] & 0xff0000) >> 16;
@ -665,9 +668,15 @@ ui_memblt(uint8 opcode, int x, int y, int cx, int cy,
struct bitmap* b;
b = (struct bitmap *) src;
bs_memblt(opcode, x, y, cx, cy, b->data, b->width, b->height,
srcx, srcy);
ui_invalidate(x, y, cx, cy);
if (bs_memblt(opcode, x, y, cx, cy, b->data, b->width, b->height,
srcx, srcy))
{
ui_invalidate(x, y, cx, cy);
}
else
{
//printf("skipped %d %d\r\n", cx, cy);
}
}
/*****************************************************************************/

Loading…
Cancel
Save