描画処理


描画処理は、下記の通りなのですが、できれば、似たような処理を増やしたくないので、これを生かしたまま、依存部分だけで吸収できればいいのですが。。 プログラム大変そう。。(汗)
スクロールも考えないといけないのも、ややこしいです。(^^;;

void PutImage(void)
{
  int x,y;
  int w,h;		// blt size:           width height
  int top;		// display start line
  
  w= surface1->w;
  //h= (bitmap ? lines :200) * scale; // text mode =200  graphics mode=204
  h= lines *scale;
  top = (204-lines)*scale; 			// 200 line= 4     204 line= 0
  

  if( isScroll())	// scroll mode 
  	{
	  int dx,dy;
	  x = portCB *256 + portCA;
	  y = portCC;

	  x *= scale;
	  y *= scale;

	  dx = surface1->w -x+1;
	  dy = surface1->h -y+1;

	  OSD_BlitSurface( surface2 ,dx ,dy , x , y ,surface1 ,0 ,0);
	  OSD_BlitSurface( surface2 ,0  ,dy ,dx , y ,surface1 ,x ,0);
	  OSD_BlitSurface( surface2 ,dx , 0 , x ,dy ,surface1 ,0 ,y);
	  OSD_BlitSurface( surface2 ,0  , 0 ,dx ,dy ,surface1 ,x ,y);

	  OSD_BlitSurface( screen   ,0+paddingw,top+paddingh, w , h , surface2 ,0 ,0);  // to screen
	}
  else		// normal mode
  	{
	//                           dest  dest_x      dest_y      w   h       src    src_x src_y
	OSD_BlitSurface( screen     ,0+paddingw,top+paddingh, Width , Height ,surface1 ,0 ,0);  // to screen
    }
}