You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
78 lines
3.7 KiB
78 lines
3.7 KiB
//-----------------------------------------------------------------------------
|
|
//
|
|
// 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 "pch.cpp"
|
|
#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', `
|
|
{
|
|
UINT16 uSR, uSG, uSB, uSA;
|
|
UINT16 uBR, uBG, uBB, uBA;
|
|
pCtx->pfnSrcBlend (&uSR, &uSG, &uSB, &uSA, DestColor, pCtx);
|
|
pCtx->pfnDestBlend(&uBR, &uBG, &uBB, &uBA, DestColor, pCtx);
|
|
|
|
pCtx->SI.uBB = (UINT16)min((UINT32)uSB + (UINT32)uBB, 0xffff);
|
|
pCtx->SI.uBG = (UINT16)min((UINT32)uSG + (UINT32)uBG, 0xffff);
|
|
pCtx->SI.uBR = (UINT16)min((UINT32)uSR + (UINT32)uBR, 0xffff);
|
|
pCtx->SI.uBA = (UINT16)min((UINT32)uSA + (UINT32)uBA, 0xffff);
|
|
}')
|
|
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')
|
|
|