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.

481 lines
9.9 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: path.c
  3. *
  4. * Client side stubs for graphics path calls.
  5. *
  6. * Created: 13-Sep-1991
  7. * Author: J. Andrew Goossen [andrewgo]
  8. *
  9. * Copyright (c) 1991-1999 Microsoft Corporation
  10. \**************************************************************************/
  11. #include "precomp.h"
  12. #pragma hdrstop
  13. /******************************Public*Routine******************************\
  14. * AbortPath
  15. *
  16. * Client side stub.
  17. *
  18. * History:
  19. * 20-Mar-1992 -by- J. Andrew Goossen [andrewgo]
  20. * Wrote it.
  21. \**************************************************************************/
  22. BOOL META WINAPI AbortPath(HDC hdc)
  23. {
  24. BOOL bRet = FALSE;
  25. FIXUP_HANDLE(hdc);
  26. if (IS_ALTDC_TYPE(hdc))
  27. {
  28. PLDC pldc;
  29. if (IS_METADC16_TYPE(hdc))
  30. return(bRet);
  31. DC_PLDC(hdc,pldc,bRet);
  32. if ((pldc->iType == LO_METADC) &&
  33. !MF_Record(hdc,EMR_ABORTPATH))
  34. {
  35. return(bRet);
  36. }
  37. }
  38. return(NtGdiAbortPath(hdc));
  39. }
  40. /******************************Public*Routine******************************\
  41. * BeginPath
  42. *
  43. * Client side stub.
  44. *
  45. * History:
  46. * 13-Sep-1991 -by- J. Andrew Goossen [andrewgo]
  47. * Wrote it.
  48. \**************************************************************************/
  49. BOOL META WINAPI BeginPath(HDC hdc)
  50. {
  51. BOOL bRet = FALSE;
  52. FIXUP_HANDLE(hdc);
  53. if (IS_ALTDC_TYPE(hdc))
  54. {
  55. PLDC pldc;
  56. if (IS_METADC16_TYPE(hdc))
  57. return(bRet);
  58. DC_PLDC(hdc,pldc,bRet);
  59. if ((pldc->iType == LO_METADC) &&
  60. !MF_Record(hdc,EMR_BEGINPATH))
  61. {
  62. return(bRet);
  63. }
  64. }
  65. return(NtGdiBeginPath(hdc));
  66. }
  67. /******************************Public*Routine******************************\
  68. * SelectClipPath
  69. *
  70. * Client side stub.
  71. *
  72. * History:
  73. * 13-Sep-1991 -by- J. Andrew Goossen [andrewgo]
  74. * Wrote it.
  75. \**************************************************************************/
  76. BOOL META WINAPI SelectClipPath(HDC hdc, int iMode)
  77. {
  78. BOOL bRet = FALSE;
  79. FIXUP_HANDLE(hdc);
  80. if (IS_ALTDC_TYPE(hdc))
  81. {
  82. PLDC pldc;
  83. if (IS_METADC16_TYPE(hdc))
  84. return(bRet);
  85. DC_PLDC(hdc,pldc,bRet);
  86. if ((pldc->iType == LO_METADC) &&
  87. !MF_SelectClipPath(hdc,iMode))
  88. {
  89. return(bRet);
  90. }
  91. }
  92. return(NtGdiSelectClipPath(hdc,iMode));
  93. }
  94. /******************************Public*Routine******************************\
  95. * CloseFigure
  96. *
  97. * Client side stub.
  98. *
  99. * History:
  100. * 13-Sep-1991 -by- J. Andrew Goossen [andrewgo]
  101. * Wrote it.
  102. \**************************************************************************/
  103. BOOL META WINAPI CloseFigure(HDC hdc)
  104. {
  105. BOOL bRet = FALSE;
  106. FIXUP_HANDLE (hdc);
  107. if (IS_ALTDC_TYPE(hdc))
  108. {
  109. PLDC pldc;
  110. if (IS_METADC16_TYPE(hdc))
  111. return(bRet);
  112. DC_PLDC(hdc,pldc,bRet);
  113. if ((pldc->iType == LO_METADC) &&
  114. !MF_Record(hdc,EMR_CLOSEFIGURE))
  115. {
  116. return(bRet);
  117. }
  118. }
  119. return(NtGdiCloseFigure(hdc));
  120. }
  121. /******************************Public*Routine******************************\
  122. * EndPath
  123. *
  124. * Client side stub.
  125. *
  126. * History:
  127. * 13-Sep-1991 -by- J. Andrew Goossen [andrewgo]
  128. * Wrote it.
  129. \**************************************************************************/
  130. BOOL META WINAPI EndPath(HDC hdc)
  131. {
  132. BOOL bRet = FALSE;
  133. FIXUP_HANDLE(hdc);
  134. if (IS_ALTDC_TYPE(hdc))
  135. {
  136. PLDC pldc;
  137. if (IS_METADC16_TYPE(hdc))
  138. return(bRet);
  139. DC_PLDC(hdc,pldc,bRet);
  140. if ((pldc->iType == LO_METADC) &&
  141. !MF_Record(hdc,EMR_ENDPATH))
  142. {
  143. return(bRet);
  144. }
  145. }
  146. return(NtGdiEndPath(hdc));
  147. }
  148. /******************************Public*Routine******************************\
  149. * FlattenPath
  150. *
  151. * Client side stub.
  152. *
  153. * History:
  154. * 13-Sep-1991 -by- J. Andrew Goossen [andrewgo]
  155. * Wrote it.
  156. \**************************************************************************/
  157. BOOL META WINAPI FlattenPath(HDC hdc)
  158. {
  159. BOOL bRet = FALSE;
  160. FIXUP_HANDLE(hdc);
  161. if (IS_ALTDC_TYPE(hdc))
  162. {
  163. PLDC pldc;
  164. if (IS_METADC16_TYPE(hdc))
  165. return(bRet);
  166. DC_PLDC(hdc,pldc,bRet);
  167. if ((pldc->iType == LO_METADC) &&
  168. !MF_Record(hdc,EMR_FLATTENPATH))
  169. {
  170. return(bRet);
  171. }
  172. }
  173. return(NtGdiFlattenPath(hdc));
  174. }
  175. /******************************Public*Routine******************************\
  176. * StrokeAndFillPath
  177. *
  178. * Client side stub.
  179. *
  180. * History:
  181. * 13-Sep-1991 -by- J. Andrew Goossen [andrewgo]
  182. * Wrote it.
  183. \**************************************************************************/
  184. BOOL META WINAPI StrokeAndFillPath(HDC hdc)
  185. {
  186. BOOL bRet = FALSE;
  187. FIXUP_HANDLE(hdc);
  188. if (IS_ALTDC_TYPE(hdc))
  189. {
  190. PLDC pldc;
  191. if (IS_METADC16_TYPE(hdc))
  192. return(bRet);
  193. DC_PLDC(hdc,pldc,bRet);
  194. if ((pldc->iType == LO_METADC) &&
  195. !MF_BoundRecord(hdc,EMR_STROKEANDFILLPATH))
  196. {
  197. return(bRet);
  198. }
  199. if (pldc->fl & LDC_SAP_CALLBACK)
  200. vSAPCallback(pldc);
  201. if (pldc->fl & LDC_DOC_CANCELLED)
  202. return(bRet);
  203. if (pldc->fl & LDC_CALL_STARTPAGE)
  204. StartPage(hdc);
  205. }
  206. RESETUSERPOLLCOUNT();
  207. return(NtGdiStrokeAndFillPath(hdc));
  208. }
  209. /******************************Public*Routine******************************\
  210. * StrokePath
  211. *
  212. * Client side stub.
  213. *
  214. * History:
  215. * 13-Sep-1991 -by- J. Andrew Goossen [andrewgo]
  216. * Wrote it.
  217. \**************************************************************************/
  218. BOOL META WINAPI StrokePath(HDC hdc)
  219. {
  220. BOOL bRet = FALSE;
  221. FIXUP_HANDLE (hdc);
  222. if (IS_ALTDC_TYPE(hdc))
  223. {
  224. PLDC pldc;
  225. if (IS_METADC16_TYPE(hdc))
  226. return(bRet);
  227. DC_PLDC(hdc,pldc,bRet);
  228. if ((pldc->iType == LO_METADC) &&
  229. !MF_BoundRecord(hdc,EMR_STROKEPATH))
  230. {
  231. return(bRet);
  232. }
  233. if (pldc->fl & LDC_SAP_CALLBACK)
  234. vSAPCallback(pldc);
  235. if (pldc->fl & LDC_DOC_CANCELLED)
  236. return(bRet);
  237. if (pldc->fl & LDC_CALL_STARTPAGE)
  238. StartPage(hdc);
  239. }
  240. RESETUSERPOLLCOUNT();
  241. return(NtGdiStrokePath(hdc));
  242. }
  243. /******************************Public*Routine******************************\
  244. * FillPath
  245. *
  246. * Client side stub.
  247. *
  248. * History:
  249. * 13-Sep-1991 -by- J. Andrew Goossen [andrewgo]
  250. * Wrote it.
  251. \**************************************************************************/
  252. BOOL META WINAPI FillPath(HDC hdc)
  253. {
  254. BOOL bRet = FALSE;
  255. FIXUP_HANDLE (hdc);
  256. if (IS_ALTDC_TYPE(hdc))
  257. {
  258. PLDC pldc;
  259. if (IS_METADC16_TYPE(hdc))
  260. return(bRet);
  261. DC_PLDC(hdc,pldc,bRet);
  262. if ((pldc->iType == LO_METADC) &&
  263. !MF_BoundRecord(hdc,EMR_FILLPATH))
  264. {
  265. return(bRet);
  266. }
  267. if (pldc->fl & LDC_SAP_CALLBACK)
  268. vSAPCallback(pldc);
  269. if (pldc->fl & LDC_DOC_CANCELLED)
  270. return(bRet);
  271. if (pldc->fl & LDC_CALL_STARTPAGE)
  272. StartPage(hdc);
  273. }
  274. RESETUSERPOLLCOUNT();
  275. return(NtGdiFillPath(hdc));
  276. }
  277. /******************************Public*Routine******************************\
  278. * WidenPath
  279. *
  280. * Client side stub.
  281. *
  282. * History:
  283. * 13-Sep-1991 -by- J. Andrew Goossen [andrewgo]
  284. * Wrote it.
  285. \**************************************************************************/
  286. BOOL META WINAPI WidenPath(HDC hdc)
  287. {
  288. BOOL bRet = FALSE;
  289. FIXUP_HANDLE (hdc);
  290. if (IS_ALTDC_TYPE(hdc))
  291. {
  292. PLDC pldc;
  293. if (IS_METADC16_TYPE(hdc))
  294. return(bRet);
  295. DC_PLDC(hdc,pldc,bRet);
  296. if ((pldc->iType == LO_METADC) &&
  297. !MF_Record(hdc,EMR_WIDENPATH))
  298. {
  299. return(bRet);
  300. }
  301. }
  302. return(NtGdiWidenPath(hdc));
  303. }
  304. /******************************Public*Routine******************************\
  305. * PathToRegion
  306. *
  307. * Client side stub.
  308. *
  309. * 13-Sep-1991 -by- J. Andrew Goossen [andrewgo]
  310. * Wrote it.
  311. \**************************************************************************/
  312. HRGN META WINAPI PathToRegion(HDC hdc)
  313. {
  314. HRGN hrgn = (HRGN)0;
  315. FIXUP_HANDLE (hdc);
  316. if (IS_ALTDC_TYPE(hdc))
  317. {
  318. PLDC pldc;
  319. if (IS_METADC16_TYPE(hdc))
  320. return(hrgn);
  321. DC_PLDC(hdc,pldc,hrgn);
  322. // Metafile the call.
  323. // Note that since PathToRegion returns region in device coordinates, we
  324. // cannot record it in a metafile which can be played to different devices.
  325. // Instead, we will treat the returned region the same as the other regions
  326. // created in other region calls. However, we still need to discard the
  327. // path definition in the metafile.
  328. if ((pldc->iType == LO_METADC) &&
  329. !MF_Record(hdc,EMR_ABORTPATH))
  330. {
  331. return(hrgn);
  332. }
  333. }
  334. hrgn = NtGdiPathToRegion(hdc);
  335. if (hrgn && MIRRORED_HDC(hdc)) {
  336. MirrorRgnDC(hdc, hrgn, NULL);
  337. }
  338. return(hrgn);
  339. }
  340. /******************************Public*Routine******************************\
  341. * GetPath
  342. *
  343. * GetPath client side stub.
  344. *
  345. * 13-Sep-1991 -by- J. Andrew Goossen [andrewgo]
  346. * Wrote it.
  347. \**************************************************************************/
  348. int WINAPI GetPath(HDC hdc,LPPOINT apt,LPBYTE aj,int cpt)
  349. {
  350. FIXUP_HANDLE(hdc);
  351. // Check to make sure we don't have an unreasonable number of points or bad handle
  352. if (IS_METADC16_TYPE(hdc))
  353. {
  354. GdiSetLastError(ERROR_INVALID_PARAMETER);
  355. return(-1);
  356. }
  357. return(NtGdiGetPath(hdc, apt, aj, cpt));
  358. }
  359.