//----------------------------------------------------------------------------- // // This file contains color blend functions. // // Copyright (C) Microsoft Corporation, 1997. // // WARNING WARNING WARNING // This cpp file generated from mcp file. // EDIT THE MCP FILE. // I warned you. // WARNING WARNING WARNING // //----------------------------------------------------------------------------- include(`m4hdr.mh')dnl #include "rgb_pch.h" #pragma hdrstop #include "ccrbd_mh.h" define(`d_ColorBlend', ` void C_ColorBlend_$1_$2(PD3DI_RASTCTX pCtx, PD3DI_RASTPRIM pP, PD3DI_RASTSPAN pS) { dnl if (($1 == AllBlend) || ($2 == AllROP)) ifelse(eval((d_index(`$1', `AllBlend') == 0) || (d_index(`$2', `AllROP') == 0)), `1', ` D3DCOLOR DestColor = pCtx->pfnBufRead(pS->pSurface);') dnl ifelse(`$1', `AllBlend', ` { numeric_limits< UINT16> Dummy; UINT16 uSR, uSG, uSB, uSA; UINT16 uBR, uBG, uBB, uBA; UINT32 u2R, u2G, u2B, u2A; pCtx->pfnSrcBlend (&uSR, &uSG, &uSB, &uSA, DestColor, pCtx); pCtx->pfnDestBlend(&uBR, &uBG, &uBB, &uBA, DestColor, pCtx); u2B= uSB; u2G= uSG; u2R= uSR; u2A= uSA; clamp_max< UINT32>( u2B+= uBB, Dummy.max()); clamp_max< UINT32>( u2G+= uBG, Dummy.max()); clamp_max< UINT32>( u2R+= uBR, Dummy.max()); clamp_max< UINT32>( u2A+= uBA, Dummy.max()); pCtx->SI.uBB = static_cast(u2B); pCtx->SI.uBG = static_cast(u2G); pCtx->SI.uBR = static_cast(u2R); pCtx->SI.uBA = static_cast(u2A); }') dnl dnl ifelse(`$2', `AllROP', ` { // It might be faster to do this in conjunction with the write. // It might be faster to do this through a function pointer too. UINT16 uBB = (UINT16)RGBA_GETBLUE(DestColor)<<8; UINT16 uBG = (UINT16)RGBA_GETGREEN(DestColor)<<8; UINT16 uBR = (UINT16)RGBA_GETRED(DestColor)<<8; UINT16 uBA = (UINT16)RGBA_GETALPHA(DestColor)<<8; switch (pCtx->pdwRenderState[D3DRENDERSTATE_ROP2]) { // case R2_BLACK : d_RepStr(`pCtx->SI.XX = 0; ', XX, uBB, uBG, uBR, uBA)break; // case R2_NOTMERGEPEN: d_RepStr(`pCtx->SI.XX = ~(pCtx->SI.XX | XX); ',XX, uBB, uBG, uBR, uBA)break; // case R2_MASKNOTPEN : d_RepStr(`pCtx->SI.XX = ~pCtx->SI.XX & XX; ', XX, uBB, uBG, uBR, uBA)break; // case R2_NOTCOPYPEN : d_RepStr(`pCtx->SI.XX = ~pCtx->SI.XX; ', XX, uBB, uBG, uBR, uBA)break; // case R2_MASKPENNOT : d_RepStr(`pCtx->SI.XX = pCtx->SI.XX & ~XX; ', XX, uBB, uBG, uBR, uBA)break; // case R2_NOT : d_RepStr(`pCtx->SI.XX = ~XX; ', XX, uBB, uBG, uBR, uBA)break; // case R2_XORPEN : d_RepStr(`pCtx->SI.XX = pCtx->SI.XX ^ XX; ', XX, uBB, uBG, uBR, uBA)break; // case R2_NOTMASKPEN : d_RepStr(`pCtx->SI.XX = ~(pCtx->SI.XX & XX); ',XX, uBB, uBG, uBR, uBA)break; // case R2_MASKPEN : d_RepStr(`pCtx->SI.XX = pCtx->SI.XX & XX; ', XX, uBB, uBG, uBR, uBA)break; // case R2_NOTXORPEN : d_RepStr(`pCtx->SI.XX = ~(pCtx->SI.XX ^ XX); ',XX, uBB, uBG, uBR, uBA)break; // case R2_NOP : d_RepStr(`pCtx->SI.XX = XX; ', XX, uBB, uBG, uBR, uBA)break; // case R2_MERGENOTPEN: d_RepStr(`pCtx->SI.XX = ~pCtx->SI.XX | XX; ', XX, uBB, uBG, uBR, uBA)break; case R2_COPYPEN : d_RepStr(`pCtx->SI.XX = pCtx->SI.XX; ', XX, uBB, uBG, uBR, uBA)break; // case R2_MERGEPENNOT: d_RepStr(`pCtx->SI.XX = pCtx->SI.XX | ~XX; ', XX, uBB, uBG, uBR, uBA)break; // case R2_MERGEPEN : d_RepStr(`pCtx->SI.XX = pCtx->SI.XX | XX; ', XX, uBB, uBG, uBR, uBA)break; // case R2_WHITE : d_RepStr(`pCtx->SI.XX = 0xffff; ', XX, uBB, uBG, uBR, uBA)break; } }') dnl pCtx->pfnColorBlendEnd(pCtx, pP, pS); }') dnl d_RepStr(`d_RepStr(`d_ColorBlend(AA, BB)', `AA', `SrcOne_DestZero', `AllBlend')', `BB', `SrcCopy', `AllROP')