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.

86 lines
1.9 KiB

  1. /**************************************************************************
  2. *
  3. * Copyright (c) 2000 Microsoft Corporation
  4. *
  5. * Module Name:
  6. *
  7. * GpCachedBitmap object
  8. *
  9. *
  10. * Created:
  11. *
  12. * 04/23/2000 asecchia
  13. * Created it.
  14. *
  15. **************************************************************************/
  16. #ifndef _CACHEDBITMAP_HPP
  17. #define _CACHEDBITMAP_HPP
  18. class GpCachedBitmap
  19. {
  20. friend GpGraphics;
  21. // We now use an ObjectTag to determine if the object is valid
  22. // instead of using a BOOL. This is much more robust and helps
  23. // with debugging. It also enables us to version our objects
  24. // more easily with a version number in the ObjectTag.
  25. ObjectTag Tag; // Keep this as the 1st value in the object!
  26. GpLockable Lockable;
  27. DpCachedBitmap DeviceCachedBitmap;
  28. protected:
  29. VOID SetValid(BOOL valid)
  30. {
  31. Tag = valid ? ObjectCachedBitmap : ObjectTagInvalid;
  32. }
  33. public:
  34. // constructor and destructor
  35. GpCachedBitmap(GpBitmap *bitmap, GpGraphics *graphics);
  36. virtual ~GpCachedBitmap();
  37. // 'getter' state retrieval
  38. BOOL IsValid() const
  39. {
  40. #ifdef _X86_
  41. // We have to guarantee that the Tag field doesn't move for
  42. // versioning to work between releases of GDI+.
  43. ASSERT(offsetof(GpCachedBitmap, Tag) == 4);
  44. #endif
  45. ASSERT((Tag == ObjectCachedBitmap) || (Tag == ObjectTagInvalid));
  46. #if DBG
  47. if (Tag == ObjectTagInvalid)
  48. {
  49. WARNING1("Invalid CachedBitmap");
  50. }
  51. #endif
  52. return (Tag == ObjectCachedBitmap);
  53. }
  54. void GetSize(Size *s)
  55. {
  56. // Get the width and height from the DeviceCachedBitmap.
  57. s->Width = DeviceCachedBitmap.Width;
  58. s->Height = DeviceCachedBitmap.Height;
  59. }
  60. // Get the lock object
  61. GpLockable *GetObjectLock()
  62. {
  63. return &Lockable;
  64. }
  65. };
  66. #endif