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.

557 lines
21 KiB

  1. /******************************Module*Header**********************************\
  2. *
  3. * *******************
  4. * * DX SAMPLE CODE *
  5. * *******************
  6. *
  7. * Module Name: chroma.h
  8. *
  9. * Content: Chromakeying definitions and inline functions
  10. *
  11. * Copyright (c) 1994-1999 3Dlabs Inc. Ltd. All rights reserved.
  12. * Copyright (c) 1995-2003 Microsoft Corporation. All rights reserved.
  13. \*****************************************************************************/
  14. #ifdef __CHROMA
  15. #pragma message ("FILE : "__FILE__" : Multiple inclusion")
  16. #endif
  17. #define __CHROMA
  18. //-----------------------------------------------------------------------------
  19. //
  20. // In this module we define the
  21. //
  22. // Get8888ScaledChroma
  23. // Get8888ZeroExtendedChroma
  24. // inline functions used to do texture chroma keying correctly.
  25. //
  26. // All other macros defined in this module are for internal module consumption
  27. // only.
  28. //
  29. //-----------------------------------------------------------------------------
  30. // Get the components for each of the colors
  31. // Put the value into the top bits of a byte.
  32. #define GET_RED_332(a) (((a) & 0xE0))
  33. #define GET_GREEN_332(a) (((a) & 0x1C) << 3)
  34. #define GET_BLUE_332(a) (((a) & 0x03) << 6)
  35. #define GET_ALPHA_2321(a) (((a) & 0x80))
  36. #define GET_RED_2321(a) (((a) & 0x60) << 1)
  37. #define GET_GREEN_2321(a) (((a) & 0x1C) << 3)
  38. #define GET_BLUE_2321(a) (((a) & 0x03) << 6)
  39. #define GET_ALPHA_5551(a) (((a) & 0x8000) >> 8)
  40. #define GET_RED_5551(a) (((a) & 0x7C00) >> 7)
  41. #define GET_GREEN_5551(a) (((a) & 0x03E0) >> 2)
  42. #define GET_BLUE_5551(a) (((a) & 0x001F) << 3)
  43. #define GET_RED_565(a) (((a) & 0xF800) >> 8)
  44. #define GET_GREEN_565(a) (((a) & 0x07E0) >> 3)
  45. #define GET_BLUE_565(a) (((a) & 0x001F) << 3)
  46. #define GET_ALPHA_4444(a) (((a) & 0xF000) >> 8)
  47. #define GET_RED_4444(a) (((a) & 0x0F00) >> 4)
  48. #define GET_GREEN_4444(a) (((a) & 0x00F0))
  49. #define GET_BLUE_4444(a) (((a) & 0x000F) << 4)
  50. #define GET_ALPHA_8888(a) (((a) & 0xFF000000) >> 24)
  51. #define GET_RED_8888(a) (((a) & 0x00FF0000) >> 16)
  52. #define GET_GREEN_8888(a) (((a) & 0x0000FF00) >> 8)
  53. #define GET_BLUE_8888(a) (((a) & 0x000000FF))
  54. // These macros assume that the passed value (a) contains no more than the
  55. // designated number of bits set i.e. 11111000 not 1111101 for a 5 bit color
  56. // The macro scales the number to match the internal color conversion of
  57. // Permedia3.
  58. #define P3SCALE_1_BIT(a) (((a) & 0x80) ? 0xFF : 0x0)
  59. #define P3SCALE_2_BIT(a) ((a) | (((a) & 0xC0) >> 2) \
  60. | (((a) & 0xC0) >> 4) \
  61. | (((a) & 0xC0) >> 6))
  62. #define P3SCALE_3_BIT(a) ((a) | (((a) & 0xE0) >> 3) | (((a) & 0xC0) >> 6))
  63. #define P3SCALE_4_BIT(a) ((a) | (((a) & 0xF0) >> 4))
  64. #define P3SCALE_5_BIT(a) ((a) | (((a) & 0xE0) >> 5))
  65. #define P3SCALE_6_BIT(a) ((a) | (((a) & 0xC0) >> 6))
  66. #define P3SCALE_7_BIT(a) ((a) | (((a) & 0x80) >> 7))
  67. #define P3SCALE_8_BIT(a) ((a))
  68. #define P3REG_PLACE_RED(a) ((a))
  69. #define P3REG_PLACE_GREEN(a) ((a) << 8)
  70. #define P3REG_PLACE_BLUE(a) ((a) << 16)
  71. #define P3REG_PLACE_ALPHA(a) ((a) << 24)
  72. // The scaling versions.
  73. #define GEN_332_KEY(a) (P3REG_PLACE_RED (P3SCALE_3_BIT(GET_RED_332 (a))) | \
  74. P3REG_PLACE_GREEN(P3SCALE_3_BIT(GET_GREEN_332(a))) | \
  75. P3REG_PLACE_BLUE (P3SCALE_2_BIT(GET_BLUE_332 (a))))
  76. #define GEN_2321_KEY(a) (P3REG_PLACE_ALPHA(P3SCALE_1_BIT(GET_ALPHA_2321(a))) | \
  77. P3REG_PLACE_RED (P3SCALE_2_BIT(GET_RED_2321 (a))) | \
  78. P3REG_PLACE_GREEN(P3SCALE_3_BIT(GET_GREEN_2321(a))) | \
  79. P3REG_PLACE_BLUE (P3SCALE_2_BIT(GET_BLUE_2321 (a))))
  80. #define GEN_5551_KEY(a) (P3REG_PLACE_ALPHA(P3SCALE_1_BIT(GET_ALPHA_5551(a))) | \
  81. P3REG_PLACE_RED (P3SCALE_5_BIT(GET_RED_5551 (a))) | \
  82. P3REG_PLACE_GREEN(P3SCALE_5_BIT(GET_GREEN_5551(a))) | \
  83. P3REG_PLACE_BLUE (P3SCALE_5_BIT(GET_BLUE_5551 (a))))
  84. #define GEN_565_KEY(a) (P3REG_PLACE_RED (P3SCALE_5_BIT(GET_RED_565 (a))) | \
  85. P3REG_PLACE_GREEN(P3SCALE_6_BIT(GET_GREEN_565(a))) | \
  86. P3REG_PLACE_BLUE (P3SCALE_5_BIT(GET_BLUE_565 (a))))
  87. #define GEN_4444_KEY(a) (P3REG_PLACE_ALPHA(P3SCALE_4_BIT(GET_ALPHA_4444(a))) | \
  88. P3REG_PLACE_RED (P3SCALE_4_BIT(GET_RED_4444 (a))) | \
  89. P3REG_PLACE_GREEN(P3SCALE_4_BIT(GET_GREEN_4444(a))) | \
  90. P3REG_PLACE_BLUE (P3SCALE_4_BIT(GET_BLUE_4444 (a))))
  91. #define GEN_8888_KEY(a) (P3REG_PLACE_ALPHA(P3SCALE_8_BIT(GET_ALPHA_8888(a))) | \
  92. P3REG_PLACE_RED (P3SCALE_8_BIT(GET_RED_8888 (a))) | \
  93. P3REG_PLACE_GREEN(P3SCALE_8_BIT(GET_GREEN_8888(a))) | \
  94. P3REG_PLACE_BLUE (P3SCALE_8_BIT(GET_BLUE_8888 (a))))
  95. // The shifting versions.
  96. #define GEN_332_SKEY(a) (P3REG_PLACE_RED (GET_RED_332 (a)) | \
  97. P3REG_PLACE_GREEN(GET_GREEN_332(a)) | \
  98. P3REG_PLACE_BLUE (GET_BLUE_332 (a)))
  99. #define GEN_2321_SKEY(a) (P3REG_PLACE_ALPHA(GET_ALPHA_2321(a)) | \
  100. P3REG_PLACE_RED (GET_RED_2321 (a)) | \
  101. P3REG_PLACE_GREEN(GET_GREEN_2321(a)) | \
  102. P3REG_PLACE_BLUE (GET_BLUE_2321 (a)))
  103. #define GEN_5551_SKEY(a) (P3REG_PLACE_ALPHA(GET_ALPHA_5551(a)) | \
  104. P3REG_PLACE_RED (GET_RED_5551 (a)) | \
  105. P3REG_PLACE_GREEN(GET_GREEN_5551(a)) | \
  106. P3REG_PLACE_BLUE (GET_BLUE_5551 (a)))
  107. #define GEN_565_SKEY(a) (P3REG_PLACE_RED (GET_RED_565 (a)) | \
  108. P3REG_PLACE_GREEN(GET_GREEN_565(a)) | \
  109. P3REG_PLACE_BLUE (GET_BLUE_565 (a)))
  110. #define GEN_4444_SKEY(a) (P3REG_PLACE_ALPHA(GET_ALPHA_4444(a)) | \
  111. P3REG_PLACE_RED (GET_RED_4444 (a)) | \
  112. P3REG_PLACE_GREEN(GET_GREEN_4444(a)) | \
  113. P3REG_PLACE_BLUE (GET_BLUE_4444 (a)))
  114. // The luminance versions
  115. #define GEN_L8_KEY(a) (P3REG_PLACE_ALPHA(0xFF) | \
  116. P3REG_PLACE_RED (GET_BLUE_8888 (a)) | \
  117. P3REG_PLACE_GREEN(GET_BLUE_8888 (a)) | \
  118. P3REG_PLACE_BLUE (GET_BLUE_8888 (a)))
  119. #define GEN_A8L8_KEY(a) (P3REG_PLACE_ALPHA(GET_GREEN_8888 (a)) | \
  120. P3REG_PLACE_RED (GET_BLUE_8888 (a)) | \
  121. P3REG_PLACE_GREEN(GET_BLUE_8888 (a)) | \
  122. P3REG_PLACE_BLUE (GET_BLUE_8888 (a)))
  123. #define GEN_A4L4_KEY(a) (P3REG_PLACE_ALPHA(P3SCALE_4_BIT(GET_GREEN_4444 (a))) | \
  124. P3REG_PLACE_RED (P3SCALE_4_BIT(GET_BLUE_4444 (a))) | \
  125. P3REG_PLACE_GREEN(P3SCALE_4_BIT(GET_BLUE_4444 (a))) | \
  126. P3REG_PLACE_BLUE (P3SCALE_4_BIT(GET_BLUE_4444 (a))))
  127. //Note: No GEN_8888_SKEY - no difference in functionality.
  128. //-----------------------------------------------------------------------------
  129. //
  130. // __inline Get8888ScaledChroma
  131. //
  132. // Convert a FB Format color to a colorkey value. The value produced exactly
  133. // matches the value that the chip will read in from the Framebuffer (it will
  134. // scale the color into it's internal 8888 format). Non-null pPalEntries
  135. // indicates that color index should be converted to RGB{A} value. bUsePalAlpha
  136. // indicates whether Alpha channel of the palette should be used. bShift makes
  137. // the conversion use a shift instead of a scale, to match the shift option in
  138. // the P3.
  139. //
  140. //-----------------------------------------------------------------------------
  141. static __inline
  142. void
  143. Get8888ScaledChroma(
  144. P3_THUNKEDDATA* pThisDisplay,
  145. DWORD dwSurfFlags,
  146. DDPIXELFORMAT* pSurfPixFormat,
  147. DWORD InLowerBound,
  148. DWORD InUpperBound,
  149. DWORD* OutLowerBound,
  150. DWORD* OutUpperBound,
  151. DWORD* pPalEntries,
  152. BOOL bUsePalAlpha,
  153. BOOL bShift)
  154. {
  155. DDPIXELFORMAT* pPixFormat;
  156. DISPDBG((DBGLVL, "InLowerBound = 0x%08X", InLowerBound));
  157. DISPDBG((DBGLVL, "InUpperBound = 0x%08X", InUpperBound));
  158. // Get a pointer to the pixelformat data (not guaranteed to exist.
  159. // If it doesn't, we use the same format as the display.
  160. if (DDSurf_HasPixelFormat(dwSurfFlags))
  161. {
  162. pPixFormat = pSurfPixFormat;
  163. }
  164. else
  165. {
  166. pPixFormat = &pThisDisplay->ddpfDisplay;
  167. }
  168. // Is the texture palette indexed?
  169. if (pPixFormat->dwFlags & DDPF_PALETTEINDEXED4 ||
  170. pPixFormat->dwFlags & DDPF_PALETTEINDEXED8)
  171. {
  172. // Are we doing a lookup through the LUT? We won't be during a blit
  173. if (! pPalEntries)
  174. {
  175. *OutLowerBound =
  176. CHROMA_LOWER_ALPHA(FORMAT_PALETTE_32BIT(InLowerBound));
  177. *OutUpperBound =
  178. CHROMA_UPPER_ALPHA(FORMAT_PALETTE_32BIT(InUpperBound));
  179. DISPDBG((DBGLVL,"Keying of index: %d", InLowerBound));
  180. }
  181. else
  182. {
  183. DWORD dwTrueColor;
  184. // ChromaKeying for paletted textures is done on the looked up
  185. // color, not the index. This means using a range is meaningless
  186. // and we have to lookup the color from the palette. Make sure
  187. // the user doesn't force us to access invalid memory.
  188. dwTrueColor = pPalEntries[(InLowerBound & 0xFF)];
  189. DISPDBG((DBGLVL,
  190. "Texture lookup index: %d, ChromaColor: 0x%x",
  191. InLowerBound, dwTrueColor));
  192. if (bUsePalAlpha)
  193. {
  194. *OutLowerBound = dwTrueColor;
  195. *OutUpperBound = dwTrueColor;
  196. }
  197. else
  198. {
  199. // Alpha channel of LUT will be set to FF
  200. *OutLowerBound = CHROMA_LOWER_ALPHA(dwTrueColor);
  201. *OutUpperBound = CHROMA_UPPER_ALPHA(dwTrueColor);
  202. }
  203. }
  204. return;
  205. }
  206. // Texture is RGB format
  207. if (pPixFormat->dwFlags & DDPF_RGB)
  208. {
  209. DWORD RedMask = pPixFormat->dwRBitMask;
  210. DWORD AlphaMask = pPixFormat->dwRGBAlphaBitMask;
  211. switch (pPixFormat->dwRGBBitCount)
  212. {
  213. // 8 Bit RGB Textures
  214. case 8:
  215. if (RedMask == 0xE0)
  216. {
  217. DISPDBG((DBGLVL," 3:3:2"));
  218. // Never any alpha
  219. if ( bShift )
  220. {
  221. *OutLowerBound =
  222. CHROMA_LOWER_ALPHA(GEN_332_SKEY(InLowerBound));
  223. *OutUpperBound =
  224. CHROMA_UPPER_ALPHA(GEN_332_SKEY(InUpperBound));
  225. }
  226. else
  227. {
  228. *OutLowerBound =
  229. CHROMA_LOWER_ALPHA(GEN_332_KEY(InLowerBound));
  230. *OutUpperBound =
  231. CHROMA_UPPER_ALPHA(GEN_332_KEY(InUpperBound));
  232. }
  233. }
  234. else
  235. {
  236. DISPDBG((DBGLVL," 1:2:3:2"));
  237. if ( bShift )
  238. {
  239. *OutLowerBound = GEN_2321_SKEY(InLowerBound);
  240. *OutUpperBound = GEN_2321_SKEY(InUpperBound);
  241. }
  242. else
  243. {
  244. *OutLowerBound = GEN_2321_KEY(InLowerBound);
  245. *OutUpperBound = GEN_2321_KEY(InUpperBound);
  246. }
  247. if (!AlphaMask)
  248. {
  249. *OutLowerBound = CHROMA_LOWER_ALPHA(*OutLowerBound);
  250. *OutUpperBound = CHROMA_UPPER_ALPHA(*OutUpperBound);
  251. }
  252. }
  253. break;
  254. // 16 Bit RGB Textures
  255. case 16:
  256. switch (RedMask)
  257. {
  258. case 0xf00:
  259. DISPDBG((DBGLVL," 4:4:4:4"));
  260. if ( bShift )
  261. {
  262. *OutLowerBound = GEN_4444_SKEY(InLowerBound);
  263. *OutUpperBound = GEN_4444_SKEY(InUpperBound);
  264. }
  265. else
  266. {
  267. *OutLowerBound = GEN_4444_KEY(InLowerBound);
  268. *OutUpperBound = GEN_4444_KEY(InUpperBound);
  269. }
  270. break;
  271. case 0x7c00:
  272. DISPDBG((DBGLVL," 1:5:5:5"));
  273. if ( bShift )
  274. {
  275. *OutLowerBound = GEN_5551_SKEY(InLowerBound);
  276. *OutUpperBound = GEN_5551_SKEY(InUpperBound);
  277. }
  278. else
  279. {
  280. *OutLowerBound = GEN_5551_KEY(InLowerBound);
  281. *OutUpperBound = GEN_5551_KEY(InUpperBound);
  282. }
  283. if (!AlphaMask)
  284. {
  285. *OutLowerBound = CHROMA_LOWER_ALPHA(*OutLowerBound);
  286. *OutUpperBound = CHROMA_UPPER_ALPHA(*OutUpperBound);
  287. }
  288. break;
  289. default:
  290. // Always supply full range of alpha values to ensure test
  291. // is done
  292. DISPDBG((DBGLVL," 5:6:5"));
  293. if ( bShift )
  294. {
  295. *OutLowerBound =
  296. CHROMA_LOWER_ALPHA(GEN_565_SKEY(InLowerBound));
  297. *OutUpperBound =
  298. CHROMA_UPPER_ALPHA(GEN_565_SKEY(InUpperBound));
  299. }
  300. else
  301. {
  302. *OutLowerBound =
  303. CHROMA_LOWER_ALPHA(GEN_565_KEY(InLowerBound));
  304. *OutUpperBound =
  305. CHROMA_UPPER_ALPHA(GEN_565_KEY(InUpperBound));
  306. }
  307. break;
  308. } // switch (RedMask)
  309. break;
  310. // 32/24 Bit RGB Textures
  311. case 24:
  312. case 32:
  313. DISPDBG((DBGLVL," 8:8:8:8"));
  314. // If the surface isn't alpha'd then set a valid
  315. // range of alpha to catch all cases.
  316. // No change in behavior for shifting or scaling.
  317. if (!AlphaMask)
  318. {
  319. *OutLowerBound = CHROMA_LOWER_ALPHA(GEN_8888_KEY(InLowerBound));
  320. *OutUpperBound = CHROMA_UPPER_ALPHA(GEN_8888_KEY(InUpperBound));
  321. }
  322. else
  323. {
  324. *OutLowerBound = GEN_8888_KEY(InLowerBound);
  325. *OutUpperBound = GEN_8888_KEY(InUpperBound);
  326. }
  327. break;
  328. } // switch (pPixFormat->dwRGBBitCount)
  329. DISPDBG((DBGLVL, "OutLowerBound = 0x%08X", *OutLowerBound));
  330. DISPDBG((DBGLVL, "OutUpperBound = 0x%08X", *OutUpperBound));
  331. }
  332. // luminance formats
  333. else if (pPixFormat->dwFlags & DDPF_LUMINANCE)
  334. {
  335. if (pPixFormat->dwFlags & DDPF_ALPHAPIXELS)
  336. {
  337. if (pPixFormat->dwLuminanceBitCount == 16)
  338. {
  339. // 16 bit A8L8
  340. *OutLowerBound = GEN_A8L8_KEY(InLowerBound);
  341. *OutUpperBound = GEN_A8L8_KEY(InUpperBound);
  342. }
  343. else
  344. {
  345. // 8 Bit A4L4
  346. *OutLowerBound = GEN_A4L4_KEY(InLowerBound);
  347. *OutUpperBound = GEN_A4L4_KEY(InUpperBound);
  348. }
  349. }
  350. else
  351. {
  352. // 8 Bit L8
  353. *OutLowerBound = GEN_L8_KEY(InLowerBound);
  354. *OutUpperBound = GEN_L8_KEY(InUpperBound);
  355. }
  356. }
  357. //@@BEGIN_DDKSPLIT
  358. //AZN - just keep in case we find an app requiring this (Legoland???)
  359. #if 0
  360. if ( TEST_BUGFIX_FLAG ( IGNORE_CK_ALPHA ) )
  361. {
  362. // Fix it up for games that don't realise that they
  363. // need to set up the alpha-channel of the chromakey
  364. // values appropriately.
  365. *OutLowerBound = CHROMA_LOWER_ALPHA(*OutLowerBound);
  366. *OutUpperBound = CHROMA_UPPER_ALPHA(*OutUpperBound);
  367. }
  368. #endif
  369. //@@END_DDKSPLIT
  370. } // Get8888ScaledChroma
  371. //-----------------------------------------------------------------------------
  372. //
  373. // __inline Get8888ZeroExtendedChroma
  374. //
  375. //-----------------------------------------------------------------------------
  376. __inline void
  377. Get8888ZeroExtendedChroma(
  378. P3_THUNKEDDATA* pThisDisplay,
  379. DWORD dwSurfFlags,
  380. DDPIXELFORMAT* pSurfPixFormat,
  381. DWORD LowerBound,
  382. DWORD UpperBound,
  383. DWORD* OutLowerBound,
  384. DWORD* OutUpperBound)
  385. {
  386. DDPIXELFORMAT* pPixFormat;
  387. DWORD InLowerBound = LowerBound;
  388. DWORD InUpperBound = UpperBound;
  389. DISPDBG((DBGLVL, "InLowerBound = 0x%08X", InLowerBound));
  390. DISPDBG((DBGLVL, "InUpperBound = 0x%08X", InUpperBound));
  391. // Get a pointer to the pixelformat data (not guaranteed to exist.
  392. // If it doesn't, we use the same format as the display.
  393. if (DDSurf_HasPixelFormat(dwSurfFlags))
  394. {
  395. pPixFormat = pSurfPixFormat;
  396. }
  397. else
  398. {
  399. pPixFormat = &pThisDisplay->ddpfDisplay;
  400. }
  401. {
  402. DWORD RedMask = pPixFormat->dwRBitMask;
  403. DWORD AlphaMask = pPixFormat->dwRGBAlphaBitMask;
  404. switch (pPixFormat->dwRGBBitCount)
  405. {
  406. // 8 Bit RGB Textures
  407. case 8:
  408. if (RedMask == 0xE0)
  409. {
  410. // Never any alpha
  411. *OutLowerBound =
  412. CHROMA_LOWER_ALPHA(FORMAT_332_32BIT_ZEROEXTEND(InLowerBound));
  413. *OutUpperBound =
  414. CHROMA_UPPER_ALPHA(FORMAT_332_32BIT_ZEROEXTEND(InUpperBound));
  415. }
  416. else
  417. {
  418. *OutLowerBound = FORMAT_2321_32BIT_ZEROEXTEND(InLowerBound);
  419. *OutUpperBound = FORMAT_2321_32BIT_ZEROEXTEND(InUpperBound);
  420. if (!AlphaMask)
  421. {
  422. *OutLowerBound = CHROMA_LOWER_ALPHA(*OutLowerBound);
  423. *OutUpperBound = CHROMA_UPPER_ALPHA(*OutUpperBound);
  424. }
  425. }
  426. break;
  427. // 16 Bit RGB Textures
  428. case 16:
  429. switch (RedMask)
  430. {
  431. case 0xf00:
  432. *OutLowerBound = (FORMAT_4444_32BIT_ZEROEXTEND(InLowerBound));
  433. *OutUpperBound = (FORMAT_4444_32BIT_ZEROEXTEND(InUpperBound));
  434. break;
  435. case 0x7c00:
  436. *OutLowerBound = FORMAT_5551_32BIT_ZEROEXTEND(InLowerBound);
  437. *OutUpperBound = FORMAT_5551_32BIT_ZEROEXTEND(InUpperBound);
  438. if (!AlphaMask)
  439. {
  440. *OutLowerBound = CHROMA_LOWER_ALPHA(*OutLowerBound);
  441. *OutUpperBound = CHROMA_UPPER_ALPHA(*OutUpperBound);
  442. }
  443. break;
  444. default:
  445. // Always supply full range of alpha values to ensure test
  446. // is done
  447. *OutLowerBound =
  448. CHROMA_LOWER_ALPHA(FORMAT_565_32BIT_ZEROEXTEND(InLowerBound));
  449. *OutUpperBound =
  450. CHROMA_UPPER_ALPHA(FORMAT_565_32BIT_ZEROEXTEND(InUpperBound));
  451. break;
  452. }
  453. break;
  454. // 32/24 Bit RGB Textures
  455. case 24:
  456. case 32:
  457. // If the surface isn't alpha'd then set a valid
  458. // range of alpha to catch all cases.
  459. if (!AlphaMask)
  460. {
  461. *OutLowerBound =
  462. CHROMA_LOWER_ALPHA(FORMAT_8888_32BIT_BGR(InLowerBound));
  463. *OutUpperBound =
  464. CHROMA_UPPER_ALPHA(FORMAT_8888_32BIT_BGR(InUpperBound));
  465. }
  466. else
  467. {
  468. *OutLowerBound = FORMAT_8888_32BIT_BGR(InLowerBound);
  469. *OutUpperBound = FORMAT_8888_32BIT_BGR(InUpperBound);
  470. }
  471. break;
  472. } // switch (pPixFormat->dwRGBBitCount)
  473. DISPDBG((DBGLVL, "OutLowerBound = 0x%08X", *OutLowerBound));
  474. DISPDBG((DBGLVL, "OutUpperBound = 0x%08X", *OutUpperBound));
  475. }
  476. //@@BEGIN_DDKSPLIT
  477. //AZN - just keep in case we find an app requiring this (Legoland???)
  478. #if 0
  479. if ( TEST_BUGFIX_FLAG ( IGNORE_CK_ALPHA ) )
  480. {
  481. // Fix it up for games that don't realise that they
  482. // need to set up the alpha-channel of the chromakey
  483. // values appropriately.
  484. *OutLowerBound = CHROMA_LOWER_ALPHA(*OutLowerBound);
  485. *OutUpperBound = CHROMA_UPPER_ALPHA(*OutUpperBound);
  486. }
  487. #endif
  488. //@@END_DDKSPLIT
  489. } // Get8888ZeroExtendedChroma