From: John Hodge (sonata) Date: Wed, 28 Nov 2012 07:28:09 +0000 (+0800) Subject: Usermode/AxWin3 - Fixed bad blit clipping X-Git-Tag: rel0.15~643 X-Git-Url: https://git.ucc.asn.au/?a=commitdiff_plain;h=d0a5fece3e6b4ce2bb4d73817d4026f9ca8e220a;p=tpg%2Facess2.git Usermode/AxWin3 - Fixed bad blit clipping --- diff --git a/Usermode/Applications/axwin3_src/WM/video.c b/Usermode/Applications/axwin3_src/WM/video.c index 3916baa1..d4005684 100644 --- a/Usermode/Applications/axwin3_src/WM/video.c +++ b/Usermode/Applications/axwin3_src/WM/video.c @@ -132,29 +132,34 @@ void Video_FillRect(int X, int Y, int W, int H, uint32_t Colour) void Video_Blit(uint32_t *Source, short DstX, short DstY, short W, short H) { uint32_t *buf; + short drawW = W; 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 - if( DstX + W > giScreenWidth ) return; + if( DstX + drawW > giScreenWidth ) { + int oldw = drawW; + drawW = giScreenWidth - DstX; + _SysDebug("Video_Blit: Clipped width from %i to %i", oldw, drawW); + } if( DstY + H > giScreenHeight ) H = giScreenHeight - DstY; if( W <= 0 || H <= 0 ) return; - if( DstX < giVideo_FirstDirtyLine ) + if( DstY < giVideo_FirstDirtyLine ) giVideo_FirstDirtyLine = DstY; if( DstY + H > giVideo_LastDirtyLine ) giVideo_LastDirtyLine = DstY + H; buf = gpScreenBuffer + DstY*giScreenWidth + DstX; - if(W != giScreenWidth) + if(drawW != giScreenWidth) { while( H -- ) { - memcpy(buf, Source, W*4); + memcpy(buf, Source, drawW*4); Source += W; buf += giScreenWidth; } diff --git a/Usermode/Applications/axwin3_src/WM/wm.c b/Usermode/Applications/axwin3_src/WM/wm.c index 464eeb11..89cdd06e 100644 --- a/Usermode/Applications/axwin3_src/WM/wm.c +++ b/Usermode/Applications/axwin3_src/WM/wm.c @@ -142,6 +142,31 @@ void WM_RaiseWindow(tWindow *Window) parent->LastChild = Window; } +/* +void WM_RaiseWindow(tWindow *Window) +{ + // Move to the last render position (move to top) + while(Window && Window->Parent) + { + if( Window->NextSibling ) + { + // remove + if( Window->PrevSibling ) + Window->PrevSibling->NextSibling = Window->NextSibling; + Window->NextSibling->PrevSibling = Window->PrevSibling; + // Mutate self + Window->PrevSibling = Window->Parent->LastChild; + Window->NextSibling = NULL; + // re-add + Window->PrevSibling->NextSibling = Window; + Window->Parent->LastChild = Window; + } + _SysDebug("WM_RaiseWindow: Raised %p", Window); + Window = Window->Parent; + } +} +*/ + void WM_FocusWindow(tWindow *Destination) { struct sWndMsg_Bool _msg; @@ -164,12 +189,10 @@ void WM_FocusWindow(tWindow *Destination) WM_Invalidate(gpWM_FocusedWindow); WM_Invalidate(Destination); - gpWM_FocusedWindow = Destination; + WM_RaiseWindow(Destination); - // Get the owner of the focused window -// while(Destination && Destination->Owner) Destination = Destination->Owner; -// gpWM_HilightedWindow = Destination; + gpWM_FocusedWindow = Destination; } @@ -263,6 +286,7 @@ int WM_MoveWindow(tWindow *Window, int X, int Y) } // TODO: Re-sanitise + _SysDebug("WM_MoveWindow: (%i,%i)", X, Y); Window->X = X; Window->Y = Y; // TODO: Why invalidate buffer? @@ -280,6 +304,7 @@ int WM_ResizeWindow(tWindow *Window, int W, int H) if( Window->W == W && Window->H == H ) return 0; + _SysDebug("WM_Resizeindow: %ix%i", W, H); Window->W = W; Window->H = H; if(Window->RenderBuffer) {