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.

235 lines
7.9 KiB

  1. /*
  2. ** Copyright (c) 1992 Microsoft Corporation
  3. */
  4. /*============================================================================
  5. // FILE RPBMVER.C
  6. //
  7. // MODULE Jumbo Cartridge Code
  8. //
  9. // PURPOSE This file contains Vertical Bitmap Code
  10. //
  11. // DESCRIBED IN This module is described in jumbo .
  12. //
  13. // MNEMONICS Standard Hungarian
  14. //
  15. // HISTORY
  16. //
  17. // 05/26/92 RodneyK Original implimentation:
  18. // 05/11/94 RajeevD Adapted for unified.
  19. //==========================================================================*/
  20. #include <windows.h>
  21. #include "jtypes.h" /* Jumbo type definitions. */
  22. /*--------------------------------------------------------------------------*/
  23. USHORT WINAPI RP_BITMAPV
  24. (
  25. USHORT usRow, /* Row to start Bitmap */
  26. USHORT usCol, /* Column to Start Bitmap */
  27. UBYTE ubTopPadBits, /* Bits to skip in the data stream */
  28. USHORT usHeight, /* Number of bits to draw */
  29. UBYTE FAR *ubBitmapData, /* Data to draw */
  30. LPBYTE lpbOut, // output band buffer
  31. UINT cbLine // bytes per scan line
  32. )
  33. /*
  34. //
  35. // PURPOSE This function draws vertical bitmaps in source
  36. // copy mode.
  37. //
  38. //
  39. // ASSUMPTIONS & The code assumes nothing other than it gets valid
  40. // ASSERTIONS input data.
  41. //
  42. //
  43. // INTERNAL STRUCTURES No complex internal data structure are used
  44. //
  45. // UNRESOLVED ISSUES None
  46. //
  47. //
  48. //--------------------------------------------------------------------------*/
  49. {
  50. UBYTE *pubDest;
  51. SHORT sIterations;
  52. USHORT usReturnVal;
  53. USHORT us1stByte;
  54. UBYTE ubMask;
  55. UBYTE ubNotMask;
  56. UBYTE ubRotator;
  57. UBYTE ubCurByte;
  58. usReturnVal = (ubTopPadBits + usHeight + 7) >> 3;
  59. pubDest = (UBYTE *) lpbOut + (usRow * cbLine) + (usCol >> 3);
  60. ubMask = 0x80 >> (usCol & 7);
  61. ubNotMask = ~ubMask;
  62. ubCurByte = *ubBitmapData++;
  63. us1stByte = 8-ubTopPadBits;
  64. ubRotator = 0x80 >> ubTopPadBits;
  65. switch (us1stByte)
  66. {
  67. case 8 :
  68. *pubDest = (ubRotator & ubCurByte) ?
  69. (*pubDest & ubNotMask) | ubMask :
  70. (*pubDest & ubNotMask);
  71. pubDest -= cbLine;
  72. ubRotator >>= 1;
  73. if ( !(--usHeight) ) break;
  74. case 7 :
  75. *pubDest = (ubRotator & ubCurByte) ?
  76. (*pubDest & ubNotMask) | ubMask :
  77. (*pubDest & ubNotMask);
  78. pubDest -= cbLine;
  79. ubRotator >>= 1;
  80. if ( !(--usHeight) ) break;
  81. case 6 :
  82. *pubDest = (ubRotator & ubCurByte) ?
  83. (*pubDest & ubNotMask) | ubMask :
  84. (*pubDest & ubNotMask);
  85. pubDest -= cbLine;
  86. ubRotator >>= 1;
  87. if ( !(--usHeight) ) break;
  88. case 5 :
  89. *pubDest = (ubRotator & ubCurByte) ?
  90. (*pubDest & ubNotMask) | ubMask :
  91. (*pubDest & ubNotMask);
  92. pubDest -= cbLine;
  93. ubRotator >>= 1;
  94. if ( !(--usHeight) ) break;
  95. case 4 :
  96. *pubDest = (ubRotator & ubCurByte) ?
  97. (*pubDest & ubNotMask) | ubMask :
  98. (*pubDest & ubNotMask);
  99. pubDest -= cbLine;
  100. ubRotator >>= 1;
  101. if ( !(--usHeight) ) break;
  102. case 3 :
  103. *pubDest = (ubRotator & ubCurByte) ?
  104. (*pubDest & ubNotMask) | ubMask :
  105. (*pubDest & ubNotMask);
  106. pubDest -= cbLine;
  107. ubRotator >>= 1;
  108. if ( !(--usHeight) ) break;
  109. case 2 :
  110. *pubDest = (ubRotator & ubCurByte) ?
  111. (*pubDest & ubNotMask) | ubMask :
  112. (*pubDest & ubNotMask);
  113. pubDest -= cbLine;
  114. ubRotator >>= 1;
  115. if ( !(--usHeight) ) break;
  116. case 1 :
  117. *pubDest = (ubRotator & ubCurByte) ?
  118. (*pubDest & ubNotMask) | ubMask :
  119. (*pubDest & ubNotMask);
  120. pubDest -= cbLine;
  121. ubRotator >>= 1;
  122. --usHeight;
  123. default:
  124. break;
  125. }
  126. ubCurByte = *ubBitmapData++;
  127. sIterations = usHeight >> 3;
  128. while (--sIterations >= 0)
  129. {
  130. /* 1 */
  131. *pubDest = (0x80 & ubCurByte) ?
  132. (*pubDest & ubNotMask) | ubMask :
  133. (*pubDest & ubNotMask);
  134. pubDest -= cbLine;
  135. /* 2 */
  136. *pubDest = (0x40 & ubCurByte) ?
  137. (*pubDest & ubNotMask) | ubMask :
  138. (*pubDest & ubNotMask);
  139. pubDest -= cbLine;
  140. /* 3 */
  141. *pubDest = (0x20 & ubCurByte) ?
  142. (*pubDest & ubNotMask) | ubMask :
  143. (*pubDest & ubNotMask);
  144. pubDest -= cbLine;
  145. /* 4 */
  146. *pubDest = (0x10 & ubCurByte) ?
  147. (*pubDest & ubNotMask) | ubMask :
  148. (*pubDest & ubNotMask);
  149. pubDest -= cbLine;
  150. /* 5 */
  151. *pubDest = (0x08 & ubCurByte) ?
  152. (*pubDest & ubNotMask) | ubMask :
  153. (*pubDest & ubNotMask);
  154. pubDest -= cbLine;
  155. /* 6 */
  156. *pubDest = (0x04 & ubCurByte) ?
  157. (*pubDest & ubNotMask) | ubMask :
  158. (*pubDest & ubNotMask);
  159. pubDest -= cbLine;
  160. /* 7 */
  161. *pubDest = (0x02 & ubCurByte) ?
  162. (*pubDest & ubNotMask) | ubMask :
  163. (*pubDest & ubNotMask);
  164. pubDest -= cbLine;
  165. /* 8 */
  166. *pubDest = (0x01 & ubCurByte) ?
  167. (*pubDest & ubNotMask) | ubMask :
  168. (*pubDest & ubNotMask);
  169. pubDest -= cbLine;
  170. ubCurByte = *ubBitmapData++;
  171. }
  172. ubRotator = 0x80;
  173. switch (usHeight & 0x07)
  174. {
  175. case 7 :
  176. *pubDest = (ubRotator & ubCurByte) ?
  177. (*pubDest & ubNotMask) | ubMask :
  178. (*pubDest & ubNotMask);
  179. pubDest -= cbLine;
  180. ubRotator >>= 1;
  181. case 6 :
  182. *pubDest = (ubRotator & ubCurByte) ?
  183. (*pubDest & ubNotMask) | ubMask :
  184. (*pubDest & ubNotMask);
  185. pubDest -= cbLine;
  186. ubRotator >>= 1;
  187. case 5 :
  188. *pubDest = (ubRotator & ubCurByte) ?
  189. (*pubDest & ubNotMask) | ubMask :
  190. (*pubDest & ubNotMask);
  191. pubDest -= cbLine;
  192. ubRotator >>= 1;
  193. case 4 :
  194. *pubDest = (ubRotator & ubCurByte) ?
  195. (*pubDest & ubNotMask) | ubMask :
  196. (*pubDest & ubNotMask);
  197. pubDest -= cbLine;
  198. ubRotator >>= 1;
  199. case 3 :
  200. *pubDest = (ubRotator & ubCurByte) ?
  201. (*pubDest & ubNotMask) | ubMask :
  202. (*pubDest & ubNotMask);
  203. pubDest -= cbLine;
  204. ubRotator >>= 1;
  205. case 2 :
  206. *pubDest = (ubRotator & ubCurByte) ?
  207. (*pubDest & ubNotMask) | ubMask :
  208. (*pubDest & ubNotMask);
  209. pubDest -= cbLine;
  210. ubRotator >>= 1;
  211. case 1 :
  212. *pubDest = (ubRotator & ubCurByte) ?
  213. (*pubDest & ubNotMask) | ubMask :
  214. (*pubDest & ubNotMask);
  215. pubDest -= cbLine;
  216. ubRotator >>= 1;
  217. default:
  218. break;
  219. }
  220. return (usReturnVal); /* Return the number of byte in the list */
  221. }