Exemplo n.º 1
0
void gpuDrawT(void)
{
	s32 xmin, xmax;
	s32 ymin, ymax;
	s32 x0, y0;
	s32 x1, y1;

	x1 = x0 = GPU_EXPANDSIGN_SPRT(PacketBuffer.S2[2]) + DrawingOffset[0];
  y1 = y0 = GPU_EXPANDSIGN_SPRT(PacketBuffer.S2[3]) + DrawingOffset[1];
  x1+= PacketBuffer.S2[4];
  y1+= PacketBuffer.S2[5];

	xmin = DrawingArea[0];	xmax = DrawingArea[2];
	ymin = DrawingArea[1];	ymax = DrawingArea[3];

  int rx0 = Max2(xmin,Min2(x0,x1));
  int ry0 = Max2(ymin,Min2(y0,y1));
  int rx1 = Min2(xmax,Max2(x0,x1));
  int ry1 = Min2(ymax,Max2(y0,y1));
  if(rx0>=rx1 || ry0>=ry1)
    return;

  //AddDirtyArea(rx0,ry0,rx1,ry1);
  if(isSkip) return;

	PixelData = GPU_RGB16(PacketBuffer.U4[0]);

	if (y0 < ymin)
		y0 = ymin;
	if (y1 > ymax)
		y1 = ymax;

	if (x0 < xmin)
		x0 = xmin;
	if (x1 > xmax)
		x1 = xmax;

  x1 -= x0;
	if (x1 < 0)
		x1 = 0;
	Pixel = &((u16*)GPU_FrameBuffer)[FRAME_OFFSET(x0, y0)];
	for (; y0<y1; ++y0)
  {
    PixelEnd = Pixel+x1; 
    if( 0 == (y0&linesInterlace) )
      gpuSpriteSpanDriver();
    Pixel += FRAME_WIDTH;
	}
}
Exemplo n.º 2
0
Arquivo: tty.c Projeto: cosmos72/twin
/*
 * for better cleannes, dirty_tty()
 * should be used *before* actually touching Win->Contents[]
 */
static void dirty_tty(dat x1, dat y1, dat x2, dat y2) {
    byte i;
    ldat S[2] = {0, 0};
    dat xy[2][4];
    
    if (dirtyN == TW_MAXBYTE || x1 > x2 || x1 >= SizeX || y1 > y2 || y1 >= SizeY)
	return;

    x2 = Min2(x2, SizeX-1);
    y2 = Min2(y2, SizeY-1);

    for (i=0; i<dirtyN; i++) {
	xy[i][0] = Min2(dirty[i][0], x1);
	xy[i][1] = Min2(dirty[i][1], y1);
	xy[i][2] = Max2(dirty[i][2], x2);
	xy[i][3] = Max2(dirty[i][3], y2);
	S[i] += (xy[0][2] - xy[0][0] + 1) * (xy[0][3] - xy[0][1] + 1);
	S[!i] += dirtyS[i];
    }
    if (dirtyN < 2)
	S[dirtyN] += (x2-x1+1)*(y2-y1+1);
    
    i = dirtyN && S[0] > S[1];

    if (S[i] >= SizeX*SizeY*3/4) {
	dirtyN = TW_MAXBYTE;
	return;
    } else if (i < dirtyN) {
	CopyMem(xy[i], dirty[i], 4*sizeof(dat));
    } else {
	dirtyN++;
	dirty[i][0] = x1;
	dirty[i][1] = y1;
	dirty[i][2] = x2;
	dirty[i][3] = y2;
    }
    dirtyS[i] = (dirty[i][2]-dirty[i][0]+1)*(dirty[i][3]-dirty[i][1]+1);
}
Exemplo n.º 3
0
void gpuDrawS(void)
{
	s32 temp;
	s32 xmin, xmax;
	s32 ymin, ymax;
	s32 x0, x1;
	s32 y0, y1;
	s32 u0;
	s32 v0;

	x1 = x0 = GPU_EXPANDSIGN_SPRT(PacketBuffer.S2[2]) + DrawingOffset[0];
  y1 = y0 = GPU_EXPANDSIGN_SPRT(PacketBuffer.S2[3]) + DrawingOffset[1];
  x1+= PacketBuffer.S2[6];
  y1+= PacketBuffer.S2[7];

	xmin = DrawingArea[0];	xmax = DrawingArea[2];
	ymin = DrawingArea[1];	ymax = DrawingArea[3];

	//TODO: Symbian minmax
	
  int rx0 = Max2(xmin,Min2(x0,x1));
  int ry0 = Max2(ymin,Min2(y0,y1));
  int rx1 = Min2(xmax,Max2(x0,x1));
  int ry1 = Min2(ymax,Max2(y0,y1));
  if( rx0>=rx1 || ry0>=ry1)
    return;

  //AddDirtyArea(rx0,ry0,rx1,ry1);
  if(isSkip) return;

  u0 = PacketBuffer.U1[8];
  v0 = PacketBuffer.U1[9];

  r4 = s32(PacketBuffer.U1[0]);
  g4 = s32(PacketBuffer.U1[1]);
  b4 = s32(PacketBuffer.U1[2]);

	temp = ymin - y0;
	if (temp > 0) {
		y0 = ymin;
		v0 += temp;
	}
	if (y1 > ymax)
		y1 = ymax;

	temp = xmin - x0;
	if (temp > 0) {
		x0 = xmin;
		u0 += temp;
	}
	if (x1 > xmax)
		x1 = xmax;
  x1 -= x0;
	if (x1 < 0)
		x1 = 0;
	
	Pixel = &((u16*)GPU_FrameBuffer)[FRAME_OFFSET(x0, y0)];
  v4    = v0;
	for (;y0<y1;++y0)
  {
    u4  = u0;
    PixelEnd = Pixel+x1; 
    if( 0 == (y0&linesInterlace) )
      gpuSpriteSpanDriver();
    Pixel += FRAME_WIDTH;
  	v4 = (++v4)&MaskV;
	}

}