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.

89 lines
2.1 KiB

  1. /*==========================================================================;
  2. *
  3. * Copyright (C) 1998 Microsoft Corporation. All Rights Reserved.
  4. *
  5. * File: surfiter.hpp
  6. * Content: Utility iterator classes for cubemaps and mipmaps
  7. *
  8. ***************************************************************************/
  9. #ifndef _SURFITER_HPP_
  10. #define _SURFITER_HPP_
  11. /* Mipmap iterator utility class */
  12. class CMipmapIter
  13. {
  14. // Private Data
  15. LPDDRAWI_DDRAWSURFACE_LCL m_currlcl;
  16. // Public Members
  17. public:
  18. // Construct and Destroy
  19. CMipmapIter(LPDDRAWI_DDRAWSURFACE_LCL lpLcl) : m_currlcl(lpLcl) {}
  20. // Modifiers
  21. inline void operator++();
  22. // Accessors
  23. operator const void* () const { return m_currlcl; }
  24. LPDDRAWI_DDRAWSURFACE_LCL operator()() const { return m_currlcl; }
  25. };
  26. inline void CMipmapIter::operator++()
  27. {
  28. LPATTACHLIST al = m_currlcl->lpAttachList;
  29. while(al != NULL)
  30. {
  31. if(al->lpAttached->lpSurfMore->ddsCapsEx.dwCaps2 & DDSCAPS2_MIPMAPSUBLEVEL)
  32. {
  33. m_currlcl = al->lpAttached;
  34. return;
  35. }
  36. al = al->lpLink;
  37. }
  38. m_currlcl = 0;
  39. }
  40. /* Cubemap iterator utility class */
  41. class CCubemapIter
  42. {
  43. // Private Data
  44. LPDDRAWI_DDRAWSURFACE_LCL m_currlcl;
  45. LPATTACHLIST m_al;
  46. // Public Members
  47. public:
  48. // Construct and Destroy
  49. CCubemapIter(LPDDRAWI_DDRAWSURFACE_LCL lpLcl) : m_currlcl(lpLcl), m_al(lpLcl->lpAttachList) {}
  50. // Modifiers
  51. inline void operator++();
  52. // Accessors
  53. operator const void* () const { return m_currlcl; }
  54. LPDDRAWI_DDRAWSURFACE_LCL operator()() const { return m_currlcl; }
  55. };
  56. inline void CCubemapIter::operator++()
  57. {
  58. while(m_al != NULL)
  59. {
  60. DWORD &caps2 = m_al->lpAttached->lpSurfMore->ddsCapsEx.dwCaps2;
  61. if((caps2 & DDSCAPS2_CUBEMAP_ALLFACES) && !(caps2 & DDSCAPS2_MIPMAPSUBLEVEL))
  62. {
  63. m_currlcl = m_al->lpAttached;
  64. m_al = m_al->lpLink;
  65. return;
  66. }
  67. m_al = m_al->lpLink;
  68. }
  69. m_currlcl = 0;
  70. }
  71. #endif