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.

65 lines
1.5 KiB

  1. //-----------------------------------------------------------------------------
  2. //
  3. // This file contains the general span parsing code.
  4. //
  5. // Copyright (C) Microsoft Corporation, 1997.
  6. //
  7. //-----------------------------------------------------------------------------
  8. #include "pch.cpp"
  9. #pragma hdrstop
  10. #include "rloop_mh.h"
  11. // #define SPAN_HISTOGRAM
  12. #ifdef SPAN_HISTOGRAM
  13. UINT32 uSpanHist[16];
  14. #endif
  15. //-----------------------------------------------------------------------------
  16. //
  17. // RenderSpans_Any
  18. //
  19. // All mode general span routine.
  20. //
  21. //-----------------------------------------------------------------------------
  22. HRESULT Ramp_RenderSpans_Any(PD3DI_RASTCTX pCtx)
  23. {
  24. PD3DI_RASTPRIM pP = pCtx->pPrim;
  25. if (pCtx->pTexture[0])
  26. {
  27. pCtx->pTexture[0]->pRampmap = pCtx->pTexRampMap;
  28. }
  29. while (pP)
  30. {
  31. UINT16 uSpans = pP->uSpans;
  32. PD3DI_RASTSPAN pS = (PD3DI_RASTSPAN)(pP + 1);
  33. while (uSpans-- > 0)
  34. {
  35. #ifdef SPAN_HISTOGRAM
  36. INT iBucket;
  37. for (iBucket = 0;
  38. iBucket < sizeof(uSpanHist)/sizeof(uSpanHist[0]);
  39. iBucket++)
  40. {
  41. if (pS->uPix <= (1 << iBucket))
  42. {
  43. uSpanHist[iBucket]++;
  44. break;
  45. }
  46. }
  47. #endif
  48. pCtx->pfnBegin(pCtx, pP, pS);
  49. pS++;
  50. }
  51. pP = pP->pNext;
  52. }
  53. return S_OK;
  54. }