Source code of Windows XP (NT5)
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.

75 lines
2.4 KiB

  1. /*****************************************************************************\
  2. FILE: texture.h
  3. DESCRIPTION:
  4. Manage a texture for several instance for each monitor. Also manage keeping the
  5. ratio correct when it's not square when loaded.
  6. BryanSt 2/9/2000
  7. Copyright (C) Microsoft Corp 2000-2001. All rights reserved.
  8. \*****************************************************************************/
  9. #ifndef TEXTURE_H
  10. #define TEXTURE_H
  11. #include "util.h"
  12. #include "main.h"
  13. #include "config.h"
  14. extern int g_nTotalTexturesLoaded;
  15. extern int g_nTexturesRenderedInThisFrame;
  16. class CTexture : public IUnknown
  17. {
  18. public:
  19. //////////////////////////////////////////////////////
  20. // Public Interfaces
  21. //////////////////////////////////////////////////////
  22. // *** IUnknown ***
  23. virtual STDMETHODIMP QueryInterface(REFIID riid, LPVOID * ppvObj);
  24. virtual STDMETHODIMP_(ULONG) AddRef(void);
  25. virtual STDMETHODIMP_(ULONG) Release(void);
  26. // Member Functions
  27. IDirect3DTexture8 * GetTexture(float * pfScale = NULL);
  28. DWORD GetTextureWidth(void) {GetTexture(); return m_dxImageInfo.Width;}
  29. DWORD GetTextureHeight(void) {GetTexture(); return m_dxImageInfo.Height;}
  30. float GetScale(void) {GetTexture(); return m_fScale;}
  31. float GetSurfaceRatio(void) {GetTexture(); return 1.0f; /*(((float) m_dxImageInfo.Height) / ((float) m_dxImageInfo.Width));*/}
  32. BOOL IsLoadedInAnyDevice(void);
  33. BOOL IsLoadedForThisDevice(void);
  34. CTexture(CMSLogoDXScreenSaver * pMain, LPCTSTR pszPath, LPVOID pvBits, DWORD cbSize);
  35. CTexture(CMSLogoDXScreenSaver * pMain, LPCTSTR pszPath, LPCTSTR pszResource, float fScale);
  36. LPTSTR m_pszPath;
  37. private:
  38. // Helper Functions
  39. void _Init(CMSLogoDXScreenSaver * pMain);
  40. HRESULT _GetPictureInfo(HRESULT hr, LPTSTR pszString, DWORD cchSize);
  41. BOOL _DoesImageNeedClipping(int * pnNewWidth, int * pnNewHeight);
  42. virtual ~CTexture();
  43. // Private Member Variables
  44. long m_cRef;
  45. // Member Variables
  46. IDirect3DTexture8 * m_pTexture[10];
  47. LPTSTR m_pszResource;
  48. LPVOID m_pvBits; // The background thread will load the image into these bits. The forground thread needs to create the interface.
  49. DWORD m_cbSize; // The number of bytes in pvBits
  50. float m_fScale; // The scale value.
  51. D3DXIMAGE_INFO m_dxImageInfo;
  52. CMSLogoDXScreenSaver * m_pMain; // Weak reference
  53. };
  54. #endif // TEXTURE_H