rem: ClipBlit( amiga_window->RPort, x, y, amiga_window->RPort, x, y, cx, cy, ( opcode ^ 3 ) << 4    );
add: WorkingClipBlit( amiga_window->RPort, x, y, amiga_window->RPort, x, y, cx, cy, ( opcode ^ 3 ) << 4    );
context: ui_patblt(uint8 opcode,	  /* dest */ int x, int y, int cx, int cy,	  /* brush */ BRUSH *brush, int bgcolour, int fgcolour){//  opcode &= 15;  // TODO: This function is totally fucked up and shout be rewritten    x += amiga_window->BorderLeft;  y += amiga_window->BorderTop;/*   printf( "Doing %d on (%d,%d)-(%d,%d) using brush %08x, fg=%d bg=%d (%03x, %03x)\n", *//* 	  opcode, x, y, x+cx-1, y+cy-1, brush, fgcolour, bgcolour, *//* 	  GetRGB4(amiga_window->WScreen->ViewPort.ColorMap, amiga_pens[fgcolour]), *//* 	  GetRGB4(amiga_window->WScreen->ViewPort.ColorMap, amiga_pens[bgcolour]) *//*     ); */    switch (brush->style)  {    case 0:	/* Solid */      //    printf( "solid %dx%d op %d\n", cx, cy, opcode );      ClipBlit( amiga_window->RPort, x, y, // Not really used                amiga_window->RPort, x, y,                cx, cy,                ( opcode ^ 3 ) << 4   /* B is always 1 */ );      break;    case 3:	/* Pattern */    {      struct RastPort rp;      printf( "pattern %dx%d op %d\n", cx, cy, opcode );      InitRastPort( &rp );          rp.BitMap = AllocBitMap( cx, cy, 8, BMF_MINPLANES, amiga_window->RPort->BitMap );          if( rp.BitMap != NULL )      {        int h;        int v;	LONG bgpen = amiga_obtain_pen( bgcolour );	LONG fgpen = amiga_obtain_pen( fgcolour );        for( v = 0; v < cy; ++v )        {          UBYTE mask;                  mask = brush->pattern[ ( v + brush->yorigin ) & 7 ];          for( h = 0; h < cx; ++h )          {            if( mask & ( 1 << ( ( h + brush->xorigin ) & 7 ) ) )            {              SetAPen( &rp, fgpen );//	      printf("*");            }            else            {              SetAPen( &rp, bgpen );//	      printf(" ");            }                WritePixel( &rp, h, v );          }//	  printf("\n");        }	amiga_release_pen( bgpen );	amiga_release_pen( fgpen );		BltBitMapRastPort( rp.BitMap, 0, 0,			   amiga_window->RPort, x, y,			   cx, cy,			   opcode << 4 ); 	WaitBlit();        FreeBitMap( rp.BitMap );      }      break;    }    default:      unimpl("brush %d\n", brush->style);  }}