コード例 #1
0
ファイル: ESVideo.cpp プロジェクト: kozarovv/mednafen-ps3
void					ESVideo::PresentFrame			(GLuint aID, uint32_t aWidth, uint32_t aHeight, const Area& aViewPort, bool aFlip)
{
	//Enter present state
	EnterPresentState();

	//Calculate output area
	Area presentArea;

	if(NoAspect)
	{
		uint32_t x = PresentArea.X, y = PresentArea.Y, w = PresentArea.Width, h = PresentArea.Height;
		Utility::CenterAndScale(x, y, w, h, aViewPort.Width, aViewPort.Height);

		presentArea = Area(x, y, w, h);
	}
	else
	{
		presentArea = PresentArea;
	}

	//Call kiddie present if possible
	if(SupportsShaders())
	{
		Present(aID, aWidth, aHeight, aViewPort, presentArea, aFlip);

		/* Reset vertex buffer */
		ApplyVertexBuffer(VertexBuffer);
	}
	else
	{
		float xl = (float)aViewPort.X / (float)aWidth;
		float xr = (float)aViewPort.Right() / (float)aWidth;
		float yl = (float)aViewPort.Y / (float)aHeight;
		float yr = (float)aViewPort.Bottom() / (float)aHeight;

		if(aFlip)
		{
			std::swap(yl, yr);
		}

		glBindTexture(GL_TEXTURE_2D, aID); glSplat();

		SetVertex(&VertexBuffer[0 * VertexSize], presentArea.X, 		presentArea.Y, 			1.0f, 1.0f, 1.0f, 1.0f, xl, yl);
		SetVertex(&VertexBuffer[1 * VertexSize], presentArea.Right(), 	presentArea.Y, 			1.0f, 1.0f, 1.0f, 1.0f, xr, yl);
		SetVertex(&VertexBuffer[2 * VertexSize], presentArea.Right(),	presentArea.Bottom(),	1.0f, 1.0f, 1.0f, 1.0f, xr, yr);
		SetVertex(&VertexBuffer[3 * VertexSize], presentArea.X,			presentArea.Bottom(),	1.0f, 1.0f, 1.0f, 1.0f, xl, yr);

		glDrawArrays(GL_QUADS, 0, 4); glSplat();
	}

	//Exit present state
	ExitPresentState();
}
コード例 #2
0
ファイル: CellVideo.cpp プロジェクト: cdenix/psmame
void					ESVideo::PlaceTexture			(Texture* aTexture, const Area& aDestination, const Area& aSource, uint32_t aColor)
{
	float r = (float)((aColor >> 24) & 0xFF) / 256.0f;
	float g = (float)((aColor >> 16) & 0xFF) / 256.0f;	
	float b = (float)((aColor >> 8) & 0xFF) / 256.0f;
	float a = (float)((aColor >> 0) & 0xFF) / 256.0f;	

	float xl = 0, xr = 1, yl = 0, yr = 1;
	xl = (float)aSource.X / (float)aTexture->GetWidth();
	xr = (float)aSource.Right() / (float)aTexture->GetWidth();
	yl = (float)aSource.Y / (float)aTexture->GetHeight();
	yr = (float)aSource.Bottom() / (float)aTexture->GetHeight();

	aTexture->Apply();
	OpenGLHelp::SetVertex(&VertexBuffer[0 * VertexSize], Clip.X + aDestination.X, Clip.Y + aDestination.Y, r, g, b, a, xl, yl);
	OpenGLHelp::SetVertex(&VertexBuffer[1 * VertexSize], Clip.X + aDestination.Right(), Clip.Y + aDestination.Y, r, g, b, a, xr, yl);
	OpenGLHelp::SetVertex(&VertexBuffer[2 * VertexSize], Clip.X + aDestination.Right(), Clip.Y + aDestination.Bottom(), r, g, b, a, xr, yr);
	OpenGLHelp::SetVertex(&VertexBuffer[3 * VertexSize], Clip.X + aDestination.X, Clip.Y + aDestination.Bottom(), r, g, b, a, xl, yr);

	glDrawArrays(GL_QUADS, 0, 4);
}
コード例 #3
0
ファイル: Area.cpp プロジェクト: mariuz/haiku
/**
 * Perform layout on the area.
 */
void Area::DoLayout()
{
	if (Content() == NULL)
		return; // empty areas need no layout

	// if there is a childArea, then it is the childArea that actually contains the content
	Area* area = (fChildArea != NULL) ? fChildArea : this;

	// set content location and size
	area->Content()->MoveTo(floor(area->Left()->Value() + 0.5),
			floor(area->Top()->Value() + 0.5));
	int32 width = (int32)floor(area->Right()->Value() - area->Left()->Value() + 0.5);
	int32 height = (int32)floor(area->Bottom()->Value() - area->Top()->Value() + 0.5);
	area->Content()->ResizeTo(width, height);
}
コード例 #4
0
ファイル: ALMLayoutBuilder.cpp プロジェクト: AmirAbrams/haiku
BALMLayoutBuilder&
BALMLayoutBuilder::AddBelow(BLayoutItem* item, YTab* _bottom, XTab* left,
	XTab* right)
{
	Area* currentArea = _CurrentArea();
	if (!left)
		left = currentArea->Left();
	if (!right)
		right = currentArea->Right();
	YTab* top = currentArea->Bottom();
	BReference<YTab> bottom = _bottom;
	if (_bottom == NULL)
		bottom = fLayout->AddYTab();

	return Add(item, left, top, right, bottom);
}
コード例 #5
0
ファイル: ALMLayoutBuilder.cpp プロジェクト: AmirAbrams/haiku
BALMLayoutBuilder&
BALMLayoutBuilder::AddAbove(BLayoutItem* item, YTab* _top, XTab* left,
	XTab* right)
{
	Area* currentArea = _CurrentArea();
	if (!left)
		left = currentArea->Left();
	if (!right)
		right = currentArea->Right();
	BReference<YTab> top = _top;
	if (_top == NULL)
		top = fLayout->AddYTab();
	YTab* bottom = currentArea->Top();

	return Add(item, left, top, right, bottom);
}
コード例 #6
0
ファイル: ALMLayoutBuilder.cpp プロジェクト: AmirAbrams/haiku
BALMLayoutBuilder&
BALMLayoutBuilder::AddToRight(BLayoutItem* item, XTab* _right, YTab* top,
	YTab* bottom)
{
	Area* currentArea = _CurrentArea();
	XTab* left = currentArea->Right();
	BReference<XTab> right = _right;
	if (_right == NULL)
		right = fLayout->AddXTab();
	if (!top)
		top = currentArea->Top();
	if (!bottom)
		bottom = currentArea->Bottom();

	return Add(item, left, top, right, bottom);
}