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.

404 lines
11 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: poly.c *
  3. * *
  4. * Chunks large data to the server. *
  5. * *
  6. * Created: 30-May-1991 14:22:40 *
  7. * Author: Eric Kutter [erick] *
  8. * *
  9. * Copyright (c) 1991-1999 Microsoft Corporation *
  10. \**************************************************************************/
  11. #include "precomp.h"
  12. #pragma hdrstop
  13. /******************************Public*Routine******************************\
  14. * PolyPolygon *
  15. * PolyPolyline *
  16. * Polygon *
  17. * Polyline *
  18. * PolyBezier *
  19. * PolylineTo *
  20. * PolyBezierTo *
  21. * *
  22. * Output routines that call PolyPolyDraw to do the work. *
  23. * *
  24. * History: *
  25. * Thu 20-Jun-1991 01:08:40 -by- Charles Whitmer [chuckwh] *
  26. * Added metafiling, handle translation, and the attribute cache. *
  27. * *
  28. * 04-Jun-1991 -by- Eric Kutter [erick] *
  29. * Wrote it. *
  30. \**************************************************************************/
  31. BOOL WINAPI PolyPolygon(HDC hdc, CONST POINT *apt, CONST INT *asz, int csz)
  32. {
  33. FIXUP_HANDLE(hdc);
  34. if (IS_ALTDC_TYPE(hdc))
  35. {
  36. PLDC pldc;
  37. if (IS_METADC16_TYPE(hdc))
  38. return (MF16_PolyPolygon(hdc, apt, asz, csz));
  39. DC_PLDC(hdc,pldc,FALSE);
  40. if (pldc->iType == LO_METADC)
  41. {
  42. if (!MF_PolyPoly(hdc, apt, asz, (DWORD) csz,EMR_POLYPOLYGON))
  43. return(FALSE);
  44. }
  45. if (pldc->fl & LDC_SAP_CALLBACK)
  46. vSAPCallback(pldc);
  47. if (pldc->fl & LDC_DOC_CANCELLED)
  48. return(FALSE);
  49. if (pldc->fl & LDC_CALL_STARTPAGE)
  50. StartPage(hdc);
  51. }
  52. return (BOOL)
  53. NtGdiPolyPolyDraw
  54. (
  55. hdc,
  56. (PPOINT)apt,
  57. (LPINT)asz,
  58. csz,
  59. I_POLYPOLYGON
  60. );
  61. }
  62. BOOL WINAPI PolyPolyline(HDC hdc, CONST POINT *apt, CONST DWORD *asz, DWORD csz)
  63. {
  64. FIXUP_HANDLE(hdc);
  65. if (IS_ALTDC_TYPE(hdc))
  66. {
  67. PLDC pldc;
  68. if (IS_METADC16_TYPE(hdc))
  69. return(FALSE);
  70. DC_PLDC(hdc,pldc,FALSE);
  71. if (pldc->iType == LO_METADC && !MF_PolyPoly(hdc,apt, asz, csz, EMR_POLYPOLYLINE))
  72. return(FALSE);
  73. if (pldc->fl & LDC_SAP_CALLBACK)
  74. vSAPCallback(pldc);
  75. if (pldc->fl & LDC_DOC_CANCELLED)
  76. return(FALSE);
  77. if (pldc->fl & LDC_CALL_STARTPAGE)
  78. StartPage(hdc);
  79. }
  80. return (BOOL)
  81. NtGdiPolyPolyDraw
  82. (
  83. hdc,
  84. (PPOINT)apt,
  85. (LPINT)asz,
  86. csz,
  87. I_POLYPOLYLINE
  88. );
  89. }
  90. BOOL WINAPI Polygon(HDC hdc, CONST POINT *apt,int cpt)
  91. {
  92. FIXUP_HANDLE(hdc);
  93. if (IS_ALTDC_TYPE(hdc))
  94. {
  95. PLDC pldc;
  96. if (IS_METADC16_TYPE(hdc))
  97. return(MF16_RecordParmsPoly(hdc,(LPPOINT)apt,(INT)cpt,META_POLYGON));
  98. DC_PLDC(hdc,pldc,FALSE);
  99. if (pldc->iType == LO_METADC)
  100. {
  101. if (!MF_Poly(hdc,apt,cpt,EMR_POLYGON))
  102. return(FALSE);
  103. }
  104. if (pldc->fl & LDC_SAP_CALLBACK)
  105. vSAPCallback(pldc);
  106. if (pldc->fl & LDC_DOC_CANCELLED)
  107. return(FALSE);
  108. if (pldc->fl & LDC_CALL_STARTPAGE)
  109. StartPage(hdc);
  110. }
  111. return (BOOL)
  112. NtGdiPolyPolyDraw
  113. (
  114. hdc,
  115. (PPOINT)apt,
  116. &cpt,
  117. 1,
  118. I_POLYPOLYGON
  119. );
  120. }
  121. BOOL WINAPI Polyline(HDC hdc, CONST POINT *apt,int cpt)
  122. {
  123. FIXUP_HANDLE(hdc);
  124. if (IS_ALTDC_TYPE(hdc))
  125. {
  126. PLDC pldc;
  127. if (IS_METADC16_TYPE(hdc))
  128. return(MF16_RecordParmsPoly(hdc,(LPPOINT)apt,cpt,META_POLYLINE));
  129. DC_PLDC(hdc,pldc,FALSE);
  130. if (pldc->iType == LO_METADC)
  131. {
  132. if (!MF_Poly(hdc,apt,cpt,EMR_POLYLINE))
  133. return(FALSE);
  134. }
  135. if (pldc->fl & LDC_SAP_CALLBACK)
  136. vSAPCallback(pldc);
  137. if (pldc->fl & LDC_DOC_CANCELLED)
  138. return(FALSE);
  139. if (pldc->fl & LDC_CALL_STARTPAGE)
  140. StartPage(hdc);
  141. }
  142. return (BOOL)
  143. NtGdiPolyPolyDraw
  144. (
  145. hdc,
  146. (PPOINT)apt,
  147. &cpt,
  148. 1,
  149. I_POLYPOLYLINE
  150. );
  151. }
  152. BOOL WINAPI PolyBezier(HDC hdc, CONST POINT * apt,DWORD cpt)
  153. {
  154. FIXUP_HANDLE(hdc);
  155. if (IS_ALTDC_TYPE(hdc))
  156. {
  157. PLDC pldc;
  158. if (IS_METADC16_TYPE(hdc))
  159. return(FALSE);
  160. DC_PLDC(hdc,pldc,FALSE);
  161. if (pldc->iType == LO_METADC && !MF_Poly(hdc,apt,cpt,EMR_POLYBEZIER))
  162. return(FALSE);
  163. if (pldc->fl & LDC_SAP_CALLBACK)
  164. vSAPCallback(pldc);
  165. if (pldc->fl & LDC_DOC_CANCELLED)
  166. return(FALSE);
  167. if (pldc->fl & LDC_CALL_STARTPAGE)
  168. StartPage(hdc);
  169. }
  170. return (BOOL)
  171. NtGdiPolyPolyDraw
  172. (
  173. hdc,
  174. (PPOINT)apt,
  175. (LPINT)&cpt,
  176. 1,
  177. I_POLYBEZIER
  178. );
  179. }
  180. BOOL WINAPI PolylineTo(HDC hdc, CONST POINT * apt,DWORD cpt)
  181. {
  182. FIXUP_HANDLE(hdc);
  183. if (IS_ALTDC_TYPE(hdc))
  184. {
  185. PLDC pldc;
  186. if (IS_METADC16_TYPE(hdc))
  187. return(FALSE);
  188. DC_PLDC(hdc,pldc,FALSE);
  189. if (pldc->iType == LO_METADC && !MF_Poly(hdc,apt,cpt,EMR_POLYLINETO))
  190. return(FALSE);
  191. if (pldc->fl & LDC_SAP_CALLBACK)
  192. vSAPCallback(pldc);
  193. if (pldc->fl & LDC_DOC_CANCELLED)
  194. return(FALSE);
  195. if (pldc->fl & LDC_CALL_STARTPAGE)
  196. StartPage(hdc);
  197. }
  198. return (BOOL)
  199. NtGdiPolyPolyDraw
  200. (
  201. hdc,
  202. (PPOINT)apt,
  203. (LPINT)&cpt,
  204. 1,
  205. I_POLYLINETO
  206. );
  207. }
  208. BOOL WINAPI PolyBezierTo(HDC hdc, CONST POINT * apt,DWORD cpt)
  209. {
  210. FIXUP_HANDLE(hdc);
  211. if (IS_ALTDC_TYPE(hdc))
  212. {
  213. PLDC pldc;
  214. if (IS_METADC16_TYPE(hdc))
  215. return(FALSE);
  216. DC_PLDC(hdc,pldc,FALSE);
  217. if (pldc->iType == LO_METADC && !MF_Poly(hdc,apt,cpt,EMR_POLYBEZIERTO))
  218. return(FALSE);
  219. if (pldc->fl & LDC_SAP_CALLBACK)
  220. vSAPCallback(pldc);
  221. if (pldc->fl & LDC_DOC_CANCELLED)
  222. return(FALSE);
  223. if (pldc->fl & LDC_CALL_STARTPAGE)
  224. StartPage(hdc);
  225. }
  226. return (BOOL)
  227. NtGdiPolyPolyDraw
  228. (
  229. hdc,
  230. (PPOINT)apt,
  231. (LPINT)&cpt,
  232. 1,
  233. I_POLYBEZIERTO
  234. );
  235. }
  236. /******************************Public*Routine******************************\
  237. * CreatePolygonRgn *
  238. * *
  239. * Client side stub. Creates a local region handle, calls PolyPolyDraw to *
  240. * pass the call to the server. *
  241. * *
  242. * Tue 04-Jun-1991 17:39:51 -by- Charles Whitmer [chuckwh] *
  243. * Wrote it. *
  244. \**************************************************************************/
  245. HRGN WINAPI CreatePolygonRgn
  246. (
  247. CONST POINT *pptl,
  248. int cPoint,
  249. int iMode
  250. )
  251. {
  252. LONG_PTR Mode = iMode;
  253. return((HRGN)
  254. NtGdiPolyPolyDraw
  255. (
  256. (HDC)Mode,
  257. (PPOINT)pptl,
  258. &cPoint,
  259. 1,
  260. I_POLYPOLYRGN
  261. ));
  262. }
  263. /******************************Public*Routine******************************\
  264. * CreatePolyPolygonRgn *
  265. * *
  266. * Client side stub. Creates a local region handle, calls PolyPolyDraw to *
  267. * pass the call to the server. *
  268. * *
  269. * Tue 04-Jun-1991 17:39:51 -by- Charles Whitmer [chuckwh] *
  270. * Wrote it. *
  271. \**************************************************************************/
  272. HRGN WINAPI CreatePolyPolygonRgn
  273. (
  274. CONST POINT *pptl,
  275. CONST INT *pc,
  276. int cPoly,
  277. int iMode
  278. )
  279. {
  280. LONG_PTR Mode = iMode;
  281. return((HRGN)
  282. NtGdiPolyPolyDraw
  283. (
  284. (HDC)Mode,
  285. (PPOINT)pptl,
  286. (LPINT)pc,
  287. cPoly,
  288. I_POLYPOLYRGN
  289. ));
  290. }
  291. /******************************Public*Routine******************************\
  292. * PolyDraw
  293. *
  294. * The real PolyDraw client side stub.
  295. *
  296. * 13-Sep-1991 -by- J. Andrew Goossen [andrewgo]
  297. * Wrote it.
  298. \**************************************************************************/
  299. BOOL WINAPI PolyDraw(HDC hdc, CONST POINT * apt, CONST BYTE * aj, int cpt)
  300. {
  301. FIXUP_HANDLE(hdc);
  302. if (IS_ALTDC_TYPE(hdc))
  303. {
  304. PLDC pldc;
  305. if (IS_METADC16_TYPE(hdc))
  306. return(FALSE);
  307. DC_PLDC(hdc,pldc,FALSE);
  308. if (pldc->iType == LO_METADC && !MF_PolyDraw(hdc,apt,aj,cpt))
  309. return(FALSE);
  310. if (pldc->fl & LDC_SAP_CALLBACK)
  311. vSAPCallback(pldc);
  312. if (pldc->fl & LDC_DOC_CANCELLED)
  313. return(FALSE);
  314. if (pldc->fl & LDC_CALL_STARTPAGE)
  315. StartPage(hdc);
  316. }
  317. return((BOOL)NtGdiPolyDraw(hdc,(PPOINT)apt,(PBYTE)aj,cpt));
  318. }