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.

122 lines
3.5 KiB

  1. //-----------------------------------------------------------------------------
  2. //
  3. // This file contains the output buffer color reading routines for Blending.
  4. //
  5. // Copyright (C) Microsoft Corporation, 1997.
  6. //
  7. //-----------------------------------------------------------------------------
  8. #include "pch.cpp"
  9. #pragma hdrstop
  10. #include "mbufread.h"
  11. // Names are read LSB to MSB, so B5G6R5 means five bits of blue starting
  12. // at the LSB, then six bits of green, then five bits of red.
  13. //-----------------------------------------------------------------------------
  14. //
  15. // Read_B8G8R8
  16. //
  17. // Reads output buffer in BGR-888 format.
  18. //
  19. //-----------------------------------------------------------------------------
  20. D3DCOLOR CMMX_BufRead_B8G8R8(PUINT8 pBits)
  21. {
  22. return (*pBits | (*(pBits+1))<<8 | (*(pBits+2))<<16 | 0xff000000);
  23. }
  24. //-----------------------------------------------------------------------------
  25. //
  26. // Read_B8G8R8X8
  27. //
  28. // Reads output buffer in BGR-888x format.
  29. //
  30. //-----------------------------------------------------------------------------
  31. D3DCOLOR CMMX_BufRead_B8G8R8X8(PUINT8 pBits)
  32. {
  33. PUINT32 pSurface = (PUINT32)pBits;
  34. return *pSurface | 0xff000000;
  35. }
  36. //-----------------------------------------------------------------------------
  37. //
  38. // Read_B8G8R8A8
  39. //
  40. // Reads output in BGRA-8888 format.
  41. //
  42. //-----------------------------------------------------------------------------
  43. D3DCOLOR CMMX_BufRead_B8G8R8A8(PUINT8 pBits)
  44. {
  45. PUINT32 pSurface = (PUINT32)pBits;
  46. return *pSurface;
  47. }
  48. //-----------------------------------------------------------------------------
  49. //
  50. // Read_B5G6R5
  51. //
  52. // Reads output in BGR-565 format.
  53. //
  54. //-----------------------------------------------------------------------------
  55. D3DCOLOR CMMX_BufRead_B5G6R5(PUINT8 pBits)
  56. {
  57. UINT16 uPixel = *(PUINT16)pBits;
  58. D3DCOLOR Color = RGBA_MAKE(( uPixel >> 8 ) & 0xf8,
  59. (( uPixel >> 3) & 0xfc ),
  60. (( uPixel << 3) & 0xf8 ),
  61. 0xff);
  62. return Color;
  63. }
  64. //-----------------------------------------------------------------------------
  65. //
  66. // Read_B5G5R5
  67. //
  68. // Reads output in BGR-555 format.
  69. //
  70. //-----------------------------------------------------------------------------
  71. D3DCOLOR CMMX_BufRead_B5G5R5(PUINT8 pBits)
  72. {
  73. UINT16 uPixel = *(PUINT16)pBits;
  74. D3DCOLOR Color = RGBA_MAKE(( uPixel >> 7 ) & 0xf8,
  75. (( uPixel >> 2) & 0xf8 ),
  76. (( uPixel << 3) & 0xf8 ),
  77. 0xff);
  78. return Color;
  79. }
  80. //-----------------------------------------------------------------------------
  81. //
  82. // Read_B5G5R5A1
  83. //
  84. // Reads output in BGRA-1555 format.
  85. //
  86. //-----------------------------------------------------------------------------
  87. D3DCOLOR CMMX_BufRead_B5G5R5A1(PUINT8 pBits)
  88. {
  89. UINT16 iPixel = *(PINT16)pBits;
  90. D3DCOLOR Color = RGBA_MAKE(( iPixel >> 7 ) & 0xf8,
  91. (( iPixel >> 2) & 0xf8 ),
  92. (( iPixel << 3) & 0xf8 ),
  93. (iPixel >> 15) & 0xff);
  94. return Color;
  95. }
  96. //-----------------------------------------------------------------------------
  97. //
  98. // Read_Palette8
  99. //
  100. // Reads output in Palette8 format.
  101. //
  102. //-----------------------------------------------------------------------------
  103. D3DCOLOR CMMX_BufRead_Palette8(PUINT8 pBits)
  104. {
  105. // ATTENTION - This is not correct. But We assume Palette8 format will
  106. // normally not be used for alpha blending.
  107. return (D3DCOLOR)0;
  108. }