Beispiel #1
0
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;
}
Beispiel #2
0
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;
}
Beispiel #3
0
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()
	{
		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);
	}
Beispiel #5
0
	void UIListBox::Render()
	{
		UIElementPtr pElement = elements_[0];
		UIElementPtr pSelElement = elements_[1];
		if (this->GetEnabled())
		{
			pElement->TextureColor().SetState(UICS_Normal);
			pElement->FontColor().SetState(UICS_Normal);
			pSelElement->TextureColor().SetState(UICS_Normal);
			pSelElement->FontColor().SetState(UICS_Normal);
		}
		else
		{
			pElement->TextureColor().SetState(UICS_Disabled);
			pElement->FontColor().SetState(UICS_Disabled);
			pSelElement->TextureColor().SetState(UICS_Disabled);
			pSelElement->FontColor().SetState(UICS_Disabled);
		}

		this->GetDialog()->DrawSprite(*pElement,
			IRect(x_, y_, x_ + width_, y_ + height_));

		// Render the text
		if (!items_.empty())
		{
			// Find out the height of a single line of text
			IRect rc = text_rc_;
			IRect rcSel = selection_rc_;
			rc.bottom() = static_cast<int32_t>(rc.top() + UIManager::Instance().GetFontSize(pElement->FontIndex()));

			// Update the line height formation
			text_height_ = rc.Height();

			static bool bSBInit;
			if (!bSBInit)
			{
				// Update the page size of the scroll bar
				if (text_height_)
				{
					scroll_bar_.SetPageSize(text_rc_.Height() / text_height_);
				}
				else
				{
					scroll_bar_.SetPageSize(text_rc_.Height());
				}
				bSBInit = true;
			}

			rc.right() = text_rc_.right();
			for (int i = static_cast<int>(scroll_bar_.GetTrackPos()); i < static_cast<int>(items_.size()); ++ i)
			{
				if (rc.bottom() > text_rc_.bottom())
				{
					break;
				}

				std::shared_ptr<UIListBoxItem> const & pItem = items_[i];

				// Determine if we need to render this item with the
				// selected element.
				bool bSelectedStyle = false;

				if (!(MULTI_SELECTION == style_) && (i == selected_))
				{
					bSelectedStyle = true;
				}
				else
				{
					if (MULTI_SELECTION == style_)
					{
						if (drag_
							&& (((i >= selected_) && (i < sel_start_))
								|| ((i <= selected_) && (i > sel_start_))))
						{
							bSelectedStyle = items_[sel_start_]->bSelected;
						}
						else
						{
							if (pItem->bSelected)
							{
								bSelectedStyle = true;
							}
						}
					}
				}

				if (bSelectedStyle)
				{
					rcSel.top() = rc.top();
					rcSel.bottom() = rc.bottom();
					this->GetDialog()->DrawSprite(*pSelElement, rcSel);
					this->GetDialog()->DrawString(pItem->strText, *pSelElement, rc);
				}
				else
				{
					this->GetDialog()->DrawString(pItem->strText, *pElement, rc);
				}

				rc += int2(0, text_height_);
			}
		}

		// Render the scroll bar
		scroll_bar_.Render();
	}
	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);*/
	}