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.

67 lines
1.4 KiB

  1. /**************************************************************************
  2. *
  3. * Copyright (c) 2000 Microsoft Corporation
  4. *
  5. * Module Name:
  6. *
  7. * VGA color hash table
  8. *
  9. * Abstract:
  10. *
  11. * This module maintains a hash table which holds the 20 VGA colors
  12. * (this includes the 4 which can be modified.)
  13. * The 8bpp halftone code, for example, needs to detect these colors
  14. * so that it doesn't halftone them.
  15. *
  16. * Created:
  17. *
  18. * 04/06/2000 agodfrey
  19. * Created it.
  20. *
  21. **************************************************************************/
  22. #ifndef _VGAHASH_HPP
  23. #define _VGAHASH_HPP
  24. #define VGA_HASH_BITS 7
  25. #define VGA_HASH_SIZE (1 << VGA_HASH_BITS)
  26. extern ARGB VgaColorHash[VGA_HASH_SIZE];
  27. VOID VGAHashRebuildTable(COLORREF *magicColors);
  28. /**************************************************************************
  29. *
  30. * Function Description:
  31. *
  32. * Hashes an RGB color
  33. *
  34. * Arguments:
  35. *
  36. * r, g, b - the red, green and blue components of the color
  37. *
  38. * Return Value:
  39. *
  40. * The hash table value
  41. *
  42. * Created:
  43. *
  44. * 04/06/2000 agodfrey
  45. * Created it.
  46. *
  47. **************************************************************************/
  48. __forceinline UINT
  49. VGAHashColor(
  50. UINT r,
  51. UINT g,
  52. UINT b
  53. )
  54. {
  55. UINT hashKey = (r >> 1) ^ (g >> 3) ^ (b >> 5);
  56. ASSERT(hashKey < VGA_HASH_SIZE);
  57. return hashKey;
  58. }
  59. #endif