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.

153 lines
6.0 KiB

  1. /******************************Module*Header*******************************\
  2. *
  3. * *******************
  4. * * GDI SAMPLE CODE *
  5. * *******************
  6. *
  7. * Module Name: lines.h
  8. *
  9. * Line drawing constants and structures.
  10. *
  11. * NOTE: This file mirrors LINES.INC. Changes here must be reflected in
  12. * the .inc file!
  13. *
  14. * Copyright (c) 1992-1998 Microsoft Corporation
  15. \**************************************************************************/
  16. typedef struct _PDEV PDEV; // Handy forward declaration
  17. // We have to be careful that we don't overflow any registers when using
  18. // the hardware to draw lines (as opposed to going through the strips
  19. // routines, which will never overflow). We accomplish this by simply
  20. // checking the bounds of the path; if it is so large that any of the
  21. // hardware terms may overflow, we punt the entire path to the strips
  22. // code (should be pretty rare).
  23. #define MAX_INTEGER_BOUND (1535) // S3's line length term is limited to
  24. #define MIN_INTEGER_BOUND (-512) // a maximum value of 2047
  25. // We have special strip routines when all strips have at most this many
  26. // pixels:
  27. #define MAX_SHORT_STROKE_LENGTH 15
  28. // # of strip drawers in every group:
  29. #define NUM_STRIP_DRAW_DIRECTIONS 4
  30. // # of strip drawers for doing either solid lines or styled lines:
  31. #define NUM_STRIP_DRAW_STYLES 8
  32. typedef LONG STYLEPOS;
  33. #define STYLE_MAX_COUNT 16
  34. #define STYLE_MAX_VALUE 0x3fffL
  35. #define RUN_MAX 20
  36. #define STRIP_MAX 100
  37. #define STYLE_DENSITY 3
  38. // Flip and round flags:
  39. #define FL_H_ROUND_DOWN 0x00000080L // .... .... 1... ....
  40. #define FL_V_ROUND_DOWN 0x00008000L // 1... .... .... ....
  41. #define FL_FLIP_D 0x00000005L // .... .... .... .1.1
  42. #define FL_FLIP_V 0x00000008L // .... .... .... 1...
  43. #define FL_FLIP_SLOPE_ONE 0x00000010L // .... .... ...1 ....
  44. #define FL_FLIP_HALF 0x00000002L // .... .... .... ..1.
  45. #define FL_FLIP_H 0x00000200L // .... ..1. .... ....
  46. #define FL_ROUND_MASK 0x0000001CL // .... .... ...1 11..
  47. #define FL_ROUND_SHIFT 2
  48. #define FL_RECTLCLIP_MASK 0x0000000CL // .... .... .... 11..
  49. #define FL_RECTLCLIP_SHIFT 2
  50. #define FL_STRIP_MASK 0x00000003L // .... .... .... ..11
  51. #define FL_STRIP_SHIFT 0
  52. #define FL_SIMPLE_CLIP 0x00000020 // .... .... ..1. ....
  53. #define FL_COMPLEX_CLIP 0x00000040 // .... .... .1.. ....
  54. #define FL_CLIP (FL_SIMPLE_CLIP | FL_COMPLEX_CLIP)
  55. #define FL_STYLED 0x00000400L // .... .1.. .... ....
  56. #define FL_ALTERNATESTYLED 0x00001000L // ...1 .... .... ....
  57. #define FL_STYLE_MASK 0x00000400L
  58. #define FL_STYLE_SHIFT 10
  59. #define FL_LAST_PEL_INCLUSIVE 0x00002000L // ..1. .... .... ....
  60. // Miscellaneous DDA defines:
  61. #define LROUND(x, flRoundDown) (((x) + F/2 - ((flRoundDown) > 0)) >> 4)
  62. #define F 16
  63. #define FLOG2 4
  64. #define LFLOOR(x) ((x) >> 4)
  65. #define FXFRAC(x) ((x) & (F - 1))
  66. ////////////////////////////////////////////////////////////////////////////
  67. // NOTE: The following structures must exactly match those declared in
  68. // lines.inc!
  69. typedef struct _STRIP {
  70. LONG cStrips; // # of strips in array
  71. LONG flFlips; // Indicates if line goes up or down
  72. POINTL ptlStart; // first point
  73. LONG alStrips[STRIP_MAX]; // Array of strips
  74. } STRIP;
  75. typedef struct _LINESTATE {
  76. STYLEPOS* pspStart; // Pointer to start of style array
  77. STYLEPOS* pspEnd; // Pointer to end of style array
  78. STYLEPOS* psp; // Pointer to current style entry
  79. STYLEPOS spRemaining; // To go in current style
  80. STYLEPOS spTotal; // Sum of style array
  81. STYLEPOS spTotal2; // Twice sum of style array
  82. STYLEPOS spNext; // Style state at start of next line
  83. STYLEPOS spComplex; // Style state at start of complex clip line
  84. STYLEPOS* aspRtoL; // Style array in right-to-left order
  85. STYLEPOS* aspLtoR; // Style array in left-to-right order
  86. ULONG ulStyleMask; // Are we working on a gap in the style?
  87. // 0xff if yes, 0x0 if not
  88. ULONG xyDensity; // Density of style
  89. ULONG cStyle; // Size of style array
  90. ULONG ulStyleMaskLtoR;// Original style mask, left-to-right order
  91. ULONG ulStyleMaskRtoL;// Original style mask, right-to-left order
  92. BOOL ulStartMask; // Determines if first element in style
  93. // array is for a gap or a dash
  94. } LINESTATE; /* ls */
  95. // Strip drawer prototype:
  96. typedef VOID (*PFNSTRIP)(PDEV*, STRIP*, LINESTATE*);
  97. extern PFNSTRIP gapfnStrip[];
  98. // Strip drawers:
  99. VOID vssSolidHorizontal(PDEV* ppdev, STRIP *pStrip, LINESTATE *pLineState);
  100. VOID vrlSolidHorizontal(PDEV* ppdev, STRIP *pStrip, LINESTATE *pLineState);
  101. VOID vssSolidVertical(PDEV* ppdev, STRIP *pStrip, LINESTATE *pLineState);
  102. VOID vrlSolidVertical(PDEV* ppdev, STRIP *pStrip, LINESTATE *pLineState);
  103. VOID vssSolidDiagonalHorizontal(PDEV* ppdev, STRIP *pStrip, LINESTATE *pLineState);
  104. VOID vrlSolidDiagonalHorizontal(PDEV* ppdev, STRIP *pStrip, LINESTATE *pLineState);
  105. VOID vssSolidDiagonalVertical(PDEV* ppdev, STRIP *pStrip, LINESTATE *pLineState);
  106. VOID vrlSolidDiagonalVertical(PDEV* ppdev, STRIP *pStrip, LINESTATE *pLineState);
  107. VOID vStripStyledHorizontal(PDEV* ppdev, STRIP *pStrip, LINESTATE *pLineState);
  108. VOID vStripStyledVertical(PDEV* ppdev, STRIP *pStrip, LINESTATE *pLineState);
  109. // External calls:
  110. BOOL bLines(PDEV*, POINTFIX*, POINTFIX*, RUN* prun, ULONG,
  111. LINESTATE*, RECTL*, PFNSTRIP apfn[], FLONG);