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.

928 lines
26 KiB

  1. /*************************************************************************\
  2. * Module Name: engstrps.cxx
  3. *
  4. * Strip drawing for bitmap simulation
  5. *
  6. * Created: 5-Apr-91
  7. * Author: Paul Butzi
  8. *
  9. * Copyright (c) 1990-1999 Microsoft Corporation
  10. \**************************************************************************/
  11. #include "precomp.hxx"
  12. #include "engline.hxx"
  13. /******************************Public*Routine******************************\
  14. * VOID vStripSolidHorizontal(pstrip, pbmi, pls)
  15. *
  16. * Draws a near-horizontal line left to right.
  17. *
  18. * History:
  19. * 22-Feb-1992 -by- J. Andrew Goossen [andrewgo]
  20. * Changed a couple of things.
  21. *
  22. * 5-Apr-1991 -by- Paul Butzi [paulb]
  23. * Wrote it.
  24. \**************************************************************************/
  25. VOID vStripSolidHorizontal(
  26. STRIP* pstrip, // Indicates which pixels to light
  27. BMINFO* pbmi, // Data and masks for bitmap format
  28. LINESTATE* pls) // Color and style state info about line
  29. {
  30. ASSERTGDI(pstrip->cStrips > 0, "Non-positive count");
  31. LONG* plEnd = &pstrip->alStrips[pstrip->cStrips];
  32. LONG* pl = &pstrip->alStrips[0];
  33. LONG iPixel = pstrip->iPixel;
  34. LONG cjDelta = pstrip->lDelta * (LONG)sizeof(CHUNK);
  35. if (pstrip->flFlips & FL_FLIP_V)
  36. cjDelta = -cjDelta;
  37. register CHUNK chAnd = pls->chAnd;
  38. register CHUNK chXor = pls->chXor;
  39. register CHUNK* pchScreen = pstrip->pchScreen;
  40. register ULONG cChunks;
  41. register CHUNK maskEnd;
  42. register CHUNK maskStart = pbmi->pamask[iPixel];
  43. do {
  44. iPixel += *pl;
  45. cChunks = iPixel >> pbmi->cShift;
  46. iPixel &= pbmi->maskPixel;
  47. maskEnd = ~(pbmi->pamask[iPixel]);
  48. if (cChunks == 0)
  49. {
  50. MASK mask = maskEnd & maskStart;
  51. *pchScreen = (*pchScreen & (chAnd | ~mask)) ^ (chXor & mask);
  52. }
  53. else
  54. {
  55. *pchScreen = (*pchScreen & (chAnd | ~maskStart)) ^
  56. (chXor & maskStart);
  57. pchScreen++;
  58. for (; cChunks > 1; cChunks--)
  59. {
  60. *pchScreen = (*pchScreen & chAnd) ^ chXor;
  61. pchScreen++;
  62. }
  63. if (maskEnd != 0)
  64. {
  65. *pchScreen = (*pchScreen & (chAnd | ~maskEnd)) ^
  66. (chXor & maskEnd);
  67. }
  68. }
  69. // Done with strip, make side step:
  70. maskStart = ~maskEnd;
  71. pchScreen = (CHUNK*) ((BYTE*) pchScreen + cjDelta);
  72. } while (++pl < plEnd);
  73. pstrip->iPixel = iPixel;
  74. pstrip->pchScreen = pchScreen;
  75. }
  76. /******************************Public*Routine******************************\
  77. * VOID vStripSolidVertical(pstrip, pbmi, pls)
  78. *
  79. * Draws a near-vertical line left to right.
  80. *
  81. * History:
  82. * 22-Feb-1992 -by- J. Andrew Goossen [andrewgo]
  83. * Changed a couple of things.
  84. *
  85. * 5-Apr-1991 -by- Paul Butzi [paulb]
  86. * Wrote it.
  87. \**************************************************************************/
  88. VOID vStripSolidVertical(
  89. STRIP* pstrip, // Indicates which pixels to light
  90. BMINFO* pbmi, // Data and masks for bitmap format
  91. LINESTATE* pls) // Color and style state info about line
  92. {
  93. ASSERTGDI(pstrip->cStrips > 0, "Non-positive count");
  94. LONG* plEnd = &pstrip->alStrips[pstrip->cStrips];
  95. LONG* pl = &pstrip->alStrips[0];
  96. LONG cjDelta = pstrip->lDelta * (LONG)sizeof(CHUNK);
  97. if (pstrip->flFlips & FL_FLIP_V)
  98. cjDelta = -cjDelta;
  99. LONG iPixel = pstrip->iPixel;
  100. CHUNK* pchScreen = pstrip->pchScreen;
  101. CHUNK chXor = pls->chXor;
  102. CHUNK chAnd = pls->chAnd;
  103. do {
  104. // Paint strip:
  105. MASK maskXor = chXor & pbmi->pamaskPel[iPixel];
  106. MASK maskAnd = chAnd | ~pbmi->pamaskPel[iPixel];
  107. LONG c = *pl;
  108. do {
  109. *pchScreen = (*pchScreen & maskAnd) ^ maskXor;
  110. pchScreen = (CHUNK*) ((BYTE*) pchScreen + cjDelta);
  111. } while (--c != 0);
  112. // Done with strip, make side step and recompute masks:
  113. iPixel++;
  114. pchScreen += (iPixel >> pbmi->cShift);
  115. iPixel &= pbmi->maskPixel;
  116. } while (++pl < plEnd);
  117. pstrip->iPixel = iPixel;
  118. pstrip->pchScreen = pchScreen;
  119. }
  120. /******************************Public*Routine******************************\
  121. * VOID vStripSolidDiagonal(pstrip, pbmi, pls)
  122. *
  123. * Draws a near-diagonal line left to right.
  124. *
  125. * History:
  126. * 11-May-1992 -by- J. Andrew Goossen [andrewgo]
  127. * Wrote it.
  128. \**************************************************************************/
  129. VOID vStripSolidDiagonal(
  130. STRIP* pstrip, // Indicates which pixels to light
  131. BMINFO* pbmi, // Data and masks for bitmap format
  132. LINESTATE* pls) // Color and style state info about line
  133. {
  134. ASSERTGDI(pstrip->cStrips > 0, "Non-positive count");
  135. LONG* plEnd = &pstrip->alStrips[pstrip->cStrips];
  136. LONG* pl = &pstrip->alStrips[0];
  137. LONG cjDelta = pstrip->lDelta * (LONG)sizeof(CHUNK);
  138. if (pstrip->flFlips & FL_FLIP_V)
  139. cjDelta = -cjDelta;
  140. LONG iPixel = pstrip->iPixel;
  141. CHUNK* pchScreen = pstrip->pchScreen;
  142. CHUNK chXor = pls->chXor;
  143. CHUNK chAnd = pls->chAnd;
  144. do {
  145. // Paint strip:
  146. register LONG c = *pl;
  147. while (TRUE)
  148. {
  149. MASK maskXor = chXor & pbmi->pamaskPel[iPixel];
  150. MASK maskAnd = chAnd | ~pbmi->pamaskPel[iPixel];
  151. *pchScreen = (*pchScreen & maskAnd) ^ maskXor;
  152. if (--c == 0)
  153. break;
  154. iPixel++;
  155. pchScreen += (iPixel >> pbmi->cShift);
  156. iPixel &= pbmi->maskPixel;
  157. pchScreen = (CHUNK*) ((BYTE*) pchScreen + cjDelta);
  158. }
  159. // Do a side step:
  160. if (pstrip->flFlips & FL_FLIP_D)
  161. pchScreen = (CHUNK*) ((BYTE*) pchScreen + cjDelta);
  162. else
  163. {
  164. iPixel++;
  165. pchScreen += (iPixel >> pbmi->cShift);
  166. iPixel &= pbmi->maskPixel;
  167. }
  168. } while (++pl < plEnd);
  169. pstrip->iPixel = iPixel;
  170. pstrip->pchScreen = pchScreen;
  171. }
  172. /******************************Public*Routine******************************\
  173. * VOID vStripStyledHorizontal(pstrip, pbmi, pls)
  174. *
  175. * Draws a styled near-horizontal line left to right.
  176. *
  177. * History:
  178. * 22-Feb-1992 -by- J. Andrew Goossen [andrewgo]
  179. * Wrote it.
  180. \**************************************************************************/
  181. VOID vStripStyledHorizontal(
  182. STRIP* pstrip, // Indicates which pixels to light
  183. BMINFO* pbmi, // Data and masks for bitmap format
  184. LINESTATE* pls) // Color and style state info about line
  185. {
  186. ASSERTGDI(pstrip->cStrips > 0, "Non-positive count");
  187. LONG* plEnd = &pstrip->alStrips[pstrip->cStrips];
  188. LONG* pl = &pstrip->alStrips[0];
  189. LONG iPixel = pstrip->iPixel;
  190. LONG cjDelta = pstrip->lDelta * (LONG)sizeof(CHUNK);
  191. if (pstrip->flFlips & FL_FLIP_V)
  192. cjDelta = -cjDelta;
  193. CHUNK* pchScreen = pstrip->pchScreen;
  194. CHUNK chAnd = pls->chAnd;
  195. CHUNK chXor = pls->chXor;
  196. BOOL bIsGap = pls->bIsGap;
  197. STYLEPOS spRemaining = pls->spRemaining;
  198. do {
  199. LONG ll = *pl;
  200. do {
  201. if (!bIsGap)
  202. {
  203. MASK maskXor = chXor & pbmi->pamaskPel[iPixel];
  204. MASK maskAnd = chAnd | ~pbmi->pamaskPel[iPixel];
  205. *pchScreen = (*pchScreen & maskAnd) ^ maskXor;
  206. }
  207. iPixel++;
  208. pchScreen += iPixel >> pbmi->cShift;
  209. iPixel &= pbmi->maskPixel;
  210. spRemaining -= pls->ulStepRun;
  211. if (spRemaining <= 0)
  212. {
  213. if (++pls->psp > pls->pspEnd)
  214. pls->psp = pls->pspStart;
  215. spRemaining += *pls->psp;
  216. bIsGap = !bIsGap;
  217. }
  218. } while (--ll != 0);
  219. // Done with strip, make side step:
  220. pchScreen = (CHUNK*) ((BYTE*) pchScreen + cjDelta);
  221. spRemaining -= pls->ulStepSide;
  222. if (spRemaining <= 0)
  223. {
  224. if (++pls->psp > pls->pspEnd)
  225. pls->psp = pls->pspStart;
  226. spRemaining += *pls->psp;
  227. bIsGap = !bIsGap;
  228. }
  229. } while (++pl != plEnd);
  230. pstrip->iPixel = iPixel;
  231. pstrip->pchScreen = pchScreen;
  232. pls->bIsGap = bIsGap;
  233. pls->spRemaining = spRemaining;
  234. }
  235. /******************************Public*Routine******************************\
  236. * VOID vStripStyledVertical(pstrip, pbmi, pls)
  237. *
  238. * Draws a styled near-vertical line left to right.
  239. *
  240. * History:
  241. * 22-Feb-1992 -by- J. Andrew Goossen [andrewgo]
  242. * Wrote it.
  243. \**************************************************************************/
  244. VOID vStripStyledVertical(
  245. STRIP* pstrip, // Indicates which pixels to light
  246. BMINFO* pbmi, // Data and masks for bitmap format
  247. LINESTATE* pls) // Color and style state info about line
  248. {
  249. ASSERTGDI(pstrip->cStrips > 0, "Non-positive count");
  250. LONG* plEnd = &pstrip->alStrips[pstrip->cStrips];
  251. LONG* pl = &pstrip->alStrips[0];
  252. LONG cjDelta = pstrip->lDelta * (LONG)sizeof(CHUNK);
  253. if (pstrip->flFlips & FL_FLIP_V)
  254. cjDelta = -cjDelta;
  255. LONG iPixel = pstrip->iPixel;
  256. CHUNK* pchScreen = pstrip->pchScreen;
  257. CHUNK chXor = pls->chXor;
  258. CHUNK chAnd = pls->chAnd;
  259. BOOL bIsGap = pls->bIsGap;
  260. STYLEPOS spRemaining = pls->spRemaining;
  261. do {
  262. // Paint strip:
  263. MASK maskXor = chXor & pbmi->pamaskPel[iPixel];
  264. MASK maskAnd = chAnd | ~pbmi->pamaskPel[iPixel];
  265. LONG c = *pl;
  266. do {
  267. if (!bIsGap)
  268. *pchScreen = (*pchScreen & maskAnd) ^ maskXor;
  269. pchScreen = (CHUNK*) ((BYTE*) pchScreen + cjDelta);
  270. spRemaining -= pls->ulStepRun;
  271. if (spRemaining <= 0)
  272. {
  273. if (++pls->psp > pls->pspEnd)
  274. pls->psp = pls->pspStart;
  275. spRemaining += *pls->psp;
  276. bIsGap = !bIsGap;
  277. }
  278. } while (--c != 0);
  279. // Done with strip, make side step and recompute masks:
  280. iPixel++;
  281. pchScreen += (iPixel >> pbmi->cShift);
  282. iPixel &= pbmi->maskPixel;
  283. spRemaining -= pls->ulStepSide;
  284. if (spRemaining <= 0)
  285. {
  286. if (++pls->psp > pls->pspEnd)
  287. pls->psp = pls->pspStart;
  288. spRemaining += *pls->psp;
  289. bIsGap = !bIsGap;
  290. }
  291. } while (++pl < plEnd);
  292. pstrip->iPixel = iPixel;
  293. pstrip->pchScreen = pchScreen;
  294. pls->bIsGap = bIsGap;
  295. pls->spRemaining = spRemaining;
  296. }
  297. /******************************Public*Routine******************************\
  298. * VOID vStripStyledDiagonal(pstrip, pbmi, pls)
  299. *
  300. * Draws a styled near-diagonal line left to right.
  301. *
  302. * History:
  303. * 22-Feb-1992 -by- J. Andrew Goossen [andrewgo]
  304. * Wrote it.
  305. \**************************************************************************/
  306. VOID vStripStyledDiagonal(
  307. STRIP* pstrip, // Indicates which pixels to light
  308. BMINFO* pbmi, // Data and masks for bitmap format
  309. LINESTATE* pls) // Color and style state info about line
  310. {
  311. ASSERTGDI(pstrip->cStrips > 0, "Non-positive count");
  312. LONG* plEnd = &pstrip->alStrips[pstrip->cStrips];
  313. LONG* pl = &pstrip->alStrips[0];
  314. LONG cjDelta = pstrip->lDelta * (LONG)sizeof(CHUNK);
  315. if (pstrip->flFlips & FL_FLIP_V)
  316. cjDelta = -cjDelta;
  317. LONG iPixel = pstrip->iPixel;
  318. CHUNK* pchScreen = pstrip->pchScreen;
  319. CHUNK chXor = pls->chXor;
  320. CHUNK chAnd = pls->chAnd;
  321. BOOL bIsGap = pls->bIsGap;
  322. STYLEPOS spRemaining = pls->spRemaining;
  323. do {
  324. // Paint strip:
  325. register LONG c = *pl;
  326. while (TRUE)
  327. {
  328. if (!bIsGap)
  329. {
  330. MASK maskXor = chXor & pbmi->pamaskPel[iPixel];
  331. MASK maskAnd = chAnd | ~pbmi->pamaskPel[iPixel];
  332. *pchScreen = (*pchScreen & maskAnd) ^ maskXor;
  333. }
  334. if (--c == 0)
  335. break;
  336. spRemaining -= pls->ulStepDiag;
  337. if (spRemaining <= 0)
  338. {
  339. if (++pls->psp > pls->pspEnd)
  340. pls->psp = pls->pspStart;
  341. spRemaining += *pls->psp;
  342. bIsGap = !bIsGap;
  343. }
  344. iPixel++;
  345. pchScreen += (iPixel >> pbmi->cShift);
  346. iPixel &= pbmi->maskPixel;
  347. pchScreen = (CHUNK*) ((BYTE*) pchScreen + cjDelta);
  348. }
  349. // Do a side step:
  350. spRemaining -= pls->ulStepRun;
  351. if (spRemaining <= 0)
  352. {
  353. if (++pls->psp > pls->pspEnd)
  354. pls->psp = pls->pspStart;
  355. spRemaining += *pls->psp;
  356. bIsGap = !bIsGap;
  357. }
  358. if (pstrip->flFlips & FL_FLIP_D)
  359. pchScreen = (CHUNK*) ((BYTE*) pchScreen + cjDelta);
  360. else
  361. {
  362. iPixel++;
  363. pchScreen += (iPixel >> pbmi->cShift);
  364. iPixel &= pbmi->maskPixel;
  365. }
  366. } while (++pl < plEnd);
  367. pstrip->iPixel = iPixel;
  368. pstrip->pchScreen = pchScreen;
  369. pls->bIsGap = bIsGap;
  370. pls->spRemaining = spRemaining;
  371. }
  372. /******************************Public*Routine******************************\
  373. * VOID vStripSolidHorizontal24(pstrip, pbmi, pls)
  374. *
  375. * Draws a 24bpp near-horizontal line left to right.
  376. *
  377. * If 24bpp line performance is an issue, these routines can be rewritten
  378. * to be a lot more complicated but take better advantage of 32-bit moves.
  379. *
  380. * History:
  381. * 4-May-1992 -by- J. Andrew Goossen [andrewgo]
  382. * Wrote it.
  383. \**************************************************************************/
  384. VOID vStripSolidHorizontal24(
  385. STRIP* pstrip, // Indicates which pixels to light
  386. BMINFO* pbmi, // Data and masks for bitmap format
  387. LINESTATE* pls) // Color and style state info about line
  388. {
  389. DONTUSE(pbmi);
  390. ASSERTGDI(pstrip->cStrips > 0, "Non-positive count");
  391. LONG* plEnd = &pstrip->alStrips[pstrip->cStrips];
  392. LONG* pl = &pstrip->alStrips[0];
  393. LONG cjDelta = pstrip->lDelta * (LONG)sizeof(CHUNK);
  394. if (pstrip->flFlips & FL_FLIP_V)
  395. cjDelta = -cjDelta;
  396. register CHUNK chAnd = pls->chAnd;
  397. register CHUNK chXor = pls->chXor;
  398. register BYTE* pjScreen = (BYTE*) pstrip->pchScreen;
  399. do {
  400. LONG c = *pl;
  401. do {
  402. *(pjScreen++) = (*pjScreen & (BYTE) (chAnd))
  403. ^ (BYTE) (chXor);
  404. *(pjScreen++) = (*pjScreen & (BYTE) (chAnd >> 8))
  405. ^ (BYTE) (chXor >> 8);
  406. *(pjScreen++) = (*pjScreen & (BYTE) (chAnd >> 16))
  407. ^ (BYTE) (chXor >> 16);
  408. } while (--c != 0);
  409. pjScreen += cjDelta;
  410. } while (++pl < plEnd);
  411. pstrip->pchScreen = (CHUNK*) pjScreen;
  412. }
  413. /******************************Public*Routine******************************\
  414. * VOID vStripSolidVertical24(pstrip, pbmi, pls)
  415. *
  416. * Draws a 24bpp near-vertical line left to right.
  417. *
  418. * History:
  419. * 4-May-1992 -by- J. Andrew Goossen [andrewgo]
  420. * Wrote it.
  421. \**************************************************************************/
  422. VOID vStripSolidVertical24(
  423. STRIP* pstrip, // Indicates which pixels to light
  424. BMINFO* pbmi, // Data and masks for bitmap format
  425. LINESTATE* pls) // Color and style state info about line
  426. {
  427. DONTUSE(pbmi);
  428. ASSERTGDI(pstrip->cStrips > 0, "Non-positive count");
  429. LONG* plEnd = &pstrip->alStrips[pstrip->cStrips];
  430. LONG* pl = &pstrip->alStrips[0];
  431. LONG cjDelta = pstrip->lDelta * (LONG)sizeof(CHUNK);
  432. if (pstrip->flFlips & FL_FLIP_V)
  433. cjDelta = -cjDelta;
  434. // Adjust because we always lay out 2 bytes before adding cjDelta:
  435. cjDelta -= 2;
  436. BYTE* pjScreen = (BYTE*) pstrip->pchScreen;
  437. CHUNK chXor = pls->chXor;
  438. CHUNK chAnd = pls->chAnd;
  439. do {
  440. // Paint strip:
  441. LONG c = *pl;
  442. do {
  443. *(pjScreen++) = (*pjScreen & (BYTE) (chAnd))
  444. ^ (BYTE) (chXor);
  445. *(pjScreen++) = (*pjScreen & (BYTE) (chAnd >> 8))
  446. ^ (BYTE) (chXor >> 8);
  447. *(pjScreen) = (*pjScreen & (BYTE) (chAnd >> 16))
  448. ^ (BYTE) (chXor >> 16);
  449. pjScreen += cjDelta;
  450. } while (--c != 0);
  451. // Done with strip, make side step:
  452. pjScreen += 3;
  453. } while (++pl < plEnd);
  454. pstrip->pchScreen = (CHUNK*) pjScreen;
  455. }
  456. /******************************Public*Routine******************************\
  457. * VOID vStripSolidDiagonal24(pstrip, pbmi, pls)
  458. *
  459. * Draws a 24bpp near-diagonal line left to right.
  460. *
  461. * History:
  462. * 4-May-1992 -by- J. Andrew Goossen [andrewgo]
  463. * Wrote it.
  464. \**************************************************************************/
  465. VOID vStripSolidDiagonal24(
  466. STRIP* pstrip, // Indicates which pixels to light
  467. BMINFO* pbmi, // Data and masks for bitmap format
  468. LINESTATE* pls) // Color and style state info about line
  469. {
  470. DONTUSE(pbmi);
  471. ASSERTGDI(pstrip->cStrips > 0, "Non-positive count");
  472. LONG* plEnd = &pstrip->alStrips[pstrip->cStrips];
  473. LONG* pl = &pstrip->alStrips[0];
  474. LONG cjDelta = pstrip->lDelta * (LONG)sizeof(CHUNK);
  475. if (pstrip->flFlips & FL_FLIP_V)
  476. cjDelta = -cjDelta;
  477. BYTE* pjScreen = (BYTE*) pstrip->pchScreen;
  478. CHUNK chXor = pls->chXor;
  479. CHUNK chAnd = pls->chAnd;
  480. do {
  481. // Paint strip:
  482. register LONG c = *pl;
  483. while (TRUE)
  484. {
  485. *(pjScreen++) = (*pjScreen & (BYTE) (chAnd))
  486. ^ (BYTE) (chXor);
  487. *(pjScreen++) = (*pjScreen & (BYTE) (chAnd >> 8))
  488. ^ (BYTE) (chXor >> 8);
  489. *(pjScreen++) = (*pjScreen & (BYTE) (chAnd >> 16))
  490. ^ (BYTE) (chXor >> 16);
  491. if (--c == 0)
  492. break;
  493. pjScreen += cjDelta;
  494. }
  495. if (pstrip->flFlips & FL_FLIP_D)
  496. pjScreen += cjDelta - 3;
  497. } while (++pl < plEnd);
  498. pstrip->pchScreen = (CHUNK*) pjScreen;
  499. }
  500. /******************************Public*Routine******************************\
  501. * VOID vStripStyledHorizontal24(pstrip, pbmi, pls)
  502. *
  503. * Draws a 24bpp styled near-horizontal line left to right.
  504. *
  505. * History:
  506. * 22-Feb-1992 -by- J. Andrew Goossen [andrewgo]
  507. * Wrote it.
  508. \**************************************************************************/
  509. VOID vStripStyledHorizontal24(
  510. STRIP* pstrip, // Indicates which pixels to light
  511. BMINFO* pbmi, // Data and masks for bitmap format
  512. LINESTATE* pls) // Color and style state info about line
  513. {
  514. DONTUSE(pbmi);
  515. ASSERTGDI(pstrip->cStrips > 0, "Non-positive count");
  516. LONG* plEnd = &pstrip->alStrips[pstrip->cStrips];
  517. LONG* pl = &pstrip->alStrips[0];
  518. LONG cjDelta = pstrip->lDelta * (LONG)sizeof(CHUNK);
  519. if (pstrip->flFlips & FL_FLIP_V)
  520. cjDelta = -cjDelta;
  521. CHUNK chAnd = pls->chAnd;
  522. CHUNK chXor = pls->chXor;
  523. BOOL bIsGap = pls->bIsGap;
  524. STYLEPOS spRemaining = pls->spRemaining;
  525. BYTE* pjScreen = (BYTE*) pstrip->pchScreen;
  526. do {
  527. LONG ll = *pl;
  528. do {
  529. if (bIsGap)
  530. pjScreen += 3;
  531. else
  532. {
  533. *(pjScreen++) = (*pjScreen & (BYTE) (chAnd))
  534. ^ (BYTE) (chXor);
  535. *(pjScreen++) = (*pjScreen & (BYTE) (chAnd >> 8))
  536. ^ (BYTE) (chXor >> 8);
  537. *(pjScreen++) = (*pjScreen & (BYTE) (chAnd >> 16))
  538. ^ (BYTE) (chXor >> 16);
  539. }
  540. spRemaining -= pls->ulStepRun;
  541. if (spRemaining <= 0)
  542. {
  543. if (++pls->psp > pls->pspEnd)
  544. pls->psp = pls->pspStart;
  545. spRemaining += *pls->psp;
  546. bIsGap = !bIsGap;
  547. }
  548. } while (--ll != 0);
  549. // Done with strip, make side step:
  550. pjScreen += cjDelta;
  551. spRemaining -= pls->ulStepSide;
  552. if (spRemaining <= 0)
  553. {
  554. if (++pls->psp > pls->pspEnd)
  555. pls->psp = pls->pspStart;
  556. spRemaining += *pls->psp;
  557. bIsGap = !bIsGap;
  558. }
  559. } while (++pl != plEnd);
  560. pstrip->pchScreen = (CHUNK*) pjScreen;
  561. pls->bIsGap = bIsGap;
  562. pls->spRemaining = spRemaining;
  563. }
  564. /******************************Public*Routine******************************\
  565. * VOID vStripStyledVertical24(pstrip, pbmi, pls)
  566. *
  567. * Draws a 24bpp styled near-vertical line left to right.
  568. *
  569. * History:
  570. * 22-Feb-1992 -by- J. Andrew Goossen [andrewgo]
  571. * Wrote it.
  572. \**************************************************************************/
  573. VOID vStripStyledVertical24(
  574. STRIP* pstrip, // Indicates which pixels to light
  575. BMINFO* pbmi, // Data and masks for bitmap format
  576. LINESTATE* pls) // Color and style state info about line
  577. {
  578. DONTUSE(pbmi);
  579. ASSERTGDI(pstrip->cStrips > 0, "Non-positive count");
  580. LONG* plEnd = &pstrip->alStrips[pstrip->cStrips];
  581. LONG* pl = &pstrip->alStrips[0];
  582. LONG cjDelta = pstrip->lDelta * (LONG)sizeof(CHUNK);
  583. if (pstrip->flFlips & FL_FLIP_V)
  584. cjDelta = -cjDelta;
  585. CHUNK chXor = pls->chXor;
  586. CHUNK chAnd = pls->chAnd;
  587. BOOL bIsGap = pls->bIsGap;
  588. STYLEPOS spRemaining = pls->spRemaining;
  589. BYTE* pjScreen = (BYTE*) pstrip->pchScreen;
  590. do {
  591. // Paint strip:
  592. LONG c = *pl;
  593. do {
  594. if (!bIsGap)
  595. {
  596. *(pjScreen++) = (*pjScreen & (BYTE) (chAnd))
  597. ^ (BYTE) (chXor);
  598. *(pjScreen++) = (*pjScreen & (BYTE) (chAnd >> 8))
  599. ^ (BYTE) (chXor >> 8);
  600. *(pjScreen) = (*pjScreen & (BYTE) (chAnd >> 16))
  601. ^ (BYTE) (chXor >> 16);
  602. pjScreen -= 2;
  603. }
  604. pjScreen += cjDelta;
  605. spRemaining -= pls->ulStepRun;
  606. if (spRemaining <= 0)
  607. {
  608. if (++pls->psp > pls->pspEnd)
  609. pls->psp = pls->pspStart;
  610. spRemaining += *pls->psp;
  611. bIsGap = !bIsGap;
  612. }
  613. } while (--c != 0);
  614. // Done with strip, make side step:
  615. pjScreen += 3;
  616. spRemaining -= pls->ulStepSide;
  617. if (spRemaining <= 0)
  618. {
  619. if (++pls->psp > pls->pspEnd)
  620. pls->psp = pls->pspStart;
  621. spRemaining += *pls->psp;
  622. bIsGap = !bIsGap;
  623. }
  624. } while (++pl < plEnd);
  625. pstrip->pchScreen = (CHUNK*) pjScreen;
  626. pls->bIsGap = bIsGap;
  627. pls->spRemaining = spRemaining;
  628. }
  629. /******************************Public*Routine******************************\
  630. * VOID vStripStyledDiagonal24(pstrip, pbmi, pls)
  631. *
  632. * Draws a 24bpp styled near-diagonal line left to right.
  633. *
  634. * History:
  635. * 22-Feb-1992 -by- J. Andrew Goossen [andrewgo]
  636. * Wrote it.
  637. \**************************************************************************/
  638. VOID vStripStyledDiagonal24(
  639. STRIP* pstrip, // Indicates which pixels to light
  640. BMINFO* pbmi, // Data and masks for bitmap format
  641. LINESTATE* pls) // Color and style state info about line
  642. {
  643. DONTUSE(pbmi);
  644. ASSERTGDI(pstrip->cStrips > 0, "Non-positive count");
  645. LONG* plEnd = &pstrip->alStrips[pstrip->cStrips];
  646. LONG* pl = &pstrip->alStrips[0];
  647. LONG cjDelta = pstrip->lDelta * (LONG)sizeof(CHUNK);
  648. if (pstrip->flFlips & FL_FLIP_V)
  649. cjDelta = -cjDelta;
  650. CHUNK chXor = pls->chXor;
  651. CHUNK chAnd = pls->chAnd;
  652. BOOL bIsGap = pls->bIsGap;
  653. STYLEPOS spRemaining = pls->spRemaining;
  654. BYTE* pjScreen = (BYTE*) pstrip->pchScreen;
  655. do {
  656. // Paint strip:
  657. register LONG c = *pl;
  658. while (TRUE)
  659. {
  660. if (bIsGap)
  661. pjScreen += 3;
  662. else
  663. {
  664. *(pjScreen++) = (*pjScreen & (BYTE) (chAnd))
  665. ^ (BYTE) (chXor);
  666. *(pjScreen++) = (*pjScreen & (BYTE) (chAnd >> 8))
  667. ^ (BYTE) (chXor >> 8);
  668. *(pjScreen++) = (*pjScreen & (BYTE) (chAnd >> 16))
  669. ^ (BYTE) (chXor >> 16);
  670. }
  671. if (--c == 0)
  672. break;
  673. pjScreen += cjDelta;
  674. spRemaining -= pls->ulStepDiag;
  675. if (spRemaining <= 0)
  676. {
  677. if (++pls->psp > pls->pspEnd)
  678. pls->psp = pls->pspStart;
  679. spRemaining += *pls->psp;
  680. bIsGap = !bIsGap;
  681. }
  682. }
  683. // Do a side step:
  684. spRemaining -= pls->ulStepRun;
  685. if (spRemaining <= 0)
  686. {
  687. if (++pls->psp > pls->pspEnd)
  688. pls->psp = pls->pspStart;
  689. spRemaining += *pls->psp;
  690. bIsGap = !bIsGap;
  691. }
  692. if (pstrip->flFlips & FL_FLIP_D)
  693. pjScreen += cjDelta - 3;
  694. } while (++pl < plEnd);
  695. pstrip->pchScreen = (CHUNK*) pjScreen;
  696. pls->bIsGap = bIsGap;
  697. pls->spRemaining = spRemaining;
  698. }
  699. PFNSTRIP gapfnStrip[] = {
  700. vStripSolidHorizontal,
  701. vStripSolidVertical,
  702. vStripSolidDiagonal,
  703. vStripSolidDiagonal,
  704. vStripStyledHorizontal,
  705. vStripStyledVertical,
  706. vStripStyledDiagonal,
  707. vStripStyledDiagonal,
  708. vStripSolidHorizontal24,
  709. vStripSolidVertical24,
  710. vStripSolidDiagonal24,
  711. vStripSolidDiagonal24,
  712. vStripStyledHorizontal24,
  713. vStripStyledVertical24,
  714. vStripStyledDiagonal24,
  715. vStripStyledDiagonal24
  716. };