Esempio n. 1
0
// Pre: nSrcAdjustment: for 160-color images, src is +1 compared to dst
static void CopySource(int w, int h, int sx, int sy, bgra_t *pVideoAddress, const int nSrcAdjustment = 0)
{
	UINT32* pDst = (UINT32*) pVideoAddress;
	const BYTE* const pSrc = g_aSourceStartofLine[ sy ] + sx;

	while (h--)
	{
		int nBytes = w;
		while (nBytes)
		{
			--nBytes;

			if (IsVideoStyle(VS_HALF_SCANLINES) && !(h & 1))
			{
				// 50% Half Scan Line clears every odd scanline (and SHIFT+PrintScreen saves only the even rows)
				*(pDst+nBytes) = 0;
			}
			else
			{
				_ASSERT( *(pSrc+nBytes+nSrcAdjustment) < (sizeof(PalIndex2RGB)/sizeof(PalIndex2RGB[0])) );
				const RGBQUAD& rRGB = PalIndex2RGB[ *(pSrc+nBytes+nSrcAdjustment) ];
				const UINT32 rgb = (((UINT32)rRGB.rgbRed)<<16) | (((UINT32)rRGB.rgbGreen)<<8) | ((UINT32)rRGB.rgbBlue);
				*(pDst+nBytes) = rgb;
			}
		}

		pDst -= GetFrameBufferWidth();
	}
}
Esempio n. 2
0
static void CopyMixedSource(int x, int y, int sx, int sy, bgra_t *pVideoAddress)
{
	const BYTE* const pSrc = g_aSourceStartofLine[ sy ] + sx;

	const int matx = x*14;
	const int maty = HGR_MATRIX_YOFFSET + y;
	const bool isSWMIXED = VideoGetSWMIXED();

	// transfer 14 pixels (i.e. the visible part of an apple hgr-byte) from row to pixelmatrix
	for (int nBytes=13; nBytes>=0; nBytes--)
	{
		hgrpixelmatrix[matx+nBytes][maty] = *(pSrc+nBytes);
	}

	const bool bIsHalfScanLines = IsVideoStyle(VS_HALF_SCANLINES);
	const UINT frameBufferWidth = GetFrameBufferWidth();

	for (int nBytes=13; nBytes>=0; nBytes--)
	{
		// color mixing between adjacent scanlines at current x position
		MixColorsVertical(matx+nBytes, maty, isSWMIXED);	//Post: colormixbuffer[]

		UINT32* pDst = (UINT32*) pVideoAddress;

		for (int h=HGR_MATRIX_YOFFSET; h<=HGR_MATRIX_YOFFSET+1; h++)
		{
			if (bIsHalfScanLines && (h & 1))
			{
				// 50% Half Scan Line clears every odd scanline (and SHIFT+PrintScreen saves only the even rows)
				*(pDst+nBytes) = 0;
			}
			else
			{
				_ASSERT( colormixbuffer[h] < (sizeof(PalIndex2RGB)/sizeof(PalIndex2RGB[0])) );
				const RGBQUAD& rRGB = PalIndex2RGB[ colormixbuffer[h] ];
				const UINT32 rgb = (((UINT32)rRGB.rgbRed)<<16) | (((UINT32)rRGB.rgbGreen)<<8) | ((UINT32)rRGB.rgbBlue);
				*(pDst+nBytes) = rgb;
			}

			pDst -= frameBufferWidth;
		}
	}
}
Esempio n. 3
0
	void CEngine::CopyMainRenderTargetToBackBuffer(CRenderContext& renderContext)
	{
		CRenderTarget& rt = m_mainRenderTarget[m_currentMainRenderTarget];
		m_pTransformedPrimEffect->SetTechnique(renderContext, "TransformedPrim");
		m_pTransformedPrimEffect->Begin(renderContext);
		m_pTransformedPrimEffect->BeginPass(renderContext, 0);
		float offset[] = {
			0.5f / GetFrameBufferWidth() ,
			0.5f / GetFrameBufferHeight()
		};
	
		m_pTransformedPrimEffect->SetTexture(renderContext, "g_tex", rt.GetTexture());
		m_pTransformedPrimEffect->SetValue(renderContext, "g_offset", offset, sizeof(offset));
		m_pTransformedPrimEffect->CommitChanges(renderContext);
		renderContext.SetVertexDeclaration(m_copyBackBufferPrim.GetVertexDecl());
		renderContext.SetStreamSource(0, m_copyBackBufferPrim.GetVertexBuffer());
		renderContext.SetIndices(m_copyBackBufferPrim.GetIndexBuffer());
		renderContext.DrawIndexedPrimitive(&m_copyBackBufferPrim);
		
		m_pTransformedPrimEffect->EndPass(renderContext);
		m_pTransformedPrimEffect->End(renderContext);
	}