Source code of Windows XP (NT5)
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.

124 lines
5.0 KiB

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