+ if( m_fd == -1 )
+ {
+ // Easy realloc
+ // TODO: Should I maintain window contents sanely? NOPE!
+ delete m_data;
+ m_data = new uint32_t[W * H];
+ }
+ else
+ {
+ //_SysIOCtl(m_fd, SHM_IOCTL_SETSIZE, W*H*4);
+ }
+ m_rect.Resize(W, H);
+}
+
+void CSurface::DrawScanline(unsigned int row, unsigned int x_ofs, unsigned int w, const void* data)
+{
+ if( row >= m_rect.m_h )
+ throw ::std::out_of_range("CSurface::DrawScanline row");
+ if( x_ofs >= m_rect.m_w )
+ throw ::std::out_of_range("CSurface::DrawScanline x_ofs");
+
+ if( w > m_rect.m_w )
+ throw ::std::out_of_range("CSurface::DrawScanline width");
+
+ size_t ofs = row*m_rect.m_w + x_ofs;
+ ::memcpy( &m_data[ofs], data, w*4 );