if( rop == GXcopy ) { if( color == 0 ) rop = GXclear; else if( color == MaxMask[s3vPriv.Bpp] ) rop = GXset; }
S3SAVSetupForFillRectSolid(color, rop, planemask)int color, rop;unsigned planemask;{    BCI_GET_PTR;    int cmd;    static unsigned int MaxMask[5] = { 0, 0xff, 0xffff, 0xffffff, 0xffffffff };    cmd = BCI_CMD_RECT        | BCI_CMD_RECT_XP | BCI_CMD_RECT_YP        | BCI_CMD_DEST_GBD | BCI_CMD_SRC_SOLID;    if(      (rop != GXclear) &&      (rop != GXnoop) &&      (rop != GXinvert) &&      (rop != GXset)    )	cmd |= BCI_CMD_SEND_COLOR;    /* In general, we ignore the planemask.  This is badness of a */    /* high magnitude, but most apps do not care.  We handle one special */    /* case here: xv uses a GXinvert ROP with a planemask to highlight */    /* its marquee, and we can adjust for that. */    if(         (rop == GXinvert) && 	(((planemask + 1) & MaxMask[s3vPriv.Bpp]) != 0 )    )    {	cmd |= BCI_CMD_SEND_COLOR;	color = planemask;	rop = GXxor;    }    cmd |= s3vAlu[rop];#if BCI_REPEAT    WaitQueue(2);    BCI_SEND(cmd);    /*ErrorF("FillRect command 0x%.8x sent\n", cmd);*/    BCI_SEND(color);#endif    s3SavedBciCmd = cmd;    s3SavedFgColor = color;}