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.

147 lines
5.5 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: stretch.c
  3. *
  4. * DrvStretchBlt
  5. *
  6. * Copyright (c) 1993 Microsoft Corporation
  7. \**************************************************************************/
  8. #include "driver.h"
  9. //@@@ This should become a VOID when all cases are handled in the stretching
  10. //@@@ code, and should go in driver.h
  11. INT vStretchBlt8bpp(PPDEV ppdev, PBYTE pSrc, LONG lSrcNext,
  12. PRECTL prclSrc, PRECTL prclDest, PRECTL prclDestClip,
  13. PULONG pulXlatVector);
  14. BOOL DrvStretchBlt(
  15. SURFOBJ *psoDest,
  16. SURFOBJ *psoSrc,
  17. SURFOBJ *psoMask,
  18. CLIPOBJ *pco,
  19. XLATEOBJ *pxlo,
  20. COLORADJUSTMENT *pca,
  21. POINTL *pptlBrushOrg,
  22. RECTL *prclDest,
  23. RECTL *prclSrc,
  24. POINTL *pptlMask,
  25. ULONG iMode)
  26. {
  27. PPDEV ppdev = (PPDEV) psoDest->dhpdev;
  28. PULONG pulXlatVector;
  29. INT iClipping;
  30. // Handle only cases where the source is a DIB and the destination is
  31. // the VGA surface (which is always the case here if the source is a
  32. // DIB). Also, halftoning and masking aren't handled by the special-case
  33. // code. We only handle the case where a single source pixel is mapped onto
  34. // each destination pixel
  35. if ((iMode == COLORONCOLOR) &&
  36. (psoSrc->iType == STYPE_BITMAP) &&
  37. (psoMask == NULL)) {
  38. // We don't special case X or Y inversion for now
  39. if ((prclDest->left < prclDest->right) &&
  40. (prclDest->top < prclDest->bottom)) {
  41. // We don't special-case cases where the source has to be clipped
  42. // to the source bitmap extent
  43. if ((prclSrc->left >= 0) &&
  44. (prclSrc->top >= 0) &&
  45. (prclSrc->right <= psoSrc->sizlBitmap.cx) &&
  46. (prclSrc->bottom <= psoSrc->sizlBitmap.cy)) {
  47. // Set up the clipping type
  48. if (pco == (CLIPOBJ *) NULL) {
  49. // No CLIPOBJ provided, so we don't have to worry about
  50. // clipping
  51. iClipping = DC_TRIVIAL;
  52. } else {
  53. // Use the CLIPOBJ-provided clipping
  54. iClipping = pco->iDComplexity;
  55. }
  56. // We don't special-case clipping for now
  57. if (iClipping != DC_COMPLEX) {
  58. switch(psoSrc->iBitmapFormat) {
  59. case BMF_1BPP:
  60. break;
  61. case BMF_4BPP:
  62. break;
  63. case BMF_8BPP:
  64. // Set up the color translation, if any
  65. if ((pxlo == NULL) ||
  66. (pxlo->flXlate & XO_TRIVIAL)) {
  67. pulXlatVector = NULL;
  68. } else {
  69. if (pxlo->pulXlate != NULL) {
  70. pulXlatVector = pxlo->pulXlate;
  71. } else {
  72. if ((pulXlatVector =
  73. XLATEOBJ_piVector(pxlo)) == NULL) {
  74. return FALSE;
  75. }
  76. }
  77. }
  78. //if the Dest is wider than 1024, it won't fit
  79. //into our 4K global buffer. For each pixel across,
  80. //we store a 4 byte DDA step in the buffer.
  81. if ((prclDest->right - prclDest->left) <=
  82. (GLOBAL_BUFFER_SIZE/sizeof(DWORD)))
  83. {
  84. //@@@ won't need to test return code once both
  85. //@@@ expand cases are also handled in the
  86. //@@@ stretching code
  87. if (vStretchBlt8bpp(ppdev,
  88. psoSrc->pvScan0,
  89. psoSrc->lDelta,
  90. prclSrc,
  91. prclDest,
  92. (iClipping == DC_TRIVIAL) ?
  93. NULL :
  94. &pco->rclBounds,
  95. pulXlatVector))
  96. {
  97. return(TRUE);
  98. }
  99. }
  100. break;
  101. case BMF_16BPP:
  102. break;
  103. case BMF_24BPP:
  104. break;
  105. case BMF_32BPP:
  106. break;
  107. default:
  108. break;
  109. }
  110. }
  111. }
  112. }
  113. }
  114. return(EngStretchBlt(psoDest,
  115. psoSrc,
  116. psoMask,
  117. pco,
  118. pxlo,
  119. pca,
  120. pptlBrushOrg,
  121. prclDest,
  122. prclSrc,
  123. pptlMask,
  124. iMode));
  125. }