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.

299 lines
5.3 KiB

  1. /*++
  2. Copyright (c) 1990-2003 Microsoft Corporation
  3. Module Name:
  4. page.c
  5. Abstract:
  6. This module has the code that implements job boundary states. The bulk of
  7. the processing is in DrvStartPage and DrvSendPage.
  8. Author:
  9. 15:30 on Thu 04 Apr 1991
  10. Took skeletal code from RASDD
  11. 15-Nov-1993 Mon 19:39:03 updated
  12. clean up / fixed / debugging information
  13. [Environment:]
  14. GDI Device Driver - Plotter.
  15. [Notes:]
  16. Revision History:
  17. --*/
  18. #include "precomp.h"
  19. #pragma hdrstop
  20. #define DBG_PLOTFILENAME DbgPage
  21. #define DBG_STARTPAGE 0x00000001
  22. #define DBG_SENDPAGE 0x00000002
  23. #define DBG_STARTDOC 0x00000004
  24. #define DBG_ENDDOC 0x00000008
  25. DEFINE_DBGVAR(0);
  26. BOOL
  27. DrvStartPage(
  28. SURFOBJ *pso
  29. )
  30. /*++
  31. Routine Description:
  32. Function called by NT GDI, to initiate a new page. This function gets
  33. called first. Before any drawing functions get called for the page.
  34. This function, should reset the page in the target device, so all
  35. drawing starts on a clean page. This is also used to sync up our
  36. internal representation of cached info, in order to send out the
  37. correct data for the first drawing objects. Things like current position,
  38. current color, etc.
  39. Arguments:
  40. pso - Pointer to the SURFOBJ which belong to this driver
  41. Return Value:
  42. TRUE if sucessful FALSE otherwise
  43. Author:
  44. 15-Feb-1994 Tue 09:58:26 updated
  45. Move PhysPosition and AnchorCorner to the SendPageHeader where the
  46. commmand is sent.
  47. 30-Nov-1993 Tue 23:08:12 created
  48. Revision History:
  49. --*/
  50. {
  51. PPDEV pPDev;
  52. if (!(pPDev = SURFOBJ_GETPDEV(pso))) {
  53. PLOTERR(("DrvStartPage: invalid pPDev"));
  54. return(FALSE);
  55. }
  56. //
  57. // initialize some PDEV values for the current plotter state
  58. // this will force the correct items to get selected in the
  59. // target device, since these variables are set to undefined states.
  60. //
  61. pPDev->CurPenSelected = -1;
  62. pPDev->LastDevROP = 0xFFFF;
  63. pPDev->Rop3CopyBits = 0xCC;
  64. pPDev->LastFillTypeIndex = 0xFFFF;
  65. pPDev->LastLineType = PLOT_LT_UNDEFINED;
  66. pPDev->DevBrushUniq = 0;
  67. ResetDBCache(pPDev);
  68. return(SendPageHeader(pPDev));
  69. }
  70. BOOL
  71. DrvSendPage(
  72. SURFOBJ *pso
  73. )
  74. /*++
  75. Routine Description:
  76. Called when the drawing has completed for the current page. We now
  77. send out the necessary codes to image and output the page on the
  78. target device.
  79. Arguments:
  80. pso - Pointer to the SURFOBJ which belong to this driver
  81. Return Value:
  82. TRUE if sucessful FALSE otherwise
  83. Author:
  84. 30-Nov-1993 Tue 21:34:53 created
  85. Revision History:
  86. --*/
  87. {
  88. PPDEV pPDev;
  89. //
  90. // Since all the commands that rendered the page have already been
  91. // sent to the target device, all that is left is to inform the
  92. // target device to eject the page. With some devices this may cause
  93. // all the drawing commands that were stored to be executed now.
  94. //
  95. if (!(pPDev = SURFOBJ_GETPDEV(pso))) {
  96. PLOTERR(("DrvSendPage: invalid pPDev"));
  97. return(FALSE);
  98. }
  99. if (pso->iType == STYPE_DEVICE) {
  100. return(SendPageTrailer(pPDev));
  101. } else {
  102. PLOTRIP(("DrvSendPage: Invalid surface type %ld passed???",
  103. (LONG)pso->iType));
  104. return(FALSE);
  105. }
  106. }
  107. BOOL
  108. DrvStartDoc(
  109. SURFOBJ *pso,
  110. PWSTR pwDocName,
  111. DWORD JobId
  112. )
  113. /*++
  114. Routine Description:
  115. This function is called once at the begining of a job. Not much processing
  116. for the current driver.
  117. Arguments:
  118. pso - Pointer to the SURFOBJ which belong to this driver
  119. pwDocName - Pointer to the document name to be started
  120. JobID - Job's ID
  121. Return Value:
  122. BOOL
  123. Author:
  124. 16-Nov-1993 Tue 01:55:15 updated
  125. re-write
  126. 08-Feb-1994 Tue 13:51:59 updated
  127. Move to StartPage for now
  128. Revision History:
  129. --*/
  130. {
  131. PPDEV pPDev;
  132. if (!(pPDev = SURFOBJ_GETPDEV(pso))) {
  133. PLOTERR(("DrvStartDoc: invalid pPDev"));
  134. return(FALSE);
  135. }
  136. PLOTDBG(DBG_STARTDOC,("DrvStartDoc: DocName = %s", pwDocName));
  137. return(TRUE);
  138. }
  139. BOOL
  140. DrvEndDoc(
  141. SURFOBJ *pso,
  142. FLONG Flags
  143. )
  144. /*++
  145. Routine Description:
  146. This function get called to signify the end of a document. Currently
  147. we don't do any processing here. However if there was any code that
  148. should be executed only once at the end of a job, this would be the
  149. place to put it.
  150. Arguments:
  151. pso - Pointer to the SURFOBJ for the device
  152. Flags - if ED_ABORTDOC bit is set then the document has been aborted
  153. Return Value:
  154. BOOLLEAN to specified if function sucessful
  155. Author:
  156. 30-Nov-1993 Tue 21:16:48 created
  157. Revision History:
  158. --*/
  159. {
  160. PPDEV pPDev;
  161. if (!(pPDev = SURFOBJ_GETPDEV(pso))) {
  162. PLOTERR(("DrvEndDoc: invalid pPDev"));
  163. return(FALSE);
  164. }
  165. PLOTDBG(DBG_ENDDOC,("DrvEndDoc called with Flags = %08lx", Flags));
  166. return(TRUE);
  167. }