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.

208 lines
5.3 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: draw.c
  3. *
  4. * The drawing guts of a portable 16-colour VGA driver for Windows NT. The
  5. * implementation herein may possibly be the simplest method of bringing
  6. * up a driver whose surface is not directly writable by GDI. One might
  7. * use the phrase "quick and dirty" when describing it.
  8. *
  9. * We create a 4bpp bitmap that is the size of the screen, and simply
  10. * have GDI do all the drawing to it. We update the screen directly
  11. * from the bitmap, based on the bounds of the drawing (basically
  12. * employing "dirty rectangles").
  13. *
  14. * In total, the only hardware-specific code we had to write was the
  15. * initialization code, and a routine for doing aligned srccopy blts
  16. * from a DIB to the screen.
  17. *
  18. * Obvious Note: This approach is definitely not recommended if you want
  19. * to get decent performance.
  20. *
  21. * Copyright (c) 1994-1995 Microsoft Corporation
  22. \**************************************************************************/
  23. #include "precomp.h"
  24. /******************************Public*Routine******************************\
  25. * DrvStrokePath
  26. *
  27. \**************************************************************************/
  28. BOOL DrvStrokePath(
  29. SURFOBJ* pso,
  30. PATHOBJ* ppo,
  31. CLIPOBJ* pco,
  32. XFORMOBJ* pxo,
  33. BRUSHOBJ* pbo,
  34. POINTL* pptlBrush,
  35. LINEATTRS* pla,
  36. MIX mix)
  37. {
  38. BOOL b;
  39. PDEV* ppdev;
  40. RECTFX rcfxBounds;
  41. RECTL rclBounds;
  42. ppdev = (PDEV*) pso->dhpdev;
  43. b = EngStrokePath(ppdev->pso, ppo, pco, pxo, pbo, pptlBrush, pla, mix);
  44. // Get the path bounds and make it lower-right exclusive:
  45. PATHOBJ_vGetBounds(ppo, &rcfxBounds);
  46. rclBounds.left = (rcfxBounds.xLeft >> 4);
  47. rclBounds.top = (rcfxBounds.yTop >> 4);
  48. rclBounds.right = (rcfxBounds.xRight >> 4) + 2;
  49. rclBounds.bottom = (rcfxBounds.yBottom >> 4) + 2;
  50. // Don't update the screen if we're currently showing an 'off-screen'
  51. // DirectDraw flip buffer:
  52. if (ppdev->fpScreenOffset == 0)
  53. {
  54. vUpdate(ppdev, &rclBounds, pco);
  55. }
  56. return(b);
  57. }
  58. /******************************Public*Routine******************************\
  59. * DrvBitBlt
  60. *
  61. \**************************************************************************/
  62. BOOL DrvBitBlt(
  63. SURFOBJ* psoDst,
  64. SURFOBJ* psoSrc,
  65. SURFOBJ* psoMask,
  66. CLIPOBJ* pco,
  67. XLATEOBJ* pxlo,
  68. RECTL* prclDst,
  69. POINTL* pptlSrc,
  70. POINTL* pptlMask,
  71. BRUSHOBJ* pbo,
  72. POINTL* pptlBrush,
  73. ROP4 rop4)
  74. {
  75. BOOL bUpdate;
  76. BOOL b;
  77. PDEV* ppdev;
  78. bUpdate = FALSE;
  79. if (psoDst->iType == STYPE_DEVICE)
  80. {
  81. bUpdate = TRUE;
  82. ppdev = (PDEV*) psoDst->dhpdev;
  83. psoDst = ppdev->pso;
  84. }
  85. if ((psoSrc != NULL) && (psoSrc->iType == STYPE_DEVICE))
  86. {
  87. ppdev = (PDEV*) psoSrc->dhpdev;
  88. psoSrc = ppdev->pso;
  89. }
  90. b = EngBitBlt(psoDst, psoSrc, psoMask, pco, pxlo, prclDst, pptlSrc,
  91. pptlMask, pbo, pptlBrush, rop4);
  92. if (bUpdate)
  93. {
  94. // Don't update the screen if we're currently showing an 'off-screen'
  95. // DirectDraw flip buffer:
  96. if (ppdev->fpScreenOffset == 0)
  97. {
  98. vUpdate(ppdev, prclDst, pco);
  99. }
  100. }
  101. return(b);
  102. }
  103. /******************************Public*Routine******************************\
  104. * DrvCopyBits
  105. *
  106. \**************************************************************************/
  107. BOOL DrvCopyBits(
  108. SURFOBJ* psoDst,
  109. SURFOBJ* psoSrc,
  110. CLIPOBJ* pco,
  111. XLATEOBJ* pxlo,
  112. RECTL* prclDst,
  113. POINTL* pptlSrc)
  114. {
  115. BOOL bUpdate;
  116. BOOL b;
  117. PDEV* ppdev;
  118. return(DrvBitBlt(psoDst, psoSrc, NULL, pco, pxlo, prclDst, pptlSrc,
  119. NULL, NULL, NULL, 0xcccc));
  120. }
  121. /******************************Public*Routine******************************\
  122. * DrvTextOut
  123. *
  124. \**************************************************************************/
  125. BOOL DrvTextOut(
  126. SURFOBJ* pso,
  127. STROBJ* pstro,
  128. FONTOBJ* pfo,
  129. CLIPOBJ* pco,
  130. RECTL* prclExtra,
  131. RECTL* prclOpaque,
  132. BRUSHOBJ* pboFore,
  133. BRUSHOBJ* pboOpaque,
  134. POINTL* pptlOrg,
  135. MIX mix)
  136. {
  137. BOOL b;
  138. PDEV* ppdev;
  139. ppdev = (PDEV*) pso->dhpdev;
  140. b = EngTextOut(ppdev->pso, pstro, pfo, pco, prclExtra, prclOpaque,
  141. pboFore, pboOpaque, pptlOrg, mix);
  142. // Don't update the screen if we're currently showing an 'off-screen'
  143. // DirectDraw flip buffer:
  144. if (ppdev->fpScreenOffset == 0)
  145. {
  146. vUpdate(ppdev, (prclOpaque != NULL) ? prclOpaque : &pstro->rclBkGround,
  147. pco);
  148. }
  149. return(b);
  150. }
  151. /******************************Public*Routine******************************\
  152. * DrvPaint
  153. *
  154. \**************************************************************************/
  155. BOOL DrvPaint(
  156. SURFOBJ* pso,
  157. CLIPOBJ* pco,
  158. BRUSHOBJ* pbo,
  159. POINTL* pptlBrush,
  160. MIX mix)
  161. {
  162. BOOL b;
  163. PDEV* ppdev;
  164. ppdev = (PDEV*) pso->dhpdev;
  165. b = EngPaint(ppdev->pso, pco, pbo, pptlBrush, mix);
  166. // Don't update the screen if we're currently showing an 'off-screen'
  167. // DirectDraw flip buffer:
  168. if (ppdev->fpScreenOffset == 0)
  169. {
  170. vUpdate(ppdev, &pco->rclBounds, pco);
  171. }
  172. return(b);
  173. }