From: John Hodge (sonata) Date: Sat, 13 Oct 2012 03:49:09 +0000 (+0800) Subject: AxWin3 - Fixed overflow caused by using width in height calculations X-Git-Tag: rel0.15~680 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=fa0ff18a7f85c7dc637aef2dfe5c1ed3dea7aee5;p=tpg%2Facess2.git AxWin3 - Fixed overflow caused by using width in height calculations --- diff --git a/Usermode/Applications/axwin3_src/WM/video.c b/Usermode/Applications/axwin3_src/WM/video.c index 3adb17d4..fe379648 100644 --- a/Usermode/Applications/axwin3_src/WM/video.c +++ b/Usermode/Applications/axwin3_src/WM/video.c @@ -133,6 +133,8 @@ void Video_Blit(uint32_t *Source, short DstX, short DstY, short W, short H) { uint32_t *buf; + _SysDebug("Video_Blit: (%p, %i, %i, %i, %i)", Source, DstX, DstY, W, H); + if( DstX >= giScreenWidth) return ; if( DstY >= giScreenHeight) return ; // TODO: Handle -ve X/Y by clipping @@ -140,10 +142,12 @@ void Video_Blit(uint32_t *Source, short DstX, short DstY, short W, short H) // TODO: Handle out of bounds by clipping too if( DstX + W > giScreenWidth ) return; if( DstY + H > giScreenHeight ) - H = giScreenWidth - DstY; + H = giScreenHeight - DstY; if( W <= 0 || H <= 0 ) return; + _SysDebug(" - Resolved to (%p, %i, %i, %i, %i)", Source, DstX, DstY, W, H); + if( DstX < giVideo_FirstDirtyLine ) giVideo_FirstDirtyLine = DstY; if( DstY + H > giVideo_LastDirtyLine ) diff --git a/Usermode/Applications/axwin3_src/WM/wm.c b/Usermode/Applications/axwin3_src/WM/wm.c index cb591545..019ce5a8 100644 --- a/Usermode/Applications/axwin3_src/WM/wm.c +++ b/Usermode/Applications/axwin3_src/WM/wm.c @@ -237,6 +237,9 @@ int WM_ResizeWindow(tWindow *Window, int W, int H) if(Window->X + W < 0) Window->X = -W + 1; if(Window->Y + H < 0) Window->Y = -H + 1; + if( Window->W == W && Window->H == H ) + return 0; + Window->W = W; Window->H = H; if(Window->RenderBuffer) { @@ -368,7 +371,8 @@ void WM_int_BlitWindow(tWindow *Window) if( !(Window->Flags & WINFLAG_SHOW) ) return ; -// _SysDebug("Blit %p to (%i,%i) %ix%i", Window, Window->X, Window->Y, Window->RealW, Window->RealH); + _SysDebug("Blit %p (%p) to (%i,%i) %ix%i", Window, Window->RenderBuffer, + Window->X, Window->Y, Window->RealW, Window->RealH); Video_Blit(Window->RenderBuffer, Window->X, Window->Y, Window->RealW, Window->RealH); if( Window == gpWM_FocusedWindow && Window->CursorW ) @@ -379,7 +383,6 @@ void WM_int_BlitWindow(tWindow *Window) Window->CursorW, Window->CursorH, 0x000000 ); - } for( child = Window->FirstChild; child; child = child->NextSibling ) diff --git a/Usermode/Applications/gui_ate_src/main.c b/Usermode/Applications/gui_ate_src/main.c index 77800752..e83ab7c4 100644 --- a/Usermode/Applications/gui_ate_src/main.c +++ b/Usermode/Applications/gui_ate_src/main.c @@ -69,6 +69,7 @@ int main(int argc, char *argv[]) AxWin3_RichText_SetCursorPos (gMainWindow_TextArea, 0, 0); AxWin3_RichText_SetCursorType (gMainWindow_TextArea, AXWIN3_RICHTEXT_CURSOR_VLINE); AxWin3_RichText_SetCursorBlink (gMainWindow_TextArea, 1); + AxWin3_ShowWindow(gMainWindow_TextArea, 1); // TODO: Status Bar? AxWin3_ShowWindow(gMainWindow, 1);