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.

48 lines
1.4 KiB

  1. //---------------------------------------------------------------------------
  2. // Cache.h - implements the CRenderCache object
  3. //---------------------------------------------------------------------------
  4. #pragma once
  5. //---------------------------------------------------------------------------
  6. #include "Render.h"
  7. //---------------------------------------------------------------------------
  8. struct BITMAPENTRY // for bitmap cache
  9. {
  10. int iDibOffset;
  11. HBITMAP hBitmap;
  12. //int iRefCount;
  13. };
  14. //---------------------------------------------------------------------------
  15. class CRenderCache
  16. {
  17. public:
  18. CRenderCache(CRenderObj *pRender, __int64 iUniqueId);
  19. ~CRenderCache();
  20. public:
  21. HRESULT GetBitmap(int iDibOffset, OUT HBITMAP *pBitmap);
  22. HRESULT AddBitmap(int iDibOffset, HBITMAP hBitmap);
  23. void ReturnBitmap(HBITMAP hBitmap);
  24. HRESULT GetScaledFontHandle(HDC hdc, LOGFONT *plf, HFONT *phFont);
  25. void ReturnFontHandle(HFONT hFont);
  26. BOOL ValidateObj();
  27. public:
  28. //---- data ----
  29. char _szHead[8];
  30. CRenderObj *_pRenderObj;
  31. __int64 _iUniqueId;
  32. protected:
  33. //---- bitmap cache ----
  34. CSimpleArray<BITMAPENTRY> _BitmapCache;
  35. //---- font cache -----
  36. HFONT _hFont;
  37. LOGFONT *_plfFont; // just keep ptr to it in shared memory
  38. char _szTail[4];
  39. };
  40. //---------------------------------------------------------------------------