X-Git-Url: https://git.ucc.asn.au/?a=blobdiff_plain;f=Usermode%2FApplications%2Faxwin4_src%2FServer%2Fcompositor.cpp;h=6f512c8d1b65899d63f6de1b69cdae7a2e816047;hb=aa5e13445f3d9ab6e0c0049780f38daed443104f;hp=497bf741cf03a107d5ae666fad7a8f99fd7fd848;hpb=340e7923b1e95c39ac85a4b22af7f1b53b315cd9;p=tpg%2Facess2.git diff --git a/Usermode/Applications/axwin4_src/Server/compositor.cpp b/Usermode/Applications/axwin4_src/Server/compositor.cpp index 497bf741..6f512c8d 100644 --- a/Usermode/Applications/axwin4_src/Server/compositor.cpp +++ b/Usermode/Applications/axwin4_src/Server/compositor.cpp @@ -6,23 +6,41 @@ * - Window compositor */ #include -#include #include +#include namespace AxWin { -CCompositor::CCompositor() +CCompositor::CCompositor(CVideo& video): + m_video(video) { // } -CWindow* CCompositor::CreateWindow(CClient& client) +CWindow* CCompositor::CreateWindow(CClient& client, const ::std::string& name) { - return new CWindow(client, "TODO"); + return new CWindow(*this, client, name); +} + +bool CCompositor::GetScreenDims(unsigned int ScreenID, unsigned int* W, unsigned int* H) +{ + assert(W && H); + if( ScreenID != 0 ) + { + *W = 0; + *H = 0; + return false; + } + else + { + m_video.GetDims(*W, *H); + return true; + } } void CCompositor::Redraw() { + _SysDebug("CCompositor::Redraw"); // Redraw the screen and clear damage rects if( m_damageRects.empty() ) return ; @@ -33,23 +51,56 @@ void CCompositor::Redraw() // For all windows, check for intersection with damage rects for( auto rect : m_damageRects ) { + _SysDebug("rect=(%i,%i) %ix%i", rect.m_x, rect.m_y, rect.m_w, rect.m_h); + // window list should be sorted by draw order (lowest first) for( auto window : m_windows ) { - if( rect.Contains( window->m_rect ) ) + if( rect.HasIntersection( window->m_surface.m_rect ) ) { - window->Repaint( rect ); + // TODO: just reblit + CRect rel_rect = window->m_surface.m_rect.RelativeIntersection(rect); + BlitFromSurface( window->m_surface, rel_rect ); + //window->Repaint( rel_rect ); } } + + // TODO: Blit from windows to a local surface, then blit from there to screen here } m_damageRects.clear(); + m_video.Flush(); } void CCompositor::DamageArea(const CRect& area) { + m_damageRects.push_back( area ); // 1. Locate intersection with any existing damaged areas // 2. Append after removing intersections } +void CCompositor::BlitFromSurface(const CSurface& dest, const CRect& src_rect) +{ + for( unsigned int i = 0; i < src_rect.m_h; i ++ ) + { + m_video.BlitLine( + dest.GetScanline(src_rect.m_y, src_rect.m_y), + dest.m_rect.m_y + src_rect.m_y + i, + dest.m_rect.m_x + src_rect.m_x, + src_rect.m_w + ); + } +} + +void CCompositor::MouseMove(unsigned int Cursor, unsigned int X, unsigned int Y, int dX, int dY) +{ + _SysDebug("MouseButton(%i, %i,%i, %+i,%+i)", Cursor, X, Y, dX, dY); + m_video.SetCursorPos(X+dX, Y+dY); +} + +void CCompositor::MouseButton(unsigned int Cursor, unsigned int X, unsigned int Y, eMouseButton Button, bool Press) +{ + _SysDebug("MouseButton(%i, %i,%i, %i=%i)", Cursor, X, Y, Button, Press); +} + } // namespace AxWin