From 74ccd1fff633643363e5c03785dba4ed9b44351e Mon Sep 17 00:00:00 2001 From: John Hodge Date: Sun, 8 Jun 2014 22:31:00 +0800 Subject: [PATCH] Usermode/AxWin4 - Rendering random data successfully now --- .../axwin4_src/Server/CSurface.cpp | 3 +-- .../axwin4_src/Server/compositor.cpp | 2 ++ .../Applications/axwin4_src/Server/video.cpp | 21 ++++++++++++++++--- Usermode/Applications/axwin4_src/UI/main.c | 4 ++-- 4 files changed, 23 insertions(+), 7 deletions(-) diff --git a/Usermode/Applications/axwin4_src/Server/CSurface.cpp b/Usermode/Applications/axwin4_src/Server/CSurface.cpp index 429657a3..6d4b0907 100644 --- a/Usermode/Applications/axwin4_src/Server/CSurface.cpp +++ b/Usermode/Applications/axwin4_src/Server/CSurface.cpp @@ -36,7 +36,7 @@ void CSurface::Resize(unsigned int W, unsigned int H) void CSurface::DrawScanline(unsigned int row, unsigned int x_ofs, unsigned int w, const void* data) { - _SysDebug("DrawScanline(%i,%i,%i,%p)", row, x_ofs, w, data); + //_SysDebug("DrawScanline(%i,%i,%i,%p)", row, x_ofs, w, data); if( row >= m_rect.m_h ) throw ::std::out_of_range("CSurface::DrawScanline row"); if( x_ofs >= m_rect.m_w ) @@ -45,7 +45,6 @@ void CSurface::DrawScanline(unsigned int row, unsigned int x_ofs, unsigned int w if( w > m_rect.m_w ) throw ::std::out_of_range("CSurface::DrawScanline width"); - _SysDebug(" memcpy(%p, %p, %i)", &m_data[row*m_rect.m_w + x_ofs], data, w*4 ); ::memcpy( &m_data[row*m_rect.m_w + x_ofs], data, w*4 ); } diff --git a/Usermode/Applications/axwin4_src/Server/compositor.cpp b/Usermode/Applications/axwin4_src/Server/compositor.cpp index 40521459..dbabc9f6 100644 --- a/Usermode/Applications/axwin4_src/Server/compositor.cpp +++ b/Usermode/Applications/axwin4_src/Server/compositor.cpp @@ -40,6 +40,7 @@ bool CCompositor::GetScreenDims(unsigned int ScreenID, unsigned int* W, unsigned void CCompositor::Redraw() { + _SysDebug("CCompositor::Redraw"); // Redraw the screen and clear damage rects if( m_damageRects.empty() ) return ; @@ -50,6 +51,7 @@ 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 ) { diff --git a/Usermode/Applications/axwin4_src/Server/video.cpp b/Usermode/Applications/axwin4_src/Server/video.cpp index d2eb26a9..55e3acbc 100644 --- a/Usermode/Applications/axwin4_src/Server/video.cpp +++ b/Usermode/Applications/axwin4_src/Server/video.cpp @@ -37,11 +37,15 @@ CVideo::CVideo(const CConfigVideo& config): throw AxWin::InitFailure("Terminal not capable of graphics"); } + _SysDebug("m_width=%i, m_height=%i", m_width, m_height); SetCursorBitmap(); SetCursorPos( m_width/2, m_height/2 ); SetBufFormat(PTYBUFFMT_FB); + uint32_t data[m_width]; + for( unsigned int i = 0; i < m_height; i ++ ) + BlitLine(data, i, 0, m_width); } void CVideo::GetDims(unsigned int& w, unsigned int& h) @@ -52,10 +56,21 @@ void CVideo::GetDims(unsigned int& w, unsigned int& h) void CVideo::BlitLine(const uint32_t* src, unsigned int dst_y, unsigned int dst_x, unsigned int width) { + //_SysDebug("CVideo::BlitLine (%p, %i, %i, %i)", src, dst_y, dst_x, width); + size_t cmdlen = sizeof(struct ptycmd_senddata)/4 + width; + //_SysDebug(" - Offset = %i, cmdlen = %i", (dst_y * m_width + dst_x) * 4, cmdlen); + struct ptycmd_senddata cmd = { + {PTY2D_CMD_SEND, cmdlen & 0xFF, cmdlen>>8}, + (dst_y * m_width + dst_x) + }; + SetBufFormat(PTYBUFFMT_2DCMD); + _SysWrite(m_fd, &cmd, sizeof(cmd)); + _SysWrite(m_fd, src, width*4); + + //SetBufFormat(PTYBUFFMT_FB); //_SysWriteAt(m_fd, (dst_y * m_width + dst_x) * 4, width * 4, src); - SetBufFormat(PTYBUFFMT_FB); - _SysSeek(m_fd, (dst_y * m_width + dst_x) * 4, SEEK_SET); - _SysWrite(m_fd, src, width * 4); + //_SysSeek(m_fd, (dst_y * m_width + dst_x) * 4, SEEK_SET); + //_SysWrite(m_fd, src, width * 4); } void CVideo::Flush() diff --git a/Usermode/Applications/axwin4_src/UI/main.c b/Usermode/Applications/axwin4_src/UI/main.c index e599cb91..3b94448f 100644 --- a/Usermode/Applications/axwin4_src/UI/main.c +++ b/Usermode/Applications/axwin4_src/UI/main.c @@ -20,8 +20,8 @@ int main(int argc, const char *argv[]) //AxWin4_SetWindowFlags(bgwin, AXWIN4_WNDFLAG_NODECORATE|AXWIN4_WNDFLAG_KEEPBELOW); // Load image - char *image = malloc(640*480*4); - AxWin4_DrawBitmap(bgwin, 0, 0, 640, 480, image); + //char *image = malloc(640*480*4); + //AxWin4_DrawBitmap(bgwin, 0, 0, 640, 480, image); _SysDebug("Beginning queue"); -- 2.20.1