/*
==================
Blits a bounding line
==================
*/
void DirectXRender::BlitGridLine(int pPosX1, int pPosY1, int pPosX2, int pPosY2,  BYTE pR, BYTE pG, BYTE pB, BYTE pA, D3DXMATRIX pWorldMatrix) {
	setTransform2d(0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0);

	// Untransformed Points
	D3DXVECTOR2 mP1Untransformed((float) pPosX1, (float) pPosY1);
	D3DXVECTOR2 mP2Untransformed((float) pPosX2, (float) pPosY2);

	D3DXVECTOR4 mP1, mP2;
	D3DXVec2Transform(&mP1, &mP1Untransformed, &pWorldMatrix);
	D3DXVec2Transform(&mP2, &mP2Untransformed, &pWorldMatrix);

	// Color
	setRainbow2d(IND_OPAQUE, 1, 0, 0, IND_FILTER_POINT, pR, pG, pB, pA, 0, 0, 0, 255, 0, 0);

	// Color
	_info._device->SetTextureStageState(0, D3DTSS_COLORARG1, D3DTA_DIFFUSE);

	// Pixel format
	_info._device->SetFVF(D3DFVF_PIXEL);

	// Filling pixels
	fillPixel(&_pixels [0], (int) mP1.x, (int) mP1.y, pR, pG, pB);
	fillPixel(&_pixels [1], (int) mP2.x, (int) mP2.y, pR, pG, pB);

	// Blitting line
	_info._device->DrawPrimitiveUP(D3DPT_LINESTRIP, 1, &_pixels, sizeof(PIXEL));
}
/*
==================
Blits a bounding line
==================
*/
inline void IND_Render::BlitCollisionLine (int pPosX1, int pPosY1, int pPosX2, int pPosY2,  byte pR, byte pG, byte pB, byte pA, IND_Matrix pIndWorldMatrix)
{
	SetTransform2d (0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0);

	D3DXMATRIX mWorldMatrix;
	GetD3DMatrix (pIndWorldMatrix, &mWorldMatrix);

	// Untransformed points
	D3DXVECTOR2 mP1Untransformed ((float) pPosX1, (float) pPosY1);			
	D3DXVECTOR2 mP2Untransformed ((float) pPosX2, (float) pPosY2);	

	D3DXVECTOR4 mP1, mP2;
	D3DXVec2Transform (&mP1, &mP1Untransformed, &mWorldMatrix);
	D3DXVec2Transform (&mP2, &mP2Untransformed, &mWorldMatrix);
	
	// Color
	SetRainbow2d (IND_OPAQUE, 1, 0, 0, IND_FILTER_POINT, pR, pG, pB, pA, 0, 0, 0, 255, 0, 0);

	// Color
	mInfo.mDevice->SetTextureStageState (0, D3DTSS_COLORARG1, D3DTA_DIFFUSE);

	// Pixel format
	mInfo.mDevice->SetFVF (D3DFVF_PIXEL);

	// Filling pixels
	FillPixel (&mPixels [0], (int) mP1.x, (int) mP1.y, pR, pG, pB);
	FillPixel (&mPixels [1], (int) mP2.x, (int) mP2.y, pR, pG, pB);

	// Blitting line
	mInfo.mDevice->DrawPrimitiveUP (D3DPT_LINESTRIP, 1, &mPixels, sizeof (PIXEL));
}