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.

222 lines
7.3 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: bltrec.hxx
  3. *
  4. * This contains the data structures for the BLTREC data structure.
  5. *
  6. * Created: 02-Jun-1992 16:30:44
  7. * Author: Donald Sidoroff [donalds]
  8. *
  9. * Copyright (c) 1990-1999 Microsoft Corporation
  10. \**************************************************************************/
  11. #define AVEC_NEED_MASK 0x00010000
  12. #define BLTREC_PBO 0x00000001
  13. #define BLTREC_PXLO 0x00000002
  14. #define BLTREC_PRO 0x00000004
  15. #define BLTREC_MIRROR_X 0x00000008
  16. #define BLTREC_MIRROR_Y 0x00000010
  17. // This is set if we should pass the mask down to the call.
  18. #define BLTREC_MASK_NEEDED 0x00010000
  19. // This is set if we should unlock the mask at the end of the call.
  20. #define BLTREC_MASK_LOCKED 0x00020000
  21. class BLTRECORD
  22. {
  23. protected:
  24. BYTE ajxoTrg[sizeof(EXFORMOBJ)];
  25. BYTE ajxoSrc[sizeof(EXFORMOBJ)];
  26. BYTE ajpoTrg[sizeof(XEPALOBJ)];
  27. BYTE ajpoTrgDC[sizeof(XEPALOBJ)];
  28. BYTE ajpoSrc[sizeof(XEPALOBJ)];
  29. BYTE ajpoSrcDC[sizeof(XEPALOBJ)];
  30. SURFACE *pSurfTrg_;
  31. SURFACE *pSurfSrc_;
  32. SURFACE *pSurfMsk_;
  33. BYTE ajxlo[sizeof(EXLATEOBJ)];
  34. EBRUSHOBJ *pebo;
  35. BYTE ajro[sizeof(RGNMEMOBJ)];
  36. POINTFIX aptfxTrg[4];
  37. POINTL aptlTrg[3];
  38. POINTL aptlSrc[2];
  39. POINTL aptlMask[2];
  40. POINTL aptlBrush[1];
  41. ROP4 rop4;
  42. FLONG flState;
  43. int iLeft;
  44. int iTop;
  45. public:
  46. BLTRECORD() { flState = 0; }
  47. ~BLTRECORD()
  48. {
  49. if (flState & (BLTREC_PBO | BLTREC_MASK_LOCKED | BLTREC_PXLO | BLTREC_PRO))
  50. {
  51. if (flState & BLTREC_MASK_LOCKED)
  52. {
  53. pSurfMsk_->vAltUnlockFast();
  54. pSurfMsk_ = (SURFACE *) NULL;
  55. }
  56. if (flState & BLTREC_PXLO)
  57. ((EXLATEOBJ *) &ajxlo[0])->vAltUnlock();
  58. if (flState & BLTREC_PRO)
  59. ((RGNOBJ *) &ajro[0])->bDeleteRGNOBJ();
  60. }
  61. }
  62. EXFORMOBJ *pxoTrg() { return((EXFORMOBJ *) &ajxoTrg[0]); }
  63. EXFORMOBJ *pxoSrc() { return((EXFORMOBJ *) &ajxoSrc[0]); }
  64. XEPALOBJ *ppoTrg() { return((XEPALOBJ *) &ajpoTrg[0]); }
  65. XEPALOBJ *ppoTrgDC() { return((XEPALOBJ *) &ajpoTrgDC[0]); }
  66. XEPALOBJ *ppoSrc() { return((XEPALOBJ *) &ajpoSrc[0]); }
  67. XEPALOBJ *ppoSrcDC() { return((XEPALOBJ *) &ajpoSrcDC[0]); }
  68. SURFACE *pSurfTrg(SURFACE *pSurf) { return(pSurfTrg_ = pSurf); }
  69. SURFACE *pSurfSrc(SURFACE *pSurf) { return(pSurfSrc_ = pSurf); }
  70. SURFACE *pSurfMsk(SURFACE *pSurf) { return(pSurfMsk_ = pSurf); }
  71. SURFACE *pSurfTrg() { return(pSurfTrg_); }
  72. SURFACE *pSurfSrc() { return(pSurfSrc_); }
  73. SURFACE *pSurfMsk() { return(pSurfMsk_); }
  74. SURFACE *pSurfMskOut() { return((flState & BLTREC_MASK_NEEDED) ? pSurfMsk_ : ((SURFACE *) NULL)); }
  75. EXLATEOBJ *pexlo() { return((EXLATEOBJ *) &ajxlo[0]); }
  76. EBRUSHOBJ *pbo() { return(pebo); }
  77. EBRUSHOBJ *pbo(EBRUSHOBJ *_pbo) { return(pebo = _pbo); }
  78. RGNMEMOBJ *prmo() { return((RGNMEMOBJ *) &ajro[0]); }
  79. POINTFIX *pptfx() { return((POINTFIX *) &aptfxTrg[0]); }
  80. POINTL *pptlTrg() { return((POINTL *) &aptlTrg[0]); }
  81. POINTL *pptlSrc() { return((POINTL *) &aptlSrc[0]); }
  82. POINTL *pptlMask() { return((POINTL *) &aptlMask[0]); }
  83. POINTL *pptlBrush() { return((POINTL *) &aptlBrush[0]); }
  84. ERECTL *perclTrg() { return((ERECTL *) &aptlTrg[0]); }
  85. ERECTL *perclSrc() { return((ERECTL *) &aptlSrc[0]); }
  86. ERECTL *perclMask() { return((ERECTL *) &aptlMask[0]); }
  87. BOOL Trg(int x, int y, int cx, int cy)
  88. {
  89. aptlTrg[0].x = x;
  90. aptlTrg[0].y = y;
  91. aptlTrg[1].x = x + cx;
  92. aptlTrg[1].y = y + cy;
  93. return(((EXFORMOBJ *) &ajxoTrg[0])->bXform(aptlTrg, 2));
  94. }
  95. BOOL TrgPlg(int x, int y, int cx, int cy)
  96. {
  97. aptlTrg[0].x = x;
  98. aptlTrg[0].y = y;
  99. aptlTrg[1].x = x + cx;
  100. aptlTrg[1].y = y;
  101. aptlTrg[2].x = x;
  102. aptlTrg[2].y = y + cy;
  103. return(((EXFORMOBJ *) &ajxoTrg[0])->bXform(aptlTrg, aptfxTrg, 3));
  104. }
  105. BOOL TrgPlg(LPPOINT pptl)
  106. {
  107. return(((EXFORMOBJ *) &ajxoTrg[0])->bXform((POINTL *) pptl, aptfxTrg, 3));
  108. }
  109. BOOL Src(int x, int y, int cx, int cy)
  110. {
  111. aptlSrc[0].x = x;
  112. aptlSrc[0].y = y;
  113. aptlSrc[1].x = x + cx;
  114. aptlSrc[1].y = y + cy;
  115. return(((EXFORMOBJ *) &ajxoSrc[0])->bXform(aptlSrc, 2));
  116. }
  117. VOID Msk(int x, int y)
  118. {
  119. aptlMask[0].x = x;
  120. aptlMask[0].y = y;
  121. aptlMask[1].x = x + aptlSrc[1].x - aptlSrc[0].x;
  122. aptlMask[1].y = y + aptlSrc[1].y - aptlSrc[0].y;
  123. }
  124. BOOL Msk(int x, int y, int cx, int cy)
  125. {
  126. aptlMask[0].x = x;
  127. aptlMask[0].y = y;
  128. aptlSrc[0].x = 0;
  129. aptlSrc[0].y = 0;
  130. aptlSrc[1].x = cx;
  131. aptlSrc[1].y = cy;
  132. if (!((EXFORMOBJ *) &ajxoSrc[0])->bXform(aptlSrc, 2))
  133. return(FALSE);
  134. else
  135. {
  136. aptlMask[1].x = x + aptlSrc[1].x - aptlSrc[0].x;
  137. aptlMask[1].y = y + aptlSrc[1].y - aptlSrc[0].y;
  138. return(TRUE);
  139. }
  140. }
  141. VOID Brush(POINTL& ptl) { aptlBrush[0] = ptl; }
  142. ULONG rop() { return(rop4); }
  143. VOID rop(ROP4 r) { rop4 = r; }
  144. VOID flSet(FLONG fl) { flState |= fl;}
  145. FLONG flGet() { return(flState); }
  146. BOOL bEqualExtents()
  147. {
  148. return(((aptlSrc[1].x-aptlSrc[0].x) == (aptlTrg[1].x-aptlTrg[0].x)) &&
  149. ((aptlSrc[1].y-aptlSrc[0].y) == (aptlTrg[1].y-aptlTrg[0].y)));
  150. }
  151. VOID vOffset(EPOINTL& eptl)
  152. {
  153. aptfxTrg[0].x += FIX_FROM_LONG(eptl.x);
  154. aptfxTrg[0].y += FIX_FROM_LONG(eptl.y);
  155. aptfxTrg[1].x += FIX_FROM_LONG(eptl.x);
  156. aptfxTrg[1].y += FIX_FROM_LONG(eptl.y);
  157. aptfxTrg[2].x += FIX_FROM_LONG(eptl.x);
  158. aptfxTrg[2].y += FIX_FROM_LONG(eptl.y);
  159. aptfxTrg[3].x += FIX_FROM_LONG(eptl.x);
  160. aptfxTrg[3].y += FIX_FROM_LONG(eptl.y);
  161. }
  162. ULONG ropFore() { return(rop4 & 0x00ff); }
  163. ULONG ropBack() { return((rop4 >> 8) & 0x00ff); }
  164. VOID vExtrema();
  165. VOID vBound(ERECTL *);
  166. VOID vOrder(ERECTL *);
  167. VOID vOrderStupid(ERECTL *);
  168. VOID vOrderAmnesia(ERECTL *);
  169. VOID vMirror(ERECTL *percl);
  170. VOID vMirror(POINTFIX *pptfx);
  171. BOOL bCreateRegion(DCOBJ&, POINTFIX *pptfx);
  172. BOOL bRotated();
  173. BOOL bRotate(SURFMEM&, ULONG);
  174. BOOL bRotate(DCOBJ&, SURFMEM&, SURFMEM&, ULONG, ULONG);
  175. BOOL bRotate(DCOBJ&, DCOBJ&, ULONG, BYTE);
  176. BOOL bStretch(SURFMEM&, ULONG);
  177. BOOL bStretch(DCOBJ&, SURFMEM&, SURFMEM&, ULONG, ULONG);
  178. BOOL bStretch(DCOBJ&, DCOBJ&, ULONG, BYTE);
  179. BOOL bBitBlt(DCOBJ&, DCOBJ&, ULONG, LONG, LONG);
  180. BOOL bBitBlt(DCOBJ&, DCOBJ&, ULONG);
  181. };