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.

183 lines
4.6 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. vUpdate(ppdev, &rclBounds, pco);
  51. return(b);
  52. }
  53. /******************************Public*Routine******************************\
  54. * DrvBitBlt
  55. *
  56. \**************************************************************************/
  57. BOOL DrvBitBlt(
  58. SURFOBJ* psoDst,
  59. SURFOBJ* psoSrc,
  60. SURFOBJ* psoMask,
  61. CLIPOBJ* pco,
  62. XLATEOBJ* pxlo,
  63. RECTL* prclDst,
  64. POINTL* pptlSrc,
  65. POINTL* pptlMask,
  66. BRUSHOBJ* pbo,
  67. POINTL* pptlBrush,
  68. ROP4 rop4)
  69. {
  70. BOOL bUpdate;
  71. BOOL b;
  72. PDEV* ppdev;
  73. bUpdate = FALSE;
  74. if (psoDst->iType == STYPE_DEVICE)
  75. {
  76. bUpdate = TRUE;
  77. ppdev = (PDEV*) psoDst->dhpdev;
  78. psoDst = ppdev->pso;
  79. }
  80. if ((psoSrc != NULL) && (psoSrc->iType == STYPE_DEVICE))
  81. {
  82. ppdev = (PDEV*) psoSrc->dhpdev;
  83. psoSrc = ppdev->pso;
  84. }
  85. b = EngBitBlt(psoDst, psoSrc, psoMask, pco, pxlo, prclDst, pptlSrc,
  86. pptlMask, pbo, pptlBrush, rop4);
  87. if (bUpdate)
  88. {
  89. vUpdate(ppdev, prclDst, pco);
  90. }
  91. return(b);
  92. }
  93. /******************************Public*Routine******************************\
  94. * DrvCopyBits
  95. *
  96. \**************************************************************************/
  97. BOOL DrvCopyBits(
  98. SURFOBJ* psoDst,
  99. SURFOBJ* psoSrc,
  100. CLIPOBJ* pco,
  101. XLATEOBJ* pxlo,
  102. RECTL* prclDst,
  103. POINTL* pptlSrc)
  104. {
  105. BOOL bUpdate;
  106. BOOL b;
  107. PDEV* ppdev;
  108. return(DrvBitBlt(psoDst, psoSrc, NULL, pco, pxlo, prclDst, pptlSrc,
  109. NULL, NULL, NULL, 0xcccc));
  110. }
  111. /******************************Public*Routine******************************\
  112. * DrvTextOut
  113. *
  114. \**************************************************************************/
  115. BOOL DrvTextOut(
  116. SURFOBJ* pso,
  117. STROBJ* pstro,
  118. FONTOBJ* pfo,
  119. CLIPOBJ* pco,
  120. RECTL* prclExtra,
  121. RECTL* prclOpaque,
  122. BRUSHOBJ* pboFore,
  123. BRUSHOBJ* pboOpaque,
  124. POINTL* pptlOrg,
  125. MIX mix)
  126. {
  127. BOOL b;
  128. PDEV* ppdev;
  129. ppdev = (PDEV*) pso->dhpdev;
  130. b = EngTextOut(ppdev->pso, pstro, pfo, pco, prclExtra, prclOpaque,
  131. pboFore, pboOpaque, pptlOrg, mix);
  132. vUpdate(ppdev, (prclOpaque != NULL) ? prclOpaque : &pstro->rclBkGround, pco);
  133. return(b);
  134. }
  135. /******************************Public*Routine******************************\
  136. * DrvPaint
  137. *
  138. \**************************************************************************/
  139. BOOL DrvPaint(
  140. SURFOBJ* pso,
  141. CLIPOBJ* pco,
  142. BRUSHOBJ* pbo,
  143. POINTL* pptlBrush,
  144. MIX mix)
  145. {
  146. BOOL b;
  147. PDEV* ppdev;
  148. ppdev = (PDEV*) pso->dhpdev;
  149. b = EngPaint(ppdev->pso, pco, pbo, pptlBrush, mix);
  150. vUpdate(ppdev, &pco->rclBounds, pco);
  151. return(b);
  152. }