3 * - By John Hodge (thePowersGang)
9 #include <compositor.hpp>
10 #include <CCompositor.hpp>
14 CCompositor::CCompositor(CVideo& video):
20 CWindow* CCompositor::CreateWindow(CClient& client)
22 return new CWindow(client, "TODO");
25 void CCompositor::Redraw()
27 // Redraw the screen and clear damage rects
28 if( m_damageRects.empty() )
31 // Build up foreground grid (Rects and windows)
32 // - This should already be built (mutated on window move/resize/reorder)
34 // For all windows, check for intersection with damage rects
35 for( auto rect : m_damageRects )
37 for( auto window : m_windows )
39 if( rect.HasIntersection( window->m_surface.m_rect ) )
42 CRect rel_rect = window->m_surface.m_rect.RelativeIntersection(rect);
43 BlitFromSurface( window->m_surface, rel_rect );
44 //window->Repaint( rel_rect );
49 m_damageRects.clear();
52 void CCompositor::DamageArea(const CRect& area)
54 // 1. Locate intersection with any existing damaged areas
55 // 2. Append after removing intersections
58 void CCompositor::BlitFromSurface(const CSurface& dest, const CRect& src_rect)
60 for( unsigned int i = 0; i < src_rect.m_h; i ++ )
63 dest.GetScanline(src_rect.m_y, src_rect.m_y),
64 dest.m_rect.m_y + src_rect.m_y + i,
65 dest.m_rect.m_x + src_rect.m_x,