/* _xaccel_draw_sprite: * Accelerated draw_sprite. */ static void _xaccel_draw_sprite(BITMAP *bmp, BITMAP *sprite, int x, int y) { int sx, sy, w, h; if (is_video_bitmap(sprite)) { sx = 0; sy = 0; w = sprite->w; h = sprite->h; if (bmp->clip) { if (x < bmp->cl) { sx += bmp->cl - x; w -= bmp->cl - x; x = bmp->cl; } if (y < bmp->ct) { sy += bmp->ct - y; h -= bmp->ct - y; y = bmp->ct; } if (x + w > bmp->cr) w = bmp->cr - x; if (w <= 0) return; if (y + h > bmp->cb) h = bmp->cb - y; if (h <= 0) return; } sx += sprite->x_ofs; sy += sprite->y_ofs; x += bmp->x_ofs; y += bmp->y_ofs; XLOCK(); XDGACopyTransparentArea(_xwin.display, _xwin.screen, sx, sy, w, h, x, y, sprite->vtable->mask_color); XUNLOCK(); bmp->id &= ~BMP_ID_LOCKED; } else _orig_draw_sprite(bmp, sprite, x, y); }
/* photon_draw_sprite: * Accelerated sprite drawing routine. */ static void photon_draw_sprite(BITMAP *bmp, BITMAP *sprite, int x, int y) { int sx, sy, w, h; if (is_video_bitmap(sprite)) { sx = sprite->x_ofs; sy = sprite->y_ofs; w = sprite->w; h = sprite->h; if (bmp->clip) { if (x < bmp->cl) { sx += bmp->cl - x; w -= bmp->cl - x; x = bmp->cl; } if (y < bmp->ct) { sy += bmp->ct - y; h -= bmp->ct - y; y = bmp->ct; } if (x + w > bmp->cr) w = bmp->cr - x; if (w <= 0) return; if (y + h > bmp->cb) h = bmp->cb - y; if (h <= 0) return; } photon_masked_blit(sprite, bmp, sx, sy, x, y, w, h); } else { /* have to use the original software version */ _orig_draw_sprite(bmp, sprite, x, y); } }
/* ddraw_draw_sprite: * Accelerated sprite drawing routine. */ static void ddraw_draw_sprite(BITMAP * bmp, BITMAP * sprite, int x, int y) { int sx, sy, w, h; if (is_video_bitmap(sprite) || is_system_bitmap(sprite)) { sx = 0; /* sprite->x_ofs & sprite->y_ofs will be accounted for in ddraw_masked_blit */ sy = 0; w = sprite->w; h = sprite->h; if (bmp->clip) { if (x < bmp->cl) { sx += bmp->cl - x; w -= bmp->cl - x; x = bmp->cl; } if (y < bmp->ct) { sy += bmp->ct - y; h -= bmp->ct - y; y = bmp->ct; } if (x + w > bmp->cr) w = bmp->cr - x; if (w <= 0) return; if (y + h > bmp->cb) h = bmp->cb - y; if (h <= 0) return; } ddraw_masked_blit(sprite, bmp, sx, sy, x, y, w, h); } else { /* have to use the original software version */ _orig_draw_sprite(bmp, sprite, x, y); } }