Merge branch 'master' of git://localhost/acess2
[tpg/acess2.git] / Usermode / Applications / axwin3_src / WM / video.c
index 60f2155..dfdd2e5 100644 (file)
@@ -49,9 +49,10 @@ void Video_Setup(void)
        giTerminalFD_Input = 0;
        // Check that the console is a VT
        // - _SysIOCtl(..., 0, NULL) returns the type, which should be 2
-       if( _SysIOCtl(1, 0, NULL) != 2 )
+       tmpInt = _SysIOCtl(1, 0, NULL);
+       if( tmpInt != 2 )
        {
-               fprintf(stderr, "stdout is not an Acess VT, can't start");
+               fprintf(stderr, "stdout is not an Acess VT, can't start (2 exp, %i got)\n", tmpInt);
                _SysDebug("stdout is not an Acess VT, can't start");
                exit(-1);
        }
@@ -87,11 +88,11 @@ void Video_Update(void)
 
        _SysDebug("Video_Update - Updating lines %i to %i (0x%x+0x%x px)",
                giVideo_FirstDirtyLine, giVideo_LastDirtyLine, ofs, size);
-       _SysSeek(giTerminalFD, ofs*4, 1);
+       _SysSeek(giTerminalFD, ofs*4, SEEK_SET);
        _SysDebug("Video_Update - Sending FD %i %p 0x%x", giTerminalFD, gpScreenBuffer+ofs, size*4);
        _SysWrite(giTerminalFD, gpScreenBuffer+ofs, size*4);
        _SysDebug("Video_Update - Done");
-       giVideo_FirstDirtyLine = 0;
+       giVideo_FirstDirtyLine = giScreenHeight;
        giVideo_LastDirtyLine = 0;
 }
 
@@ -158,10 +159,8 @@ void Video_Blit(uint32_t *Source, short DstX, short DstY, short W, short H)
 
        if( W <= 0 || H <= 0 )  return;
 
-       if( DstY < giVideo_FirstDirtyLine )
-               giVideo_FirstDirtyLine = DstY;
-       if( DstY + H > giVideo_LastDirtyLine )
-               giVideo_LastDirtyLine = DstY + H;
+       giVideo_FirstDirtyLine = MIN(DstY, giVideo_FirstDirtyLine);
+       giVideo_LastDirtyLine  = MAX(DstY+H, giVideo_LastDirtyLine);
        
        buf = gpScreenBuffer + DstY*giScreenWidth + DstX;
        if(drawW != giScreenWidth || W != giScreenWidth)

UCC git Repository :: git.ucc.asn.au