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.

139 lines
5.5 KiB

  1. /******************************Module*Header*******************************\
  2. * Module Name: lines.h
  3. *
  4. * Line drawing constants and structures.
  5. *
  6. * NOTE: This file mirrors LINES.INC. Changes here must be reflected in
  7. * the .inc file!
  8. *
  9. * Created: 30-Mar-1992
  10. * Author: Andrew Milton [w-andym]
  11. *
  12. * Copyright (c) 1992 Microsoft Corporation
  13. \**************************************************************************/
  14. typedef LONG STYLEPOS;
  15. #define STYLE_MAX_COUNT 16 // Maximum number of style array entries
  16. #define STYLE_MAX_VALUE 0x3fffL // Maximum for of a style array element
  17. #define RUN_MAX 20 // Size of our complex clip runs buffer
  18. #define STRIP_MAX 100 // Size of our strip buffer
  19. #define STYLE_DENSITY 3 // Each style unit is 3 pixels long
  20. // For the ROP table:
  21. #define MIX_XOR_OFFSET 8
  22. #define AND_ZERO 0L
  23. #define AND_PEN 1L
  24. #define AND_NOTPEN 2L
  25. #define AND_ONE 3L
  26. #define XOR_ZERO (AND_ZERO << MIX_XOR_OFFSET)
  27. #define XOR_PEN (AND_PEN << MIX_XOR_OFFSET)
  28. #define XOR_NOTPEN (AND_NOTPEN << MIX_XOR_OFFSET)
  29. #define XOR_ONE (AND_ONE << MIX_XOR_OFFSET)
  30. // Flip and round flags (see lines.inc for a description):
  31. #define FL_H_ROUND_DOWN 0x00000080L // .... .... 1... ....
  32. #define FL_V_ROUND_DOWN 0x00008000L // 1... .... .... ....
  33. #define FL_FLIP_D 0x00000005L // .... .... .... .1.1
  34. #define FL_FLIP_V 0x00000008L // .... .... .... 1...
  35. #define FL_FLIP_SLOPE_ONE 0x00000010L // .... .... ...1 ....
  36. #define FL_FLIP_HALF 0x00000002L // .... .... .... ..1.
  37. #define FL_FLIP_H 0x00000200L // .... ..1. .... ....
  38. #define FL_ROUND_MASK 0x0000001CL // .... .... ...1 11..
  39. #define FL_ROUND_SHIFT 2
  40. #define FL_RECTLCLIP_MASK 0x0000000CL // .... .... .... 11..
  41. #define FL_RECTLCLIP_SHIFT 2
  42. #define FL_STRIP_MASK 0x00000003L // .... .... .... ..11
  43. #define FL_STRIP_SHIFT 0
  44. #define FL_SIMPLE_CLIP 0x00000020 // .... .... ..1. ....
  45. #define FL_COMPLEX_CLIP 0x00000040 // .... .... .1.. ....
  46. #define FL_CLIP (FL_SIMPLE_CLIP | FL_COMPLEX_CLIP)
  47. #define FL_ARBITRARYSTYLED 0x00000400L // .... .1.. .... ....
  48. #define FL_SET 0x00000800L // .... 1... .... ....
  49. #define FL_STYLED (FL_ARBITRARYSTYLED)
  50. #define FL_STRIP_ARRAY_MASK 0x00000C00L
  51. #define FL_STRIP_ARRAY_SHIFT 10
  52. // Simpler flag bits in high byte:
  53. #define FL_DONT_DO_HALF_FLIP 0x00002000L // ..1. .... .... ....
  54. #define FL_PHYSICAL_DEVICE 0x00004000L // .1.. .... .... ....
  55. // Miscellaneous DDA defines:
  56. #define LROUND(x, flRoundDown) (((x) + F/2 - ((flRoundDown) > 0)) >> 4)
  57. #define F 16
  58. #define FLOG2 4
  59. #define LFLOOR(x) ((x) >> 4)
  60. #define FXFRAC(x) ((x) & (F - 1))
  61. struct _STRIP;
  62. struct _LINESTATE;
  63. typedef VOID (*PFNSTRIP)(struct _STRIP*, struct _LINESTATE*, LONG*);
  64. typedef struct _STRIP {
  65. // Updated by strip drawers:
  66. BYTE* pjScreen; // Points to the first pixel of the line
  67. BYTE bIsGap; // Are we working on a gap in the style?
  68. BYTE jFiller2[3]; // bIsGap sometimes treated as a ULONG
  69. STYLEPOS* psp; // Pointer to current style entry
  70. STYLEPOS spRemaining; // To go in current style
  71. // Not modified by strip drawers:
  72. LONG lNextScan; // Signed increment to next scan
  73. LONG* plStripEnd; // Points one element past last strip
  74. LONG flFlips; // Indicates if line goes up or down
  75. STYLEPOS* pspStart; // Pointer to start of style array
  76. STYLEPOS* pspEnd; // Pointer to end of style array
  77. ULONG xyDensity; // Density of style
  78. ULONG chAndXor; // Lines colors (need 2 for doing ROPs)
  79. // We leave room for a couple of extra dwords at the end of the strips
  80. // array that can be used by the strip drawers:
  81. LONG alStrips[STRIP_MAX + 2]; // Array of strips
  82. } STRIP;
  83. typedef struct _LINESTATE {
  84. ULONG chAndXor; // Line colors (need 2 for doing ROPs)
  85. STYLEPOS spTotal; // Sum of style array
  86. STYLEPOS spTotal2; // Twice sum of style array
  87. STYLEPOS spNext; // Style state at start of next line
  88. STYLEPOS spComplex; // Style state at start of complex clip line
  89. STYLEPOS* aspRtoL; // Style array in right-to-left order
  90. STYLEPOS* aspLtoR; // Style array in left-to-right order
  91. ULONG xyDensity; // Density of style
  92. ULONG cStyle; // Size of style array
  93. ULONG ulStyleMaskLtoR;// Original style mask, left-to-right order
  94. ULONG ulStyleMaskRtoL;// Original style mask, right-to-left order
  95. BOOL bStartIsGap; // Determines if first element in style
  96. // array is for a gap or a dash
  97. } LINESTATE; /* ls */
  98. BOOL bLinesSimple(PPDEV, POINTFIX*, POINTFIX*, RUN*, ULONG, LINESTATE*,
  99. RECTL*, PFNSTRIP*, FLONG);
  100. BOOL bLines(PPDEV, POINTFIX*, POINTFIX*, RUN*, ULONG,
  101. LINESTATE*, RECTL*, PFNSTRIP*, FLONG);