mispritest.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. /*
  2. * mispritest.h
  3. *
  4. * mi sprite structures
  5. */
  6. /*
  7. Copyright 1989, 1998 The Open Group
  8. Permission to use, copy, modify, distribute, and sell this software and its
  9. documentation for any purpose is hereby granted without fee, provided that
  10. the above copyright notice appear in all copies and that both that
  11. copyright notice and this permission notice appear in supporting
  12. documentation.
  13. The above copyright notice and this permission notice shall be included in
  14. all copies or substantial portions of the Software.
  15. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
  19. AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  20. CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
  21. Except as contained in this notice, the name of The Open Group shall not be
  22. used in advertising or otherwise to promote the sale, use or other dealings
  23. in this Software without prior written authorization from The Open Group.
  24. */
  25. #ifdef HAVE_DIX_CONFIG_H
  26. #include <dix-config.h>
  27. #endif
  28. #ifndef _MISPRITEST_H_
  29. #define _MISPRITEST_H_
  30. # include "misprite.h"
  31. # include "picturestr.h"
  32. # include "damage.h"
  33. /*
  34. * per screen information
  35. */
  36. typedef struct {
  37. /* screen procedures */
  38. CloseScreenProcPtr CloseScreen;
  39. GetImageProcPtr GetImage;
  40. GetSpansProcPtr GetSpans;
  41. SourceValidateProcPtr SourceValidate;
  42. /* window procedures */
  43. CopyWindowProcPtr CopyWindow;
  44. /* colormap procedures */
  45. InstallColormapProcPtr InstallColormap;
  46. StoreColorsProcPtr StoreColors;
  47. /* os layer procedures */
  48. ScreenBlockHandlerProcPtr BlockHandler;
  49. CursorPtr pCursor;
  50. int x; /* cursor hotspot */
  51. int y;
  52. BoxRec saved; /* saved area from the screen */
  53. Bool isUp; /* cursor in frame buffer */
  54. Bool shouldBeUp; /* cursor should be displayed */
  55. WindowPtr pCacheWin; /* window the cursor last seen in */
  56. Bool isInCacheWin;
  57. Bool checkPixels; /* check colormap collision */
  58. xColorItem colors[2];
  59. ColormapPtr pInstalledMap;
  60. ColormapPtr pColormap;
  61. VisualPtr pVisual;
  62. const miSpriteCursorFuncRec * funcs;
  63. DamagePtr pDamage; /* damage tracking structure */
  64. } miSpriteScreenRec, *miSpriteScreenPtr;
  65. #define SOURCE_COLOR 0
  66. #define MASK_COLOR 1
  67. #define miSpriteIsUpTRUE(pScreen, pScreenPriv) if (!pScreenPriv->isUp) { \
  68. pScreenPriv->isUp = TRUE; \
  69. DamageRegister (&(*pScreen->GetScreenPixmap) (pScreen)->drawable, pScreenPriv->pDamage); \
  70. }
  71. #define miSpriteIsUpFALSE(pScreen, pScreenPriv) if (pScreenPriv->isUp) { \
  72. DamageUnregister (&(*pScreen->GetScreenPixmap) (pScreen)->drawable, pScreenPriv->pDamage); \
  73. pScreenPriv->isUp = FALSE; \
  74. }
  75. /*
  76. * Overlap BoxPtr and Box elements
  77. */
  78. #define BOX_OVERLAP(pCbox,X1,Y1,X2,Y2) \
  79. (((pCbox)->x1 <= (X2)) && ((X1) <= (pCbox)->x2) && \
  80. ((pCbox)->y1 <= (Y2)) && ((Y1) <= (pCbox)->y2))
  81. /*
  82. * Overlap BoxPtr, origins, and rectangle
  83. */
  84. #define ORG_OVERLAP(pCbox,xorg,yorg,x,y,w,h) \
  85. BOX_OVERLAP((pCbox),(x)+(xorg),(y)+(yorg),(x)+(xorg)+(w),(y)+(yorg)+(h))
  86. /*
  87. * Overlap BoxPtr, origins and RectPtr
  88. */
  89. #define ORGRECT_OVERLAP(pCbox,xorg,yorg,pRect) \
  90. ORG_OVERLAP((pCbox),(xorg),(yorg),(pRect)->x,(pRect)->y, \
  91. (int)((pRect)->width), (int)((pRect)->height))
  92. /*
  93. * Overlap BoxPtr and horizontal span
  94. */
  95. #define SPN_OVERLAP(pCbox,y,x,w) BOX_OVERLAP((pCbox),(x),(y),(x)+(w),(y))
  96. #define LINE_SORT(x1,y1,x2,y2) \
  97. { int _t; \
  98. if (x1 > x2) { _t = x1; x1 = x2; x2 = _t; } \
  99. if (y1 > y2) { _t = y1; y1 = y2; y2 = _t; } }
  100. #define LINE_OVERLAP(pCbox,x1,y1,x2,y2,lw2) \
  101. BOX_OVERLAP((pCbox), (x1)-(lw2), (y1)-(lw2), (x2)+(lw2), (y2)+(lw2))
  102. #endif /* _MISPRITEST_H_ */