Leaked source code of windows server 2003
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.

85 lines
4.0 KiB

  1. //-----------------------------------------------------------------------------
  2. //
  3. // This file contains color blend functions.
  4. //
  5. // Copyright (C) Microsoft Corporation, 1997.
  6. //
  7. // WARNING WARNING WARNING
  8. // This cpp file generated from mcp file.
  9. // EDIT THE MCP FILE.
  10. // I warned you.
  11. // WARNING WARNING WARNING
  12. //
  13. //-----------------------------------------------------------------------------
  14. include(`m4hdr.mh')dnl
  15. #include "rgb_pch.h"
  16. #pragma hdrstop
  17. #include "ccrbd_mh.h"
  18. define(`d_ColorBlend', `
  19. void C_ColorBlend_$1_$2(PD3DI_RASTCTX pCtx, PD3DI_RASTPRIM pP,
  20. PD3DI_RASTSPAN pS)
  21. {
  22. dnl if (($1 == AllBlend) || ($2 == AllROP))
  23. ifelse(eval((d_index(`$1', `AllBlend') == 0) || (d_index(`$2', `AllROP') == 0)), `1', `
  24. D3DCOLOR DestColor = pCtx->pfnBufRead(pS->pSurface);')
  25. dnl
  26. ifelse(`$1', `AllBlend', `
  27. {
  28. numeric_limits< UINT16> Dummy;
  29. UINT16 uSR, uSG, uSB, uSA;
  30. UINT16 uBR, uBG, uBB, uBA;
  31. UINT32 u2R, u2G, u2B, u2A;
  32. pCtx->pfnSrcBlend (&uSR, &uSG, &uSB, &uSA, DestColor, pCtx);
  33. pCtx->pfnDestBlend(&uBR, &uBG, &uBB, &uBA, DestColor, pCtx);
  34. u2B= uSB; u2G= uSG; u2R= uSR; u2A= uSA;
  35. clamp_max< UINT32>( u2B+= uBB, Dummy.max());
  36. clamp_max< UINT32>( u2G+= uBG, Dummy.max());
  37. clamp_max< UINT32>( u2R+= uBR, Dummy.max());
  38. clamp_max< UINT32>( u2A+= uBA, Dummy.max());
  39. pCtx->SI.uBB = static_cast<UINT16>(u2B);
  40. pCtx->SI.uBG = static_cast<UINT16>(u2G);
  41. pCtx->SI.uBR = static_cast<UINT16>(u2R);
  42. pCtx->SI.uBA = static_cast<UINT16>(u2A);
  43. }')
  44. dnl
  45. dnl
  46. ifelse(`$2', `AllROP', `
  47. {
  48. // It might be faster to do this in conjunction with the write.
  49. // It might be faster to do this through a function pointer too.
  50. UINT16 uBB = (UINT16)RGBA_GETBLUE(DestColor)<<8;
  51. UINT16 uBG = (UINT16)RGBA_GETGREEN(DestColor)<<8;
  52. UINT16 uBR = (UINT16)RGBA_GETRED(DestColor)<<8;
  53. UINT16 uBA = (UINT16)RGBA_GETALPHA(DestColor)<<8;
  54. switch (pCtx->pdwRenderState[D3DRENDERSTATE_ROP2]) {
  55. // case R2_BLACK : d_RepStr(`pCtx->SI.XX = 0; ', XX, uBB, uBG, uBR, uBA)break;
  56. // case R2_NOTMERGEPEN: d_RepStr(`pCtx->SI.XX = ~(pCtx->SI.XX | XX); ',XX, uBB, uBG, uBR, uBA)break;
  57. // case R2_MASKNOTPEN : d_RepStr(`pCtx->SI.XX = ~pCtx->SI.XX & XX; ', XX, uBB, uBG, uBR, uBA)break;
  58. // case R2_NOTCOPYPEN : d_RepStr(`pCtx->SI.XX = ~pCtx->SI.XX; ', XX, uBB, uBG, uBR, uBA)break;
  59. // case R2_MASKPENNOT : d_RepStr(`pCtx->SI.XX = pCtx->SI.XX & ~XX; ', XX, uBB, uBG, uBR, uBA)break;
  60. // case R2_NOT : d_RepStr(`pCtx->SI.XX = ~XX; ', XX, uBB, uBG, uBR, uBA)break;
  61. // case R2_XORPEN : d_RepStr(`pCtx->SI.XX = pCtx->SI.XX ^ XX; ', XX, uBB, uBG, uBR, uBA)break;
  62. // case R2_NOTMASKPEN : d_RepStr(`pCtx->SI.XX = ~(pCtx->SI.XX & XX); ',XX, uBB, uBG, uBR, uBA)break;
  63. // case R2_MASKPEN : d_RepStr(`pCtx->SI.XX = pCtx->SI.XX & XX; ', XX, uBB, uBG, uBR, uBA)break;
  64. // case R2_NOTXORPEN : d_RepStr(`pCtx->SI.XX = ~(pCtx->SI.XX ^ XX); ',XX, uBB, uBG, uBR, uBA)break;
  65. // case R2_NOP : d_RepStr(`pCtx->SI.XX = XX; ', XX, uBB, uBG, uBR, uBA)break;
  66. // case R2_MERGENOTPEN: d_RepStr(`pCtx->SI.XX = ~pCtx->SI.XX | XX; ', XX, uBB, uBG, uBR, uBA)break;
  67. case R2_COPYPEN : d_RepStr(`pCtx->SI.XX = pCtx->SI.XX; ', XX, uBB, uBG, uBR, uBA)break;
  68. // case R2_MERGEPENNOT: d_RepStr(`pCtx->SI.XX = pCtx->SI.XX | ~XX; ', XX, uBB, uBG, uBR, uBA)break;
  69. // case R2_MERGEPEN : d_RepStr(`pCtx->SI.XX = pCtx->SI.XX | XX; ', XX, uBB, uBG, uBR, uBA)break;
  70. // case R2_WHITE : d_RepStr(`pCtx->SI.XX = 0xffff; ', XX, uBB, uBG, uBR, uBA)break;
  71. }
  72. }')
  73. dnl
  74. pCtx->pfnColorBlendEnd(pCtx, pP, pS);
  75. }')
  76. dnl
  77. d_RepStr(`d_RepStr(`d_ColorBlend(AA, BB)',
  78. `AA', `SrcOne_DestZero', `AllBlend')',
  79. `BB', `SrcCopy', `AllROP')