git.ucc.asn.au
/
tpg
/
acess2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Cleaning up clang warnings
[tpg/acess2.git]
/
Usermode
/
Applications
/
axwin3_src
/
WM
/
video.c
diff --git
a/Usermode/Applications/axwin3_src/WM/video.c
b/Usermode/Applications/axwin3_src/WM/video.c
index
d400568
..
1b9ffab
100644
(file)
--- a/
Usermode/Applications/axwin3_src/WM/video.c
+++ b/
Usermode/Applications/axwin3_src/WM/video.c
@@
-38,7
+38,7
@@
void Video_Setup(void)
// Open terminal
#if 0
// Open terminal
#if 0
- giTerminalFD =
o
pen(gsTerminalDevice, OPENFLAG_READ|OPENFLAG_WRITE);
+ giTerminalFD =
_SysO
pen(gsTerminalDevice, OPENFLAG_READ|OPENFLAG_WRITE);
if( giTerminalFD == -1 )
{
fprintf(stderr, "ERROR: Unable to open '%s' (%i)\n", gsTerminalDevice, _errno);
if( giTerminalFD == -1 )
{
fprintf(stderr, "ERROR: Unable to open '%s' (%i)\n", gsTerminalDevice, _errno);
@@
-48,8
+48,8
@@
void Video_Setup(void)
giTerminalFD = 1;
giTerminalFD_Input = 0;
// Check that the console is a VT
giTerminalFD = 1;
giTerminalFD_Input = 0;
// Check that the console is a VT
- // -
ioc
tl(..., 0, NULL) returns the type, which should be 2
- if(
ioc
tl(1, 0, NULL) != 2 )
+ // -
_SysIOC
tl(..., 0, NULL) returns the type, which should be 2
+ if(
_SysIOC
tl(1, 0, NULL) != 2 )
{
fprintf(stderr, "stdout is not an Acess VT, can't start");
_SysDebug("stdout is not an Acess VT, can't start");
{
fprintf(stderr, "stdout is not an Acess VT, can't start");
_SysDebug("stdout is not an Acess VT, can't start");
@@
-59,22
+59,22
@@
void Video_Setup(void)
// Set mode to video
tmpInt = TERM_MODE_FB;
// Set mode to video
tmpInt = TERM_MODE_FB;
-
ioc
tl( giTerminalFD, TERM_IOCTL_MODETYPE, &tmpInt );
+
_SysIOC
tl( giTerminalFD, TERM_IOCTL_MODETYPE, &tmpInt );
// Get dimensions
// Get dimensions
- giScreenWidth =
ioc
tl( giTerminalFD, TERM_IOCTL_WIDTH, NULL );
- giScreenHeight =
ioc
tl( giTerminalFD, TERM_IOCTL_HEIGHT, NULL );
+ giScreenWidth =
_SysIOC
tl( giTerminalFD, TERM_IOCTL_WIDTH, NULL );
+ giScreenHeight =
_SysIOC
tl( giTerminalFD, TERM_IOCTL_HEIGHT, NULL );
giVideo_LastDirtyLine = giScreenHeight;
// Force VT to be shown
giVideo_LastDirtyLine = giScreenHeight;
// Force VT to be shown
-
ioc
tl( giTerminalFD, TERM_IOCTL_FORCESHOW, NULL );
+
_SysIOC
tl( giTerminalFD, TERM_IOCTL_FORCESHOW, NULL );
// Create local framebuffer (back buffer)
gpScreenBuffer = malloc( giScreenWidth*giScreenHeight*4 );
// Set cursor position and bitmap
// Create local framebuffer (back buffer)
gpScreenBuffer = malloc( giScreenWidth*giScreenHeight*4 );
// Set cursor position and bitmap
-
ioc
tl(giTerminalFD, TERM_IOCTL_SETCURSORBITMAP, &cCursorBitmap);
+
_SysIOC
tl(giTerminalFD, TERM_IOCTL_SETCURSORBITMAP, &cCursorBitmap);
Video_SetCursorPos( giScreenWidth/2, giScreenHeight/2 );
}
Video_SetCursorPos( giScreenWidth/2, giScreenHeight/2 );
}
@@
-87,9
+87,9
@@
void Video_Update(void)
_SysDebug("Video_Update - Updating lines %i to %i (0x%x+0x%x px)",
giVideo_FirstDirtyLine, giVideo_LastDirtyLine, ofs, size);
_SysDebug("Video_Update - Updating lines %i to %i (0x%x+0x%x px)",
giVideo_FirstDirtyLine, giVideo_LastDirtyLine, ofs, size);
-
seek(giTerminalFD, ofs*4, 1
);
+
_SysSeek(giTerminalFD, ofs*4, SEEK_SET
);
_SysDebug("Video_Update - Sending FD %i %p 0x%x", giTerminalFD, gpScreenBuffer+ofs, size*4);
_SysDebug("Video_Update - Sending FD %i %p 0x%x", giTerminalFD, gpScreenBuffer+ofs, size*4);
-
w
rite(giTerminalFD, gpScreenBuffer+ofs, size*4);
+
_SysW
rite(giTerminalFD, gpScreenBuffer+ofs, size*4);
_SysDebug("Video_Update - Done");
giVideo_FirstDirtyLine = 0;
giVideo_LastDirtyLine = 0;
_SysDebug("Video_Update - Done");
giVideo_FirstDirtyLine = 0;
giVideo_LastDirtyLine = 0;
@@
-103,7
+103,7
@@
void Video_SetCursorPos(short X, short Y)
} pos;
pos.x = giVideo_CursorX = X;
pos.y = giVideo_CursorY = Y;
} pos;
pos.x = giVideo_CursorX = X;
pos.y = giVideo_CursorY = Y;
-
ioc
tl(giTerminalFD, TERM_IOCTL_GETSETCURSOR, &pos);
+
_SysIOC
tl(giTerminalFD, TERM_IOCTL_GETSETCURSOR, &pos);
}
void Video_FillRect(int X, int Y, int W, int H, uint32_t Colour)
}
void Video_FillRect(int X, int Y, int W, int H, uint32_t Colour)
@@
-136,13
+136,22
@@
void Video_Blit(uint32_t *Source, short DstX, short DstY, short W, short H)
if( DstX >= giScreenWidth) return ;
if( DstY >= giScreenHeight) return ;
if( DstX >= giScreenWidth) return ;
if( DstY >= giScreenHeight) return ;
- // TODO: Handle -ve X/Y by clipping
- if( DstX < 0 || DstY < 0 ) return ;
- // TODO: Handle out of bounds by clipping too
+ // Drawing oob to left/top, clip
+ if( DstX < 0 ) {
+ Source += -DstX;
+ drawW -= -DstX;
+ DstX = 0;
+ }
+ if( DstY < 0 ) {
+ Source += (-DstY)*W;
+ H -= -DstY;
+ DstY = 0;
+ }
+ if( drawW < 0 ) return ;
+ // Drawing oob to the right, clip
if( DstX + drawW > giScreenWidth ) {
if( DstX + drawW > giScreenWidth ) {
- int oldw = drawW;
+
//
int oldw = drawW;
drawW = giScreenWidth - DstX;
drawW = giScreenWidth - DstX;
- _SysDebug("Video_Blit: Clipped width from %i to %i", oldw, drawW);
}
if( DstY + H > giScreenHeight )
H = giScreenHeight - DstY;
}
if( DstY + H > giScreenHeight )
H = giScreenHeight - DstY;
@@
-155,7
+164,7
@@
void Video_Blit(uint32_t *Source, short DstX, short DstY, short W, short H)
giVideo_LastDirtyLine = DstY + H;
buf = gpScreenBuffer + DstY*giScreenWidth + DstX;
giVideo_LastDirtyLine = DstY + H;
buf = gpScreenBuffer + DstY*giScreenWidth + DstX;
- if(drawW != giScreenWidth)
+ if(drawW != giScreenWidth
|| W != giScreenWidth
)
{
while( H -- )
{
{
while( H -- )
{
@@
-166,6
+175,7
@@
void Video_Blit(uint32_t *Source, short DstX, short DstY, short W, short H)
}
else
{
}
else
{
+ // Only valid if copying full scanlines on both ends
memcpy(buf, Source, giScreenWidth*H*4);
}
}
memcpy(buf, Source, giScreenWidth*H*4);
}
}
UCC
git Repository :: git.ucc.asn.au