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;
}
/*****************************************************************************/

@ -35,9 +35,9 @@ int bs_warp_coords(int * x, int * y, int * cx, int * cy,
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);
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);

@ -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;
}

@ -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