bool SylVNC::BltBitmap(SrvBitmap *pcDstBitmap, SrvBitmap *pcSrcBitmap, IRect cSrcRect, IPoint cDstPos, int nMode) { if((!pcDstBitmap->m_bVideoMem) && (!pcSrcBitmap->m_bVideoMem)) { // Off-screen to off-screen return DisplayDriver::BltBitmap(pcDstBitmap, pcSrcBitmap, cSrcRect, cDstPos, nMode); } int srcX1 = cSrcRect.left; int srcY1 = cSrcRect.top; int srcX2 = cSrcRect.right; int srcY2 = cSrcRect.bottom; int dstX1 = cDstPos.x; int dstY1 = cDstPos.y; int dstX2 = cDstPos.x + cSrcRect.Width(); int dstY2 = cDstPos.y + cSrcRect.Height(); if((pcDstBitmap->m_bVideoMem) && (pcSrcBitmap->m_bVideoMem)) { if(nMode == DM_COPY) // dbprintf("SylVNC::BltBitmap() - Screen to screen DM_COPY\n"); ; else if(nMode == DM_OVER) dbprintf("SylVNC::BltBitmap() - Screen to screen DM_OVER\n"); else if(nMode == DM_BLEND) dbprintf("SylVNC::BltBitmap() - Screen to screen DM_BLEND\n"); else dbprintf("SylVNC::BltBitmap() - Unknown nMode = %d\n", nMode); } DisplayDriver::BltBitmap(pcDstBitmap, pcSrcBitmap, cSrcRect, cDstPos, nMode); if(pcDstBitmap->m_bVideoMem) { // ACQUIRE RFB lock m_cRFBLock.Lock(); rfbMarkRectAsModified( rfbScreen, dstX1, dstY1, dstX2 + 1, dstY2 + 1); // RELEASE RFB lock m_cRFBLock.Unlock(); } if(pcSrcBitmap->m_bVideoMem) { // ACQUIRE RFB lock m_cRFBLock.Lock(); rfbMarkRectAsModified( rfbScreen, srcX1, srcY1, srcX2 + 1, srcY2 + 1); // RELEASE RFB lock m_cRFBLock.Unlock(); } resume_thread( rfbEventThread ); // rfbProcessEvents(rfbScreen, 0); return true; }
bool VMware::BltBitmap(SrvBitmap *pcDstBitmap, SrvBitmap *pcSrcBitmap, IRect cSrcRect, IRect cDstRect, int nMode, int nAlpha) { if(((!pcDstBitmap->m_bVideoMem) && (!pcSrcBitmap->m_bVideoMem)) || nMode != DM_COPY || cSrcRect.Size() != cDstRect.Size()) { // Off-screen to off-screen return DisplayDriver::BltBitmap(pcDstBitmap, pcSrcBitmap, cSrcRect, cDstRect, nMode, nAlpha); } IPoint cDstPos = cDstRect.LeftTop(); int srcX = cSrcRect.left; int srcY = cSrcRect.top; int dstX = cDstPos.x; int dstY = cDstPos.y; int width = cSrcRect.Width() + 1; int height = cSrcRect.Height() + 1; bool accelDmCopy = false; if((pcDstBitmap->m_bVideoMem) && (pcSrcBitmap->m_bVideoMem)) { if(nMode == DM_COPY) accelDmCopy = m_regCapabilities & SVGA_CAP_RECT_COPY; else if(nMode == DM_OVER) dbprintf("VMware::BltBitmap() - Screen to screen DM_OVER\n"); else if(nMode == DM_BLEND) dbprintf("VMware::BltBitmap() - Screen to screen DM_BLEND\n"); else dbprintf("VMware::BltBitmap() - Unknown nMode = %d\n", nMode); } // ACQUIRE lock m_cGELock.Lock(); if(accelDmCopy) { // Accelerated screen to screen DM_COPY Fifo_RectCopy(srcX, srcY, dstX, dstY, width, height); m_bFifoCmds = true; } else { if(m_bFifoCmds) FifoSync(); DisplayDriver::BltBitmap(pcDstBitmap, pcSrcBitmap, cSrcRect, cDstRect, nMode, nAlpha); if(pcDstBitmap->m_bVideoMem) Fifo_UpdateRect(dstX, dstY, width, height); } // RELEASE lock m_cGELock.Unlock(); return true; }
void CoreDelegateImpl::Draw() { static float x = 50; static float y = 600; auto p_renderer = Core::GetRenderer(); IRect rect = p_renderer->GetTargetRectangle(); p_renderer->SetMatrix(MatrixMode::Projection, Matrix4f::CreateOrtho(0, rect.Width(), 0, rect.Height())); std::wstring message = L"FPS: " + std::to_wstring(Core::GetApplication()->GetCurrentFPS()); auto en_font = Core::GetGlobalObject<Resources::ResourceManager>()->GetHandleToResource<Render::Font>("Arial_en"); auto arial_font = Core::GetGlobalObject<Resources::ResourceManager>()->GetHandleToResource<Render::Font>("Arial"); Core::GetGlobalObject<Render::FontManager>()->Render({ x, y }, 1.f, message, arial_font); Core::GetGlobalObject<Render::FontManager>()->Render({ x, y - 50 }, 1.f, message_num_0, en_font); Core::GetGlobalObject<Render::FontManager>()->Render({ x, y - 100 }, 1.f, L"Мама мыла раму!", arial_font); }
bool VMware::FillRect(SrvBitmap *pcBitmap, const IRect& cRect, const Color32_s& sColor, int nMode) { if(!pcBitmap->m_bVideoMem || nMode != DM_COPY) { /* Off-screen */ return DisplayDriver::FillRect(pcBitmap, cRect, sColor, nMode); } int dstX = cRect.left; int dstY = cRect.top; int width = cRect.Width() + 1; int height = cRect.Height() + 1; int nColor; if (pcBitmap->m_eColorSpc == CS_RGB32) nColor = COL_TO_RGB32(sColor); else nColor = COL_TO_RGB16(sColor); bool accelOp = false; // accelOp = m_regCapabilities & SVGA_CAP_RECT_FILL; // ACQUIRE lock m_cGELock.Lock(); if(accelOp) { /* Accelerated on-screen RectFill */ Fifo_RectFill(dstX, dstY, width, height, nColor); m_bFifoCmds = true; } else { if(m_bFifoCmds) FifoSync(); DisplayDriver::FillRect(pcBitmap, cRect, sColor, nMode); Fifo_UpdateRect(dstX, dstY, width, height); } // RELEASE lock m_cGELock.Unlock(); return true; }
void CoreDelegateImpl::Draw() { auto p_lights = Core::GetRenderer()->GetLightsController(); p_lights->DisableLighting(); drawGrid(100, 4); p_lights->EnableLighting(); static float x = 50; static float y = 600; auto p_renderer = Core::GetRenderer(); IRect rect = p_renderer->GetTargetRectangle(); p_renderer->SetMatrix(MatrixMode::Projection, Matrix4f::CreateOrtho(0, rect.Width(), 0, rect.Height())); std::wstring message = L"FPS: " + std::to_wstring(Core::GetApplication()->GetCurrentFPS()); auto en_font = Core::GetGlobalObject<Resources::ResourceManager>()->GetHandleToResource<Render::Font>("Arial_en"); auto p_font_mgr = Core::GetGlobalObject<Render::FontManager>(); p_font_mgr->Render({ x, 900 }, 0.6f, message, en_font); p_font_mgr->Render({ x, 865 }, 0.6f, L"Vertices: " + std::to_wstring(Core::GetGlobalObject<Render::MeshSystem>()->GetVerticesRendered()), en_font); p_font_mgr->Render({ x, 830 }, 0.6f, L"Trigs: " + std::to_wstring(Core::GetGlobalObject<Render::MeshSystem>()->GetTrianglesRendered()), en_font); /*message = L"asdqwetbij[we6 ewrgasdf"; for (int i = 0; i < 100; ++i) p_font_mgr->Render({ x, y }, 1.f, message, en_font);*/ }