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.

98 lines
2.9 KiB

  1. /*
  2. ** Copyright 1991, 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. GLboolean __glReadSpan(__GLcolorBuffer *cfb, GLint x, GLint y,
  20. __GLcolor *results, GLint w)
  21. {
  22. while (--w >= 0) {
  23. (*cfb->readColor)(cfb, x, y, results);
  24. x++;
  25. results++;
  26. }
  27. return GL_FALSE;
  28. }
  29. /*
  30. ** NOTE: this is a hack. Late in the game we determined that returning
  31. ** a span of data should not also blend. So this code stacks the old
  32. ** blend enable value, disables blending, updates the pick procs, and
  33. ** then does the store. Obviously this is a real slow thing to
  34. ** do.
  35. */
  36. void __glReturnSpan(__GLcolorBuffer *cfb, GLint x, GLint y,
  37. const __GLaccumCell *ac, __GLfloat scale, GLint w)
  38. {
  39. __GLfragment frag;
  40. GLuint oldEnables;
  41. __GLcontext *gc = cfb->buf.gc;
  42. __GLfloat rscale, gscale, bscale, ascale;
  43. __GLaccumBuffer *afb = &gc->accumBuffer;
  44. /* Temporarily disable blending if its enabled */
  45. oldEnables = gc->state.enables.general;
  46. if (oldEnables & __GL_BLEND_ENABLE) {
  47. gc->state.enables.general &= ~__GL_BLEND_ENABLE;
  48. __GL_DELAY_VALIDATE(gc);
  49. (*gc->procs.validate)(gc);
  50. }
  51. rscale = scale * afb->oneOverRedScale;
  52. gscale = scale * afb->oneOverGreenScale;
  53. bscale = scale * afb->oneOverBlueScale;
  54. ascale = scale * afb->oneOverAlphaScale;
  55. frag.x = x;
  56. frag.y = y;
  57. while (--w >= 0) {
  58. frag.color.r = ac->r * rscale;
  59. frag.color.g = ac->g * gscale;
  60. frag.color.b = ac->b * bscale;
  61. frag.color.a = ac->a * ascale;
  62. __glClampRGBColor(cfb->buf.gc, &frag.color, &frag.color);
  63. (*cfb->store)(cfb, &frag);
  64. frag.x++;
  65. ac++;
  66. }
  67. /* Restore blending enable */
  68. if (oldEnables & __GL_BLEND_ENABLE) {
  69. gc->state.enables.general = oldEnables;
  70. __GL_DELAY_VALIDATE(gc);
  71. (*gc->procs.validate)(gc);
  72. }
  73. }
  74. GLboolean FASTCALL __glFetchSpan(__GLcontext *gc)
  75. {
  76. __GLcolor *fcp;
  77. __GLcolorBuffer *cfb;
  78. GLint x, y;
  79. GLint w;
  80. w = gc->polygon.shader.length;
  81. fcp = gc->polygon.shader.fbcolors;
  82. cfb = gc->polygon.shader.cfb;
  83. x = gc->polygon.shader.frag.x;
  84. y = gc->polygon.shader.frag.y;
  85. (*cfb->readSpan)(cfb, x, y, fcp, w);
  86. return GL_FALSE;
  87. }