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.

1580 lines
43 KiB

  1. /*
  2. ** Copyright 1991,1992, Silicon Graphics, Inc.
  3. ** All Rights Reserved.
  4. **
  5. ** This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
  6. ** the contents of this file may not be disclosed to third parties, copied or
  7. ** duplicated in any form, in whole or in part, without the prior written
  8. ** permission of Silicon Graphics, Inc.
  9. **
  10. ** RESTRICTED RIGHTS LEGEND:
  11. ** Use, duplication or disclosure by the Government is subject to restrictions
  12. ** as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
  13. ** and Computer Software clause at DFARS 252.227-7013, and/or in similar or
  14. ** successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
  15. ** rights reserved under the Copyright Laws of the United States.
  16. */
  17. #include "precomp.h"
  18. #pragma hdrstop
  19. /*
  20. ** This file contains routines to render a span of pixel data (from a
  21. ** glDrawPixels or possibly a glCopyPixels request).
  22. */
  23. /*
  24. ** This routine is used to store one fragment from a DrawPixels request.
  25. ** It should only be used if the user is either texturing or fogging.
  26. */
  27. void FASTCALL __glSlowDrawPixelsStore(__GLcolorBuffer *cfb, const __GLfragment *frag)
  28. {
  29. __GLcontext *gc = cfb->buf.gc;
  30. __GLvertex *rp = &gc->state.current.rasterPos;
  31. __GLfragment newfrag;
  32. // The texturing code assumes that FPU truncation is enabled, so
  33. // we have to turn it on for this case:
  34. FPU_SAVE_MODE();
  35. FPU_CHOP_ON();
  36. newfrag = *frag;
  37. if (gc->texture.textureEnabled) {
  38. __GLfloat qInv = __glOne / rp->texture.w;
  39. (*gc->procs.texture)(gc, &newfrag.color, rp->texture.x * qInv,
  40. rp->texture.y * qInv, __glOne);
  41. }
  42. if (gc->state.enables.general & __GL_FOG_ENABLE) {
  43. (*gc->procs.fogPoint)(gc, &newfrag, rp->eyeZ);
  44. }
  45. (*gc->procs.store)(cfb, &newfrag);
  46. FPU_RESTORE_MODE();
  47. }
  48. /*
  49. ** The only span format supported by this routine is GL_RGB, GL_UNSIGNED_BYTE.
  50. ** The store proc is assumed not to mess with the fragment color or alpha.
  51. **
  52. ** zoomx is assumed to be less than -1.0 or greater than 1.0.
  53. */
  54. void FASTCALL __glSpanRenderRGBubyte(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  55. GLvoid *span)
  56. {
  57. __GLfloat zoomy;
  58. GLint itop, ibottom, iright;
  59. GLint row, column;
  60. GLint i, width;
  61. GLint coladd, rowadd;
  62. GLubyte *spanData;
  63. GLfloat *redMap, *greenMap, *blueMap;
  64. __GLfragment frag;
  65. void (FASTCALL *store)(__GLcolorBuffer *cfb, const __GLfragment *frag);
  66. GLint rows;
  67. GLint startCol;
  68. GLshort *pixelArray;
  69. FPU_SAVE_MODE();
  70. FPU_CHOP_ON();
  71. zoomy = spanInfo->zoomy;
  72. rowadd = spanInfo->rowadd;
  73. coladd = spanInfo->coladd;
  74. ibottom = spanInfo->startRow;
  75. itop = spanInfo->y + zoomy;
  76. width = spanInfo->realWidth;
  77. redMap = (GLfloat*) gc->pixel.redCurMap;
  78. greenMap = (GLfloat*) gc->pixel.greenCurMap;
  79. blueMap = (GLfloat*) gc->pixel.blueCurMap;
  80. store = gc->procs.pxStore;
  81. frag.z = spanInfo->fragz;
  82. frag.color.a = ((GLfloat *) (gc->pixel.alphaCurMap))[255];
  83. rows = spanInfo->rows;
  84. startCol = spanInfo->startCol;
  85. #ifdef NT
  86. if (redMap)
  87. #endif
  88. for (row = ibottom; row != itop; row += rowadd) {
  89. if (rows == 0) break;
  90. rows--;
  91. column = startCol;
  92. pixelArray = spanInfo->pixelArray;
  93. spanData = (GLubyte*) span;
  94. frag.y = row;
  95. for (i=0; i<width; i++) {
  96. iright = column + *pixelArray++;
  97. frag.color.r = redMap[*spanData++];
  98. frag.color.g = greenMap[*spanData++];
  99. frag.color.b = blueMap[*spanData++];
  100. do {
  101. frag.x = column;
  102. /* This procedure will do the rest */
  103. (*store)(gc->drawBuffer, &frag);
  104. column += coladd;
  105. } while (column != iright);
  106. }
  107. }
  108. spanInfo->rows = rows;
  109. spanInfo->startRow = itop;
  110. FPU_RESTORE_MODE();
  111. }
  112. /*
  113. ** Render a RGB, UNSIGNED_BYTE span.
  114. **
  115. ** zoomx is assumed to be less than or equal to 1.0 and greater than or equal
  116. ** to -1.0.
  117. **
  118. ** The store proc is assumed not to mess with the fragment alpha.
  119. */
  120. void FASTCALL __glSpanRenderRGBubyte2(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  121. GLvoid *span)
  122. {
  123. __GLfloat zoomy;
  124. GLint itop, ibottom;
  125. GLint row;
  126. GLint i;
  127. GLint rowadd, coladd;
  128. GLubyte *spanData;
  129. GLfloat *redMap, *greenMap, *blueMap;
  130. __GLfragment frag;
  131. void (FASTCALL *store)(__GLcolorBuffer *cfb, const __GLfragment *frag);
  132. GLint endCol, startCol;
  133. GLint rows;
  134. FPU_SAVE_MODE();
  135. FPU_CHOP_ON();
  136. zoomy = spanInfo->zoomy;
  137. rowadd = spanInfo->rowadd;
  138. coladd = spanInfo->coladd;
  139. ibottom = spanInfo->startRow;
  140. itop = spanInfo->y + zoomy;
  141. frag.color.a = ((GLfloat *) (gc->pixel.alphaCurMap))[255];
  142. frag.z = spanInfo->fragz;
  143. redMap = (GLfloat*) gc->pixel.redCurMap;
  144. greenMap = (GLfloat*) gc->pixel.greenCurMap;
  145. blueMap = (GLfloat*) gc->pixel.blueCurMap;
  146. store = gc->procs.pxStore;
  147. startCol = spanInfo->startCol;
  148. endCol = spanInfo->endCol;
  149. rows = spanInfo->rows;
  150. #ifdef NT
  151. if (redMap)
  152. #endif
  153. for (row = ibottom; row != itop; row += rowadd) {
  154. if (rows == 0) break;
  155. rows--;
  156. spanData = (GLubyte*) span;
  157. frag.y = row;
  158. i = startCol;
  159. do {
  160. frag.color.r = redMap[*spanData++];
  161. frag.color.g = greenMap[*spanData++];
  162. frag.color.b = blueMap[*spanData++];
  163. frag.x = i;
  164. /* This procedure will do the rest */
  165. (*store)(gc->drawBuffer, &frag);
  166. i += coladd;
  167. } while (i != endCol);
  168. }
  169. spanInfo->rows = rows;
  170. spanInfo->startRow = itop;
  171. FPU_RESTORE_MODE();
  172. }
  173. /*
  174. ** Render a GL_RGBA, GL_UNSIGNED_BYTE span.
  175. **
  176. ** zoomx is assumed to be less than -1.0 or greater than 1.0.
  177. */
  178. void FASTCALL __glSpanRenderRGBAubyte(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  179. GLvoid *span)
  180. {
  181. __GLfloat zoomy;
  182. GLint itop, ibottom, iright;
  183. GLint row, column;
  184. GLint i, width;
  185. GLint coladd, rowadd;
  186. GLubyte *spanData;
  187. GLfloat *redMap, *greenMap, *blueMap, *alphaMap;
  188. __GLfragment frag;
  189. void (FASTCALL *store)(__GLcolorBuffer *cfb, const __GLfragment *frag);
  190. GLint rows;
  191. GLint startCol;
  192. GLshort *pixelArray;
  193. FPU_SAVE_MODE();
  194. FPU_CHOP_ON();
  195. zoomy = spanInfo->zoomy;
  196. rowadd = spanInfo->rowadd;
  197. coladd = spanInfo->coladd;
  198. ibottom = spanInfo->startRow;
  199. itop = spanInfo->y + zoomy;
  200. width = spanInfo->realWidth;
  201. redMap = (GLfloat*) gc->pixel.redCurMap;
  202. greenMap = (GLfloat*) gc->pixel.greenCurMap;
  203. blueMap = (GLfloat*) gc->pixel.blueCurMap;
  204. alphaMap = (GLfloat*) gc->pixel.alphaCurMap;
  205. store = gc->procs.pxStore;
  206. frag.z = spanInfo->fragz;
  207. rows = spanInfo->rows;
  208. startCol = spanInfo->startCol;
  209. #ifdef NT
  210. if (redMap)
  211. #endif
  212. for (row = ibottom; row != itop; row += rowadd) {
  213. if (rows == 0) break;
  214. rows--;
  215. column = startCol;
  216. pixelArray = spanInfo->pixelArray;
  217. spanData = (GLubyte*) span;
  218. frag.y = row;
  219. for (i=0; i<width; i++) {
  220. iright = column + *pixelArray++;
  221. frag.color.r = redMap[*spanData++];
  222. frag.color.g = greenMap[*spanData++];
  223. frag.color.b = blueMap[*spanData++];
  224. frag.color.a = alphaMap[*spanData++];
  225. do {
  226. frag.x = column;
  227. /* This procedure will do the rest */
  228. (*store)(gc->drawBuffer, &frag);
  229. column += coladd;
  230. } while (column != iright);
  231. }
  232. }
  233. spanInfo->rows = rows;
  234. spanInfo->startRow = itop;
  235. FPU_RESTORE_MODE();
  236. }
  237. /*
  238. ** Render a GL_RGBA, GL_UNSIGNED_BYTE span.
  239. **
  240. ** zoomx is assumed to be less than or equal to 1.0 and greater than or equal
  241. ** to -1.0.
  242. */
  243. void FASTCALL __glSpanRenderRGBAubyte2(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  244. GLvoid *span)
  245. {
  246. __GLfloat zoomy;
  247. GLint itop, ibottom;
  248. GLint row;
  249. GLint i;
  250. GLint rowadd, coladd;
  251. GLubyte *spanData;
  252. GLfloat *redMap, *greenMap, *blueMap, *alphaMap;
  253. __GLfragment frag;
  254. void (FASTCALL *store)(__GLcolorBuffer *cfb, const __GLfragment *frag);
  255. GLint endCol, startCol;
  256. GLint rows;
  257. FPU_SAVE_MODE();
  258. FPU_CHOP_ON();
  259. zoomy = spanInfo->zoomy;
  260. rowadd = spanInfo->rowadd;
  261. coladd = spanInfo->coladd;
  262. ibottom = spanInfo->startRow;
  263. itop = spanInfo->y + zoomy;
  264. frag.z = spanInfo->fragz;
  265. redMap = (GLfloat*) gc->pixel.redCurMap;
  266. greenMap = (GLfloat*) gc->pixel.greenCurMap;
  267. blueMap = (GLfloat*) gc->pixel.blueCurMap;
  268. alphaMap = (GLfloat*) gc->pixel.alphaCurMap;
  269. store = gc->procs.pxStore;
  270. startCol = spanInfo->startCol;
  271. endCol = spanInfo->endCol;
  272. rows = spanInfo->rows;
  273. #ifdef NT
  274. if (redMap)
  275. #endif
  276. for (row = ibottom; row != itop; row += rowadd) {
  277. if (rows == 0) break;
  278. rows--;
  279. spanData = (GLubyte*) span;
  280. frag.y = row;
  281. i = startCol;
  282. do {
  283. frag.color.r = redMap[*spanData++];
  284. frag.color.g = greenMap[*spanData++];
  285. frag.color.b = blueMap[*spanData++];
  286. frag.color.a = alphaMap[*spanData++];
  287. frag.x = i;
  288. /* This procedure will do the rest */
  289. (*store)(gc->drawBuffer, &frag);
  290. i += coladd;
  291. } while (i != endCol);
  292. }
  293. spanInfo->rows = rows;
  294. spanInfo->startRow = itop;
  295. FPU_RESTORE_MODE();
  296. }
  297. /*
  298. ** Render a GL_DEPTH_COMPONENT, GL_UNSIGNED_INT span. This is for
  299. ** implementations with 32 bit depth buffers.
  300. **
  301. ** zoomx is assumed to be less than -1.0 or greater than 1.0.
  302. */
  303. void FASTCALL __glSpanRenderDepthUint(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  304. GLvoid *span)
  305. {
  306. __GLfloat zoomy;
  307. GLint itop, ibottom, iright;
  308. GLint row, column;
  309. GLint i, width;
  310. GLint coladd, rowadd;
  311. GLuint *spanData;
  312. __GLfragment frag;
  313. void (FASTCALL *store)(__GLcolorBuffer *cfb, const __GLfragment *frag);
  314. GLint rows;
  315. GLint startCol;
  316. GLshort *pixelArray;
  317. FPU_SAVE_MODE();
  318. FPU_CHOP_ON();
  319. zoomy = spanInfo->zoomy;
  320. rowadd = spanInfo->rowadd;
  321. coladd = spanInfo->coladd;
  322. ibottom = spanInfo->startRow;
  323. itop = spanInfo->y + zoomy;
  324. width = spanInfo->realWidth;
  325. frag.color.r = gc->state.current.rasterPos.colors[__GL_FRONTFACE].r;
  326. frag.color.g = gc->state.current.rasterPos.colors[__GL_FRONTFACE].g;
  327. frag.color.b = gc->state.current.rasterPos.colors[__GL_FRONTFACE].b;
  328. frag.color.a = gc->state.current.rasterPos.colors[__GL_FRONTFACE].a;
  329. store = gc->procs.pxStore;
  330. rows = spanInfo->rows;
  331. startCol = spanInfo->startCol;
  332. for (row = ibottom; row != itop; row += rowadd) {
  333. if (rows == 0) break;
  334. rows--;
  335. column = startCol;
  336. pixelArray = spanInfo->pixelArray;
  337. spanData = (GLuint*) span;
  338. frag.y = row;
  339. for (i=0; i<width; i++) {
  340. iright = column + *pixelArray++;
  341. frag.z = *spanData++; /* Assumes 32 bit depth buffer */
  342. do {
  343. frag.x = column;
  344. /* This procedure will do the rest */
  345. (*store)(gc->drawBuffer, &frag);
  346. column += coladd;
  347. } while (column != iright);
  348. }
  349. }
  350. spanInfo->rows = rows;
  351. spanInfo->startRow = itop;
  352. FPU_RESTORE_MODE();
  353. }
  354. /*
  355. ** Render a GL_DEPTH_COMPONENT, GL_UNSIGNED_INT span. This is for
  356. ** implementations with 32 bit depth buffers.
  357. **
  358. ** zoomx is assumed to be less than or equal to 1.0 and greater than or equal
  359. ** to -1.0.
  360. */
  361. void FASTCALL __glSpanRenderDepthUint2(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  362. GLvoid *span)
  363. {
  364. __GLfloat zoomy;
  365. GLint itop, ibottom;
  366. GLint row;
  367. GLint i;
  368. GLint rowadd, coladd;
  369. GLuint *spanData;
  370. __GLfragment frag;
  371. void (FASTCALL *store)(__GLcolorBuffer *cfb, const __GLfragment *frag);
  372. GLint endCol, startCol;
  373. GLint rows;
  374. FPU_SAVE_MODE();
  375. FPU_CHOP_ON();
  376. zoomy = spanInfo->zoomy;
  377. rowadd = spanInfo->rowadd;
  378. coladd = spanInfo->coladd;
  379. ibottom = spanInfo->startRow;
  380. itop = spanInfo->y + zoomy;
  381. frag.color.r = gc->state.current.rasterPos.colors[__GL_FRONTFACE].r;
  382. frag.color.g = gc->state.current.rasterPos.colors[__GL_FRONTFACE].g;
  383. frag.color.b = gc->state.current.rasterPos.colors[__GL_FRONTFACE].b;
  384. frag.color.a = gc->state.current.rasterPos.colors[__GL_FRONTFACE].a;
  385. store = gc->procs.pxStore;
  386. startCol = spanInfo->startCol;
  387. endCol = spanInfo->endCol;
  388. rows = spanInfo->rows;
  389. for (row = ibottom; row != itop; row += rowadd) {
  390. if (rows == 0) break;
  391. rows--;
  392. spanData = (GLuint*) span;
  393. frag.y = row;
  394. i = startCol;
  395. do {
  396. frag.z = *spanData++; /* Assumes 32 bit depth buffer */
  397. frag.x = i;
  398. /* This procedure will do the rest */
  399. (*store)(gc->drawBuffer, &frag);
  400. i += coladd;
  401. } while (i != endCol);
  402. }
  403. spanInfo->rows = rows;
  404. spanInfo->startRow = itop;
  405. FPU_RESTORE_MODE();
  406. }
  407. /*
  408. ** Render a GL_DEPTH_COMPONENT, GL_UNSIGNED_INT span. This is for
  409. ** implementations with 31 bit depth buffers.
  410. **
  411. ** zoomx is assumed to be less than -1.0 or greater than 1.0.
  412. */
  413. void FASTCALL __glSpanRenderDepth2Uint(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  414. GLvoid *span)
  415. {
  416. __GLfloat zoomy;
  417. GLint itop, ibottom, iright;
  418. GLint row, column;
  419. GLint i, width;
  420. GLint coladd, rowadd;
  421. GLuint *spanData;
  422. __GLfragment frag;
  423. void (FASTCALL *store)(__GLcolorBuffer *cfb, const __GLfragment *frag);
  424. GLint rows;
  425. GLint startCol;
  426. GLshort *pixelArray;
  427. FPU_SAVE_MODE();
  428. FPU_CHOP_ON();
  429. zoomy = spanInfo->zoomy;
  430. rowadd = spanInfo->rowadd;
  431. coladd = spanInfo->coladd;
  432. ibottom = spanInfo->startRow;
  433. itop = spanInfo->y + zoomy;
  434. width = spanInfo->realWidth;
  435. frag.color.r = gc->state.current.rasterPos.colors[__GL_FRONTFACE].r;
  436. frag.color.g = gc->state.current.rasterPos.colors[__GL_FRONTFACE].g;
  437. frag.color.b = gc->state.current.rasterPos.colors[__GL_FRONTFACE].b;
  438. frag.color.a = gc->state.current.rasterPos.colors[__GL_FRONTFACE].a;
  439. store = gc->procs.pxStore;
  440. rows = spanInfo->rows;
  441. startCol = spanInfo->startCol;
  442. for (row = ibottom; row != itop; row += rowadd) {
  443. if (rows == 0) break;
  444. rows--;
  445. column = startCol;
  446. pixelArray = spanInfo->pixelArray;
  447. spanData = (GLuint*) span;
  448. frag.y = row;
  449. for (i=0; i<width; i++) {
  450. iright = column + *pixelArray++;
  451. frag.z = (*spanData++) >> 1; /* Assumes 31 bit depth buffer */
  452. do {
  453. frag.x = column;
  454. /* This procedure will do the rest */
  455. (*store)(gc->drawBuffer, &frag);
  456. column += coladd;
  457. } while (column != iright);
  458. }
  459. }
  460. spanInfo->rows = rows;
  461. spanInfo->startRow = itop;
  462. FPU_RESTORE_MODE();
  463. }
  464. /*
  465. ** Render a GL_DEPTH_COMPONENT, GL_UNSIGNED_INT span. This is for
  466. ** implementations with 31 bit depth buffers.
  467. **
  468. ** zoomx is assumed to be less than or equal to 1.0 and greater than or equal
  469. ** to -1.0.
  470. */
  471. void FASTCALL __glSpanRenderDepth2Uint2(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  472. GLvoid *span)
  473. {
  474. __GLfloat zoomy;
  475. GLint itop, ibottom;
  476. GLint row;
  477. GLint i;
  478. GLint rowadd, coladd;
  479. GLuint *spanData;
  480. __GLfragment frag;
  481. void (FASTCALL *store)(__GLcolorBuffer *cfb, const __GLfragment *frag);
  482. GLint endCol, startCol;
  483. GLint rows;
  484. FPU_SAVE_MODE();
  485. FPU_CHOP_ON();
  486. zoomy = spanInfo->zoomy;
  487. rowadd = spanInfo->rowadd;
  488. coladd = spanInfo->coladd;
  489. ibottom = spanInfo->startRow;
  490. itop = spanInfo->y + zoomy;
  491. frag.color.r = gc->state.current.rasterPos.colors[__GL_FRONTFACE].r;
  492. frag.color.g = gc->state.current.rasterPos.colors[__GL_FRONTFACE].g;
  493. frag.color.b = gc->state.current.rasterPos.colors[__GL_FRONTFACE].b;
  494. frag.color.a = gc->state.current.rasterPos.colors[__GL_FRONTFACE].a;
  495. store = gc->procs.pxStore;
  496. startCol = spanInfo->startCol;
  497. endCol = spanInfo->endCol;
  498. rows = spanInfo->rows;
  499. for (row = ibottom; row != itop; row += rowadd) {
  500. if (rows == 0) break;
  501. rows--;
  502. spanData = (GLuint*) span;
  503. frag.y = row;
  504. i = startCol;
  505. do {
  506. frag.z = (*spanData++) >> 1; /* Assumes 31 bit depth buffer */
  507. frag.x = i;
  508. /* This procedure will do the rest */
  509. (*store)(gc->drawBuffer, &frag);
  510. i += coladd;
  511. } while (i != endCol);
  512. }
  513. spanInfo->rows = rows;
  514. spanInfo->startRow = itop;
  515. FPU_RESTORE_MODE();
  516. }
  517. /*
  518. ** Render a GL_STENCIL_INDEX, GL_UNSIGNED_SHORT span.
  519. **
  520. ** zoomx is assumed to be less than -1.0 or greater than 1.0.
  521. */
  522. void FASTCALL __glSpanRenderStencilUshort(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  523. GLvoid *span)
  524. {
  525. __GLfloat zoomy;
  526. GLint itop, ibottom, iright;
  527. GLint row, column;
  528. GLint i, width;
  529. GLint coladd, rowadd;
  530. GLushort *spanData;
  531. void (*store)(__GLstencilBuffer *sfb, GLint x, GLint y, GLint value);
  532. __GLstencilBuffer *sb = &gc->stencilBuffer;
  533. GLint rows;
  534. GLint startCol;
  535. GLint value;
  536. GLshort *pixelArray;
  537. zoomy = spanInfo->zoomy;
  538. rowadd = spanInfo->rowadd;
  539. coladd = spanInfo->coladd;
  540. ibottom = spanInfo->startRow;
  541. itop = spanInfo->y + zoomy;
  542. width = spanInfo->realWidth;
  543. store = sb->store;
  544. rows = spanInfo->rows;
  545. startCol = spanInfo->startCol;
  546. for (row = ibottom; row != itop; row += rowadd) {
  547. if (rows == 0) break;
  548. rows--;
  549. column = startCol;
  550. pixelArray = spanInfo->pixelArray;
  551. spanData = (GLushort*) span;
  552. for (i=0; i<width; i++) {
  553. iright = column + *pixelArray++;
  554. value = *spanData++;
  555. do {
  556. (*store)(sb, column, row, value);
  557. column += coladd;
  558. } while (column != iright);
  559. }
  560. }
  561. spanInfo->rows = rows;
  562. spanInfo->startRow = itop;
  563. }
  564. /*
  565. ** Render a GL_STENCIL_INDEX, GL_UNSIGNED_SHORT span.
  566. **
  567. ** zoomx is assumed to be less than or equal to 1.0 and greater than or equal
  568. ** to -1.0.
  569. */
  570. void FASTCALL __glSpanRenderStencilUshort2(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  571. GLvoid *span)
  572. {
  573. __GLfloat zoomy;
  574. GLint itop, ibottom;
  575. GLint row;
  576. GLint i;
  577. GLint rowadd, coladd;
  578. GLushort *spanData;
  579. void (*store)(__GLstencilBuffer *sfb, GLint x, GLint y, GLint value);
  580. __GLstencilBuffer *sb = &gc->stencilBuffer;
  581. GLint endCol, startCol;
  582. GLint rows;
  583. zoomy = spanInfo->zoomy;
  584. rowadd = spanInfo->rowadd;
  585. coladd = spanInfo->coladd;
  586. ibottom = spanInfo->startRow;
  587. itop = spanInfo->y + zoomy;
  588. store = sb->store;
  589. startCol = spanInfo->startCol;
  590. endCol = spanInfo->endCol;
  591. rows = spanInfo->rows;
  592. for (row = ibottom; row != itop; row += rowadd) {
  593. if (rows == 0) break;
  594. rows--;
  595. spanData = (GLushort*) span;
  596. i = startCol;
  597. do {
  598. (*store)(sb, i, row, *spanData++);
  599. i += coladd;
  600. } while (i != endCol);
  601. }
  602. spanInfo->rows = rows;
  603. spanInfo->startRow = itop;
  604. }
  605. /*
  606. ** Render a GL_STENCIL_INDEX, GL_UNSIGNED_BYTE span.
  607. **
  608. ** zoomx is assumed to be less than -1.0 or greater than 1.0.
  609. */
  610. void FASTCALL __glSpanRenderStencilUbyte(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  611. GLvoid *span)
  612. {
  613. __GLfloat zoomy;
  614. GLint itop, ibottom, iright;
  615. GLint row, column;
  616. GLint i, width;
  617. GLint coladd, rowadd;
  618. GLubyte *spanData;
  619. void (*store)(__GLstencilBuffer *sfb, GLint x, GLint y, GLint value);
  620. __GLstencilBuffer *sb = &gc->stencilBuffer;
  621. GLint rows;
  622. GLint startCol;
  623. GLint value;
  624. GLshort *pixelArray;
  625. zoomy = spanInfo->zoomy;
  626. rowadd = spanInfo->rowadd;
  627. coladd = spanInfo->coladd;
  628. ibottom = spanInfo->startRow;
  629. itop = spanInfo->y + zoomy;
  630. width = spanInfo->realWidth;
  631. store = sb->store;
  632. rows = spanInfo->rows;
  633. startCol = spanInfo->startCol;
  634. for (row = ibottom; row != itop; row += rowadd) {
  635. if (rows == 0) break;
  636. rows--;
  637. column = startCol;
  638. pixelArray = spanInfo->pixelArray;
  639. spanData = (GLubyte*) span;
  640. for (i=0; i<width; i++) {
  641. iright = column + *pixelArray++;
  642. value = *spanData++;
  643. do {
  644. (*store)(sb, column, row, value);
  645. column += coladd;
  646. } while (column != iright);
  647. }
  648. }
  649. spanInfo->rows = rows;
  650. spanInfo->startRow = itop;
  651. }
  652. /*
  653. ** Render a GL_STENCIL_INDEX, GL_UNSIGNED_BYTE span.
  654. **
  655. ** zoomx is assumed to be less than or equal to 1.0 and greater than or equal
  656. ** to -1.0.
  657. */
  658. void FASTCALL __glSpanRenderStencilUbyte2(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  659. GLvoid *span)
  660. {
  661. __GLfloat zoomy;
  662. GLint itop, ibottom;
  663. GLint row;
  664. GLint i;
  665. GLint rowadd, coladd;
  666. GLubyte *spanData;
  667. void (*store)(__GLstencilBuffer *sfb, GLint x, GLint y, GLint value);
  668. __GLstencilBuffer *sb = &gc->stencilBuffer;
  669. GLint endCol, startCol;
  670. GLint rows;
  671. zoomy = spanInfo->zoomy;
  672. rowadd = spanInfo->rowadd;
  673. coladd = spanInfo->coladd;
  674. ibottom = spanInfo->startRow;
  675. itop = spanInfo->y + zoomy;
  676. store = sb->store;
  677. startCol = spanInfo->startCol;
  678. endCol = spanInfo->endCol;
  679. rows = spanInfo->rows;
  680. for (row = ibottom; row != itop; row += rowadd) {
  681. if (rows == 0) break;
  682. rows--;
  683. spanData = (GLubyte*) span;
  684. i = startCol;
  685. do {
  686. (*store)(sb, i, row, *spanData++);
  687. i += coladd;
  688. } while (i != endCol);
  689. }
  690. spanInfo->rows = rows;
  691. spanInfo->startRow = itop;
  692. }
  693. /*
  694. ** Render a GL_COLOR_INDEX, GL_UNSIGNED_SHORT span. gc->modes.rgbMode must
  695. ** be GL_FALSE.
  696. **
  697. ** zoomx is assumed to be less than -1.0 or greater than 1.0.
  698. */
  699. void FASTCALL __glSpanRenderCIushort(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  700. GLvoid *span)
  701. {
  702. __GLfloat zoomy;
  703. GLint itop, ibottom, iright;
  704. GLint row, column;
  705. GLint i, width;
  706. GLint coladd, rowadd;
  707. GLushort *spanData;
  708. GLint rows;
  709. GLint startCol;
  710. __GLfragment frag;
  711. void (FASTCALL *store)(__GLcolorBuffer *cfb, const __GLfragment *frag);
  712. GLshort *pixelArray;
  713. GLint mask;
  714. FPU_SAVE_MODE();
  715. FPU_CHOP_ON();
  716. zoomy = spanInfo->zoomy;
  717. rowadd = spanInfo->rowadd;
  718. coladd = spanInfo->coladd;
  719. ibottom = spanInfo->startRow;
  720. itop = spanInfo->y + zoomy;
  721. width = spanInfo->realWidth;
  722. mask = gc->frontBuffer.redMax;
  723. store = gc->procs.pxStore;
  724. frag.z = spanInfo->fragz;
  725. rows = spanInfo->rows;
  726. startCol = spanInfo->startCol;
  727. for (row = ibottom; row != itop; row += rowadd) {
  728. if (rows == 0) break;
  729. rows--;
  730. column = startCol;
  731. pixelArray = spanInfo->pixelArray;
  732. spanData = (GLushort*) span;
  733. frag.y = row;
  734. for (i=0; i<width; i++) {
  735. iright = column + *pixelArray++;
  736. frag.color.r = *spanData++ & mask;
  737. do {
  738. frag.x = column;
  739. (*store)(gc->drawBuffer, &frag);
  740. column += coladd;
  741. } while (column != iright);
  742. }
  743. }
  744. spanInfo->rows = rows;
  745. spanInfo->startRow = itop;
  746. FPU_RESTORE_MODE();
  747. }
  748. /*
  749. ** Render a GL_COLOR_INDEX, GL_UNSIGNED_SHORT. gc->modes.rgbMode must
  750. ** be GL_FALSE.
  751. **
  752. ** zoomx is assumed to be less than or equal to 1.0 and greater than or equal
  753. ** to -1.0.
  754. */
  755. void FASTCALL __glSpanRenderCIushort2(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  756. GLvoid *span)
  757. {
  758. __GLfloat zoomy;
  759. GLint itop, ibottom;
  760. GLint row;
  761. GLint i;
  762. GLint rowadd, coladd;
  763. GLushort *spanData;
  764. GLint endCol, startCol;
  765. GLint rows;
  766. __GLfragment frag;
  767. void (FASTCALL *store)(__GLcolorBuffer *cfb, const __GLfragment *frag);
  768. GLint mask;
  769. FPU_SAVE_MODE();
  770. FPU_CHOP_ON();
  771. zoomy = spanInfo->zoomy;
  772. rowadd = spanInfo->rowadd;
  773. coladd = spanInfo->coladd;
  774. ibottom = spanInfo->startRow;
  775. itop = spanInfo->y + zoomy;
  776. mask = gc->frontBuffer.redMax;
  777. store = gc->procs.pxStore;
  778. frag.z = spanInfo->fragz;
  779. startCol = spanInfo->startCol;
  780. endCol = spanInfo->endCol;
  781. rows = spanInfo->rows;
  782. for (row = ibottom; row != itop; row += rowadd) {
  783. if (rows == 0) break;
  784. rows--;
  785. spanData = (GLushort*) span;
  786. frag.y = row;
  787. i = startCol;
  788. do {
  789. frag.x = i;
  790. frag.color.r = *spanData++ & mask;
  791. (*store)(gc->drawBuffer, &frag);
  792. i += coladd;
  793. } while (i != endCol);
  794. }
  795. spanInfo->rows = rows;
  796. spanInfo->startRow = itop;
  797. FPU_RESTORE_MODE();
  798. }
  799. /*
  800. ** Render a GL_COLOR_INDEX, GL_UNSIGNED_BYTE span. gc->modes.rgbMode must
  801. ** be GL_FALSE.
  802. **
  803. ** zoomx is assumed to be less than -1.0 or greater than 1.0.
  804. */
  805. void FASTCALL __glSpanRenderCIubyte(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  806. GLvoid *span)
  807. {
  808. __GLfloat zoomy;
  809. GLint itop, ibottom, iright;
  810. GLint row, column;
  811. GLint i, width;
  812. GLint coladd, rowadd;
  813. GLubyte *spanData;
  814. GLint rows;
  815. GLint startCol;
  816. GLfloat *indexMap;
  817. __GLfragment frag;
  818. void (FASTCALL *store)(__GLcolorBuffer *cfb, const __GLfragment *frag);
  819. GLshort *pixelArray;
  820. FPU_SAVE_MODE();
  821. FPU_CHOP_ON();
  822. zoomy = spanInfo->zoomy;
  823. rowadd = spanInfo->rowadd;
  824. coladd = spanInfo->coladd;
  825. ibottom = spanInfo->startRow;
  826. itop = spanInfo->y + zoomy;
  827. width = spanInfo->realWidth;
  828. indexMap = (GLfloat*) gc->pixel.iCurMap;
  829. store = gc->procs.pxStore;
  830. frag.z = spanInfo->fragz;
  831. rows = spanInfo->rows;
  832. startCol = spanInfo->startCol;
  833. #ifdef NT
  834. if (indexMap)
  835. #endif
  836. for (row = ibottom; row != itop; row += rowadd) {
  837. if (rows == 0) break;
  838. rows--;
  839. column = startCol;
  840. pixelArray = spanInfo->pixelArray;
  841. spanData = (GLubyte*) span;
  842. frag.y = row;
  843. for (i=0; i<width; i++) {
  844. iright = column + *pixelArray++;
  845. frag.color.r = indexMap[*spanData++];
  846. do {
  847. frag.x = column;
  848. (*store)(gc->drawBuffer, &frag);
  849. column += coladd;
  850. } while (column != iright);
  851. }
  852. }
  853. spanInfo->rows = rows;
  854. spanInfo->startRow = itop;
  855. FPU_RESTORE_MODE();
  856. }
  857. /*
  858. ** Render a GL_COLOR_INDEX, GL_UNSIGNED_BYTE span. Also, gc->modes.rgbMode
  859. ** must be GL_FALSE.
  860. **
  861. ** zoomx is assumed to be less than or equal to 1.0 and greater than or equal
  862. ** to -1.0.
  863. */
  864. void FASTCALL __glSpanRenderCIubyte2(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  865. GLvoid *span)
  866. {
  867. __GLfloat zoomy;
  868. GLint itop, ibottom;
  869. GLint row;
  870. GLint i;
  871. GLint rowadd, coladd;
  872. GLubyte *spanData;
  873. GLint endCol, startCol;
  874. GLint rows;
  875. GLfloat *indexMap;
  876. __GLfragment frag;
  877. void (FASTCALL *store)(__GLcolorBuffer *cfb, const __GLfragment *frag);
  878. FPU_SAVE_MODE();
  879. FPU_CHOP_ON();
  880. zoomy = spanInfo->zoomy;
  881. rowadd = spanInfo->rowadd;
  882. coladd = spanInfo->coladd;
  883. ibottom = spanInfo->startRow;
  884. itop = spanInfo->y + zoomy;
  885. indexMap = (GLfloat*) gc->pixel.iCurMap;
  886. store = gc->procs.pxStore;
  887. frag.z = spanInfo->fragz;
  888. startCol = spanInfo->startCol;
  889. endCol = spanInfo->endCol;
  890. rows = spanInfo->rows;
  891. #ifdef NT
  892. if (indexMap)
  893. #endif
  894. for (row = ibottom; row != itop; row += rowadd) {
  895. if (rows == 0) break;
  896. rows--;
  897. spanData = (GLubyte*) span;
  898. frag.y = row;
  899. i = startCol;
  900. do {
  901. frag.x = i;
  902. frag.color.r = indexMap[*spanData++];
  903. (*store)(gc->drawBuffer, &frag);
  904. i += coladd;
  905. } while (i != endCol);
  906. }
  907. spanInfo->rows = rows;
  908. spanInfo->startRow = itop;
  909. FPU_RESTORE_MODE();
  910. }
  911. /*
  912. ** Render a GL_COLOR_INDEX, GL_UNSIGNED_BYTE span. Also, gc->modes.rgbMode
  913. ** must be GL_TRUE.
  914. **
  915. ** zoomx is assumed to be less than -1.0 or greater than 1.0.
  916. */
  917. void FASTCALL __glSpanRenderCIubyte3(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  918. GLvoid *span)
  919. {
  920. __GLfloat zoomy;
  921. GLint itop, ibottom, iright;
  922. GLint row, column;
  923. GLint i, width;
  924. GLint coladd, rowadd;
  925. GLubyte *spanData;
  926. GLint rows;
  927. GLint startCol;
  928. GLfloat *redMap, *greenMap, *blueMap, *alphaMap;
  929. __GLfragment frag;
  930. GLubyte value;
  931. void (FASTCALL *store)(__GLcolorBuffer *cfb, const __GLfragment *frag);
  932. GLshort *pixelArray;
  933. FPU_SAVE_MODE();
  934. FPU_CHOP_ON();
  935. zoomy = spanInfo->zoomy;
  936. rowadd = spanInfo->rowadd;
  937. coladd = spanInfo->coladd;
  938. ibottom = spanInfo->startRow;
  939. itop = spanInfo->y + zoomy;
  940. width = spanInfo->realWidth;
  941. redMap = (GLfloat*) gc->pixel.redCurMap;
  942. greenMap = (GLfloat*) gc->pixel.greenCurMap;
  943. blueMap = (GLfloat*) gc->pixel.blueCurMap;
  944. alphaMap = (GLfloat*) gc->pixel.alphaCurMap;
  945. store = gc->procs.pxStore;
  946. frag.z = spanInfo->fragz;
  947. rows = spanInfo->rows;
  948. startCol = spanInfo->startCol;
  949. #ifdef NT
  950. if (redMap)
  951. #endif
  952. for (row = ibottom; row != itop; row += rowadd) {
  953. if (rows == 0) break;
  954. rows--;
  955. column = startCol;
  956. pixelArray = spanInfo->pixelArray;
  957. spanData = (GLubyte*) span;
  958. frag.y = row;
  959. for (i=0; i<width; i++) {
  960. iright = column + *pixelArray++;
  961. value = *spanData++;
  962. frag.color.r = redMap[value];
  963. frag.color.g = greenMap[value];
  964. frag.color.b = blueMap[value];
  965. frag.color.a = alphaMap[value];
  966. do {
  967. frag.x = column;
  968. (*store)(gc->drawBuffer, &frag);
  969. column += coladd;
  970. } while (column != iright);
  971. }
  972. }
  973. spanInfo->rows = rows;
  974. spanInfo->startRow = itop;
  975. FPU_RESTORE_MODE();
  976. }
  977. /*
  978. ** Render a GL_COLOR_INDEX, GL_UNSIGNED_BYTE span. Also, gc->modes.rgbMode
  979. ** must be GL_TRUE.
  980. **
  981. ** zoomx is assumed to be less than or equal to 1.0 and greater than or equal
  982. ** to -1.0.
  983. */
  984. void FASTCALL __glSpanRenderCIubyte4(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  985. GLvoid *span)
  986. {
  987. __GLfloat zoomy;
  988. GLint itop, ibottom;
  989. GLint row;
  990. GLint i;
  991. GLint rowadd, coladd;
  992. GLubyte *spanData;
  993. GLint endCol, startCol;
  994. GLint rows;
  995. GLubyte value;
  996. GLfloat *redMap, *greenMap, *blueMap, *alphaMap;
  997. __GLfragment frag;
  998. void (FASTCALL *store)(__GLcolorBuffer *cfb, const __GLfragment *frag);
  999. FPU_SAVE_MODE();
  1000. FPU_CHOP_ON();
  1001. zoomy = spanInfo->zoomy;
  1002. rowadd = spanInfo->rowadd;
  1003. coladd = spanInfo->coladd;
  1004. ibottom = spanInfo->startRow;
  1005. itop = spanInfo->y + zoomy;
  1006. redMap = (GLfloat*) gc->pixel.redCurMap;
  1007. greenMap = (GLfloat*) gc->pixel.greenCurMap;
  1008. blueMap = (GLfloat*) gc->pixel.blueCurMap;
  1009. alphaMap = (GLfloat*) gc->pixel.alphaCurMap;
  1010. store = gc->procs.pxStore;
  1011. frag.z = spanInfo->fragz;
  1012. startCol = spanInfo->startCol;
  1013. endCol = spanInfo->endCol;
  1014. rows = spanInfo->rows;
  1015. #ifdef NT
  1016. if (redMap)
  1017. #endif
  1018. for (row = ibottom; row != itop; row += rowadd) {
  1019. if (rows == 0) break;
  1020. rows--;
  1021. spanData = (GLubyte*) span;
  1022. frag.y = row;
  1023. i = startCol;
  1024. do {
  1025. frag.x = i;
  1026. value = *spanData++;
  1027. frag.color.r = redMap[value];
  1028. frag.color.g = greenMap[value];
  1029. frag.color.b = blueMap[value];
  1030. frag.color.a = alphaMap[value];
  1031. (*store)(gc->drawBuffer, &frag);
  1032. i += coladd;
  1033. } while (i != endCol);
  1034. }
  1035. spanInfo->rows = rows;
  1036. spanInfo->startRow = itop;
  1037. FPU_RESTORE_MODE();
  1038. }
  1039. /*
  1040. ** Render a GL_RGBA, scaled (by the implementation color scales) GL_FLOAT span.
  1041. **
  1042. ** zoomx is assumed to be less than -1.0 or greater than 1.0.
  1043. */
  1044. void FASTCALL __glSpanRenderRGBA(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1045. GLvoid *span)
  1046. {
  1047. __GLfloat zoomy;
  1048. GLint itop, ibottom, iright;
  1049. GLint row, column;
  1050. GLint i, width;
  1051. GLint coladd, rowadd;
  1052. GLfloat *spanData;
  1053. __GLfragment frag;
  1054. void (FASTCALL *store)(__GLcolorBuffer *cfb, const __GLfragment *frag);
  1055. GLint rows;
  1056. GLshort *pixelArray;
  1057. FPU_SAVE_MODE();
  1058. FPU_CHOP_ON();
  1059. zoomy = spanInfo->zoomy;
  1060. rowadd = spanInfo->rowadd;
  1061. coladd = spanInfo->coladd;
  1062. ibottom = spanInfo->startRow;
  1063. itop = spanInfo->y + zoomy;
  1064. width = spanInfo->realWidth;
  1065. store = gc->procs.pxStore;
  1066. rows = spanInfo->rows;
  1067. frag.z = spanInfo->fragz;
  1068. for (row = ibottom; row != itop; row += rowadd) {
  1069. if (rows == 0) break;
  1070. rows--;
  1071. column = spanInfo->startCol;
  1072. pixelArray = spanInfo->pixelArray;
  1073. spanData = (GLfloat*) span;
  1074. frag.y = row;
  1075. for (i=0; i<width; i++) {
  1076. iright = column + *pixelArray++;
  1077. frag.color.r = *spanData++;
  1078. frag.color.g = *spanData++;
  1079. frag.color.b = *spanData++;
  1080. frag.color.a = *spanData++;
  1081. do {
  1082. frag.x = column;
  1083. /* This procedure will do the rest */
  1084. (*store)(gc->drawBuffer, &frag);
  1085. column += coladd;
  1086. } while (column != iright);
  1087. }
  1088. }
  1089. spanInfo->rows = rows;
  1090. spanInfo->startRow = itop;
  1091. FPU_RESTORE_MODE();
  1092. }
  1093. /*
  1094. ** Render a GL_RGBA, scaled (by the implementation color scales) GL_FLOAT span.
  1095. **
  1096. ** zoomx is assumed to be less than or equal to 1.0 and greater than or equal
  1097. ** to -1.0.
  1098. */
  1099. void FASTCALL __glSpanRenderRGBA2(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1100. GLvoid *span)
  1101. {
  1102. __GLfloat zoomy;
  1103. GLint itop, ibottom;
  1104. GLint row, column;
  1105. GLint i, width;
  1106. GLint coladd, rowadd;
  1107. GLfloat *spanData;
  1108. __GLfragment frag;
  1109. void (FASTCALL *store)(__GLcolorBuffer *cfb, const __GLfragment *frag);
  1110. GLint rows;
  1111. FPU_SAVE_MODE();
  1112. FPU_CHOP_ON();
  1113. zoomy = spanInfo->zoomy;
  1114. rowadd = spanInfo->rowadd;
  1115. coladd = spanInfo->coladd;
  1116. ibottom = spanInfo->startRow;
  1117. itop = spanInfo->y + zoomy;
  1118. width = spanInfo->realWidth;
  1119. store = gc->procs.pxStore;
  1120. frag.z = spanInfo->fragz;
  1121. rows = spanInfo->rows;
  1122. for (row = ibottom; row != itop; row += rowadd) {
  1123. if (rows == 0) break;
  1124. rows--;
  1125. column = spanInfo->startCol;
  1126. spanData = (GLfloat*) span;
  1127. frag.y = row;
  1128. for (i=0; i<width; i++) {
  1129. frag.color.r = *spanData++;
  1130. frag.color.g = *spanData++;
  1131. frag.color.b = *spanData++;
  1132. frag.color.a = *spanData++;
  1133. frag.x = column;
  1134. /* This procedure will do the rest */
  1135. (*store)(gc->drawBuffer, &frag);
  1136. column += coladd;
  1137. }
  1138. }
  1139. spanInfo->rows = rows;
  1140. spanInfo->startRow = itop;
  1141. FPU_RESTORE_MODE();
  1142. }
  1143. /*
  1144. ** Render a GL_DEPTH_COMPONENT, GL_FLOAT span.
  1145. **
  1146. ** zoomx is assumed to be less than -1.0 or greater than 1.0.
  1147. */
  1148. void FASTCALL __glSpanRenderDepth(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1149. GLvoid *span)
  1150. {
  1151. __GLfloat zoomy;
  1152. GLint itop, ibottom, iright;
  1153. GLint row, column;
  1154. GLint i, width;
  1155. GLint coladd, rowadd;
  1156. GLfloat *spanData;
  1157. __GLfragment frag;
  1158. void (FASTCALL *store)(__GLcolorBuffer *cfb, const __GLfragment *frag);
  1159. GLint rows;
  1160. GLshort *pixelArray;
  1161. FPU_SAVE_MODE();
  1162. FPU_CHOP_ON();
  1163. zoomy = spanInfo->zoomy;
  1164. rowadd = spanInfo->rowadd;
  1165. coladd = spanInfo->coladd;
  1166. ibottom = spanInfo->startRow;
  1167. itop = spanInfo->y + zoomy;
  1168. width = spanInfo->realWidth;
  1169. store = gc->procs.pxStore;
  1170. frag.color.r = gc->state.current.rasterPos.colors[__GL_FRONTFACE].r;
  1171. frag.color.g = gc->state.current.rasterPos.colors[__GL_FRONTFACE].g;
  1172. frag.color.b = gc->state.current.rasterPos.colors[__GL_FRONTFACE].b;
  1173. frag.color.a = gc->state.current.rasterPos.colors[__GL_FRONTFACE].a;
  1174. rows = spanInfo->rows;
  1175. for (row = ibottom; row != itop; row += rowadd) {
  1176. if (rows == 0) break;
  1177. rows--;
  1178. column = spanInfo->startCol;
  1179. pixelArray = spanInfo->pixelArray;
  1180. spanData = (GLfloat*) span;
  1181. frag.y = row;
  1182. for (i=0; i<width; i++) {
  1183. iright = column + *pixelArray++;
  1184. frag.z = *spanData++ * gc->depthBuffer.scale;
  1185. do {
  1186. frag.x = column;
  1187. /* This procedure will do the rest */
  1188. (*store)(gc->drawBuffer, &frag);
  1189. column += coladd;
  1190. } while (column != iright);
  1191. }
  1192. }
  1193. spanInfo->rows = rows;
  1194. spanInfo->startRow = itop;
  1195. FPU_RESTORE_MODE();
  1196. }
  1197. /*
  1198. ** Render a GL_DEPTH_COMPONENT, GL_FLOAT.
  1199. **
  1200. ** zoomx is assumed to be less than or equal to 1.0 and greater than or equal
  1201. ** to -1.0.
  1202. */
  1203. void FASTCALL __glSpanRenderDepth2(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1204. GLvoid *span)
  1205. {
  1206. __GLfloat zoomy;
  1207. GLint itop, ibottom;
  1208. GLint row, column;
  1209. GLint i, width;
  1210. GLint coladd, rowadd;
  1211. GLfloat *spanData;
  1212. __GLfragment frag;
  1213. void (FASTCALL *store)(__GLcolorBuffer *cfb, const __GLfragment *frag);
  1214. GLint rows;
  1215. FPU_SAVE_MODE();
  1216. FPU_CHOP_ON();
  1217. zoomy = spanInfo->zoomy;
  1218. rowadd = spanInfo->rowadd;
  1219. coladd = spanInfo->coladd;
  1220. ibottom = spanInfo->startRow;
  1221. itop = spanInfo->y + zoomy;
  1222. width = spanInfo->realWidth;
  1223. store = gc->procs.pxStore;
  1224. frag.color.r = gc->state.current.rasterPos.colors[__GL_FRONTFACE].r;
  1225. frag.color.g = gc->state.current.rasterPos.colors[__GL_FRONTFACE].g;
  1226. frag.color.b = gc->state.current.rasterPos.colors[__GL_FRONTFACE].b;
  1227. frag.color.a = gc->state.current.rasterPos.colors[__GL_FRONTFACE].a;
  1228. rows = spanInfo->rows;
  1229. for (row = ibottom; row != itop; row += rowadd) {
  1230. if (rows == 0) break;
  1231. rows--;
  1232. column = spanInfo->startCol;
  1233. spanData = (GLfloat*) span;
  1234. frag.y = row;
  1235. for (i=0; i<width; i++) {
  1236. frag.x = column;
  1237. frag.z = *spanData++ * gc->depthBuffer.scale;
  1238. /* This procedure will do the rest */
  1239. (*store)(gc->drawBuffer, &frag);
  1240. column += coladd;
  1241. }
  1242. }
  1243. spanInfo->rows = rows;
  1244. spanInfo->startRow = itop;
  1245. FPU_RESTORE_MODE();
  1246. }
  1247. /*
  1248. ** Render a GL_COLOR_INDEX, GL_FLOAT span (gc->modes.rgbMode == GL_FALSE).
  1249. **
  1250. ** zoomx is assumed to be less than -1.0 or greater than 1.0.
  1251. */
  1252. void FASTCALL __glSpanRenderCI(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1253. GLvoid *span)
  1254. {
  1255. __GLfloat zoomy;
  1256. GLint itop, ibottom, iright;
  1257. GLint row, column;
  1258. GLint i, width;
  1259. GLint coladd, rowadd;
  1260. GLfloat *spanData;
  1261. __GLfragment frag;
  1262. void (FASTCALL *store)(__GLcolorBuffer *cfb, const __GLfragment *frag);
  1263. GLint rows;
  1264. GLshort *pixelArray;
  1265. GLint mask;
  1266. zoomy = spanInfo->zoomy;
  1267. rowadd = spanInfo->rowadd;
  1268. coladd = spanInfo->coladd;
  1269. ibottom = spanInfo->startRow;
  1270. itop = spanInfo->y + zoomy;
  1271. width = spanInfo->realWidth;
  1272. mask = gc->frontBuffer.redMax;
  1273. store = gc->procs.pxStore;
  1274. frag.z = spanInfo->fragz;
  1275. rows = spanInfo->rows;
  1276. for (row = ibottom; row != itop; row += rowadd) {
  1277. if (rows == 0) break;
  1278. rows--;
  1279. column = spanInfo->startCol;
  1280. pixelArray = spanInfo->pixelArray;
  1281. spanData = (GLfloat*) span;
  1282. frag.y = row;
  1283. for (i=0; i<width; i++) {
  1284. iright = column + *pixelArray++;
  1285. frag.color.r = (GLint) (*spanData++) & mask;
  1286. do {
  1287. frag.x = column;
  1288. /* This procedure will do the rest */
  1289. (*store)(gc->drawBuffer, &frag);
  1290. column += coladd;
  1291. } while (column != iright);
  1292. }
  1293. }
  1294. spanInfo->rows = rows;
  1295. spanInfo->startRow = itop;
  1296. }
  1297. /*
  1298. ** Render a GL_COLOR_INDEX, GL_FLOAT span (gc->modes.rgbMode == GL_FALSE).
  1299. **
  1300. ** zoomx is assumed to be less than or equal to 1.0 and greater than or equal
  1301. ** to -1.0.
  1302. */
  1303. void FASTCALL __glSpanRenderCI2(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1304. GLvoid *span)
  1305. {
  1306. __GLfloat zoomy;
  1307. GLint itop, ibottom;
  1308. GLint row, column;
  1309. GLint i, width;
  1310. GLint coladd, rowadd;
  1311. GLfloat *spanData;
  1312. __GLfragment frag;
  1313. void (FASTCALL *store)(__GLcolorBuffer *cfb, const __GLfragment *frag);
  1314. GLint rows;
  1315. GLint mask;
  1316. zoomy = spanInfo->zoomy;
  1317. rowadd = spanInfo->rowadd;
  1318. coladd = spanInfo->coladd;
  1319. ibottom = spanInfo->startRow;
  1320. itop = spanInfo->y + zoomy;
  1321. width = spanInfo->realWidth;
  1322. mask = gc->frontBuffer.redMax;
  1323. store = gc->procs.pxStore;
  1324. frag.z = spanInfo->fragz;
  1325. rows = spanInfo->rows;
  1326. for (row = ibottom; row != itop; row += rowadd) {
  1327. if (rows == 0) break;
  1328. rows--;
  1329. column = spanInfo->startCol;
  1330. spanData = (GLfloat*) span;
  1331. frag.y = row;
  1332. for (i=0; i<width; i++) {
  1333. frag.color.r = (GLint) (*spanData++) & mask;
  1334. frag.x = column;
  1335. /* This procedure will do the rest */
  1336. (*store)(gc->drawBuffer, &frag);
  1337. column += coladd;
  1338. }
  1339. }
  1340. spanInfo->rows = rows;
  1341. spanInfo->startRow = itop;
  1342. }
  1343. /*
  1344. ** Render a GL_STENCIL_INDEX, GL_FLOAT span.
  1345. **
  1346. ** zoomx is assumed to be less than -1.0 or greater than 1.0.
  1347. */
  1348. void FASTCALL __glSpanRenderStencil(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1349. GLvoid *span)
  1350. {
  1351. __GLfloat zoomy;
  1352. GLint itop, ibottom, iright;
  1353. GLint row, column;
  1354. GLint i, width;
  1355. GLint coladd, rowadd;
  1356. GLfloat *spanData;
  1357. GLint index;
  1358. __GLstencilBuffer *sb;
  1359. GLint rows;
  1360. GLshort *pixelArray;
  1361. zoomy = spanInfo->zoomy;
  1362. rowadd = spanInfo->rowadd;
  1363. coladd = spanInfo->coladd;
  1364. ibottom = spanInfo->startRow;
  1365. itop = spanInfo->y + zoomy;
  1366. width = spanInfo->realWidth;
  1367. sb = &gc->stencilBuffer;
  1368. rows = spanInfo->rows;
  1369. for (row = ibottom; row != itop; row += rowadd) {
  1370. if (rows == 0) break;
  1371. rows--;
  1372. column = spanInfo->startCol;
  1373. pixelArray = spanInfo->pixelArray;
  1374. spanData = (GLfloat*) span;
  1375. for (i=0; i<width; i++) {
  1376. iright = column + *pixelArray++;
  1377. index = *spanData++;
  1378. do {
  1379. (*sb->store)(sb, column, row, index);
  1380. column += coladd;
  1381. } while (column != iright);
  1382. }
  1383. }
  1384. spanInfo->rows = rows;
  1385. spanInfo->startRow = itop;
  1386. }
  1387. /*
  1388. ** Render a GL_STENCIL_INDEX, GL_FLOAT span.
  1389. **
  1390. ** zoomx is assumed to be less than or equal to 1.0 and greater than or equal
  1391. ** to -1.0.
  1392. */
  1393. void FASTCALL __glSpanRenderStencil2(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1394. GLvoid *span)
  1395. {
  1396. __GLfloat zoomy;
  1397. GLint itop, ibottom;
  1398. GLint row, column;
  1399. GLint i, width;
  1400. GLint coladd, rowadd;
  1401. GLfloat *spanData;
  1402. GLint index;
  1403. __GLstencilBuffer *sb;
  1404. GLint rows;
  1405. zoomy = spanInfo->zoomy;
  1406. rowadd = spanInfo->rowadd;
  1407. coladd = spanInfo->coladd;
  1408. ibottom = spanInfo->startRow;
  1409. itop = spanInfo->y + zoomy;
  1410. width = spanInfo->realWidth;
  1411. sb = &gc->stencilBuffer;
  1412. rows = spanInfo->rows;
  1413. for (row = ibottom; row != itop; row += rowadd) {
  1414. if (rows == 0) break;
  1415. rows--;
  1416. column = spanInfo->startCol;
  1417. spanData = (GLfloat*) span;
  1418. for (i=0; i<width; i++) {
  1419. index = *spanData++;
  1420. (*sb->store)(sb, column, row, index);
  1421. column += coladd;
  1422. }
  1423. }
  1424. spanInfo->rows = rows;
  1425. spanInfo->startRow = itop;
  1426. }