Source code of Windows XP (NT5)
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.

1166 lines
40 KiB

  1. /******************************************************************************\
  2. *
  3. * $Workfile: OVERLAY.C $
  4. *
  5. * Copyright (c) 1996-1997 Microsoft Corporation
  6. * Copyright (c) 1996-1997 Cirrus Logic, Inc.
  7. *
  8. * $Log: V:/CirrusLogic/CL54xx/NT40/Archive/Display/OVERLAY.C_v $
  9. *
  10. \******************************************************************************/
  11. #include "precomp.h"
  12. #include "debug.h"
  13. #include "panflags.h"
  14. #include "dispint.h"
  15. #if DIRECTDRAW
  16. #include "overlay.h"
  17. #ifdef DEBUG
  18. #define DPF Msg
  19. extern void __cdecl Msg( LPSTR szFormat, ... );
  20. #else
  21. #define DPF 1 ? (void)0 : (void)
  22. #endif // DEBUG
  23. /* bandwidth matrix --------------------------------------*/
  24. /* inline functions --------------------------------------*/
  25. //static int __inline DrawEngineBusy(void)
  26. //{
  27. // _outp(0x3ce,0x31);
  28. // return _inpw(0x3ce) & 0x100; /* Input a word -- test high byte. */
  29. //}
  30. /* defines -----------------------------------------------*/
  31. #define MAX_STRETCH_SIZE 1024
  32. #define IN_VBLANK (_inp(0x3da) & 8)
  33. #define CRTINDEX 0x3d4
  34. #define DRAW_ENGINE_BUSY (DrawEngineBusy())
  35. #define PAKJR_GET_U(x) ((x & 0x00000FC0) >> 6)
  36. #define PAKJR_GET_V(x) (x & 0x0000003F)
  37. #define AVG_3_TO_1(u1, u2) ((u1 + ((u2 << 1) + u2)) >> 2) & 0x0000003F
  38. #define AVG_2_TO_2(u1, u2) (((u1 << 1) + (u2 << 1)) >> 2) & 0x0000003F
  39. #define AVG_1_2(u1,u2) u1
  40. #define AVG_1_2_1(u1, u2, u3) ((u1 + (u2 << 1) + u3) >> 2) & 0x0000003F
  41. #define MERGE_3_1(src, dst) (src & 0xFFFE0000) | (dst & 0x0001F000) | \
  42. ((AVG_3_TO_1(PAKJR_GET_U(dst), PAKJR_GET_U(src))) << 6) | \
  43. (AVG_3_TO_1(PAKJR_GET_V(dst), PAKJR_GET_V(src)))
  44. #define MERGE_2_2(src, dst) (src & 0xFFC00000) | (dst & 0x003FF000) | \
  45. ((AVG_2_TO_2(PAKJR_GET_U(dst), PAKJR_GET_U(src))) << 6) | \
  46. (AVG_2_TO_2(PAKJR_GET_V(dst), PAKJR_GET_V(src)))
  47. #define MERGE_1_3(src, dst) (src & 0xF8000000) | (dst & 0x07FFF000) | \
  48. ((AVG_3_TO_1(PAKJR_GET_U(src), PAKJR_GET_U(dst))) << 6) | \
  49. (AVG_3_TO_1(PAKJR_GET_V(src), PAKJR_GET_V(dst)))
  50. #define MERGE_1_2_1(src1, src2, dst) ((src2 & 0x0001F000) << 15) | \
  51. ((src1 & 0x07FE0000) >> 5) | \
  52. ((dst & 0x0001F000)) | \
  53. ((AVG_1_2_1(PAKJR_GET_U(dst), PAKJR_GET_U(src1), PAKJR_GET_U(src2))) << 6) | \
  54. (AVG_1_2( PAKJR_GET_V(dst), PAKJR_GET_V(src1)))
  55. #define MERGE_1_1_2(src1, src2, dst) ((src2 & 0x003FF000) << 10) | \
  56. ((src1 & 0xFE000000) >> 10) | \
  57. ((dst & 0xF8000000) >> 15) | \
  58. ((AVG_1_2_1(PAKJR_GET_U(dst), PAKJR_GET_U(src2), PAKJR_GET_U(src1))) << 6) | \
  59. (AVG_1_2_1(PAKJR_GET_V(dst), PAKJR_GET_V(src2), PAKJR_GET_V(src1)))
  60. #define MERGE_2_1_1(src1, src2, dst) ((src2 & 0x0001F000) << 15) | \
  61. ((src1 & 0xFE000000) >> 5) | \
  62. ((dst & 0x003FF000)) | \
  63. ((AVG_1_2_1(PAKJR_GET_U(src1), PAKJR_GET_U(dst), PAKJR_GET_U(src2))) << 6) | \
  64. (AVG_1_2_1(PAKJR_GET_V(src1), PAKJR_GET_V(dst), PAKJR_GET_V(src2)))
  65. VOID NEAR PASCAL PackJRSpecialEnd_0_0 (LPDWORD dwSrcStart, LPDWORD dwDstStart, WORD wWidth);
  66. VOID NEAR PASCAL PackJRSpecialEnd_0_1 (LPDWORD dwSrcStart, LPDWORD dwDstStart, WORD wWidth);
  67. VOID NEAR PASCAL PackJRSpecialEnd_0_2 (LPDWORD dwSrcStart, LPDWORD dwDstStart, WORD wWidth);
  68. VOID NEAR PASCAL PackJRSpecialEnd_0_3 (LPDWORD dwSrcStart, LPDWORD dwDstStart, WORD wWidth);
  69. VOID NEAR PASCAL PackJRSpecialEnd_1_1 (LPDWORD dwSrcStart, LPDWORD dwDstStart, WORD wWidth);
  70. VOID NEAR PASCAL PackJRSpecialEnd_1_2 (LPDWORD dwSrcStart, LPDWORD dwDstStart, WORD wWidth);
  71. VOID NEAR PASCAL PackJRSpecialEnd_1_3 (LPDWORD dwSrcStart, LPDWORD dwDstStart, WORD wWidth);
  72. VOID NEAR PASCAL PackJRSpecialEnd_2_1 (LPDWORD dwSrcStart, LPDWORD dwDstStart, WORD wWidth);
  73. VOID NEAR PASCAL PackJRSpecialEnd_2_2 (LPDWORD dwSrcStart, LPDWORD dwDstStart, WORD wWidth);
  74. VOID NEAR PASCAL PackJRSpecialEnd_2_3 (LPDWORD dwSrcStart, LPDWORD dwDstStart, WORD wWidth);
  75. VOID NEAR PASCAL PackJRSpecialEnd_3_1 (LPDWORD dwSrcStart, LPDWORD dwDstStart, WORD wWidth);
  76. VOID NEAR PASCAL PackJRSpecialEnd_3_2 (LPDWORD dwSrcStart, LPDWORD dwDstStart, WORD wWidth);
  77. VOID NEAR PASCAL PackJRSpecialEnd_3_3 (LPDWORD dwSrcStart, LPDWORD dwDstStart, WORD wWidth);
  78. /* global data -------------------------------------------*/
  79. typedef void (NEAR PASCAL *NPALIGN)(LPDWORD, LPDWORD, DWORD, DWORD, WORD, WORD);
  80. typedef void (NEAR PASCAL *NPEND)(LPDWORD , LPDWORD, WORD);
  81. DWORD dwFOURCCs[5];
  82. static NPEND npEnd[4][4] = {
  83. (&PackJRSpecialEnd_0_0),
  84. (&PackJRSpecialEnd_0_1),
  85. (&PackJRSpecialEnd_0_2),
  86. (&PackJRSpecialEnd_0_3),
  87. (&PackJRSpecialEnd_0_0),
  88. (&PackJRSpecialEnd_1_1),
  89. (&PackJRSpecialEnd_1_2),
  90. (&PackJRSpecialEnd_1_3),
  91. (&PackJRSpecialEnd_0_0),
  92. (&PackJRSpecialEnd_2_1),
  93. (&PackJRSpecialEnd_2_2),
  94. (&PackJRSpecialEnd_2_3),
  95. (&PackJRSpecialEnd_0_0),
  96. (&PackJRSpecialEnd_3_1),
  97. (&PackJRSpecialEnd_3_2),
  98. (&PackJRSpecialEnd_3_3),
  99. };
  100. /**********************************************************
  101. *
  102. * Name: PackJRBltAlignEnd
  103. *
  104. * Module Abstract:
  105. * ----------------
  106. * Blts the last few PackJR pixels that are not properly
  107. * aligned (so it can't use the hardware BLTer).
  108. *
  109. * Output Parameters:
  110. * ------------------
  111. * none
  112. *
  113. ***********************************************************
  114. * Author:
  115. * Date: 10/06/96
  116. *
  117. * Revision History:
  118. * -----------------
  119. * WHO WHEN WHAT/WHY/HOW
  120. * --- ---- ------------
  121. *
  122. *********************************************************/
  123. VOID PackJRBltAlignEnd (LPBYTE dwSrcStart, LPBYTE dwDstStart, DWORD dwWidth,
  124. DWORD dwHeight, WORD wSrcPitch, WORD wDstPitch)
  125. {
  126. DWORD dwHeightLoop;
  127. switch (dwWidth)
  128. {
  129. case 1:
  130. for(dwHeightLoop = 0; dwHeightLoop < dwHeight; dwHeightLoop++)
  131. {
  132. *dwDstStart = MERGE_3_1(*dwDstStart, *dwSrcStart);
  133. (ULONG_PTR)dwSrcStart += wSrcPitch;
  134. (ULONG_PTR)dwDstStart += wDstPitch;
  135. }
  136. break;
  137. case 2:
  138. for(dwHeightLoop = 0; dwHeightLoop < dwHeight; dwHeightLoop++)
  139. {
  140. *dwDstStart = MERGE_2_2(*dwDstStart, *dwSrcStart);
  141. (ULONG_PTR)dwSrcStart += wSrcPitch;
  142. (ULONG_PTR)dwDstStart += wDstPitch;
  143. }
  144. break;
  145. case 3:
  146. for(dwHeightLoop = 0; dwHeightLoop < dwHeight; dwHeightLoop++)
  147. {
  148. *dwDstStart = MERGE_1_3(*dwDstStart, *dwSrcStart);
  149. (ULONG_PTR)dwSrcStart += wSrcPitch;
  150. (ULONG_PTR)dwDstStart += wDstPitch;
  151. }
  152. break;
  153. }
  154. }
  155. /**********************************************************
  156. *
  157. * Name: PackJRSpecialEnd functions
  158. *
  159. * Module Abstract:
  160. * ----------------
  161. * Blts the last few PackJR pixels that are not properly
  162. * aligned (so it can't use the hardware BLTer).
  163. *
  164. * There are 12 of these functions, based on alignment
  165. * and width
  166. *
  167. * Output Parameters:
  168. * ------------------
  169. * none
  170. *
  171. ***********************************************************
  172. * Author:
  173. * Date: 10/06/96
  174. *
  175. * Revision History:
  176. * -----------------
  177. * WHO WHEN WHAT/WHY/HOW
  178. * --- ---- ------------
  179. *
  180. *********************************************************/
  181. VOID NEAR PASCAL PackJRSpecialEnd_0_0 (LPDWORD dwSrcStart, LPDWORD dwDstStart, WORD wWidth)
  182. {
  183. //this should neverbe called
  184. return;
  185. }
  186. VOID NEAR PASCAL PackJRSpecialEnd_0_1(LPDWORD dwSrcStart, LPDWORD dwDstStart, WORD wWidth)
  187. {
  188. *dwDstStart = MERGE_3_1(*dwDstStart, *dwSrcStart);
  189. return;
  190. }
  191. VOID NEAR PASCAL PackJRSpecialEnd_0_2(LPDWORD dwSrcStart, LPDWORD dwDstStart, WORD wWidth)
  192. {
  193. *dwDstStart = MERGE_2_2(*dwDstStart, *dwSrcStart);
  194. return;
  195. }
  196. VOID NEAR PASCAL PackJRSpecialEnd_0_3(LPDWORD dwSrcStart, LPDWORD dwDstStart, WORD wWidth)
  197. {
  198. *dwDstStart = MERGE_1_3(*dwDstStart, *dwSrcStart);
  199. return;
  200. }
  201. VOID NEAR PASCAL PackJRSpecialEnd_1_1(LPDWORD dwSrcStart, LPDWORD dwDstStart, WORD wWidth)
  202. {
  203. *dwDstStart++ = ((*dwSrcStart & 0x07C00000) >>10) |
  204. ((*dwDstStart & 0xFFFE0000)) |
  205. ((AVG_3_TO_1(PAKJR_GET_U(*dwSrcStart), PAKJR_GET_U(*dwDstStart))) << 6) | \
  206. (AVG_3_TO_1(PAKJR_GET_V(*dwSrcStart), PAKJR_GET_V(*dwDstStart)));
  207. return;
  208. }
  209. VOID NEAR PASCAL PackJRSpecialEnd_1_2(LPDWORD dwSrcStart, LPDWORD dwDstStart, WORD wWidth)
  210. {
  211. *dwDstStart++ = ((*dwSrcStart & 0x07FFE000) >> 5) |
  212. ((*dwDstStart & 0xFFC00000)) |
  213. ((AVG_2_TO_2(PAKJR_GET_U(*dwSrcStart), PAKJR_GET_U(*dwDstStart))) << 6) | \
  214. (AVG_2_TO_2(PAKJR_GET_V(*dwSrcStart), PAKJR_GET_V(*dwDstStart)));
  215. return;
  216. }
  217. VOID NEAR PASCAL PackJRSpecialEnd_1_3(LPDWORD dwSrcStart, LPDWORD dwDstStart, WORD wWidth)
  218. {
  219. *dwDstStart++ = ((*dwSrcStart & 0x07FFF000)) |
  220. ((*dwDstStart & 0xF1000000)) |
  221. ((AVG_3_TO_1(PAKJR_GET_U(*dwDstStart), PAKJR_GET_U(*dwSrcStart))) << 6) | \
  222. (AVG_3_TO_1(PAKJR_GET_V(*dwDstStart), PAKJR_GET_V(*dwSrcStart)));
  223. return;
  224. }
  225. VOID NEAR PASCAL PackJRSpecialEnd_2_1(LPDWORD dwSrcStart, LPDWORD dwDstStart, WORD wWidth)
  226. {
  227. *dwDstStart++ = ((*dwSrcStart & 0x0003E000) >> 5) |
  228. ((*dwDstStart & 0xFFFE0000)) |
  229. ((AVG_3_TO_1(PAKJR_GET_U(*dwSrcStart), PAKJR_GET_U(*dwDstStart))) << 6) | \
  230. (AVG_3_TO_1(PAKJR_GET_V(*dwSrcStart), PAKJR_GET_V(*dwDstStart)));
  231. return;
  232. }
  233. VOID NEAR PASCAL PackJRSpecialEnd_2_2(LPDWORD dwSrcStart, LPDWORD dwDstStart, WORD wWidth)
  234. {
  235. *dwDstStart++ = ((*dwSrcStart & 0xFFC00000) >> 10) |
  236. ((*dwDstStart & 0xFFC00000)) |
  237. ((AVG_2_TO_2(PAKJR_GET_U(*dwSrcStart), PAKJR_GET_U(*dwDstStart))) << 6) | \
  238. (AVG_2_TO_2(PAKJR_GET_V(*dwSrcStart), PAKJR_GET_V(*dwDstStart)));
  239. return;
  240. }
  241. VOID NEAR PASCAL PackJRSpecialEnd_2_3(LPDWORD dwSrcStart, LPDWORD dwDstStart, WORD wWidth)
  242. {
  243. *dwDstStart++ = ((*dwSrcStart & 0xFFC00000) >> 10) |
  244. ((*(dwSrcStart + 1) & 0x0001F000) << 10) |
  245. ((*dwDstStart & 0xF1000000)) |
  246. ((AVG_1_2_1(PAKJR_GET_U(*dwDstStart), PAKJR_GET_U(*dwSrcStart), PAKJR_GET_U(*(dwSrcStart+1)))) << 6) | \
  247. (AVG_1_2_1(PAKJR_GET_V(*dwDstStart), PAKJR_GET_V(*dwSrcStart), PAKJR_GET_V(*(dwSrcStart+1))));
  248. return;
  249. }
  250. VOID NEAR PASCAL PackJRSpecialEnd_3_1(LPDWORD dwSrcStart, LPDWORD dwDstStart, WORD wWidth)
  251. {
  252. *dwDstStart++ = ((*dwSrcStart & 0xF1000000) >> 15) |
  253. ((*dwDstStart & 0xFFFE0000)) |
  254. ((AVG_3_TO_1(PAKJR_GET_U(*dwSrcStart), PAKJR_GET_U(*dwDstStart))) << 6) | \
  255. (AVG_3_TO_1(PAKJR_GET_V(*dwSrcStart), PAKJR_GET_V(*dwDstStart)));
  256. return;
  257. }
  258. VOID NEAR PASCAL PackJRSpecialEnd_3_2(LPDWORD dwSrcStart, LPDWORD dwDstStart, WORD wWidth)
  259. {
  260. *dwDstStart++ = ((*dwSrcStart & 0xF1000000) >> 15) |
  261. ((*(dwSrcStart + 1) & 0x0001F000) << 5) |
  262. ((*dwDstStart & 0xFFC00000)) |
  263. ((AVG_1_2_1(PAKJR_GET_U(*dwSrcStart), PAKJR_GET_U(*dwDstStart), PAKJR_GET_U(*(dwSrcStart+1)))) << 6) | \
  264. (AVG_1_2_1(PAKJR_GET_V(*dwSrcStart), PAKJR_GET_V(*dwDstStart), PAKJR_GET_V(*(dwSrcStart+1))));
  265. return;
  266. }
  267. VOID NEAR PASCAL PackJRSpecialEnd_3_3(LPDWORD dwSrcStart, LPDWORD dwDstStart, WORD wWidth)
  268. {
  269. *dwDstStart++ = ((*dwSrcStart & 0xF1000000) >> 15) |
  270. ((*(dwSrcStart + 1) & 0x003FF000) << 5) |
  271. ((*dwDstStart & 0xF1000000)) |
  272. ((AVG_1_2_1(PAKJR_GET_U(*dwDstStart), PAKJR_GET_U(*(dwSrcStart+1)), PAKJR_GET_U(*dwSrcStart))) << 6) | \
  273. (AVG_1_2_1(PAKJR_GET_V(*dwDstStart), PAKJR_GET_V(*(dwSrcStart+1)), PAKJR_GET_V(*dwSrcStart)));
  274. return;
  275. }
  276. /**********************************************************
  277. *
  278. * Name: PackJRAlign functions
  279. *
  280. * Module Abstract:
  281. * ----------------
  282. * These functions handle bliting unaligned PackJR
  283. * data
  284. *
  285. * There are 12 of these functions, based on alignment
  286. * of source and destination
  287. *
  288. * Output Parameters:
  289. * ------------------
  290. * none
  291. *
  292. ***********************************************************
  293. * Author:
  294. * Date: 10/06/96
  295. *
  296. * Revision History:
  297. * -----------------
  298. * WHO WHEN WHAT/WHY/HOW
  299. * --- ---- ------------
  300. *
  301. *********************************************************/
  302. VOID NEAR PASCAL PackJRAlign_1_1 (LPDWORD dwSrcStart, LPDWORD dwDstStart, DWORD dwWidth,
  303. DWORD dwHeight, WORD wSrcPitch, WORD wDstPitch)
  304. {
  305. DWORD dwHeightLoop, dwWidthLoop, i;
  306. for(dwHeightLoop = 0; dwHeightLoop < dwHeight; dwHeightLoop++)
  307. {
  308. dwWidthLoop = dwWidth;
  309. if (dwWidthLoop > 3)
  310. {
  311. *dwDstStart++ = MERGE_3_1(*dwSrcStart, *dwDstStart);
  312. dwWidthLoop-=3;
  313. dwSrcStart++;
  314. }
  315. if (dwWidthLoop > 3)
  316. {
  317. for (i=0; i < (dwWidthLoop >> 2); i++)
  318. *dwDstStart++ = *dwSrcStart++;
  319. dwWidthLoop&=3;
  320. }
  321. if (dwWidthLoop != 0)
  322. npEnd[LOWORD((ULONG_PTR)dwSrcStart & 3)][LOWORD(dwWidthLoop)]
  323. (dwSrcStart, dwDstStart, LOWORD(dwWidthLoop));
  324. (ULONG_PTR)dwSrcStart+= (wSrcPitch - dwWidth + dwWidthLoop);
  325. (ULONG_PTR)dwDstStart+= (wDstPitch - dwWidth + dwWidthLoop);
  326. }
  327. }
  328. VOID NEAR PASCAL PackJRAlign_1_2 (LPDWORD dwSrcStart, LPDWORD dwDstStart, DWORD dwWidth,
  329. DWORD dwHeight, WORD wSrcPitch, WORD wDstPitch)
  330. {
  331. DWORD dwHeightLoop, dwWidthLoop, i;
  332. for(dwHeightLoop = 0; dwHeightLoop < dwHeight; dwHeightLoop++)
  333. {
  334. dwWidthLoop = dwWidth;
  335. if (dwWidthLoop > 3)
  336. {
  337. *dwDstStart++ = ((*dwSrcStart & 0x07FE0000) << 5) |
  338. ((*dwDstStart & 0x003FF000)) |
  339. ((AVG_2_TO_2(PAKJR_GET_U(*dwSrcStart), PAKJR_GET_U(*dwDstStart))) << 6) | \
  340. (AVG_2_TO_2(PAKJR_GET_V(*dwSrcStart), PAKJR_GET_V(*dwDstStart)));
  341. dwWidthLoop-=2;
  342. }
  343. if (dwWidthLoop > 3)
  344. {
  345. for (i=0; i < (dwWidthLoop >> 2); i++)
  346. {
  347. *dwDstStart++ = ((*dwSrcStart & 0xF8000000) >> 15) |
  348. ((*(dwSrcStart + 1) & 0x07FFF000) << 5) |
  349. ((AVG_3_TO_1(PAKJR_GET_U(*dwSrcStart), PAKJR_GET_U(*(dwSrcStart+1)))) << 6) | \
  350. (AVG_3_TO_1(PAKJR_GET_V(*dwSrcStart), PAKJR_GET_V(*(dwSrcStart+1))));
  351. dwSrcStart++;
  352. }
  353. dwWidthLoop&=3;
  354. }
  355. (ULONG_PTR)dwSrcStart+=3;
  356. if (dwWidthLoop != 0)
  357. npEnd[LOWORD((ULONG_PTR)dwSrcStart & 3)][LOWORD(dwWidthLoop)]
  358. (dwSrcStart, dwDstStart, LOWORD(dwWidthLoop));
  359. (ULONG_PTR)dwSrcStart+= (wSrcPitch - dwWidth + dwWidthLoop);
  360. (ULONG_PTR)dwDstStart+= (wDstPitch - dwWidth + dwWidthLoop);
  361. }
  362. }
  363. VOID NEAR PASCAL PackJRAlign_1_3 (LPDWORD dwSrcStart, LPDWORD dwDstStart, DWORD dwWidth,
  364. DWORD dwHeight, WORD wSrcPitch, WORD wDstPitch)
  365. {
  366. DWORD dwHeightLoop, dwWidthLoop, i;
  367. for(dwHeightLoop = 0; dwHeightLoop < dwHeight; dwHeightLoop++)
  368. {
  369. dwWidthLoop = dwWidth;
  370. if (dwWidthLoop > 3)
  371. {
  372. *dwDstStart++ = ((*dwSrcStart & 0x003E0000) << 10) |
  373. ((*dwDstStart & 0x07FFF000)) |
  374. ((AVG_3_TO_1(PAKJR_GET_U(*dwSrcStart), PAKJR_GET_U(*dwDstStart))) << 6) | \
  375. (AVG_3_TO_1(PAKJR_GET_V(*dwSrcStart), PAKJR_GET_V(*dwDstStart)));
  376. dwWidthLoop--;
  377. }
  378. if (dwWidthLoop > 3)
  379. {
  380. for (i=0; i < (dwWidthLoop >> 2); i++)
  381. {
  382. *dwDstStart++ = ((*dwSrcStart & 0xFFC0000) >> 10) |
  383. ((*(dwSrcStart+1) & 0x003FF000) << 10) |
  384. ((AVG_2_TO_2(PAKJR_GET_U(*(dwSrcStart+1)), PAKJR_GET_U(*dwSrcStart))) << 6) | \
  385. (AVG_2_TO_2(PAKJR_GET_V(*(dwSrcStart+1)), PAKJR_GET_V(*dwSrcStart)));
  386. dwSrcStart++;
  387. }
  388. dwWidthLoop&=3;
  389. }
  390. (ULONG_PTR)dwSrcStart+=2;
  391. if (dwWidthLoop != 0)
  392. npEnd[LOWORD((ULONG_PTR)dwSrcStart & 3)][LOWORD(dwWidthLoop)]
  393. (dwSrcStart, dwDstStart, LOWORD(dwWidthLoop));
  394. (ULONG_PTR)dwSrcStart+= (wSrcPitch - dwWidth + dwWidthLoop);
  395. (ULONG_PTR)dwDstStart+= (wDstPitch - dwWidth + dwWidthLoop);
  396. }
  397. }
  398. VOID NEAR PASCAL PackJRAlign_1_0 (LPDWORD dwSrcStart, LPDWORD dwDstStart, DWORD dwWidth,
  399. DWORD dwHeight, WORD wSrcPitch, WORD wDstPitch)
  400. {
  401. DWORD dwHeightLoop, dwWidthLoop, i;
  402. for(dwHeightLoop = 0; dwHeightLoop < dwHeight; dwHeightLoop++)
  403. {
  404. dwWidthLoop = dwWidth;
  405. if (dwWidthLoop > 3)
  406. {
  407. for (i=0; i < (dwWidthLoop >> 2); i++)
  408. {
  409. *dwDstStart++ = ((*dwSrcStart & 0xFFFE0000) >> 5) |
  410. ((*(dwSrcStart+1) & 0x0001E000) << 15) |
  411. ((AVG_3_TO_1(PAKJR_GET_U(*(dwSrcStart+1)), PAKJR_GET_U(*dwSrcStart))) << 6) | \
  412. (AVG_3_TO_1(PAKJR_GET_V(*(dwSrcStart+1)), PAKJR_GET_V(*dwSrcStart)));
  413. dwSrcStart++;
  414. }
  415. dwWidthLoop&=3;
  416. }
  417. (ULONG_PTR)dwSrcStart+=1;
  418. if (dwWidthLoop != 0)
  419. npEnd[LOWORD((ULONG_PTR)dwSrcStart & 3)][LOWORD(dwWidthLoop)]
  420. (dwSrcStart, dwDstStart, LOWORD(dwWidthLoop));
  421. (ULONG_PTR)dwSrcStart+= (wSrcPitch - dwWidth + dwWidthLoop);
  422. (ULONG_PTR)dwDstStart+= (wDstPitch - dwWidth + dwWidthLoop);
  423. }
  424. }
  425. VOID NEAR PASCAL PackJRAlign_2_1 (LPDWORD dwSrcStart, LPDWORD dwDstStart, DWORD dwWidth,
  426. DWORD dwHeight, WORD wSrcPitch, WORD wDstPitch)
  427. {
  428. DWORD dwHeightLoop, dwWidthLoop, i;
  429. for(dwHeightLoop = 0; dwHeightLoop < dwHeight; dwHeightLoop++)
  430. {
  431. dwWidthLoop = dwWidth;
  432. if (dwWidthLoop > 3)
  433. {
  434. *dwDstStart++ = MERGE_1_2_1(*dwSrcStart, *(dwSrcStart+1), *dwDstStart);
  435. dwWidthLoop-=3;
  436. dwSrcStart++;
  437. }
  438. if (dwWidthLoop > 3)
  439. {
  440. for (i=0; i < (dwWidthLoop >> 2); i++)
  441. {
  442. *dwDstStart++ = ((*dwSrcStart & 0xFFFE0000) >> 5) |
  443. ((*(dwSrcStart+1) & 0x0001F000) << 15) |
  444. ((AVG_3_TO_1(PAKJR_GET_U(*(dwSrcStart+1)), PAKJR_GET_U(*dwSrcStart))) << 6) | \
  445. (AVG_3_TO_1(PAKJR_GET_V(*(dwSrcStart+1)), PAKJR_GET_V(*dwSrcStart)));
  446. dwSrcStart++;
  447. }
  448. dwWidthLoop&=3;
  449. }
  450. (ULONG_PTR)dwSrcStart+=1;
  451. if (dwWidthLoop != 0)
  452. npEnd[LOWORD((ULONG_PTR)dwSrcStart & 3)][LOWORD(dwWidthLoop)]
  453. (dwSrcStart, dwDstStart, LOWORD(dwWidthLoop));
  454. (ULONG_PTR)dwSrcStart+= (wSrcPitch - dwWidth + dwWidthLoop);
  455. (ULONG_PTR)dwDstStart+= (wDstPitch - dwWidth + dwWidthLoop);
  456. }
  457. }
  458. VOID NEAR PASCAL PackJRAlign_2_2 (LPDWORD dwSrcStart, LPDWORD dwDstStart, DWORD dwWidth,
  459. DWORD dwHeight, WORD wSrcPitch, WORD wDstPitch)
  460. {
  461. DWORD dwHeightLoop, dwWidthLoop, i;
  462. for(dwHeightLoop = 0; dwHeightLoop < dwHeight; dwHeightLoop++)
  463. {
  464. dwWidthLoop = dwWidth;
  465. if (dwWidthLoop > 3)
  466. {
  467. *dwDstStart++ = MERGE_2_2(*dwSrcStart, *dwDstStart);
  468. dwWidthLoop-=2;
  469. dwSrcStart++;
  470. }
  471. if (dwWidthLoop > 3)
  472. {
  473. for (i=0; i < (dwWidthLoop >> 2); i++)
  474. *dwDstStart++ = *dwSrcStart++;
  475. dwWidthLoop&=3;
  476. }
  477. if (dwWidthLoop != 0)
  478. npEnd[LOWORD((ULONG_PTR)dwSrcStart & 3)][LOWORD(dwWidthLoop)]
  479. (dwSrcStart, dwDstStart, LOWORD(dwWidthLoop));
  480. (ULONG_PTR)dwSrcStart+= (wSrcPitch - dwWidth + dwWidthLoop);
  481. (ULONG_PTR)dwDstStart+= (wDstPitch - dwWidth + dwWidthLoop);
  482. }
  483. }
  484. VOID NEAR PASCAL PackJRAlign_2_3 (LPDWORD dwSrcStart, LPDWORD dwDstStart, DWORD dwWidth,
  485. DWORD dwHeight, WORD wSrcPitch, WORD wDstPitch)
  486. {
  487. DWORD dwHeightLoop, dwWidthLoop, i;
  488. for(dwHeightLoop = 0; dwHeightLoop < dwHeight; dwHeightLoop++)
  489. {
  490. dwWidthLoop = dwWidth;
  491. if (dwWidthLoop > 3)
  492. {
  493. *dwDstStart++ = ((*dwSrcStart & 0x003E0000) << 10) |
  494. ((*dwDstStart & 0x07FFF000)) |
  495. ((AVG_3_TO_1(PAKJR_GET_U(*dwSrcStart), PAKJR_GET_U(*dwDstStart))) << 6) | \
  496. (AVG_3_TO_1(PAKJR_GET_V(*dwSrcStart), PAKJR_GET_V(*dwDstStart)));
  497. dwWidthLoop--;
  498. }
  499. if (dwWidthLoop > 3)
  500. {
  501. for (i=0; i < (dwWidthLoop >> 2); i++)
  502. {
  503. *dwDstStart++ = ((*dwSrcStart & 0xF8000000) >> 15) |
  504. ((*(dwSrcStart + 1) & 0x07FFF000) << 5) |
  505. ((AVG_3_TO_1(PAKJR_GET_U(*dwSrcStart), PAKJR_GET_U(*(dwSrcStart+1)))) << 6) | \
  506. (AVG_3_TO_1(PAKJR_GET_V(*dwSrcStart), PAKJR_GET_V(*(dwSrcStart+1))));
  507. }
  508. dwWidthLoop&=3;
  509. }
  510. (ULONG_PTR)dwSrcStart+=3;
  511. if (dwWidthLoop != 0)
  512. npEnd[LOWORD((ULONG_PTR)dwSrcStart & 3)][LOWORD(dwWidthLoop)]
  513. (dwSrcStart, dwDstStart, LOWORD(dwWidthLoop));
  514. (ULONG_PTR)dwSrcStart+= (wSrcPitch - dwWidth + dwWidthLoop);
  515. (ULONG_PTR)dwDstStart+= (wDstPitch - dwWidth + dwWidthLoop);
  516. }
  517. }
  518. VOID NEAR PASCAL PackJRAlign_2_0 (LPDWORD dwSrcStart, LPDWORD dwDstStart, DWORD dwWidth,
  519. DWORD dwHeight, WORD wSrcPitch, WORD wDstPitch)
  520. {
  521. DWORD dwHeightLoop, dwWidthLoop, i;
  522. for(dwHeightLoop = 0; dwHeightLoop < dwHeight; dwHeightLoop++)
  523. {
  524. dwWidthLoop = dwWidth;
  525. if (dwWidthLoop > 3)
  526. {
  527. for (i=0; i < (dwWidthLoop >> 2); i++)
  528. {
  529. *dwDstStart++ = ((*dwSrcStart & 0xFFC00000) >> 10) |
  530. ((*(dwSrcStart+1) & 0x003FF000) << 10) |
  531. ((AVG_2_TO_2(PAKJR_GET_U(*(dwSrcStart+1)), PAKJR_GET_U(*dwSrcStart))) << 6) | \
  532. (AVG_2_TO_2(PAKJR_GET_V(*(dwSrcStart+1)), PAKJR_GET_V(*dwSrcStart)));
  533. dwSrcStart++;
  534. }
  535. dwWidthLoop&=3;
  536. }
  537. (ULONG_PTR)dwSrcStart+=2;
  538. if (dwWidthLoop != 0)
  539. npEnd[LOWORD((ULONG_PTR)dwSrcStart & 3)][LOWORD(dwWidthLoop)]
  540. (dwSrcStart, dwDstStart, LOWORD(dwWidthLoop));
  541. (ULONG_PTR)dwSrcStart+= (wSrcPitch - dwWidth + dwWidthLoop);
  542. (ULONG_PTR)dwDstStart+= (wDstPitch - dwWidth + dwWidthLoop);
  543. }
  544. }
  545. VOID NEAR PASCAL PackJRAlign_3_1 (LPDWORD dwSrcStart, LPDWORD dwDstStart, DWORD dwWidth,
  546. DWORD dwHeight, WORD wSrcPitch, WORD wDstPitch)
  547. {
  548. DWORD dwHeightLoop, dwWidthLoop, i;
  549. for(dwHeightLoop = 0; dwHeightLoop < dwHeight; dwHeightLoop++)
  550. {
  551. dwWidthLoop = dwWidth;
  552. if (dwWidthLoop > 3)
  553. {
  554. *dwDstStart++ = MERGE_1_1_2(*dwSrcStart, *(dwSrcStart+1), *dwDstStart);
  555. dwWidthLoop-=3;
  556. dwSrcStart++;
  557. }
  558. if (dwWidthLoop > 3)
  559. {
  560. for (i=0; i < (dwWidthLoop >> 2); i++)
  561. {
  562. *dwDstStart++ = ((*(dwSrcStart+1) & 0x003FF000) << 10) |
  563. ((*dwSrcStart & 0xFFC00000) >> 10) |
  564. ((AVG_2_TO_2(PAKJR_GET_U(*(dwSrcStart+1)), PAKJR_GET_U(*dwSrcStart))) << 6) | \
  565. (AVG_2_TO_2(PAKJR_GET_V(*(dwSrcStart+1)), PAKJR_GET_V(*dwSrcStart)));
  566. dwSrcStart++;
  567. }
  568. dwWidthLoop&=3;
  569. }
  570. (ULONG_PTR)dwSrcStart+=2;
  571. if (dwWidthLoop != 0)
  572. npEnd[LOWORD((ULONG_PTR)dwSrcStart & 3)][LOWORD(dwWidthLoop)]
  573. (dwSrcStart, dwDstStart, LOWORD(dwWidthLoop));
  574. (ULONG_PTR)dwSrcStart+= (wSrcPitch - dwWidth + dwWidthLoop);
  575. (ULONG_PTR)dwDstStart+= (wDstPitch - dwWidth + dwWidthLoop);
  576. }
  577. }
  578. VOID NEAR PASCAL PackJRAlign_3_2 (LPDWORD dwSrcStart, LPDWORD dwDstStart, DWORD dwWidth,
  579. DWORD dwHeight, WORD wSrcPitch, WORD wDstPitch)
  580. {
  581. DWORD dwHeightLoop, dwWidthLoop, i;
  582. for(dwHeightLoop = 0; dwHeightLoop < dwHeight; dwHeightLoop++)
  583. {
  584. dwWidthLoop = dwWidth;
  585. if (dwWidthLoop > 3)
  586. {
  587. *dwDstStart++ = MERGE_2_1_1(*dwSrcStart, *(dwSrcStart+1), *dwDstStart);
  588. dwWidthLoop-=2;
  589. dwSrcStart++;
  590. }
  591. if (dwWidthLoop > 3)
  592. {
  593. for (i=0; i < (dwWidthLoop >> 2); i++)
  594. {
  595. *dwDstStart++ = ((*dwSrcStart & 0xFFFE0000) >> 5) |
  596. ((*(dwSrcStart+1) & 0x0001F000) << 15) |
  597. ((AVG_3_TO_1(PAKJR_GET_U(*(dwSrcStart+1)), PAKJR_GET_U(*dwSrcStart))) << 6) | \
  598. (AVG_3_TO_1(PAKJR_GET_V(*(dwSrcStart+1)), PAKJR_GET_V(*dwSrcStart)));
  599. dwSrcStart++;
  600. }
  601. dwWidthLoop&=3;
  602. }
  603. (ULONG_PTR)dwSrcStart+=1;
  604. if (dwWidthLoop != 0)
  605. npEnd[LOWORD((ULONG_PTR)dwSrcStart & 3)][LOWORD(dwWidthLoop)]
  606. (dwSrcStart, dwDstStart, LOWORD(dwWidthLoop));
  607. (ULONG_PTR)dwSrcStart+= (wSrcPitch - dwWidth + dwWidthLoop);
  608. (ULONG_PTR)dwDstStart+= (wDstPitch - dwWidth + dwWidthLoop);
  609. }
  610. }
  611. VOID NEAR PASCAL PackJRAlign_3_3 (LPDWORD dwSrcStart, LPDWORD dwDstStart, DWORD dwWidth,
  612. DWORD dwHeight, WORD wSrcPitch, WORD wDstPitch)
  613. {
  614. DWORD dwHeightLoop, dwWidthLoop, i;
  615. for(dwHeightLoop = 0; dwHeightLoop < dwHeight; dwHeightLoop++)
  616. {
  617. dwWidthLoop = dwWidth;
  618. if (dwWidthLoop > 3)
  619. {
  620. *dwDstStart++ = MERGE_1_3(*dwSrcStart, *dwDstStart);
  621. dwWidthLoop-=1;
  622. dwSrcStart++;
  623. }
  624. if (dwWidthLoop > 3)
  625. {
  626. for (i=0; i < (dwWidthLoop >> 2); i++)
  627. *dwDstStart++ = *dwSrcStart++;
  628. dwWidthLoop&=3;
  629. }
  630. if (dwWidthLoop != 0)
  631. npEnd[LOWORD((ULONG_PTR)dwSrcStart & 3)][LOWORD(dwWidthLoop)]
  632. (dwSrcStart, dwDstStart, LOWORD(dwWidthLoop));
  633. (ULONG_PTR)dwSrcStart+= (wSrcPitch - dwWidth + dwWidthLoop);
  634. (ULONG_PTR)dwDstStart+= (wDstPitch - dwWidth + dwWidthLoop);
  635. }
  636. }
  637. VOID NEAR PASCAL PackJRAlign_3_0 (LPDWORD dwSrcStart, LPDWORD dwDstStart, DWORD dwWidth,
  638. DWORD dwHeight, WORD wSrcPitch, WORD wDstPitch)
  639. {
  640. DWORD dwHeightLoop, dwWidthLoop, i;
  641. for(dwHeightLoop = 0; dwHeightLoop < dwHeight; dwHeightLoop++)
  642. {
  643. dwWidthLoop = dwWidth;
  644. if (dwWidthLoop > 3)
  645. {
  646. for (i=0; i < (dwWidthLoop >> 2); i++)
  647. {
  648. *dwDstStart++ = ((*dwSrcStart & 0xF8000000) >> 15) |
  649. ((*(dwSrcStart + 1) & 0x07FFF000) << 5) |
  650. ((AVG_3_TO_1(PAKJR_GET_U(*dwSrcStart), PAKJR_GET_U(*(dwSrcStart+1)))) << 6) | \
  651. (AVG_3_TO_1(PAKJR_GET_V(*dwSrcStart), PAKJR_GET_V(*(dwSrcStart+1))));
  652. }
  653. dwWidthLoop&=3;
  654. }
  655. (ULONG_PTR)dwSrcStart+=3;
  656. if (dwWidthLoop != 0)
  657. npEnd[LOWORD((ULONG_PTR)dwSrcStart & 3)][LOWORD(dwWidthLoop)]
  658. (dwSrcStart, dwDstStart, LOWORD(dwWidthLoop));
  659. (ULONG_PTR)dwSrcStart+= (wSrcPitch - dwWidth + dwWidthLoop);
  660. (ULONG_PTR)dwDstStart+= (wDstPitch - dwWidth + dwWidthLoop);
  661. }
  662. }
  663. VOID NEAR PASCAL PackJRAlign_0_1 (LPDWORD dwSrcStart, LPDWORD dwDstStart, DWORD dwWidth,
  664. DWORD dwHeight, WORD wSrcPitch, WORD wDstPitch)
  665. {
  666. DWORD dwHeightLoop, dwWidthLoop, i;
  667. for(dwHeightLoop = 0; dwHeightLoop < dwHeight; dwHeightLoop++)
  668. {
  669. dwWidthLoop = dwWidth;
  670. if (dwWidthLoop > 3)
  671. {
  672. *dwDstStart++ = ((*dwDstStart & 0x0001F000) >> 15) |
  673. ((*dwSrcStart & 0x07FFF000) << 5) |
  674. ((AVG_3_TO_1(PAKJR_GET_U(*dwDstStart), PAKJR_GET_U(*dwSrcStart))) << 6) | \
  675. (AVG_3_TO_1(PAKJR_GET_V(*dwDstStart), PAKJR_GET_V(*dwSrcStart)));
  676. dwWidthLoop-=3;
  677. }
  678. if (dwWidthLoop > 3)
  679. {
  680. for (i=0; i < (dwWidthLoop >> 2); i++)
  681. {
  682. *dwDstStart++ = ((*dwSrcStart & 0xF8000000) >> 15) |
  683. ((*(dwSrcStart + 1) & 0x07FFF000) << 5) |
  684. ((AVG_3_TO_1(PAKJR_GET_U(*dwSrcStart), PAKJR_GET_U(*(dwSrcStart+1)))) << 6) | \
  685. (AVG_3_TO_1(PAKJR_GET_V(*dwSrcStart), PAKJR_GET_V(*(dwSrcStart+1))));
  686. dwSrcStart++;
  687. }
  688. dwWidthLoop&=3;
  689. }
  690. (ULONG_PTR)dwSrcStart+=3;
  691. if (dwWidthLoop != 0)
  692. npEnd[LOWORD((ULONG_PTR)dwSrcStart & 3)][LOWORD(dwWidthLoop)]
  693. (dwSrcStart, dwDstStart, LOWORD(dwWidthLoop));
  694. (ULONG_PTR)dwSrcStart+= (wSrcPitch - dwWidth + dwWidthLoop);
  695. (ULONG_PTR)dwDstStart+= (wDstPitch - dwWidth + dwWidthLoop);
  696. }
  697. }
  698. VOID NEAR PASCAL PackJRAlign_0_2 (LPDWORD dwSrcStart, LPDWORD dwDstStart, DWORD dwWidth,
  699. DWORD dwHeight, WORD wSrcPitch, WORD wDstPitch)
  700. {
  701. DWORD dwHeightLoop, dwWidthLoop, i;
  702. for(dwHeightLoop = 0; dwHeightLoop < dwHeight; dwHeightLoop++)
  703. {
  704. dwWidthLoop = dwWidth;
  705. if (dwWidthLoop > 3)
  706. {
  707. *dwDstStart++ = ((*dwDstStart & 0x003FF000)) |
  708. ((*dwSrcStart & 0x003FF000) << 10) |
  709. ((AVG_2_TO_2(PAKJR_GET_U(*dwDstStart), PAKJR_GET_U(*dwSrcStart))) << 6) | \
  710. (AVG_2_TO_2(PAKJR_GET_V(*dwSrcStart), PAKJR_GET_V(*dwSrcStart)));
  711. dwWidthLoop-=2;
  712. }
  713. if (dwWidthLoop > 3)
  714. {
  715. for (i=0; i < (dwWidthLoop >> 2); i++)
  716. {
  717. *dwDstStart++ = ((*(dwSrcStart+1) & 0x003FF000) << 10) |
  718. ((*dwSrcStart & 0xFFC00000) >> 10) |
  719. ((AVG_2_TO_2(PAKJR_GET_U(*(dwSrcStart+1)), PAKJR_GET_U(*dwSrcStart))) << 6) | \
  720. (AVG_2_TO_2(PAKJR_GET_V(*(dwSrcStart+1)), PAKJR_GET_V(*dwSrcStart)));
  721. dwSrcStart++;
  722. }
  723. dwWidthLoop&=3;
  724. }
  725. (ULONG_PTR)dwSrcStart+=2;
  726. if (dwWidthLoop != 0)
  727. npEnd[LOWORD((ULONG_PTR)dwSrcStart & 3)][LOWORD(dwWidthLoop)]
  728. (dwSrcStart, dwDstStart, LOWORD(dwWidthLoop));
  729. (ULONG_PTR)dwSrcStart+= (wSrcPitch - dwWidth + dwWidthLoop);
  730. (ULONG_PTR)dwDstStart+= (wDstPitch - dwWidth + dwWidthLoop);
  731. }
  732. }
  733. VOID NEAR PASCAL PackJRAlign_0_3 (LPDWORD dwSrcStart, LPDWORD dwDstStart, DWORD dwWidth,
  734. DWORD dwHeight, WORD wSrcPitch, WORD wDstPitch)
  735. {
  736. DWORD dwHeightLoop, dwWidthLoop, i;
  737. for(dwHeightLoop = 0; dwHeightLoop < dwHeight; dwHeightLoop++)
  738. {
  739. dwWidthLoop = dwWidth;
  740. if (dwWidthLoop > 3)
  741. {
  742. *dwDstStart++ = ((*dwDstStart & 0x07FFF000)) |
  743. ((*dwSrcStart & 0x0001F000) << 15) |
  744. ((AVG_3_TO_1(PAKJR_GET_U(*dwSrcStart), PAKJR_GET_U(*dwDstStart))) << 6) | \
  745. (AVG_3_TO_1(PAKJR_GET_V(*dwSrcStart), PAKJR_GET_V(*dwDstStart)));
  746. dwWidthLoop--;
  747. }
  748. if (dwWidthLoop > 3)
  749. {
  750. for (i=0; i < (dwWidthLoop >> 2); i++)
  751. {
  752. *dwDstStart++ = ((*dwSrcStart & 0xFFFE0000) >> 5) |
  753. ((*(dwSrcStart+1) & 0x0001F000) << 15) |
  754. ((AVG_3_TO_1(PAKJR_GET_U(*(dwSrcStart+1)), PAKJR_GET_U(*dwSrcStart))) << 6) | \
  755. (AVG_3_TO_1(PAKJR_GET_V(*(dwSrcStart+1)), PAKJR_GET_V(*dwSrcStart)));
  756. dwSrcStart++;
  757. }
  758. dwWidthLoop&=3;
  759. }
  760. (ULONG_PTR)dwSrcStart+=1;
  761. if (dwWidthLoop != 0)
  762. npEnd[LOWORD((ULONG_PTR)dwSrcStart & 3)][LOWORD(dwWidthLoop)]
  763. (dwSrcStart, dwDstStart, LOWORD(dwWidthLoop));
  764. (ULONG_PTR)dwSrcStart+= (wSrcPitch - dwWidth + dwWidthLoop);
  765. (ULONG_PTR)dwDstStart+= (wDstPitch - dwWidth + dwWidthLoop);
  766. }
  767. }
  768. VOID NEAR PASCAL PackJRAlign_0_0 (LPDWORD dwSrcStart, LPDWORD dwDstStart, DWORD dwWidth,
  769. DWORD dwHeight, WORD wSrcPitch, WORD wDstPitch)
  770. {
  771. //This function should never be reached
  772. return;
  773. }
  774. /**********************************************************
  775. *
  776. * Name: PackJRBltAlign
  777. *
  778. * Module Abstract:
  779. * ----------------
  780. * Blts PackJR data that is not DWORD aligned (so it
  781. * can't use the hardware BLTer).
  782. *
  783. * Output Parameters:
  784. * ------------------
  785. * none
  786. *
  787. ***********************************************************
  788. * Author:
  789. * Date: 10/06/96
  790. *
  791. * Revision History:
  792. * -----------------
  793. * WHO WHEN WHAT/WHY/HOW
  794. * --- ---- ------------
  795. *
  796. *********************************************************/
  797. VOID PackJRBltAlign (LPBYTE dwSrcStart, LPBYTE dwDstStart, DWORD dwWidth,
  798. DWORD dwHeight, WORD wSrcPitch, WORD wDstPitch)
  799. {
  800. static NPALIGN npAlign[4][4] = {
  801. (&PackJRAlign_0_0),
  802. (&PackJRAlign_0_1),
  803. (&PackJRAlign_0_2),
  804. (&PackJRAlign_0_3),
  805. (&PackJRAlign_1_0),
  806. (&PackJRAlign_1_1),
  807. (&PackJRAlign_1_2),
  808. (&PackJRAlign_1_3),
  809. (&PackJRAlign_2_0),
  810. (&PackJRAlign_2_1),
  811. (&PackJRAlign_2_2),
  812. (&PackJRAlign_2_3),
  813. (&PackJRAlign_3_0),
  814. (&PackJRAlign_3_1),
  815. (&PackJRAlign_3_2),
  816. (&PackJRAlign_3_3),
  817. };
  818. npAlign[LOWORD((ULONG_PTR)dwSrcStart) & 3][LOWORD((ULONG_PTR)dwDstStart & 3)]
  819. ((LPDWORD)((ULONG_PTR)dwSrcStart & 0xFFFFFFFC),
  820. (LPDWORD)((ULONG_PTR)dwDstStart & 0xFFFFFFFC),
  821. dwWidth, dwHeight, wSrcPitch, wDstPitch);
  822. return;
  823. }
  824. /**********************************************************
  825. *
  826. * Name: PanOverlay1_7555
  827. *
  828. * Module Abstract:
  829. * ----------------
  830. * Save data for panning overlay window one.
  831. * Clip lpVideoRect to panning viewport.
  832. *
  833. * Output Parameters:
  834. * ------------------
  835. * lpVideoRect is clipped to panning viewport.
  836. *
  837. ***********************************************************
  838. * Author: Rita Ma
  839. * Date: 04/01/97
  840. *
  841. * Revision History:
  842. * -----------------
  843. * WHO WHEN WHAT/WHY/HOW
  844. * --- ---- ------------
  845. *
  846. **********************************************************/
  847. BOOL PanOverlay1_7555(
  848. PDEV* ppdev,
  849. LPRECTL lpVideoRect)
  850. {
  851. BYTE* pjPorts;
  852. pjPorts = ppdev->pjPorts;
  853. // Update panning viewport for the 32 bits DLL
  854. // return false if no overlay enable
  855. // if (ppdev->dwPanningFlag & OVERLAY_OLAY_SHOW)
  856. // return(FALSE);
  857. ppdev->rOverlaySrc.left = ppdev->sOverlay1.rSrc.left;
  858. ppdev->rOverlaySrc.top = ppdev->sOverlay1.rSrc.top;
  859. ppdev->rOverlaySrc.right = ppdev->sOverlay1.rSrc.right;
  860. ppdev->rOverlaySrc.bottom = ppdev->sOverlay1.rSrc.bottom;
  861. ppdev->rOverlayDest.left = ppdev->sOverlay1.rDest.left;
  862. ppdev->rOverlayDest.top = ppdev->sOverlay1.rDest.top;
  863. ppdev->rOverlayDest.right = ppdev->sOverlay1.rDest.right;
  864. ppdev->rOverlayDest.bottom = ppdev->sOverlay1.rDest.bottom;
  865. lpVideoRect->left = ppdev->sOverlay1.rDest.left;
  866. lpVideoRect->top = ppdev->sOverlay1.rDest.top;
  867. lpVideoRect->right = ppdev->sOverlay1.rDest.right;
  868. lpVideoRect->bottom = ppdev->sOverlay1.rDest.bottom;
  869. lpVideoRect->left -= ppdev->min_Xscreen;
  870. lpVideoRect->right -= ppdev->min_Xscreen;
  871. lpVideoRect->top -= ppdev->min_Yscreen;
  872. lpVideoRect->bottom -= ppdev->min_Yscreen;
  873. srcLeft_clip = ppdev->rOverlaySrc.left;
  874. srcTop_clip = ppdev->rOverlaySrc.top;
  875. bTop_clip = 0;
  876. //
  877. // clip lpVideoRect to panning viewport
  878. //
  879. if (lpVideoRect->left < 0)
  880. {
  881. srcLeft_clip = (LONG)ppdev->min_Xscreen - ppdev->rOverlayDest.left;
  882. bLeft_clip = 1;
  883. DISPDBG((0, "srcLeft_clip:%x", srcLeft_clip));
  884. lpVideoRect->left = 0;
  885. }
  886. if (lpVideoRect->top < 0)
  887. {
  888. srcTop_clip = (LONG)ppdev->min_Yscreen - ppdev->rOverlayDest.top;
  889. bTop_clip = 1;
  890. DISPDBG((0, "srcTop_clip:%x", srcTop_clip));
  891. lpVideoRect->top = 0;
  892. }
  893. if (lpVideoRect->right > (ppdev->max_Xscreen - ppdev->min_Xscreen)+1)
  894. {
  895. lpVideoRect->right = (ppdev->max_Xscreen - ppdev->min_Xscreen)+1;
  896. }
  897. if (lpVideoRect->bottom > (ppdev->max_Yscreen - ppdev->min_Yscreen)+1)
  898. {
  899. lpVideoRect->bottom =(ppdev->max_Yscreen - ppdev->min_Yscreen)+1;
  900. }
  901. return (TRUE);
  902. } // VOID PanOverlay1_Init
  903. /**********************************************************
  904. *
  905. * Name: PanOverlay1_Init
  906. *
  907. * Module Abstract:
  908. * ----------------
  909. * Save data for panning overlay window one.
  910. * Clip lpVideoRect to panning viewport.
  911. *
  912. * Output Parameters:
  913. * ------------------
  914. * lpVideoRect is clipped to panning viewport.
  915. *
  916. ***********************************************************
  917. * Author: Rita Ma
  918. * Date: 04/01/97
  919. *
  920. * Revision History:
  921. * -----------------
  922. * WHO WHEN WHAT/WHY/HOW
  923. * --- ---- ------------
  924. *
  925. **********************************************************/
  926. VOID PanOverlay1_Init(PDEV* ppdev,PDD_SURFACE_LOCAL lpSurface,
  927. LPRECTL lpVideoRect, LPRECTL lpOverlaySrc, LPRECTL lpOverlayDest,
  928. DWORD dwFourcc, WORD wBitCount)
  929. {
  930. //
  931. // save these for panning code to use
  932. //
  933. ppdev->lPitch_gbls = lpSurface->lpGbl->lPitch;
  934. ppdev->fpVidMem_gbls = lpSurface->lpGbl->fpVidMem;
  935. // ppdev->dwReserved1_lcls = lpSurface->dwReserved1;
  936. ppdev->sOverlay1.dwFourcc = dwFourcc;
  937. ppdev->sOverlay1.wBitCount= wBitCount;
  938. ppdev->sOverlay1.lAdjustSource = 0L;
  939. ppdev->dwPanningFlag |= OVERLAY_OLAY_SHOW;
  940. ppdev->sOverlay1.rDest.left = lpOverlayDest->left;
  941. ppdev->sOverlay1.rDest.right = lpOverlayDest->right;
  942. ppdev->sOverlay1.rDest.top = lpOverlayDest->top;
  943. ppdev->sOverlay1.rDest.bottom= lpOverlayDest->bottom;
  944. ppdev->sOverlay1.rSrc.left = lpOverlaySrc->left;
  945. ppdev->sOverlay1.rSrc.right = lpOverlaySrc->right;
  946. ppdev->sOverlay1.rSrc.top = lpOverlaySrc->top;
  947. ppdev->sOverlay1.rSrc.bottom = lpOverlaySrc->bottom;
  948. lpVideoRect->left = lpOverlayDest->left;
  949. lpVideoRect->right = lpOverlayDest->right;
  950. lpVideoRect->top = lpOverlayDest->top;
  951. lpVideoRect->bottom = lpOverlayDest->bottom;
  952. //
  953. // adjust to panning viewport
  954. //
  955. lpVideoRect->left -= (LONG)ppdev->min_Xscreen;
  956. lpVideoRect->right -= (LONG)ppdev->min_Xscreen;
  957. lpVideoRect->top -= (LONG)ppdev->min_Yscreen;
  958. lpVideoRect->bottom -= (LONG)ppdev->min_Yscreen;
  959. srcLeft_clip = lpOverlaySrc->left;
  960. srcTop_clip = lpOverlaySrc->top;
  961. bLeft_clip = 0;
  962. bTop_clip = 0;
  963. //
  964. // clip lpVideoRect to panning viewport
  965. //
  966. if (lpVideoRect->left < 0)
  967. {
  968. srcLeft_clip = (LONG)ppdev->min_Xscreen - lpOverlayDest->left;
  969. bLeft_clip = 1;
  970. DISPDBG((0, "srcLeft_clip:%x", srcLeft_clip));
  971. lpVideoRect->left = 0;
  972. }
  973. if (lpVideoRect->top < 0)
  974. {
  975. srcTop_clip = (LONG)ppdev->min_Yscreen - lpOverlayDest->top;
  976. bTop_clip = 1;
  977. DISPDBG((0, "srcTop_clip:%x", srcTop_clip));
  978. lpVideoRect->top = 0;
  979. }
  980. if (lpVideoRect->right > (ppdev->max_Xscreen - ppdev->min_Xscreen)+1)
  981. {
  982. lpVideoRect->right = (ppdev->max_Xscreen - ppdev->min_Xscreen)+1;
  983. }
  984. if (lpVideoRect->bottom > (ppdev->max_Yscreen - ppdev->min_Yscreen)+1)
  985. {
  986. lpVideoRect->bottom =(ppdev->max_Yscreen - ppdev->min_Yscreen)+1;
  987. }
  988. } // VOID PanOverlay1_Init
  989. #endif // endif DIRECTDRAW