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.

125 lines
4.3 KiB

  1. /******************************Module*Header*******************************\
  2. *
  3. * $Workfile: BLTMM.C $
  4. *
  5. * Contains the low-level memory-mapped IO blt functions. This module
  6. * mirrors 'bltio.c'.
  7. *
  8. * Hopefully, if you're basing your display driver on this code, to
  9. * support all of DrvBitBlt and DrvCopyBits, you'll only have to implement
  10. * the following routines. You shouldn't have to modify much in
  11. * 'bitblt.c'. I've tried to make these routines as few, modular, simple,
  12. * and efficient as I could, while still accelerating as many calls as
  13. * possible that would be cost-effective in terms of performance wins
  14. * versus size and effort.
  15. *
  16. * Note: In the following, 'relative' coordinates refers to coordinates
  17. * that haven't yet had the offscreen bitmap (DFB) offset applied.
  18. * 'Absolute' coordinates have had the offset applied. For example,
  19. * we may be told to blt to (1, 1) of the bitmap, but the bitmap may
  20. * be sitting in offscreen memory starting at coordinate (0, 768) --
  21. * (1, 1) would be the 'relative' start coordinate, and (1, 769)
  22. * would be the 'absolute' start coordinate'.
  23. *
  24. * Copyright (c) 1992-1995 Microsoft Corporation
  25. * Copyright (c) 1997 Cirrus Logic, Inc.
  26. *
  27. * $Log: X:/log/laguna/nt35/displays/cl546x/BLTMM.C $
  28. *
  29. * Rev 1.3 Mar 04 1998 15:11:50 frido
  30. * Added new shadow macros.
  31. *
  32. * Rev 1.2 Nov 03 1997 11:44:02 frido
  33. * Added REQUIRE macros.
  34. *
  35. \**************************************************************************/
  36. #include "precomp.h"
  37. #define BLTMM_DBG_LEVEL 0
  38. extern BYTE gajRop[];
  39. /******************************Public*Routine******************************\
  40. * VOID vMmFillSolid
  41. *
  42. * Fills a list of rectangles with a solid colour.
  43. *
  44. \**************************************************************************/
  45. VOID vMmFillSolid( // Type FNFILL
  46. PDEV* ppdev,
  47. LONG c, // Can't be zero
  48. RECTL* prcl, // List of rectangles to be filled, in relative
  49. // coordinates
  50. ULONG ulHwForeMix, // Hardware mix mode
  51. ULONG ulHwBackMix, // Not used
  52. BRUSHOBJ* pbo, // Drawing colour is pbo->iSolidColor
  53. POINTL* pptlBrush) // Not used
  54. {
  55. ULONG ulColor; // color
  56. ulColor = pbo->iSolidColor;
  57. switch (ppdev->ulBitCount)
  58. {
  59. case 8:
  60. ulColor |= ulColor << 8;
  61. case 16:
  62. ulColor |= ulColor << 16;
  63. }
  64. REQUIRE(4);
  65. LL_BGCOLOR(ulColor, 0);
  66. LL_DRAWBLTDEF((ppdev->uBLTDEF << 16) | ulHwForeMix, 0);
  67. do
  68. {
  69. REQUIRE(5);
  70. LL_OP0(prcl->left + ppdev->ptlOffset.x, prcl->top + ppdev->ptlOffset.y);
  71. LL_BLTEXT(prcl->right - prcl->left, prcl->bottom - prcl->top);
  72. prcl++;
  73. }
  74. while (--c != 0);
  75. }
  76. /******************************Public*Routine******************************\
  77. * VOID vMmFillPatFast
  78. *
  79. * This routine uses the S3 pattern hardware to draw a patterned list of
  80. * rectangles.
  81. *
  82. \**************************************************************************/
  83. VOID vMmFillPatFast( // Type FNFILL
  84. PDEV* ppdev,
  85. LONG c, // Can't be zero
  86. RECTL* prcl, // List of rectangles to be filled, in relative
  87. // coordinates
  88. ULONG ulHwForeMix, // Hardware mix mode (foreground mix mode if
  89. // the brush has a mask)
  90. ULONG ulHwBackMix, // Not used (unless the brush has a mask, in
  91. // which case it's the background mix mode)
  92. BRUSHOBJ* pbo, // pbo
  93. POINTL* pptlBrush) // Pattern alignment
  94. {
  95. ULONG ulBltDef = ppdev->uBLTDEF;
  96. if (!SetBrush(ppdev, &ulBltDef, pbo, pptlBrush))
  97. {
  98. return;
  99. }
  100. REQUIRE(2);
  101. LL_DRAWBLTDEF((ulBltDef << 16) | ulHwForeMix, 2);
  102. do
  103. {
  104. REQUIRE(5);
  105. LL_OP0(prcl->left + ppdev->ptlOffset.x, prcl->top + ppdev->ptlOffset.y);
  106. LL_BLTEXT(prcl->right - prcl->left, prcl->bottom - prcl->top);
  107. prcl++;
  108. }
  109. while (--c != 0);
  110. }