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.

1951 lines
50 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 unpack data from the user's data space
  21. ** into a span of pixels which can then be rendered.
  22. */
  23. /*
  24. ** Return the number of elements per group of a specified format
  25. */
  26. GLint FASTCALL __glElementsPerGroup(GLenum format)
  27. {
  28. switch(format) {
  29. case GL_RGB:
  30. #ifdef GL_EXT_bgra
  31. case GL_BGR_EXT:
  32. #endif
  33. return 3;
  34. case GL_LUMINANCE_ALPHA:
  35. case __GL_RED_ALPHA:
  36. return 2;
  37. case GL_RGBA:
  38. #ifdef GL_EXT_bgra
  39. case GL_BGRA_EXT:
  40. #endif
  41. return 4;
  42. default:
  43. return 1;
  44. }
  45. }
  46. /*
  47. ** Return the number of bytes per element, based on the element type
  48. */
  49. __GLfloat FASTCALL __glBytesPerElement(GLenum type)
  50. {
  51. switch(type) {
  52. case GL_BITMAP:
  53. return ((__GLfloat) 1.0 / (__GLfloat) 8.0);
  54. case GL_UNSIGNED_SHORT:
  55. case GL_SHORT:
  56. return 2;
  57. case GL_UNSIGNED_BYTE:
  58. case GL_BYTE:
  59. return 1;
  60. case GL_INT:
  61. case GL_UNSIGNED_INT:
  62. case GL_FLOAT:
  63. default:
  64. return 4;
  65. }
  66. }
  67. void FASTCALL __glInitUnpacker(__GLcontext *gc, __GLpixelSpanInfo *spanInfo)
  68. {
  69. GLint alignment;
  70. GLint lsb_first;
  71. GLint components;
  72. GLint element_size;
  73. GLint rowsize;
  74. GLint padding;
  75. GLint group_size;
  76. GLint groups_per_line;
  77. GLint skip_pixels, skip_lines;
  78. GLint swap_bytes;
  79. GLenum format, type;
  80. const GLvoid *pixels;
  81. format = spanInfo->srcFormat;
  82. type = spanInfo->srcType;
  83. pixels = spanInfo->srcImage;
  84. skip_pixels = spanInfo->srcSkipPixels;
  85. skip_lines = spanInfo->srcSkipLines;
  86. alignment = spanInfo->srcAlignment;
  87. lsb_first = spanInfo->srcLsbFirst;
  88. swap_bytes = spanInfo->srcSwapBytes;
  89. components = __glElementsPerGroup(format);
  90. groups_per_line = spanInfo->srcLineLength;
  91. element_size = __glBytesPerElement(type);
  92. if (element_size == 1) swap_bytes = 0;
  93. group_size = element_size * components;
  94. rowsize = groups_per_line * group_size;
  95. if (type == GL_BITMAP) {
  96. rowsize = (groups_per_line + 7)/8;
  97. }
  98. padding = (rowsize % alignment);
  99. if (padding) {
  100. rowsize += alignment - padding;
  101. }
  102. if (((skip_pixels & 0x7) && type == GL_BITMAP) ||
  103. (swap_bytes && element_size > 1)) {
  104. spanInfo->srcPackedData = GL_FALSE;
  105. } else {
  106. spanInfo->srcPackedData = GL_TRUE;
  107. }
  108. if (type == GL_BITMAP) {
  109. spanInfo->srcCurrent = (GLvoid *) (((const GLubyte *) pixels) +
  110. skip_lines * rowsize + skip_pixels / 8);
  111. spanInfo->srcStartBit = skip_pixels % 8;
  112. } else {
  113. spanInfo->srcCurrent = (GLvoid *) (((const GLubyte *) pixels) +
  114. skip_lines * rowsize + skip_pixels * group_size);
  115. }
  116. spanInfo->srcRowIncrement = rowsize;
  117. spanInfo->srcGroupIncrement = group_size;
  118. spanInfo->srcComponents = components;
  119. spanInfo->srcElementSize = element_size;
  120. }
  121. /*
  122. ** An unpacker that unpacks from BITMAP source data, into FLOAT spans.
  123. **
  124. ** zoomx is assumed to be less than 1.0 and greater than -1.0.
  125. */
  126. void __glSpanUnpackBitmap(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  127. GLvoid *inspan, GLvoid *outspan)
  128. {
  129. GLint i,j;
  130. GLint width;
  131. GLvoid *userData;
  132. GLfloat *spanData;
  133. GLint lsbFirst;
  134. GLint startBit;
  135. GLint bit;
  136. GLubyte ubyte;
  137. GLshort *pixelArray;
  138. GLint skipCount;
  139. __GLfloat zero, one;
  140. userData = inspan;
  141. spanData = (GLfloat *) outspan;
  142. pixelArray = spanInfo->pixelArray;
  143. width = spanInfo->width;
  144. lsbFirst = spanInfo->srcLsbFirst;
  145. startBit = spanInfo->srcStartBit;
  146. i = width;
  147. bit = startBit;
  148. ubyte = *(GLubyte *) userData;
  149. zero = __glZero;
  150. one = __glOne;
  151. skipCount = 1;
  152. if (lsbFirst) {
  153. switch(bit) {
  154. case 1:
  155. if (--skipCount == 0) {
  156. skipCount = *pixelArray++;
  157. if (ubyte & 0x02) *spanData++ = one;
  158. else *spanData++ = zero;
  159. }
  160. if (--i == 0) break;
  161. case 2:
  162. if (--skipCount == 0) {
  163. skipCount = *pixelArray++;
  164. if (ubyte & 0x04) *spanData++ = one;
  165. else *spanData++ = zero;
  166. }
  167. if (--i == 0) break;
  168. case 3:
  169. if (--skipCount == 0) {
  170. skipCount = *pixelArray++;
  171. if (ubyte & 0x08) *spanData++ = one;
  172. else *spanData++ = zero;
  173. }
  174. if (--i == 0) break;
  175. case 4:
  176. if (--skipCount == 0) {
  177. skipCount = *pixelArray++;
  178. if (ubyte & 0x10) *spanData++ = one;
  179. else *spanData++ = zero;
  180. }
  181. if (--i == 0) break;
  182. case 5:
  183. if (--skipCount == 0) {
  184. skipCount = *pixelArray++;
  185. if (ubyte & 0x20) *spanData++ = one;
  186. else *spanData++ = zero;
  187. }
  188. if (--i == 0) break;
  189. case 6:
  190. if (--skipCount == 0) {
  191. skipCount = *pixelArray++;
  192. if (ubyte & 0x40) *spanData++ = one;
  193. else *spanData++ = zero;
  194. }
  195. if (--i == 0) break;
  196. case 7:
  197. if (--skipCount == 0) {
  198. skipCount = *pixelArray++;
  199. if (ubyte & 0x80) *spanData++ = one;
  200. else *spanData++ = zero;
  201. }
  202. i--;
  203. userData = (GLvoid *) ((GLubyte *) userData + 1);
  204. case 0:
  205. break;
  206. }
  207. while (i >= 8) {
  208. ubyte = *(GLubyte *) userData;
  209. userData = (GLvoid *) ((GLubyte *) userData + 1);
  210. i -= 8;
  211. if (--skipCount == 0) {
  212. skipCount = *pixelArray++;
  213. if (ubyte & 0x01) *spanData++ = one;
  214. else *spanData++ = zero;
  215. }
  216. if (--skipCount == 0) {
  217. skipCount = *pixelArray++;
  218. if (ubyte & 0x02) *spanData++ = one;
  219. else *spanData++ = zero;
  220. }
  221. if (--skipCount == 0) {
  222. skipCount = *pixelArray++;
  223. if (ubyte & 0x04) *spanData++ = one;
  224. else *spanData++ = zero;
  225. }
  226. if (--skipCount == 0) {
  227. skipCount = *pixelArray++;
  228. if (ubyte & 0x08) *spanData++ = one;
  229. else *spanData++ = zero;
  230. }
  231. if (--skipCount == 0) {
  232. skipCount = *pixelArray++;
  233. if (ubyte & 0x10) *spanData++ = one;
  234. else *spanData++ = zero;
  235. }
  236. if (--skipCount == 0) {
  237. skipCount = *pixelArray++;
  238. if (ubyte & 0x20) *spanData++ = one;
  239. else *spanData++ = zero;
  240. }
  241. if (--skipCount == 0) {
  242. skipCount = *pixelArray++;
  243. if (ubyte & 0x40) *spanData++ = one;
  244. else *spanData++ = zero;
  245. }
  246. if (--skipCount == 0) {
  247. skipCount = *pixelArray++;
  248. if (ubyte & 0x80) *spanData++ = one;
  249. else *spanData++ = zero;
  250. }
  251. }
  252. if (i) {
  253. ubyte = *(GLubyte *) userData;
  254. if (--skipCount == 0) {
  255. skipCount = *pixelArray++;
  256. if (ubyte & 0x01) *spanData++ = one;
  257. else *spanData++ = zero;
  258. }
  259. if (--i == 0) return;
  260. if (--skipCount == 0) {
  261. skipCount = *pixelArray++;
  262. if (ubyte & 0x02) *spanData++ = one;
  263. else *spanData++ = zero;
  264. }
  265. if (--i == 0) return;
  266. if (--skipCount == 0) {
  267. skipCount = *pixelArray++;
  268. if (ubyte & 0x04) *spanData++ = one;
  269. else *spanData++ = zero;
  270. }
  271. if (--i == 0) return;
  272. if (--skipCount == 0) {
  273. skipCount = *pixelArray++;
  274. if (ubyte & 0x08) *spanData++ = one;
  275. else *spanData++ = zero;
  276. }
  277. if (--i == 0) return;
  278. if (--skipCount == 0) {
  279. skipCount = *pixelArray++;
  280. if (ubyte & 0x10) *spanData++ = one;
  281. else *spanData++ = zero;
  282. }
  283. if (--i == 0) return;
  284. if (--skipCount == 0) {
  285. skipCount = *pixelArray++;
  286. if (ubyte & 0x20) *spanData++ = one;
  287. else *spanData++ = zero;
  288. }
  289. if (--i == 0) return;
  290. if (--skipCount == 0) {
  291. skipCount = *pixelArray++;
  292. if (ubyte & 0x40) *spanData++ = one;
  293. else *spanData++ = zero;
  294. }
  295. }
  296. } else {
  297. switch(bit) {
  298. case 1:
  299. if (--skipCount == 0) {
  300. skipCount = *pixelArray++;
  301. if (ubyte & 0x40) *spanData++ = one;
  302. else *spanData++ = zero;
  303. }
  304. if (--i == 0) break;
  305. case 2:
  306. if (--skipCount == 0) {
  307. skipCount = *pixelArray++;
  308. if (ubyte & 0x20) *spanData++ = one;
  309. else *spanData++ = zero;
  310. }
  311. if (--i == 0) break;
  312. case 3:
  313. if (--skipCount == 0) {
  314. skipCount = *pixelArray++;
  315. if (ubyte & 0x10) *spanData++ = one;
  316. else *spanData++ = zero;
  317. }
  318. if (--i == 0) break;
  319. case 4:
  320. if (--skipCount == 0) {
  321. skipCount = *pixelArray++;
  322. if (ubyte & 0x08) *spanData++ = one;
  323. else *spanData++ = zero;
  324. }
  325. if (--i == 0) break;
  326. case 5:
  327. if (--skipCount == 0) {
  328. skipCount = *pixelArray++;
  329. if (ubyte & 0x04) *spanData++ = one;
  330. else *spanData++ = zero;
  331. }
  332. if (--i == 0) break;
  333. case 6:
  334. if (--skipCount == 0) {
  335. skipCount = *pixelArray++;
  336. if (ubyte & 0x02) *spanData++ = one;
  337. else *spanData++ = zero;
  338. }
  339. if (--i == 0) break;
  340. case 7:
  341. if (--skipCount == 0) {
  342. skipCount = *pixelArray++;
  343. if (ubyte & 0x01) *spanData++ = one;
  344. else *spanData++ = zero;
  345. }
  346. i--;
  347. userData = (GLvoid *) ((GLubyte *) userData + 1);
  348. case 0:
  349. break;
  350. }
  351. while (i >= 8) {
  352. ubyte = *(GLubyte *) userData;
  353. userData = (GLvoid *) ((GLubyte *) userData + 1);
  354. i -= 8;
  355. if (--skipCount == 0) {
  356. skipCount = *pixelArray++;
  357. if (ubyte & 0x80) *spanData++ = one;
  358. else *spanData++ = zero;
  359. }
  360. if (--skipCount == 0) {
  361. skipCount = *pixelArray++;
  362. if (ubyte & 0x40) *spanData++ = one;
  363. else *spanData++ = zero;
  364. }
  365. if (--skipCount == 0) {
  366. skipCount = *pixelArray++;
  367. if (ubyte & 0x20) *spanData++ = one;
  368. else *spanData++ = zero;
  369. }
  370. if (--skipCount == 0) {
  371. skipCount = *pixelArray++;
  372. if (ubyte & 0x10) *spanData++ = one;
  373. else *spanData++ = zero;
  374. }
  375. if (--skipCount == 0) {
  376. skipCount = *pixelArray++;
  377. if (ubyte & 0x08) *spanData++ = one;
  378. else *spanData++ = zero;
  379. }
  380. if (--skipCount == 0) {
  381. skipCount = *pixelArray++;
  382. if (ubyte & 0x04) *spanData++ = one;
  383. else *spanData++ = zero;
  384. }
  385. if (--skipCount == 0) {
  386. skipCount = *pixelArray++;
  387. if (ubyte & 0x02) *spanData++ = one;
  388. else *spanData++ = zero;
  389. }
  390. if (--skipCount == 0) {
  391. skipCount = *pixelArray++;
  392. if (ubyte & 0x01) *spanData++ = one;
  393. else *spanData++ = zero;
  394. }
  395. }
  396. if (i) {
  397. ubyte = *(GLubyte *) userData;
  398. if (--skipCount == 0) {
  399. skipCount = *pixelArray++;
  400. if (ubyte & 0x80) *spanData++ = one;
  401. else *spanData++ = zero;
  402. }
  403. if (--i == 0) return;
  404. if (--skipCount == 0) {
  405. skipCount = *pixelArray++;
  406. if (ubyte & 0x40) *spanData++ = one;
  407. else *spanData++ = zero;
  408. }
  409. if (--i == 0) return;
  410. if (--skipCount == 0) {
  411. skipCount = *pixelArray++;
  412. if (ubyte & 0x20) *spanData++ = one;
  413. else *spanData++ = zero;
  414. }
  415. if (--i == 0) return;
  416. if (--skipCount == 0) {
  417. skipCount = *pixelArray++;
  418. if (ubyte & 0x10) *spanData++ = one;
  419. else *spanData++ = zero;
  420. }
  421. if (--i == 0) return;
  422. if (--skipCount == 0) {
  423. skipCount = *pixelArray++;
  424. if (ubyte & 0x08) *spanData++ = one;
  425. else *spanData++ = zero;
  426. }
  427. if (--i == 0) return;
  428. if (--skipCount == 0) {
  429. skipCount = *pixelArray++;
  430. if (ubyte & 0x04) *spanData++ = one;
  431. else *spanData++ = zero;
  432. }
  433. if (--i == 0) return;
  434. if (--skipCount == 0) {
  435. skipCount = *pixelArray++;
  436. if (ubyte & 0x02) *spanData++ = one;
  437. else *spanData++ = zero;
  438. }
  439. }
  440. }
  441. }
  442. /*
  443. ** An unpacker that unpacks from BITMAP source data, into FLOAT spans.
  444. **
  445. ** zoomx is assumed to be less than or equal to -1.0 or greater than or
  446. ** equal to 1.0.
  447. */
  448. void __glSpanUnpackBitmap2(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  449. GLvoid *inspan, GLvoid *outspan)
  450. {
  451. GLint i,j;
  452. GLint width;
  453. GLvoid *userData;
  454. GLfloat *spanData;
  455. GLint lsbFirst;
  456. GLint startBit;
  457. GLint bit;
  458. GLubyte ubyte;
  459. width = spanInfo->realWidth;
  460. userData = inspan;
  461. spanData = (GLfloat *) outspan;
  462. lsbFirst = spanInfo->srcLsbFirst;
  463. startBit = spanInfo->srcStartBit;
  464. i = width;
  465. bit = startBit;
  466. ubyte = *(GLubyte *) userData;
  467. if (lsbFirst) {
  468. switch(bit) {
  469. case 1:
  470. if (ubyte & 0x02) *spanData++ = __glOne;
  471. else *spanData++ = __glZero;
  472. if (--i == 0) break;
  473. case 2:
  474. if (ubyte & 0x04) *spanData++ = __glOne;
  475. else *spanData++ = __glZero;
  476. if (--i == 0) break;
  477. case 3:
  478. if (ubyte & 0x08) *spanData++ = __glOne;
  479. else *spanData++ = __glZero;
  480. if (--i == 0) break;
  481. case 4:
  482. if (ubyte & 0x10) *spanData++ = __glOne;
  483. else *spanData++ = __glZero;
  484. if (--i == 0) break;
  485. case 5:
  486. if (ubyte & 0x20) *spanData++ = __glOne;
  487. else *spanData++ = __glZero;
  488. if (--i == 0) break;
  489. case 6:
  490. if (ubyte & 0x40) *spanData++ = __glOne;
  491. else *spanData++ = __glZero;
  492. if (--i == 0) break;
  493. case 7:
  494. if (ubyte & 0x80) *spanData++ = __glOne;
  495. else *spanData++ = __glZero;
  496. i--;
  497. userData = (GLvoid *) ((GLubyte *) userData + 1);
  498. case 0:
  499. break;
  500. }
  501. while (i >= 8) {
  502. ubyte = *(GLubyte *) userData;
  503. userData = (GLvoid *) ((GLubyte *) userData + 1);
  504. i -= 8;
  505. if (ubyte & 0x01) *spanData++ = __glOne;
  506. else *spanData++ = __glZero;
  507. if (ubyte & 0x02) *spanData++ = __glOne;
  508. else *spanData++ = __glZero;
  509. if (ubyte & 0x04) *spanData++ = __glOne;
  510. else *spanData++ = __glZero;
  511. if (ubyte & 0x08) *spanData++ = __glOne;
  512. else *spanData++ = __glZero;
  513. if (ubyte & 0x10) *spanData++ = __glOne;
  514. else *spanData++ = __glZero;
  515. if (ubyte & 0x20) *spanData++ = __glOne;
  516. else *spanData++ = __glZero;
  517. if (ubyte & 0x40) *spanData++ = __glOne;
  518. else *spanData++ = __glZero;
  519. if (ubyte & 0x80) *spanData++ = __glOne;
  520. else *spanData++ = __glZero;
  521. }
  522. if (i) {
  523. ubyte = *(GLubyte *) userData;
  524. if (ubyte & 0x01) *spanData++ = __glOne;
  525. else *spanData++ = __glZero;
  526. if (--i == 0) return;
  527. if (ubyte & 0x02) *spanData++ = __glOne;
  528. else *spanData++ = __glZero;
  529. if (--i == 0) return;
  530. if (ubyte & 0x04) *spanData++ = __glOne;
  531. else *spanData++ = __glZero;
  532. if (--i == 0) return;
  533. if (ubyte & 0x08) *spanData++ = __glOne;
  534. else *spanData++ = __glZero;
  535. if (--i == 0) return;
  536. if (ubyte & 0x10) *spanData++ = __glOne;
  537. else *spanData++ = __glZero;
  538. if (--i == 0) return;
  539. if (ubyte & 0x20) *spanData++ = __glOne;
  540. else *spanData++ = __glZero;
  541. if (--i == 0) return;
  542. if (ubyte & 0x40) *spanData++ = __glOne;
  543. else *spanData++ = __glZero;
  544. }
  545. } else {
  546. switch(bit) {
  547. case 1:
  548. if (ubyte & 0x40) *spanData++ = __glOne;
  549. else *spanData++ = __glZero;
  550. if (--i == 0) break;
  551. case 2:
  552. if (ubyte & 0x20) *spanData++ = __glOne;
  553. else *spanData++ = __glZero;
  554. if (--i == 0) break;
  555. case 3:
  556. if (ubyte & 0x10) *spanData++ = __glOne;
  557. else *spanData++ = __glZero;
  558. if (--i == 0) break;
  559. case 4:
  560. if (ubyte & 0x08) *spanData++ = __glOne;
  561. else *spanData++ = __glZero;
  562. if (--i == 0) break;
  563. case 5:
  564. if (ubyte & 0x04) *spanData++ = __glOne;
  565. else *spanData++ = __glZero;
  566. if (--i == 0) break;
  567. case 6:
  568. if (ubyte & 0x02) *spanData++ = __glOne;
  569. else *spanData++ = __glZero;
  570. if (--i == 0) break;
  571. case 7:
  572. if (ubyte & 0x01) *spanData++ = __glOne;
  573. else *spanData++ = __glZero;
  574. i--;
  575. userData = (GLvoid *) ((GLubyte *) userData + 1);
  576. case 0:
  577. break;
  578. }
  579. while (i >= 8) {
  580. ubyte = *(GLubyte *) userData;
  581. userData = (GLvoid *) ((GLubyte *) userData + 1);
  582. i -= 8;
  583. if (ubyte & 0x80) *spanData++ = __glOne;
  584. else *spanData++ = __glZero;
  585. if (ubyte & 0x40) *spanData++ = __glOne;
  586. else *spanData++ = __glZero;
  587. if (ubyte & 0x20) *spanData++ = __glOne;
  588. else *spanData++ = __glZero;
  589. if (ubyte & 0x10) *spanData++ = __glOne;
  590. else *spanData++ = __glZero;
  591. if (ubyte & 0x08) *spanData++ = __glOne;
  592. else *spanData++ = __glZero;
  593. if (ubyte & 0x04) *spanData++ = __glOne;
  594. else *spanData++ = __glZero;
  595. if (ubyte & 0x02) *spanData++ = __glOne;
  596. else *spanData++ = __glZero;
  597. if (ubyte & 0x01) *spanData++ = __glOne;
  598. else *spanData++ = __glZero;
  599. }
  600. if (i) {
  601. ubyte = *(GLubyte *) userData;
  602. if (ubyte & 0x80) *spanData++ = __glOne;
  603. else *spanData++ = __glZero;
  604. if (--i == 0) return;
  605. if (ubyte & 0x40) *spanData++ = __glOne;
  606. else *spanData++ = __glZero;
  607. if (--i == 0) return;
  608. if (ubyte & 0x20) *spanData++ = __glOne;
  609. else *spanData++ = __glZero;
  610. if (--i == 0) return;
  611. if (ubyte & 0x10) *spanData++ = __glOne;
  612. else *spanData++ = __glZero;
  613. if (--i == 0) return;
  614. if (ubyte & 0x08) *spanData++ = __glOne;
  615. else *spanData++ = __glZero;
  616. if (--i == 0) return;
  617. if (ubyte & 0x04) *spanData++ = __glOne;
  618. else *spanData++ = __glZero;
  619. if (--i == 0) return;
  620. if (ubyte & 0x02) *spanData++ = __glOne;
  621. else *spanData++ = __glZero;
  622. }
  623. }
  624. }
  625. /*
  626. ** An unpacker that unpacks from RGB, UNSIGNED_BYTE source data, into
  627. ** RGB, UNSIGNED_BYTE spans.
  628. **
  629. ** zoomx is assumed to be less than 1.0 and greater than -1.0.
  630. */
  631. void __glSpanUnpackRGBubyte(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  632. GLvoid *inspan, GLvoid *outspan)
  633. {
  634. GLint i;
  635. GLubyte *userData;
  636. GLubyte *spanData;
  637. GLint width, groupInc;
  638. GLshort *pixelArray;
  639. GLint skipCount;
  640. #ifdef __GL_LINT
  641. gc = gc;
  642. #endif
  643. width = spanInfo->realWidth;
  644. groupInc = spanInfo->srcGroupIncrement;
  645. userData = (GLubyte *) inspan;
  646. spanData = (GLubyte *) outspan;
  647. pixelArray = spanInfo->pixelArray;
  648. i = 0;
  649. do {
  650. spanData[0] = userData[0];
  651. spanData[1] = userData[1];
  652. spanData[2] = userData[2];
  653. spanData += 3;
  654. skipCount = *pixelArray++;
  655. userData = (GLubyte *) ((GLubyte *) userData + 3 * skipCount);
  656. i++;
  657. } while (i<width);
  658. }
  659. /*
  660. ** An unpacker that unpacks from either index, UNSIGNED_BYTE source data,
  661. ** into UNSIGNED_BYTE spans.
  662. **
  663. ** zoomx is assumed to be less than 1.0 and greater than -1.0.
  664. */
  665. void __glSpanUnpackIndexUbyte(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  666. GLvoid *inspan, GLvoid *outspan)
  667. {
  668. GLint i;
  669. GLubyte *userData;
  670. GLubyte *spanData;
  671. GLint width, groupInc;
  672. GLshort *pixelArray;
  673. GLint skipCount;
  674. #ifdef __GL_LINT
  675. gc = gc;
  676. #endif
  677. width = spanInfo->realWidth;
  678. groupInc = spanInfo->srcGroupIncrement;
  679. userData = (GLubyte *) inspan;
  680. spanData = (GLubyte *) outspan;
  681. pixelArray = spanInfo->pixelArray;
  682. i = 0;
  683. do {
  684. *spanData = *userData;
  685. spanData++;
  686. skipCount = *pixelArray++;
  687. userData = (GLubyte *) ((GLubyte *) userData + skipCount);
  688. i++;
  689. } while (i<width);
  690. }
  691. /*
  692. ** An unpacker that unpacks from RGBA, UNSIGNED_BYTE source data, into
  693. ** RGBA, UNSIGNED_BYTE spans.
  694. **
  695. ** This could be faster if we could assume that the first ubyte (red)
  696. ** was aligned on a word boundary. Then we could just use unsigned int
  697. ** pointers to copy the user's data. This might be a reasonable future
  698. ** optimization.
  699. **
  700. ** zoomx is assumed to be less than 1.0 and greater than -1.0.
  701. */
  702. void __glSpanUnpackRGBAubyte(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  703. GLvoid *inspan, GLvoid *outspan)
  704. {
  705. GLint i;
  706. GLubyte *userData;
  707. GLubyte *spanData;
  708. GLint width, groupInc;
  709. GLshort *pixelArray;
  710. GLint skipCount;
  711. #ifdef __GL_LINT
  712. gc = gc;
  713. #endif
  714. width = spanInfo->realWidth;
  715. groupInc = spanInfo->srcGroupIncrement;
  716. userData = (GLubyte *) inspan;
  717. spanData = (GLubyte *) outspan;
  718. pixelArray = spanInfo->pixelArray;
  719. i = 0;
  720. do {
  721. spanData[0] = userData[0];
  722. spanData[1] = userData[1];
  723. spanData[2] = userData[2];
  724. spanData[3] = userData[3];
  725. spanData += 4;
  726. skipCount = *pixelArray++;
  727. userData = (GLubyte *) ((GLubyte *) userData + (skipCount << 2));
  728. i++;
  729. } while (i<width);
  730. }
  731. /*
  732. ** Swaps bytes from an incoming span of two byte objects to an outgoing span.
  733. ** No pixel skipping is performed.
  734. */
  735. void __glSpanSwapBytes2(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  736. GLvoid *inspan, GLvoid *outspan)
  737. {
  738. GLint i;
  739. GLint width = spanInfo->realWidth;
  740. GLubyte *inData = (GLubyte *) inspan;
  741. GLubyte *outData = (GLubyte *) outspan;
  742. GLubyte a,b;
  743. GLint components = spanInfo->srcComponents;
  744. GLint totalSize = width * components;
  745. #ifdef __GL_LINT
  746. gc = gc;
  747. #endif
  748. for (i=0; i<totalSize; i++) {
  749. a = inData[0];
  750. b = inData[1];
  751. outData[0] = b;
  752. outData[1] = a;
  753. outData += 2;
  754. inData += 2;
  755. }
  756. }
  757. /*
  758. ** Swaps bytes from an incoming span of two byte objects to an outgoing span.
  759. ** No pixel skipping is performed. This version is for swapping to the
  760. ** desination image.
  761. */
  762. void __glSpanSwapBytes2Dst(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  763. GLvoid *inspan, GLvoid *outspan)
  764. {
  765. GLint i;
  766. GLint width = spanInfo->realWidth;
  767. GLubyte *inData = (GLubyte *) inspan;
  768. GLubyte *outData = (GLubyte *) outspan;
  769. GLubyte a,b;
  770. GLint components = spanInfo->dstComponents;
  771. GLint totalSize = width * components;
  772. #ifdef __GL_LINT
  773. gc = gc;
  774. #endif
  775. for (i=0; i<totalSize; i++) {
  776. a = inData[0];
  777. b = inData[1];
  778. outData[0] = b;
  779. outData[1] = a;
  780. outData += 2;
  781. inData += 2;
  782. }
  783. }
  784. /*
  785. ** Swaps bytes from an incoming span of two byte objects to an outgoing span.
  786. ** Pixel skipping is performed.
  787. */
  788. void __glSpanSwapAndSkipBytes2(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  789. GLvoid *inspan, GLvoid *outspan)
  790. {
  791. GLint i,j;
  792. GLint width = spanInfo->realWidth;
  793. GLubyte *inData = (GLubyte *) inspan;
  794. GLubyte *outData = (GLubyte *) outspan;
  795. GLubyte a,b;
  796. GLint components = spanInfo->srcComponents;
  797. GLint groupInc = spanInfo->srcGroupIncrement;
  798. GLshort *pixelArray = spanInfo->pixelArray;
  799. GLint skipCount;
  800. #ifdef __GL_LINT
  801. gc = gc;
  802. #endif
  803. for (i=0; i<width; i++) {
  804. for (j=0; j<components; j++) {
  805. a = inData[0];
  806. b = inData[1];
  807. outData[0] = b;
  808. outData[1] = a;
  809. outData += 2;
  810. inData += 2;
  811. }
  812. skipCount = (*pixelArray++) - 1;
  813. inData = (GLubyte *) ((GLubyte *) inData + (skipCount * groupInc));
  814. }
  815. }
  816. /*
  817. ** Swaps bytes from an incoming span of four byte objects to an outgoing span.
  818. ** No pixel skipping is performed.
  819. */
  820. void __glSpanSwapBytes4(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  821. GLvoid *inspan, GLvoid *outspan)
  822. {
  823. GLint i;
  824. GLint width = spanInfo->realWidth;
  825. GLubyte *inData = (GLubyte *) inspan;
  826. GLubyte *outData = (GLubyte *) outspan;
  827. GLubyte a,b,c,d;
  828. GLint components = spanInfo->srcComponents;
  829. GLint totalSize = width * components;
  830. #ifdef __GL_LINT
  831. gc = gc;
  832. #endif
  833. for (i=0; i<totalSize; i++) {
  834. c = inData[2];
  835. d = inData[3];
  836. a = inData[0];
  837. b = inData[1];
  838. outData[0] = d;
  839. outData[1] = c;
  840. outData[2] = b;
  841. outData[3] = a;
  842. outData += 4;
  843. inData += 4;
  844. }
  845. }
  846. /*
  847. ** Swaps bytes from an incoming span of four byte objects to an outgoing span.
  848. ** No pixel skipping is performed. This version is for swapping to the
  849. ** destination image.
  850. */
  851. void __glSpanSwapBytes4Dst(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  852. GLvoid *inspan, GLvoid *outspan)
  853. {
  854. GLint i;
  855. GLint width = spanInfo->realWidth;
  856. GLubyte *inData = (GLubyte *) inspan;
  857. GLubyte *outData = (GLubyte *) outspan;
  858. GLubyte a,b,c,d;
  859. GLint components = spanInfo->dstComponents;
  860. GLint totalSize = width * components;
  861. #ifdef __GL_LINT
  862. gc = gc;
  863. #endif
  864. for (i=0; i<totalSize; i++) {
  865. c = inData[2];
  866. d = inData[3];
  867. a = inData[0];
  868. b = inData[1];
  869. outData[0] = d;
  870. outData[1] = c;
  871. outData[2] = b;
  872. outData[3] = a;
  873. outData += 4;
  874. inData += 4;
  875. }
  876. }
  877. /*
  878. ** Swaps bytes from an incoming span of four byte objects to an outgoing span.
  879. ** Pixel skipping is performed.
  880. */
  881. void __glSpanSwapAndSkipBytes4(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  882. GLvoid *inspan, GLvoid *outspan)
  883. {
  884. GLint i,j;
  885. GLint width = spanInfo->realWidth;
  886. GLubyte *inData = (GLubyte *) inspan;
  887. GLubyte *outData = (GLubyte *) outspan;
  888. GLubyte a,b,c,d;
  889. GLint components = spanInfo->srcComponents;
  890. GLint groupInc = spanInfo->srcGroupIncrement;
  891. GLshort *pixelArray = spanInfo->pixelArray;
  892. GLint skipCount;
  893. #ifdef __GL_LINT
  894. gc = gc;
  895. #endif
  896. for (i=0; i<width; i++) {
  897. for (j=0; j<components; j++) {
  898. c = inData[2];
  899. d = inData[3];
  900. outData[0] = d;
  901. outData[1] = c;
  902. a = inData[0];
  903. b = inData[1];
  904. outData[2] = b;
  905. outData[3] = a;
  906. outData += 4;
  907. inData += 4;
  908. }
  909. skipCount = (*pixelArray++) - 1;
  910. inData = (GLubyte *) ((GLubyte *) inData + (skipCount * groupInc));
  911. }
  912. }
  913. /*
  914. ** A span modifier that skips pixels according to the pixel skip array.
  915. ** Components are assumed to be 1 byte in size.
  916. */
  917. void __glSpanSkipPixels1(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  918. GLvoid *inspan, GLvoid *outspan)
  919. {
  920. GLint i,j;
  921. GLint width = spanInfo->realWidth;
  922. GLubyte *inData = (GLubyte *) inspan;
  923. GLubyte *outData = (GLubyte *) outspan;
  924. GLint components = spanInfo->srcComponents;
  925. GLint groupInc = spanInfo->srcGroupIncrement;
  926. GLshort *pixelArray = spanInfo->pixelArray;
  927. GLint skipCount;
  928. #ifdef __GL_LINT
  929. gc = gc;
  930. #endif
  931. for (i=0; i<width; i++) {
  932. for (j=0; j<components; j++) {
  933. *outData++ = *inData++;
  934. }
  935. skipCount = (*pixelArray++) - 1;
  936. inData = (GLubyte *) ((GLubyte *) inData + (skipCount * groupInc));
  937. }
  938. }
  939. /*
  940. ** A span modifier that skips pixels according to the pixel skip array.
  941. ** Components are assumed to be 2 bytes in size, and aligned on a half
  942. ** word boundary.
  943. */
  944. void __glSpanSkipPixels2(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  945. GLvoid *inspan, GLvoid *outspan)
  946. {
  947. GLint i,j;
  948. GLint width = spanInfo->realWidth;
  949. GLushort *inData = (GLushort *) inspan;
  950. GLushort *outData = (GLushort *) outspan;
  951. GLint components = spanInfo->srcComponents;
  952. GLint groupInc = spanInfo->srcGroupIncrement;
  953. GLshort *pixelArray = spanInfo->pixelArray;
  954. GLint skipCount;
  955. #ifdef __GL_LINT
  956. gc = gc;
  957. #endif
  958. for (i=0; i<width; i++) {
  959. for (j=0; j<components; j++) {
  960. *outData++ = *inData++;
  961. }
  962. skipCount = (*pixelArray++) - 1;
  963. inData = (GLushort *) ((GLubyte *) inData + (skipCount * groupInc));
  964. }
  965. }
  966. /*
  967. ** A span modifier that skips pixels according to the pixel skip array.
  968. ** Components are assumed to be 4 bytes in size, and aligned on a word
  969. ** boundary.
  970. */
  971. void __glSpanSkipPixels4(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  972. GLvoid *inspan, GLvoid *outspan)
  973. {
  974. GLint i,j;
  975. GLint width = spanInfo->realWidth;
  976. GLuint *inData = (GLuint *) inspan;
  977. GLuint *outData = (GLuint *) outspan;
  978. GLint components = spanInfo->srcComponents;
  979. GLint groupInc = spanInfo->srcGroupIncrement;
  980. GLshort *pixelArray = spanInfo->pixelArray;
  981. GLint skipCount;
  982. #ifdef __GL_LINT
  983. gc = gc;
  984. #endif
  985. for (i=0; i<width; i++) {
  986. for (j=0; j<components; j++) {
  987. *outData++ = *inData++;
  988. }
  989. skipCount = (*pixelArray++) - 1;
  990. inData = (GLuint *) ((GLubyte *) inData + (skipCount * groupInc));
  991. }
  992. }
  993. /*
  994. ** A span modifier that skips pixels according to the pixel skip array.
  995. ** Components are assumed to be 2 bytes in size. No alignment is assumed,
  996. ** so misaligned data should use this path.
  997. */
  998. void __glSpanSlowSkipPixels2(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  999. GLvoid *inspan, GLvoid *outspan)
  1000. {
  1001. GLint i,j;
  1002. GLint width = spanInfo->realWidth;
  1003. GLubyte *inData = (GLubyte *) inspan;
  1004. GLubyte *outData = (GLubyte *) outspan;
  1005. GLubyte a,b;
  1006. GLint components = spanInfo->srcComponents;
  1007. GLint groupInc = spanInfo->srcGroupIncrement;
  1008. GLshort *pixelArray = spanInfo->pixelArray;
  1009. GLint skipCount;
  1010. #ifdef __GL_LINT
  1011. gc = gc;
  1012. #endif
  1013. for (i=0; i<width; i++) {
  1014. for (j=0; j<components; j++) {
  1015. a = inData[0];
  1016. b = inData[1];
  1017. outData[0] = a;
  1018. outData[1] = b;
  1019. outData += 2;
  1020. inData += 2;
  1021. }
  1022. skipCount = (*pixelArray++) - 1;
  1023. inData = ((GLubyte *) inData + (skipCount * groupInc));
  1024. }
  1025. }
  1026. /*
  1027. ** A span modifier that skips pixels according to the pixel skip array.
  1028. ** Components are assumed to be 4 bytes in size. No alignment is assumed,
  1029. ** so misaligned data should use this path.
  1030. */
  1031. void __glSpanSlowSkipPixels4(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1032. GLvoid *inspan, GLvoid *outspan)
  1033. {
  1034. GLint i,j;
  1035. GLint width = spanInfo->realWidth;
  1036. GLubyte *inData = (GLubyte *) inspan;
  1037. GLubyte *outData = (GLubyte *) outspan;
  1038. GLubyte a,b,c,d;
  1039. GLint components = spanInfo->srcComponents;
  1040. GLint groupInc = spanInfo->srcGroupIncrement;
  1041. GLshort *pixelArray = spanInfo->pixelArray;
  1042. GLint skipCount;
  1043. #ifdef __GL_LINT
  1044. gc = gc;
  1045. #endif
  1046. for (i=0; i<width; i++) {
  1047. for (j=0; j<components; j++) {
  1048. a = inData[0];
  1049. b = inData[1];
  1050. c = inData[2];
  1051. d = inData[3];
  1052. outData[0] = a;
  1053. outData[1] = b;
  1054. outData[2] = c;
  1055. outData[3] = d;
  1056. outData += 4;
  1057. inData += 4;
  1058. }
  1059. skipCount = (*pixelArray++) - 1;
  1060. inData = ((GLubyte *) inData + (skipCount * groupInc));
  1061. }
  1062. }
  1063. /*
  1064. ** A span modifier that aligns pixels 2 bytes in size. No alignment is
  1065. ** assumed, so misaligned data should use this path.
  1066. */
  1067. void __glSpanAlignPixels2(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1068. GLvoid *inspan, GLvoid *outspan)
  1069. {
  1070. GLint i;
  1071. GLint width = spanInfo->realWidth;
  1072. GLubyte *inData = (GLubyte *) inspan;
  1073. GLubyte *outData = (GLubyte *) outspan;
  1074. GLubyte a,b;
  1075. GLint components = spanInfo->srcComponents;
  1076. GLint totalSize = width * components;
  1077. #ifdef __GL_LINT
  1078. gc = gc;
  1079. #endif
  1080. for (i=0; i<totalSize; i++) {
  1081. a = inData[0];
  1082. b = inData[1];
  1083. outData[0] = a;
  1084. outData[1] = b;
  1085. outData += 2;
  1086. inData += 2;
  1087. }
  1088. }
  1089. /*
  1090. ** A span modifier that aligns pixels 2 bytes in size. No alignment is
  1091. ** assumed, so misaligned data should use this path. This version is for
  1092. ** aligning to the destination image.
  1093. */
  1094. void __glSpanAlignPixels2Dst(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1095. GLvoid *inspan, GLvoid *outspan)
  1096. {
  1097. GLint i;
  1098. GLint width = spanInfo->realWidth;
  1099. GLubyte *inData = (GLubyte *) inspan;
  1100. GLubyte *outData = (GLubyte *) outspan;
  1101. GLubyte a,b;
  1102. GLint components = spanInfo->dstComponents;
  1103. GLint totalSize = width * components;
  1104. #ifdef __GL_LINT
  1105. gc = gc;
  1106. #endif
  1107. for (i=0; i<totalSize; i++) {
  1108. a = inData[0];
  1109. b = inData[1];
  1110. outData[0] = a;
  1111. outData[1] = b;
  1112. outData += 2;
  1113. inData += 2;
  1114. }
  1115. }
  1116. /*
  1117. ** A span modifier that aligns pixels 4 bytes in size. No alignment is
  1118. ** assumed, so misaligned data should use this path.
  1119. */
  1120. void __glSpanAlignPixels4(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1121. GLvoid *inspan, GLvoid *outspan)
  1122. {
  1123. GLint i;
  1124. GLint width = spanInfo->realWidth;
  1125. GLubyte *inData = (GLubyte *) inspan;
  1126. GLubyte *outData = (GLubyte *) outspan;
  1127. GLubyte a,b,c,d;
  1128. GLint components = spanInfo->srcComponents;
  1129. GLint totalSize = width * components;
  1130. #ifdef __GL_LINT
  1131. gc = gc;
  1132. #endif
  1133. for (i=0; i<totalSize; i++) {
  1134. a = inData[0];
  1135. b = inData[1];
  1136. c = inData[2];
  1137. d = inData[3];
  1138. outData[0] = a;
  1139. outData[1] = b;
  1140. outData[2] = c;
  1141. outData[3] = d;
  1142. outData += 4;
  1143. inData += 4;
  1144. }
  1145. }
  1146. /*
  1147. ** A span modifier that aligns pixels 4 bytes in size. No alignment is
  1148. ** assumed, so misaligned data should use this path. This version is
  1149. ** for swapping to the destination image.
  1150. */
  1151. void __glSpanAlignPixels4Dst(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1152. GLvoid *inspan, GLvoid *outspan)
  1153. {
  1154. GLint i;
  1155. GLint width = spanInfo->realWidth;
  1156. GLubyte *inData = (GLubyte *) inspan;
  1157. GLubyte *outData = (GLubyte *) outspan;
  1158. GLubyte a,b,c,d;
  1159. GLint components = spanInfo->dstComponents;
  1160. GLint totalSize = width * components;
  1161. #ifdef __GL_LINT
  1162. gc = gc;
  1163. #endif
  1164. for (i=0; i<totalSize; i++) {
  1165. a = inData[0];
  1166. b = inData[1];
  1167. c = inData[2];
  1168. d = inData[3];
  1169. outData[0] = a;
  1170. outData[1] = b;
  1171. outData[2] = c;
  1172. outData[3] = d;
  1173. outData += 4;
  1174. inData += 4;
  1175. }
  1176. }
  1177. /*
  1178. ** Unpacks from any component of type UNSIGNED_BYTE to a span of the same
  1179. ** format of type FLOAT.
  1180. */
  1181. void __glSpanUnpackUbyte(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1182. GLvoid *inspan, GLvoid *outspan)
  1183. {
  1184. GLint i;
  1185. GLint width = spanInfo->realWidth;
  1186. GLubyte *inData = (GLubyte *) inspan;
  1187. GLfloat *outData = (GLfloat *) outspan;
  1188. GLint components = spanInfo->srcComponents;
  1189. GLint totalSize = width * components;
  1190. #ifdef __GL_LINT
  1191. gc = gc;
  1192. #endif
  1193. for (i=0; i<totalSize; i++) {
  1194. *outData++ = __GL_UB_TO_FLOAT(*inData++);
  1195. }
  1196. }
  1197. /*
  1198. ** Unpacks from any component of type BYTE to a span of the same
  1199. ** format of type FLOAT.
  1200. */
  1201. void __glSpanUnpackByte(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1202. GLvoid *inspan, GLvoid *outspan)
  1203. {
  1204. GLint i;
  1205. GLint width = spanInfo->realWidth;
  1206. GLbyte *inData = (GLbyte *) inspan;
  1207. GLfloat *outData = (GLfloat *) outspan;
  1208. GLint components = spanInfo->srcComponents;
  1209. GLint totalSize = width * components;
  1210. #ifdef __GL_LINT
  1211. gc = gc;
  1212. #endif
  1213. for (i=0; i<totalSize; i++) {
  1214. *outData++ = __GL_B_TO_FLOAT(*inData++);
  1215. }
  1216. }
  1217. /*
  1218. ** Unpacks from any component of type UNSIGNED_SHORT to a span of the same
  1219. ** format of type FLOAT.
  1220. */
  1221. void __glSpanUnpackUshort(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1222. GLvoid *inspan, GLvoid *outspan)
  1223. {
  1224. GLint i;
  1225. GLint width = spanInfo->realWidth;
  1226. GLushort *inData = (GLushort *) inspan;
  1227. GLfloat *outData = (GLfloat *) outspan;
  1228. GLint components = spanInfo->srcComponents;
  1229. GLint totalSize = width * components;
  1230. #ifdef __GL_LINT
  1231. gc = gc;
  1232. #endif
  1233. for (i=0; i<totalSize; i++) {
  1234. *outData++ = __GL_US_TO_FLOAT(*inData++);
  1235. }
  1236. }
  1237. /*
  1238. ** Unpacks from any component of type SHORT to a span of the same
  1239. ** format of type FLOAT.
  1240. */
  1241. void __glSpanUnpackShort(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1242. GLvoid *inspan, GLvoid *outspan)
  1243. {
  1244. GLint i;
  1245. GLint width = spanInfo->realWidth;
  1246. GLshort *inData = (GLshort *) inspan;
  1247. GLfloat *outData = (GLfloat *) outspan;
  1248. GLint components = spanInfo->srcComponents;
  1249. GLint totalSize = width * components;
  1250. #ifdef __GL_LINT
  1251. gc = gc;
  1252. #endif
  1253. for (i=0; i<totalSize; i++) {
  1254. *outData++ = __GL_S_TO_FLOAT(*inData++);
  1255. }
  1256. }
  1257. /*
  1258. ** Unpacks from any component of type UNSIGNED_INT to a span of the same
  1259. ** format of type FLOAT.
  1260. */
  1261. void __glSpanUnpackUint(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1262. GLvoid *inspan, GLvoid *outspan)
  1263. {
  1264. GLint i;
  1265. GLint width = spanInfo->realWidth;
  1266. GLuint *inData = (GLuint *) inspan;
  1267. GLfloat *outData = (GLfloat *) outspan;
  1268. GLint components = spanInfo->srcComponents;
  1269. GLint totalSize = width * components;
  1270. #ifdef __GL_LINT
  1271. gc = gc;
  1272. #endif
  1273. for (i=0; i<totalSize; i++) {
  1274. *outData++ = __GL_UI_TO_FLOAT(*inData++);
  1275. }
  1276. }
  1277. /*
  1278. ** Unpacks from any component of type INT to a span of the same
  1279. ** format of type FLOAT.
  1280. */
  1281. void __glSpanUnpackInt(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1282. GLvoid *inspan, GLvoid *outspan)
  1283. {
  1284. GLint i;
  1285. GLint width = spanInfo->realWidth;
  1286. GLint *inData = (GLint *) inspan;
  1287. GLfloat *outData = (GLfloat *) outspan;
  1288. GLint components = spanInfo->srcComponents;
  1289. GLint totalSize = width * components;
  1290. #ifdef __GL_LINT
  1291. gc = gc;
  1292. #endif
  1293. for (i=0; i<totalSize; i++) {
  1294. *outData++ = __GL_I_TO_FLOAT(*inData++);
  1295. }
  1296. }
  1297. /*
  1298. ** Unpacks from any index of type UNSIGNED_BYTE to a span of the same
  1299. ** format of type FLOAT.
  1300. */
  1301. void __glSpanUnpackUbyteI(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1302. GLvoid *inspan, GLvoid *outspan)
  1303. {
  1304. GLint i;
  1305. GLint totalSize = spanInfo->realWidth;
  1306. GLubyte *inData = (GLubyte *) inspan;
  1307. GLfloat *outData = (GLfloat *) outspan;
  1308. #ifdef __GL_LINT
  1309. gc = gc;
  1310. #endif
  1311. for (i=0; i<totalSize; i++) {
  1312. *outData++ = *inData++;
  1313. }
  1314. }
  1315. /*
  1316. ** Unpacks from any index of type BYTE to a span of the same
  1317. ** format of type FLOAT.
  1318. */
  1319. void __glSpanUnpackByteI(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1320. GLvoid *inspan, GLvoid *outspan)
  1321. {
  1322. GLint i;
  1323. GLint totalSize = spanInfo->realWidth;
  1324. GLbyte *inData = (GLbyte *) inspan;
  1325. GLfloat *outData = (GLfloat *) outspan;
  1326. #ifdef __GL_LINT
  1327. gc = gc;
  1328. #endif
  1329. for (i=0; i<totalSize; i++) {
  1330. *outData++ = *inData++;
  1331. }
  1332. }
  1333. /*
  1334. ** Unpacks from any index of type UNSIGNED_SHORT to a span of the same
  1335. ** format of type FLOAT.
  1336. */
  1337. void __glSpanUnpackUshortI(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1338. GLvoid *inspan, GLvoid *outspan)
  1339. {
  1340. GLint i;
  1341. GLint totalSize = spanInfo->realWidth;
  1342. GLushort *inData = (GLushort *) inspan;
  1343. GLfloat *outData = (GLfloat *) outspan;
  1344. #ifdef __GL_LINT
  1345. gc = gc;
  1346. #endif
  1347. for (i=0; i<totalSize; i++) {
  1348. *outData++ = *inData++;
  1349. }
  1350. }
  1351. /*
  1352. ** Unpacks from any index of type SHORT to a span of the same
  1353. ** format of type FLOAT.
  1354. */
  1355. void __glSpanUnpackShortI(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1356. GLvoid *inspan, GLvoid *outspan)
  1357. {
  1358. GLint i;
  1359. GLint totalSize = spanInfo->realWidth;
  1360. GLshort *inData = (GLshort *) inspan;
  1361. GLfloat *outData = (GLfloat *) outspan;
  1362. #ifdef __GL_LINT
  1363. gc = gc;
  1364. #endif
  1365. for (i=0; i<totalSize; i++) {
  1366. *outData++ = *inData++;
  1367. }
  1368. }
  1369. /*
  1370. ** Unpacks from any index of type UNSIGNED_INT to a span of the same
  1371. ** format of type FLOAT.
  1372. */
  1373. void __glSpanUnpackUintI(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1374. GLvoid *inspan, GLvoid *outspan)
  1375. {
  1376. GLint i;
  1377. GLint totalSize = spanInfo->realWidth;
  1378. GLuint *inData = (GLuint *) inspan;
  1379. GLfloat *outData = (GLfloat *) outspan;
  1380. #ifdef __GL_LINT
  1381. gc = gc;
  1382. #endif
  1383. for (i=0; i<totalSize; i++) {
  1384. *outData++ = *inData++;
  1385. }
  1386. }
  1387. /*
  1388. ** Unpacks from any index of type INT to a span of the same
  1389. ** format of type FLOAT.
  1390. */
  1391. void __glSpanUnpackIntI(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1392. GLvoid *inspan, GLvoid *outspan)
  1393. {
  1394. GLint i;
  1395. GLint totalSize = spanInfo->realWidth;
  1396. GLint *inData = (GLint *) inspan;
  1397. GLfloat *outData = (GLfloat *) outspan;
  1398. #ifdef __GL_LINT
  1399. gc = gc;
  1400. #endif
  1401. for (i=0; i<totalSize; i++) {
  1402. *outData++ = *inData++;
  1403. }
  1404. }
  1405. /*
  1406. ** Clamps from any type FLOAT to a span of the same format of type FLOAT.
  1407. */
  1408. void __glSpanClampFloat(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1409. GLvoid *inspan, GLvoid *outspan)
  1410. {
  1411. GLint i;
  1412. GLint width = spanInfo->realWidth;
  1413. GLint components = spanInfo->srcComponents;
  1414. GLint totalSize = width * components;
  1415. GLfloat *inData = (GLfloat *) inspan;
  1416. GLfloat *outData = (GLfloat *) outspan;
  1417. GLfloat r, one, zero;
  1418. one = __glOne;
  1419. zero = __glZero;
  1420. for (i=0; i<totalSize; i++) {
  1421. r = *inData++;
  1422. if (r > one) r = one;
  1423. else if (r < zero) r = zero;
  1424. *outData++ = r;
  1425. }
  1426. }
  1427. /*
  1428. ** Clamps from a signed FLOAT [-1, 1] to a span of the same format of type
  1429. ** FLOAT.
  1430. */
  1431. void __glSpanClampSigned(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1432. GLvoid *inspan, GLvoid *outspan)
  1433. {
  1434. GLint i;
  1435. GLint width = spanInfo->realWidth;
  1436. GLint components = spanInfo->srcComponents;
  1437. GLint totalSize = width * components;
  1438. GLfloat *inData = (GLfloat *) inspan;
  1439. GLfloat *outData = (GLfloat *) outspan;
  1440. GLfloat r, zero;
  1441. zero = __glZero;
  1442. for (i=0; i<totalSize; i++) {
  1443. r = *inData++;
  1444. if (r < zero) r = zero;
  1445. *outData++ = r;
  1446. }
  1447. }
  1448. /*
  1449. ** Expands and scales a RED, FLOAT span into a RGBA, FLOAT span.
  1450. */
  1451. void __glSpanExpandRed(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1452. GLvoid *inspan, GLvoid *outspan)
  1453. {
  1454. GLint i;
  1455. GLint width = spanInfo->realWidth;
  1456. GLfloat *outData = (GLfloat *) outspan;
  1457. GLfloat *inData = (GLfloat *) inspan;
  1458. GLfloat zero = __glZero;
  1459. GLfloat as = gc->frontBuffer.alphaScale;
  1460. GLfloat rs = gc->frontBuffer.redScale;
  1461. for (i=0; i<width; i++) {
  1462. *outData++ = *inData++ * rs; /* Red */
  1463. *outData++ = zero; /* Green */
  1464. *outData++ = zero; /* Blue */
  1465. *outData++ = as; /* Alpha */
  1466. }
  1467. }
  1468. /*
  1469. ** Expands and scales a GREEN, FLOAT span into a RGBA, FLOAT span.
  1470. */
  1471. void __glSpanExpandGreen(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1472. GLvoid *inspan, GLvoid *outspan)
  1473. {
  1474. GLint i;
  1475. GLint width = spanInfo->realWidth;
  1476. GLfloat *outData = (GLfloat *) outspan;
  1477. GLfloat *inData = (GLfloat *) inspan;
  1478. GLfloat zero = __glZero;
  1479. GLfloat gs = gc->frontBuffer.greenScale;
  1480. GLfloat as = gc->frontBuffer.alphaScale;
  1481. for (i=0; i<width; i++) {
  1482. *outData++ = zero; /* Red */
  1483. *outData++ = *inData++ * gs; /* Green */
  1484. *outData++ = zero; /* Blue */
  1485. *outData++ = as; /* Alpha */
  1486. }
  1487. }
  1488. /*
  1489. ** Expands and scales a BLUE, FLOAT span into a RGBA, FLOAT span.
  1490. */
  1491. void __glSpanExpandBlue(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1492. GLvoid *inspan, GLvoid *outspan)
  1493. {
  1494. GLint i;
  1495. GLint width = spanInfo->realWidth;
  1496. GLfloat *outData = (GLfloat *) outspan;
  1497. GLfloat *inData = (GLfloat *) inspan;
  1498. GLfloat zero = __glZero;
  1499. GLfloat bs = gc->frontBuffer.blueScale;
  1500. GLfloat as = gc->frontBuffer.alphaScale;
  1501. for (i=0; i<width; i++) {
  1502. *outData++ = zero; /* Red */
  1503. *outData++ = zero; /* Green */
  1504. *outData++ = *inData++ * bs; /* Blue */
  1505. *outData++ = as; /* Alpha */
  1506. }
  1507. }
  1508. /*
  1509. ** Expands and scales an ALPHA, FLOAT span into a RGBA, FLOAT span.
  1510. */
  1511. void __glSpanExpandAlpha(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1512. GLvoid *inspan, GLvoid *outspan)
  1513. {
  1514. GLint i;
  1515. GLint width = spanInfo->realWidth;
  1516. GLfloat *outData = (GLfloat *) outspan;
  1517. GLfloat *inData = (GLfloat *) inspan;
  1518. GLfloat zero = __glZero;
  1519. GLfloat as = gc->frontBuffer.alphaScale;
  1520. for (i=0; i<width; i++) {
  1521. *outData++ = zero; /* Red */
  1522. *outData++ = zero; /* Green */
  1523. *outData++ = zero; /* Blue */
  1524. *outData++ = *inData++ * as; /* Alpha */
  1525. }
  1526. }
  1527. /*
  1528. ** Expands and scales an RGB, FLOAT span into a RGBA, FLOAT span.
  1529. */
  1530. void __glSpanExpandRGB(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1531. GLvoid *inspan, GLvoid *outspan)
  1532. {
  1533. GLint i;
  1534. GLint width = spanInfo->realWidth;
  1535. GLfloat *outData = (GLfloat *) outspan;
  1536. GLfloat *inData = (GLfloat *) inspan;
  1537. GLfloat r,g,b;
  1538. GLfloat rs,gs,bs;
  1539. GLfloat as = gc->frontBuffer.alphaScale;
  1540. rs = gc->frontBuffer.redScale;
  1541. gs = gc->frontBuffer.greenScale;
  1542. bs = gc->frontBuffer.blueScale;
  1543. for (i=0; i<width; i++) {
  1544. r = *inData++ * rs;
  1545. g = *inData++ * gs;
  1546. b = *inData++ * bs;
  1547. *outData++ = r;
  1548. *outData++ = g;
  1549. *outData++ = b;
  1550. *outData++ = as; /* Alpha */
  1551. }
  1552. }
  1553. #ifdef GL_EXT_bgra
  1554. /*
  1555. ** Expands and scales a BGR, FLOAT span into a RGBA, FLOAT span.
  1556. */
  1557. void __glSpanExpandBGR(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1558. GLvoid *inspan, GLvoid *outspan)
  1559. {
  1560. GLint i;
  1561. GLint width = spanInfo->realWidth;
  1562. GLfloat *outData = (GLfloat *) outspan;
  1563. GLfloat *inData = (GLfloat *) inspan;
  1564. GLfloat r,g,b;
  1565. GLfloat rs,gs,bs;
  1566. GLfloat as = gc->frontBuffer.alphaScale;
  1567. rs = gc->frontBuffer.redScale;
  1568. gs = gc->frontBuffer.greenScale;
  1569. bs = gc->frontBuffer.blueScale;
  1570. for (i=0; i<width; i++) {
  1571. b = *inData++ * bs;
  1572. g = *inData++ * gs;
  1573. r = *inData++ * rs;
  1574. *outData++ = r;
  1575. *outData++ = g;
  1576. *outData++ = b;
  1577. *outData++ = as; /* Alpha */
  1578. }
  1579. }
  1580. #endif
  1581. /*
  1582. ** Expands and scales a LUMINANCE, FLOAT span into a RGBA, FLOAT span.
  1583. */
  1584. void __glSpanExpandLuminance(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1585. GLvoid *inspan, GLvoid *outspan)
  1586. {
  1587. GLint i;
  1588. GLint width = spanInfo->realWidth;
  1589. GLfloat *outData = (GLfloat *) outspan;
  1590. GLfloat *inData = (GLfloat *) inspan;
  1591. GLfloat comp;
  1592. GLfloat rs,gs,bs;
  1593. GLfloat as = gc->frontBuffer.alphaScale;
  1594. rs = gc->frontBuffer.redScale;
  1595. gs = gc->frontBuffer.greenScale;
  1596. bs = gc->frontBuffer.blueScale;
  1597. for (i=0; i<width; i++) {
  1598. comp = *inData++;
  1599. *outData++ = comp * rs; /* Red */
  1600. *outData++ = comp * gs; /* Green */
  1601. *outData++ = comp * bs; /* Blue */
  1602. *outData++ = as; /* Alpha */
  1603. }
  1604. }
  1605. /*
  1606. ** Expands and scales a LUMINANCE_ALPHA, FLOAT span into a RGBA, FLOAT span.
  1607. */
  1608. void __glSpanExpandLuminanceAlpha(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1609. GLvoid *inspan, GLvoid *outspan)
  1610. {
  1611. GLint i;
  1612. GLint width = spanInfo->realWidth;
  1613. GLfloat *outData = (GLfloat *) outspan;
  1614. GLfloat *inData = (GLfloat *) inspan;
  1615. GLfloat comp;
  1616. GLfloat rs,gs,bs;
  1617. GLfloat as = gc->frontBuffer.alphaScale;
  1618. rs = gc->frontBuffer.redScale;
  1619. gs = gc->frontBuffer.greenScale;
  1620. bs = gc->frontBuffer.blueScale;
  1621. for (i=0; i<width; i++) {
  1622. comp = *inData++;
  1623. *outData++ = comp * rs; /* Red */
  1624. *outData++ = comp * gs; /* Green */
  1625. *outData++ = comp * bs; /* Blue */
  1626. *outData++ = *inData++ * as; /* Alpha */
  1627. }
  1628. }
  1629. /*
  1630. ** Expands and scales a __GL_RED_ALPHA, FLOAT span into a RGBA, FLOAT span.
  1631. */
  1632. void __glSpanExpandRedAlpha(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1633. GLvoid *inspan, GLvoid *outspan)
  1634. {
  1635. GLint i;
  1636. GLint width = spanInfo->realWidth;
  1637. GLfloat *outData = (GLfloat *) outspan;
  1638. GLfloat *inData = (GLfloat *) inspan;
  1639. GLfloat comp;
  1640. GLfloat zero;
  1641. GLfloat rs,gs,bs;
  1642. GLfloat as = gc->frontBuffer.alphaScale;
  1643. rs = gc->frontBuffer.redScale;
  1644. zero = __glZero;
  1645. for (i=0; i<width; i++) {
  1646. comp = *inData++;
  1647. *outData++ = comp * rs; /* Red */
  1648. *outData++ = zero;
  1649. *outData++ = zero;
  1650. *outData++ = *inData++ * as; /* Alpha */
  1651. }
  1652. }
  1653. /*
  1654. ** The only span format supported by this routine is GL_RGBA, GL_FLOAT.
  1655. ** The span is simply scaled by the frame buffer scaling factors.
  1656. */
  1657. void __glSpanScaleRGBA(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1658. GLvoid *inspan, GLvoid *outspan)
  1659. {
  1660. GLint i, width;
  1661. GLfloat rscale, gscale, bscale, ascale;
  1662. GLfloat red, green, blue, alpha;
  1663. GLfloat *inData, *outData;
  1664. width = spanInfo->realWidth;
  1665. inData = (GLfloat *) inspan;
  1666. outData = (GLfloat *) outspan;
  1667. rscale = gc->frontBuffer.redScale;
  1668. gscale = gc->frontBuffer.greenScale;
  1669. bscale = gc->frontBuffer.blueScale;
  1670. ascale = gc->frontBuffer.alphaScale;
  1671. for (i=0; i<width; i++) {
  1672. red = *inData++ * rscale;
  1673. green = *inData++ * gscale;
  1674. *outData++ = red;
  1675. *outData++ = green;
  1676. blue = *inData++ * bscale;
  1677. alpha = *inData++ * ascale;
  1678. *outData++ = blue;
  1679. *outData++ = alpha;
  1680. }
  1681. }
  1682. /*
  1683. ** The only span format supported by this routine is GL_RGBA, GL_FLOAT.
  1684. ** The span is simply unscaled by the frame buffer scaling factors.
  1685. */
  1686. void __glSpanUnscaleRGBA(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1687. GLvoid *inspan, GLvoid *outspan)
  1688. {
  1689. GLint i, width;
  1690. GLfloat rscale, gscale, bscale, ascale;
  1691. GLfloat red, green, blue, alpha;
  1692. GLfloat *inData, *outData;
  1693. width = spanInfo->realWidth;
  1694. inData = (GLfloat *) inspan;
  1695. outData = (GLfloat *) outspan;
  1696. rscale = gc->frontBuffer.oneOverRedScale;
  1697. gscale = gc->frontBuffer.oneOverGreenScale;
  1698. bscale = gc->frontBuffer.oneOverBlueScale;
  1699. ascale = gc->frontBuffer.oneOverAlphaScale;
  1700. for (i=0; i<width; i++) {
  1701. red = *inData++ * rscale;
  1702. green = *inData++ * gscale;
  1703. *outData++ = red;
  1704. *outData++ = green;
  1705. blue = *inData++ * bscale;
  1706. alpha = *inData++ * ascale;
  1707. *outData++ = blue;
  1708. *outData++ = alpha;
  1709. }
  1710. }
  1711. #ifdef GL_EXT_bgra
  1712. /*
  1713. ** The only span format supported by this routine is GL_BGRA, GL_FLOAT.
  1714. ** The span is scaled by the frame buffer scaling factors and swapped
  1715. ** into RGBA order.
  1716. */
  1717. void __glSpanScaleBGRA(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1718. GLvoid *inspan, GLvoid *outspan)
  1719. {
  1720. GLint i, width;
  1721. GLfloat rscale, gscale, bscale, ascale;
  1722. GLfloat red, green, blue, alpha;
  1723. GLfloat *inData, *outData;
  1724. width = spanInfo->realWidth;
  1725. inData = (GLfloat *) inspan;
  1726. outData = (GLfloat *) outspan;
  1727. rscale = gc->frontBuffer.redScale;
  1728. gscale = gc->frontBuffer.greenScale;
  1729. bscale = gc->frontBuffer.blueScale;
  1730. ascale = gc->frontBuffer.alphaScale;
  1731. for (i=0; i<width; i++) {
  1732. blue = *inData++ * bscale;
  1733. green = *inData++ * gscale;
  1734. red = *inData++ * rscale;
  1735. alpha = *inData++ * ascale;
  1736. *outData++ = red;
  1737. *outData++ = green;
  1738. *outData++ = blue;
  1739. *outData++ = alpha;
  1740. }
  1741. }
  1742. /*
  1743. ** The only input format supported by this routine is GL_RGBA, GL_FLOAT.
  1744. ** The span is unscaled by the frame buffer scaling factors and swapped
  1745. ** into BGRA order.
  1746. */
  1747. void __glSpanUnscaleBGRA(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1748. GLvoid *inspan, GLvoid *outspan)
  1749. {
  1750. GLint i, width;
  1751. GLfloat rscale, gscale, bscale, ascale;
  1752. GLfloat red, green, blue, alpha;
  1753. GLfloat *inData, *outData;
  1754. width = spanInfo->realWidth;
  1755. inData = (GLfloat *) inspan;
  1756. outData = (GLfloat *) outspan;
  1757. rscale = gc->frontBuffer.oneOverRedScale;
  1758. gscale = gc->frontBuffer.oneOverGreenScale;
  1759. bscale = gc->frontBuffer.oneOverBlueScale;
  1760. ascale = gc->frontBuffer.oneOverAlphaScale;
  1761. for (i=0; i<width; i++) {
  1762. red = *inData++ * rscale;
  1763. green = *inData++ * gscale;
  1764. blue = *inData++ * bscale;
  1765. alpha = *inData++ * ascale;
  1766. *outData++ = blue;
  1767. *outData++ = green;
  1768. *outData++ = red;
  1769. *outData++ = alpha;
  1770. }
  1771. }
  1772. #endif
  1773. /*
  1774. ** The only span format supported by this routine is palette index, GL_FLOAT.
  1775. ** The span is simply scaled by the frame buffer scaling factors.
  1776. */
  1777. #ifdef GL_EXT_paletted_texture
  1778. void __glSpanScalePI(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  1779. GLvoid *inspan, GLvoid *outspan)
  1780. {
  1781. GLint i, width;
  1782. GLfloat rscale, gscale, bscale, ascale;
  1783. GLfloat red, green, blue, alpha;
  1784. GLfloat *inData, *outData;
  1785. RGBQUAD *rgb;
  1786. width = spanInfo->realWidth;
  1787. inData = (GLfloat *) inspan;
  1788. outData = (GLfloat *) outspan;
  1789. // Throw in an extra scaling of 1/255 because the palette
  1790. // data is in ubyte format
  1791. rscale = gc->frontBuffer.redScale*__glOneOver255;
  1792. gscale = gc->frontBuffer.greenScale*__glOneOver255;
  1793. bscale = gc->frontBuffer.blueScale*__glOneOver255;
  1794. ascale = gc->frontBuffer.alphaScale*__glOneOver255;
  1795. for (i=0; i<width; i++) {
  1796. rgb = &spanInfo->srcPalette[(int)((*inData++)*
  1797. spanInfo->srcPaletteSize)];
  1798. red = rgb->rgbRed * rscale;
  1799. green = rgb->rgbGreen * gscale;
  1800. *outData++ = red;
  1801. *outData++ = green;
  1802. blue = rgb->rgbBlue * bscale;
  1803. alpha = rgb->rgbReserved * ascale;
  1804. *outData++ = blue;
  1805. *outData++ = alpha;
  1806. }
  1807. }
  1808. #endif