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.

270 lines
7.9 KiB

  1. /****************************************************************************/
  2. // wghapi.h
  3. //
  4. // Glyph Handler public types, constants
  5. //
  6. // Copyright (C) 1997-1999 Microsoft Corporation
  7. /****************************************************************************/
  8. #ifndef _H_GH_
  9. #define _H_GH_
  10. extern "C" {
  11. #include <aordprot.h>
  12. }
  13. #include "or.h"
  14. #define GH_TEXT_BUFFER_SIZE 1024
  15. #define FIFTEEN_BITS ((1L << 15)-1)
  16. // flAccel flags for STROBJ
  17. // SO_FLAG_DEFAULT_PLACEMENT // defult inc vectors used to position chars
  18. // SO_HORIZONTAL // "left to right" or "right to left"
  19. // SO_VERTICAL // "top to bottom" or "bottom to top"
  20. // SO_REVERSED // set if horiz & "right to left" or if vert & "bottom to top"
  21. // SO_ZERO_BEARINGS // all glyphs have zero a and c spaces
  22. // SO_CHAR_INC_EQUAL_BM_BASE // base == cx for horiz, == cy for vert.
  23. // SO_MAXEXT_EQUAL_BM_SIDE // side == cy for horiz, == cx for vert.
  24. // do not substitute device font for tt font even if device font sub table
  25. // tells the driver this should be done
  26. // SO_DO_NOT_SUBSTITUTE_DEVICE_FONT
  27. #define SO_FLAG_DEFAULT_PLACEMENT 0x00000001
  28. #define SO_HORIZONTAL 0x00000002
  29. #define SO_VERTICAL 0x00000004
  30. #define SO_REVERSED 0x00000008
  31. #define SO_ZERO_BEARINGS 0x00000010
  32. #define SO_CHAR_INC_EQUAL_BM_BASE 0x00000020
  33. #define SO_MAXEXT_EQUAL_BM_SIDE 0x00000040
  34. #define SO_DO_NOT_SUBSTITUTE_DEVICE_FONT 0x00000080
  35. #define SO_GLYPHINDEX_TEXTOUT 0x00000100
  36. #ifdef DC_DEBUG
  37. #define GHFRAGRESET(x) g_Fragment = x
  38. #define GHFRAGLEFT(x) g_FragmentLeft[g_Fragment] = x
  39. #define GHFRAGRIGHT(x) g_FragmentRight[g_Fragment++] = x
  40. #else
  41. #define GHFRAGRESET(x)
  42. #define GHFRAGLEFT(x)
  43. #define GHFRAGRIGHT(x)
  44. #endif
  45. #if defined(OS_WINCE) || defined(OS_WINNT)
  46. const ULONG gTextLeftMask[8][2] =
  47. {
  48. {0x00000000,0x00000000},
  49. {0xffffff00,0xffffffff},
  50. {0xffff0000,0xffffffff},
  51. {0xff000000,0xffffffff},
  52. {0x00000000,0xffffffff},
  53. {0x00000000,0xffffff00},
  54. {0x00000000,0xffff0000},
  55. {0x00000000,0xff000000}
  56. };
  57. const ULONG gTextRightMask[8][2] =
  58. {
  59. {0x00000000,0x00000000},
  60. {0x000000ff,0x00000000},
  61. {0x0000ffff,0x00000000},
  62. {0x00ffffff,0x00000000},
  63. {0xffffffff,0x00000000},
  64. {0xffffffff,0x000000ff},
  65. {0xffffffff,0x0000ffff},
  66. {0xffffffff,0x00ffffff}
  67. };
  68. const ULONG TranTable [] =
  69. {
  70. 0x00000000,
  71. 0xff000000,
  72. 0x00ff0000,
  73. 0xffff0000,
  74. 0x0000ff00,
  75. 0xff00ff00,
  76. 0x00ffff00,
  77. 0xffffff00,
  78. 0x000000ff,
  79. 0xff0000ff,
  80. 0x00ff00ff,
  81. 0xffff00ff,
  82. 0x0000ffff,
  83. 0xff00ffff,
  84. 0x00ffffff,
  85. 0xffffffff
  86. };
  87. #endif // defined(OS_WINCE) || defined(OS_WINNT)
  88. // the following definitions are used by the glyph clipping functions
  89. #define GLYPH_CLIP_NONE 0 // No clipping is necessary
  90. #define GLYPH_CLIP_PARTIAL 1 // The glyph is partially clipped
  91. #define GLYPH_CLIP_ALL 2 // The glyph is completly clipped
  92. typedef RECT RECTCLIPOFFSET, *PRECTCLIPOFFSET;
  93. class CUH;
  94. class CCLX;
  95. #include "objs.h"
  96. class CGH
  97. {
  98. public:
  99. CGH(CObjs* objs);
  100. ~CGH();
  101. public:
  102. DCVOID DCAPI GH_Init();
  103. //
  104. //API
  105. //
  106. HRESULT DCAPI GH_GlyphOut(LPINDEX_ORDER pOrder, LPVARIABLE_INDEXBYTES pVariableBytes);
  107. private:
  108. //
  109. // Internal
  110. //
  111. // flAccel flags for STROBJ
  112. // SO_FLAG_DEFAULT_PLACEMENT // defult inc vectors used to position chars
  113. // SO_HORIZONTAL // "left to right" or "right to left"
  114. // SO_VERTICAL // "top to bottom" or "bottom to top"
  115. // SO_REVERSED // set if horiz & "right to left" or if vert & "bottom to top"
  116. // SO_ZERO_BEARINGS // all glyphs have zero a and c spaces
  117. // SO_CHAR_INC_EQUAL_BM_BASE // base == cx for horiz, == cy for vert.
  118. // SO_MAXEXT_EQUAL_BM_SIDE // side == cy for horiz, == cx for vert.
  119. // do not substitute device font for tt font even if device font sub table
  120. // tells the driver this should be done
  121. // SO_DO_NOT_SUBSTITUTE_DEVICE_FONT
  122. #define SO_FLAG_DEFAULT_PLACEMENT 0x00000001
  123. #define SO_HORIZONTAL 0x00000002
  124. #define SO_VERTICAL 0x00000004
  125. #define SO_REVERSED 0x00000008
  126. #define SO_ZERO_BEARINGS 0x00000010
  127. #define SO_CHAR_INC_EQUAL_BM_BASE 0x00000020
  128. #define SO_MAXEXT_EQUAL_BM_SIDE 0x00000040
  129. #define SO_DO_NOT_SUBSTITUTE_DEVICE_FONT 0x00000080
  130. #define SO_GLYPHINDEX_TEXTOUT 0x00000100
  131. #ifdef DC_DEBUG
  132. #define GHFRAGRESET(x) g_Fragment = x
  133. #define GHFRAGLEFT(x) g_FragmentLeft[g_Fragment] = x
  134. #define GHFRAGRIGHT(x) g_FragmentRight[g_Fragment++] = x
  135. #else
  136. #define GHFRAGRESET(x)
  137. #define GHFRAGLEFT(x)
  138. #define GHFRAGRIGHT(x)
  139. #endif
  140. void DCINTERNAL GHSlowOutputBuffer(LPINDEX_ORDER, PDCUINT8, ULONG, unsigned);
  141. #ifdef DC_HICOLOR
  142. VOID vSrcTranCopyS1D8_24(PBYTE, LONG, LONG, PBYTE, LONG, LONG, LONG, LONG, DCRGB);
  143. VOID vSrcOpaqCopyS1D8_24(PBYTE, LONG, LONG, PBYTE, LONG, LONG, LONG, LONG, DCRGB, DCRGB);
  144. VOID vSrcTranCopyS1D8_16(PBYTE, LONG, LONG, PBYTE, LONG, LONG, LONG, LONG, ULONG);
  145. VOID vSrcOpaqCopyS1D8_16(PBYTE, LONG, LONG, PBYTE, LONG, LONG, LONG, LONG, ULONG, ULONG);
  146. #endif
  147. VOID vSrcTranCopyS1D8(PBYTE, LONG, LONG, PBYTE, LONG, LONG, LONG, LONG, ULONG, ULONG);
  148. VOID vSrcOpaqCopyS1D8(PBYTE, LONG, LONG, PBYTE, LONG, LONG, LONG, LONG, ULONG, ULONG);
  149. public:
  150. static HRESULT draw_f_tb_no_to_temp_start (CGH* inst, LPINDEX_ORDER,unsigned,PDCUINT8 DCPTR, PDCUINT8,
  151. PDCINT,PDCINT,PDCUINT8,PDCUINT8,ULONG,unsigned, PDCUINT16, int *);
  152. static HRESULT draw_nf_tb_no_to_temp_start(CGH* inst, LPINDEX_ORDER,unsigned,PDCUINT8 DCPTR, PDCUINT8,
  153. PDCINT,PDCINT,PDCUINT8,PDCUINT8,ULONG,unsigned, PDCUINT16, int *);
  154. static HRESULT draw_f_ntb_o_to_temp_start (CGH* inst, LPINDEX_ORDER,unsigned,PDCUINT8 DCPTR, PDCUINT8,
  155. PDCINT,PDCINT,PDCUINT8,PDCUINT8,ULONG,unsigned, PDCUINT16, int *);
  156. static HRESULT draw_nf_ntb_o_to_temp_start(CGH* inst, LPINDEX_ORDER,unsigned,PDCUINT8 DCPTR, PDCUINT8,
  157. PDCINT,PDCINT,PDCUINT8,PDCUINT8,ULONG,unsigned, PDCUINT16, int *);
  158. inline PDCUINT8 GetGlyphClipBuffer(ULONG size)
  159. {
  160. if (_ClipGlyphBitsBufferSize >= size) {
  161. TRC_ASSERT((_pClipGlyphBitsBuffer!=NULL),
  162. (TB, _T("The is _ClipGlyphBitsBufferSize NULL.")));
  163. return _pClipGlyphBitsBuffer;
  164. }
  165. if (_pClipGlyphBitsBuffer!=NULL) {
  166. LocalFree(_pClipGlyphBitsBuffer);
  167. }
  168. _pClipGlyphBitsBuffer = (PDCUINT8)LocalAlloc(LMEM_FIXED, size);
  169. _ClipGlyphBitsBufferSize = (_pClipGlyphBitsBuffer == NULL) ? 0 : size;
  170. return _pClipGlyphBitsBuffer;
  171. }
  172. private:
  173. //
  174. // Private data members
  175. //
  176. #ifdef DC_DEBUG
  177. unsigned g_Fragment;
  178. int g_FragmentLeft[256];
  179. int g_FragmentRight[256];
  180. unsigned g_ulBytes;
  181. #endif
  182. public:
  183. //Needs to be accessible by CGH:: static functions
  184. CUH* _pUh;
  185. private:
  186. CCLX* _pClx;
  187. CUT* _pUt;
  188. private:
  189. CObjs* _pClientObjects;
  190. PDCUINT8 _pClipGlyphBitsBuffer;
  191. ULONG _ClipGlyphBitsBufferSize;
  192. };
  193. typedef HRESULT (*PFN_MASTERTEXTTYPE) (CGH* inst, LPINDEX_ORDER,unsigned,PDCUINT8 DCPTR, PDCUINT8,
  194. PDCINT,PDCINT,PDCUINT8,PDCUINT8,ULONG,unsigned, PDCUINT16, int *);
  195. extern const PFN_MASTERTEXTTYPE MasterTextTypeTable[8];
  196. #endif //_H_GH_