PRB: ATI Display Driver: TransparentImage() Cannot Render Requested Image as Transparent When Destination and Source Are Both Screen DC (263684)



The information in this article applies to:

  • Microsoft Windows CE Operating System, Versions 2.12
  • Microsoft Windows CE Operating System, Versions 2.11
  • Microsoft Windows CE Platform Builder 2.11
  • Microsoft Windows CE Platform Builder 2.12
  • Microsoft Windows CE Platform Builder 3.0 (BETA)
  • Microsoft Windows CE Operating System, Versions 3.0

This article was previously published under Q263684

SYMPTOMS

The sample ATI driver (in the Platform\Cepc\Drivers\Display\Ati folder) has a problem with video memory-to-video memory bitblock transfers that also use TRANPARENCY. The TransparentImage function cannot render a requested image as transparent when the destination and source are both screen DCs. This problem can be corrected by replacing the ATI::AcceleratedSrcCopyBlt function with the code that is included in the "More Information" section of this article.

MORE INFORMATION

Use the AccelerateSrcCopyBlt function, as follows:
SCODE
ATI::AcceleratedSrcCopyBlt (GPEBltParms *pBltParms)
{
	DWORD	DstCntl = DST_Y_TOP_TO_BOTTOM | DST_X_LEFT_TO_RIGHT;
	int	srcX = pBltParms->prclSrc->left + ((ATISurf *) (pBltParms->pSrc))->Left();	// Left of source rect.
	int	srcY = pBltParms->prclSrc->top + ((ATISurf *) (pBltParms->pSrc))->Top();	// Top of source rect.
	int	dstX = pBltParms->prclDst->left + ((ATISurf *) (pBltParms->pDst))->Left();	// Left of dest. rect.
	int	dstY = pBltParms->prclDst->top + ((ATISurf *) (pBltParms->pDst))->Top();	// Top of dest. rect.
	int	width = pBltParms->prclDst->right  - pBltParms->prclDst->left;		// Rectangle Width Data Store.
	int	height = pBltParms->prclDst->bottom - pBltParms->prclDst->top;		// Rectangle Height Data Store.

	RETAILMSG (ATI_FUNCTION_MSGS, (TEXT("ATI::AcceleratedSrcCopyBlt()\r\n")));

	// Check for negative x or y direction and correct values accordingly.
	if (!pBltParms->xPositive)
	{
		srcX += (width - 1);
		dstX += (width - 1);
		DstCntl &= ~DST_X_LEFT_TO_RIGHT;
	}

	if (!pBltParms->yPositive)
	{
		srcY += (height - 1);
		dstY += (height - 1);
		DstCntl &= ~DST_Y_TOP_TO_BOTTOM;
	}

	WaitForFIFO(10);		// Wait for max number of possible used registers to be available.

	if (pBltParms->bltFlags & BLT_TRANSPARENT)
	{

		_memwD_reg (CLR_CMP_CNTL, COMPARE_SOURCE | COMPARE_EQUAL);	// Turn on transparency.
		_memwD_reg (CLR_CMP_CLR, pBltParms->solidColor);		// Set comparison color.
	}

	switch (pBltParms->rop4)
	{
		case	0x6666:	// SRCINVERT
			_memwD_reg (DP_MIX, FRGD_MIX_D_XOR_S | BKGD_MIX_D);
			break;

		case	0x8888:	// SRCAND
			_memwD_reg (DP_MIX, FRGD_MIX_D_AND_S | BKGD_MIX_D);
			break;

		default:
		case	0xCCCC:	// SRCCOPY
			_memwD_reg (DP_MIX, FRGD_MIX_S | BKGD_MIX_D);
			break;

		case	0xEEEE:	// SRCPAINT
			_memwD_reg (DP_MIX, FRGD_MIX_D_OR_S | BKGD_MIX_D);
			break;
	}

	_memwD_reg (DP_SRC, FRGD_SRC_BLIT);
	_memwD_reg (SRC_Y_X, (srcX << 16) | srcY);
	_memwD_reg (SRC_HEIGHT1_WIDTH1, (width << 16) | height);
	_memwD_reg (DST_CNTL, DstCntl);
	_memwD_reg (DST_Y_X, (dstX << 16) | dstY);
	_memwD_reg (DST_HEIGHT_WIDTH, (width << 16) | height);

	if (pBltParms->bltFlags & BLT_TRANSPARENT)
	{
		_memwD_reg (CLR_CMP_CNTL, COMPARE_DESTINATION | COMPARE_FALSE);	// Turn off Transparency.
	}

	return	S_OK;
}
				

Modification Type:MinorLast Reviewed:12/27/2003
Keywords:kbprb KB263684