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.

282 lines
6.8 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 span reading routines. These are routines which
  21. ** read data from the depth buffer, stencil buffer, or frame buffer
  22. ** into internal software spans. The type of internal span that it
  23. ** is read into varies from routine to routine.
  24. */
  25. /*
  26. ** A reader that reads spans into scaled a RGBA, FLOAT span.
  27. **
  28. ** zoomx is assumed to be less than 1.0 and greater than -1.0.
  29. */
  30. void FASTCALL __glSpanReadRGBA(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  31. GLvoid *span)
  32. {
  33. GLint i;
  34. GLint width;
  35. GLfloat *spanData;
  36. GLint readY, readX;
  37. GLshort *pixelArray;
  38. GLint skipCount;
  39. width = spanInfo->realWidth;
  40. spanData = (GLfloat*) span;
  41. pixelArray = spanInfo->pixelArray;
  42. readY = spanInfo->readY;
  43. readX = spanInfo->readX;
  44. for (i=0; i<width; i++) {
  45. #ifdef NT
  46. (*gc->readBuffer->readColor)(gc->readBuffer, readX, readY,
  47. (__GLcolor *) spanData);
  48. #else
  49. (*gc->frontBuffer.readColor)(gc->readBuffer, readX, readY,
  50. (__GLcolor *) spanData);
  51. #endif
  52. spanData += 4;
  53. skipCount = *pixelArray++;
  54. readX += skipCount;
  55. }
  56. }
  57. /*
  58. ** A reader that reads spans into a scaled RGBA, FLOAT span.
  59. **
  60. ** zoomx is assumed to be less than or equal to -1.0 or greater than or
  61. ** equal to 1.0.
  62. */
  63. void FASTCALL __glSpanReadRGBA2(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  64. GLvoid *span)
  65. {
  66. GLint i;
  67. GLint width;
  68. GLfloat *spanData;
  69. GLint readY, readX;
  70. width = spanInfo->width;
  71. spanData = (GLfloat*) span;
  72. readY = spanInfo->readY;
  73. readX = spanInfo->readX;
  74. #ifdef NT
  75. (*gc->readBuffer->readSpan)(gc->readBuffer, readX, readY,
  76. (__GLcolor *) spanData, width);
  77. #else
  78. (*gc->frontBuffer.readSpan)(gc->readBuffer, readX, readY,
  79. (__GLcolor *) spanData, width);
  80. #endif
  81. }
  82. /*
  83. ** A reader that reads spans into a COLOR_INDEX, FLOAT span.
  84. **
  85. ** zoomx is assumed to be less than 1.0 and greater than -1.0.
  86. */
  87. void FASTCALL __glSpanReadCI(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  88. GLvoid *span)
  89. {
  90. GLint i;
  91. GLint width;
  92. GLfloat *spanData;
  93. GLenum format;
  94. GLint readY, readX;
  95. GLshort *pixelArray;
  96. GLint skipCount;
  97. width = spanInfo->realWidth;
  98. spanData = (GLfloat*) span;
  99. pixelArray = spanInfo->pixelArray;
  100. readY = spanInfo->readY;
  101. readX = spanInfo->readX;
  102. for (i=0; i<width; i++) {
  103. #ifdef NT
  104. (*gc->readBuffer->readColor)(gc->readBuffer, readX, readY,
  105. (__GLcolor *) spanData);
  106. #else
  107. (*gc->frontBuffer.readColor)(gc->readBuffer, readX, readY,
  108. (__GLcolor *) spanData);
  109. #endif
  110. spanData++;
  111. skipCount = *pixelArray++;
  112. readX += skipCount;
  113. }
  114. }
  115. /*
  116. ** A reader that reads spans into a COLOR_INDEX, FLOAT span.
  117. **
  118. ** zoomx is assumed to be less than or equal to -1.0 or greater than or
  119. ** equal to 1.0.
  120. */
  121. void FASTCALL __glSpanReadCI2(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  122. GLvoid *span)
  123. {
  124. GLint i;
  125. GLint width;
  126. GLfloat *spanData;
  127. GLint readY, readX;
  128. width = spanInfo->width;
  129. spanData = (GLfloat*) span;
  130. readY = spanInfo->readY;
  131. readX = spanInfo->readX;
  132. for (i=0; i<width; i++) {
  133. #ifdef NT
  134. (*gc->readBuffer->readColor)(gc->readBuffer, readX, readY,
  135. (__GLcolor *) spanData);
  136. #else
  137. (*gc->frontBuffer.readColor)(gc->readBuffer, readX, readY,
  138. (__GLcolor *) spanData);
  139. #endif
  140. spanData++;
  141. readX++;
  142. }
  143. }
  144. /*
  145. ** A reader that reads spans into a DEPTH_COMPONENT, FLOAT span.
  146. **
  147. ** zoomx is assumed to be less than 1.0 and greater than -1.0.
  148. */
  149. void FASTCALL __glSpanReadDepth(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  150. GLvoid *span)
  151. {
  152. GLint i;
  153. GLint width;
  154. GLfloat *spanData;
  155. GLint readY, readX;
  156. GLshort *pixelArray;
  157. GLint skipCount;
  158. __GLfloat oneOverScale;
  159. width = spanInfo->realWidth;
  160. spanData = (GLfloat*) span;
  161. pixelArray = spanInfo->pixelArray;
  162. readY = spanInfo->readY;
  163. readX = spanInfo->readX;
  164. oneOverScale = __glOne / gc->depthBuffer.scale;
  165. for (i=0; i<width; i++) {
  166. *spanData++ =
  167. (*gc->depthBuffer.fetch)(&(gc->depthBuffer), readX, readY) *
  168. oneOverScale;
  169. skipCount = *pixelArray++;
  170. readX += skipCount;
  171. }
  172. }
  173. /*
  174. ** A reader that reads spans into a DEPTH_COMPONENT, FLOAT span.
  175. **
  176. ** zoomx is assumed to be less than or equal to -1.0 or greater than or
  177. ** equal to 1.0.
  178. */
  179. void FASTCALL __glSpanReadDepth2(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  180. GLvoid *span)
  181. {
  182. GLint i;
  183. GLint width;
  184. GLfloat *spanData;
  185. GLint readY, readX;
  186. __GLfloat oneOverScale;
  187. width = spanInfo->width;
  188. spanData = (GLfloat*) span;
  189. readY = spanInfo->readY;
  190. readX = spanInfo->readX;
  191. oneOverScale = __glOne / gc->depthBuffer.scale;
  192. for (i=0; i<width; i++) {
  193. *spanData++ =
  194. (*gc->depthBuffer.fetch)(&(gc->depthBuffer), readX, readY) *
  195. oneOverScale;
  196. readX++;
  197. }
  198. }
  199. /*
  200. ** A reader that reads spans into a STENCIL_INDEX, FLOAT span.
  201. **
  202. ** zoomx is assumed to be less than 1.0 and greater than -1.0.
  203. */
  204. void FASTCALL __glSpanReadStencil(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  205. GLvoid *span)
  206. {
  207. GLint i;
  208. GLint width;
  209. GLfloat *spanData;
  210. GLint readY, readX;
  211. GLshort *pixelArray;
  212. GLint skipCount;
  213. width = spanInfo->realWidth;
  214. spanData = (GLfloat*) span;
  215. pixelArray = spanInfo->pixelArray;
  216. readY = spanInfo->readY;
  217. readX = spanInfo->readX;
  218. for (i=0; i<width; i++) {
  219. *spanData++ =
  220. (*gc->stencilBuffer.fetch)(&(gc->stencilBuffer), readX, readY);
  221. skipCount = *pixelArray++;
  222. readX += skipCount;
  223. }
  224. }
  225. /*
  226. ** A reader that reads spans into a STENCIL_INDEX, FLOAT span.
  227. **
  228. ** zoomx is assumed to be less than or equal to -1.0 or greater than or
  229. ** equal to 1.0.
  230. */
  231. void FASTCALL __glSpanReadStencil2(__GLcontext *gc, __GLpixelSpanInfo *spanInfo,
  232. GLvoid *span)
  233. {
  234. GLint i;
  235. GLint width;
  236. GLfloat *spanData;
  237. GLint readY, readX;
  238. width = spanInfo->width;
  239. spanData = (GLfloat*) span;
  240. readY = spanInfo->readY;
  241. readX = spanInfo->readX;
  242. for (i=0; i<width; i++) {
  243. *spanData++ =
  244. (*gc->stencilBuffer.fetch)(&(gc->stencilBuffer), readX, readY);
  245. readX++;
  246. }
  247. }