void Savage_InvertRectangle(engine_token *et, fill_rect_params *pList, uint32 count) { int cmd = BCI_CMD_RECT | BCI_CMD_RECT_XP | BCI_CMD_RECT_YP | BCI_CMD_DEST_PBD_NEW; (void)et; // avoid compiler warning for unused arg BCI_CMD_SET_ROP(cmd, 0x55); // use GXinvert for rop while (count--) { int x = pList->left; int y = pList->top; int w = pList->right - x + 1; int h = pList->bottom - y + 1; BCI_GET_PTR; gInfo.WaitQueue(7); BCI_SEND(cmd); BCI_SEND(gInfo.sharedInfo->frameBufferOffset); BCI_SEND(gInfo.sharedInfo->globalBitmapDesc); BCI_SEND(BCI_X_Y(x, y)); BCI_SEND(BCI_W_H(w, h)); pList++; } }
void savagefb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) { struct savagefb_par *par = info->par; int cmd, color; if (!rect->width || !rect->height) return; if (info->fix.visual == FB_VISUAL_PSEUDOCOLOR) color = rect->color; else color = ((u32 *)info->pseudo_palette)[rect->color]; cmd = BCI_CMD_RECT | BCI_CMD_RECT_XP | BCI_CMD_RECT_YP | BCI_CMD_DEST_GBD | BCI_CMD_SRC_SOLID | BCI_CMD_SEND_COLOR; par->bci_ptr = 0; BCI_CMD_SET_ROP(cmd, savagefb_rop[rect->rop]); par->SavageWaitFifo(par,4); BCI_SEND(cmd); BCI_SEND(color); BCI_SEND( BCI_X_Y(rect->dx, rect->dy) ); BCI_SEND( BCI_W_H(rect->width, rect->height) ); }
void savagefb_copyarea(struct fb_info *info, const struct fb_copyarea *region) { struct savagefb_par *par = info->par; int sx = region->sx, dx = region->dx; int sy = region->sy, dy = region->dy; int cmd; if (!region->width || !region->height) return; par->bci_ptr = 0; cmd = BCI_CMD_RECT | BCI_CMD_DEST_GBD | BCI_CMD_SRC_GBD; BCI_CMD_SET_ROP(cmd, savagefb_rop[0]); if (dx <= sx) { cmd |= BCI_CMD_RECT_XP; } else { sx += region->width - 1; dx += region->width - 1; } if (dy <= sy) { cmd |= BCI_CMD_RECT_YP; } else { sy += region->height - 1; dy += region->height - 1; } par->SavageWaitFifo(par,4); BCI_SEND(cmd); BCI_SEND(BCI_X_Y(sx, sy)); BCI_SEND(BCI_X_Y(dx, dy)); BCI_SEND(BCI_W_H(region->width, region->height)); }
void Savage_ScreenToScreenBlit(engine_token *et, blit_params *pList, uint32 count) { (void)et; // avoid compiler warning for unused arg while (count--) { int cmd; int src_x = pList->src_left; int src_y = pList->src_top; int dest_x = pList->dest_left; int dest_y = pList->dest_top; int width = pList->width; int height = pList->height; BCI_GET_PTR; cmd = BCI_CMD_RECT | BCI_CMD_DEST_PBD_NEW | BCI_CMD_SRC_SBD_COLOR_NEW; BCI_CMD_SET_ROP(cmd, 0xCC); // use GXcopy for rop if (dest_x <= src_x) { cmd |= BCI_CMD_RECT_XP; } else { src_x += width; dest_x += width; } if (dest_y <= src_y) { cmd |= BCI_CMD_RECT_YP; } else { src_y += height; dest_y += height; } gInfo.WaitQueue(9); BCI_SEND(cmd); BCI_SEND(gInfo.sharedInfo->frameBufferOffset); BCI_SEND(gInfo.sharedInfo->globalBitmapDesc); BCI_SEND(gInfo.sharedInfo->frameBufferOffset); BCI_SEND(gInfo.sharedInfo->globalBitmapDesc); BCI_SEND(BCI_X_Y(src_x, src_y)); BCI_SEND(BCI_X_Y(dest_x, dest_y)); BCI_SEND(BCI_W_H(width + 1, height + 1)); pList++; } }
void savagefb_imageblit(struct fb_info *info, const struct fb_image *image) { struct savagefb_par *par = info->par; int fg, bg, size, i, width; int cmd; u32 *src = (u32 *) image->data; if (!image->width || !image->height) return; if (image->depth != 1) { cfb_imageblit(info, image); return; } if (info->fix.visual == FB_VISUAL_PSEUDOCOLOR) { fg = image->fg_color; bg = image->bg_color; } else { fg = ((u32 *)info->pseudo_palette)[image->fg_color]; bg = ((u32 *)info->pseudo_palette)[image->bg_color]; } cmd = BCI_CMD_RECT | BCI_CMD_RECT_XP | BCI_CMD_RECT_YP | BCI_CMD_CLIP_LR | BCI_CMD_DEST_GBD | BCI_CMD_SRC_MONO | BCI_CMD_SEND_COLOR; par->bci_ptr = 0; BCI_CMD_SET_ROP(cmd, savagefb_rop[0]); width = (image->width + 31) & ~31; size = (width * image->height)/8; size >>= 2; par->SavageWaitFifo(par, size + 5); BCI_SEND(cmd); BCI_SEND(BCI_CLIP_LR(image->dx, image->dx + image->width - 1)); BCI_SEND(fg); BCI_SEND(bg); BCI_SEND(BCI_X_Y(image->dx, image->dy)); BCI_SEND(BCI_W_H(width, image->height)); for (i = 0; i < size; i++) BCI_SEND(src[i]); }
void Savage_FillSpan(engine_token *et, uint32 color, uint16 *pList, uint32 count) { int cmd = BCI_CMD_RECT | BCI_CMD_RECT_XP | BCI_CMD_RECT_YP | BCI_CMD_DEST_PBD_NEW | BCI_CMD_SRC_SOLID | BCI_CMD_SEND_COLOR; (void)et; // avoid compiler warning for unused arg BCI_CMD_SET_ROP(cmd, 0xF0); // use GXcopy for rop while (count--) { int y = *pList++; int x = *pList++; int w = *pList++ - x + 1; BCI_GET_PTR; // The MediaPlayer in Zeta 1.21 displays a window which has 2 zero width // spans which the Savage chips display as a line completely across the // screen; thus, the following if statement discards any span with zero // or negative width. if (w <= 0) continue; gInfo.WaitQueue(7); BCI_SEND(cmd); BCI_SEND(gInfo.sharedInfo->frameBufferOffset); BCI_SEND(gInfo.sharedInfo->globalBitmapDesc); BCI_SEND(color); BCI_SEND(BCI_X_Y(x, y)); BCI_SEND(BCI_W_H(w, 1)); } }