home *** CD-ROM | disk | FTP | other *** search
/ MacHack 1999 / MacHack 1999.toast / The Hacks / OutOfContextMenus / Source / CDuplicateBehavior.cp < prev    next >
Encoding:
Text File  |  1999-06-25  |  1.5 KB  |  55 lines  |  [TEXT/CWIE]

  1. // ===========================================================================
  2. //    CDuplicateBehavior.cp                 ©1999 Eric Traut
  3. // ===========================================================================
  4.  
  5. #include "CDuplicateBehavior.h"
  6. #include "CShadowWindow.h"
  7.  
  8.  
  9. // ---------------------------------------------------------------------------
  10. //        • CNewCardBehavior
  11. // ---------------------------------------------------------------------------
  12.  
  13. CDuplicateBehavior::CDuplicateBehavior(
  14.     CShadowWindow &        inShadowWindow)
  15.     :    COffscreenBehavior(inShadowWindow, true)
  16. {
  17. }
  18.  
  19.  
  20. // ---------------------------------------------------------------------------
  21. //        • RenderToGWorld
  22. // ---------------------------------------------------------------------------
  23.  
  24. Boolean
  25. CDuplicateBehavior::RenderToGWorld(
  26.     StGWorldLocker &        inBackingLocker,
  27.     StGWorldLocker &        inRenderingLocker)
  28. {
  29.     // Split the blit into two halves.
  30.     Rect        destRect;
  31.     UInt32        gworldWidth = mGWorldRect.right - mGWorldRect.left;
  32.  
  33.     destRect = mGWorldRect;
  34.     destRect.right = destRect.left + (mGWorldRect.right - mGWorldRect.left) / 2;
  35.     ::CopyBits(    reinterpret_cast<BitMap *>(*inBackingLocker.GetPixMap()),
  36.                 reinterpret_cast<BitMap *>(*inRenderingLocker.GetPixMap()),
  37.                 &mGWorldRect,
  38.                 &destRect,
  39.                 srcCopy,
  40.                 NULL);
  41.  
  42.     ::OffsetRect(&destRect, (mGWorldRect.right - mGWorldRect.left) / 2, 0);
  43.     ::CopyBits(    reinterpret_cast<BitMap *>(*inBackingLocker.GetPixMap()),
  44.                 reinterpret_cast<BitMap *>(*inRenderingLocker.GetPixMap()),
  45.                 &mGWorldRect,
  46.                 &destRect,
  47.                 srcCopy,
  48.                 NULL);
  49.  
  50.     return true;
  51. }
  52.  
  53.  
  54.  
  55.