fbgetsp.c 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. /*
  2. *
  3. * Copyright © 1998 Keith Packard
  4. *
  5. * Permission to use, copy, modify, distribute, and sell this software and its
  6. * documentation for any purpose is hereby granted without fee, provided that
  7. * the above copyright notice appear in all copies and that both that
  8. * copyright notice and this permission notice appear in supporting
  9. * documentation, and that the name of Keith Packard not be used in
  10. * advertising or publicity pertaining to distribution of the software without
  11. * specific, written prior permission. Keith Packard makes no
  12. * representations about the suitability of this software for any purpose. It
  13. * is provided "as is" without express or implied warranty.
  14. *
  15. * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  16. * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  17. * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  18. * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  19. * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  20. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  21. * PERFORMANCE OF THIS SOFTWARE.
  22. */
  23. #ifdef HAVE_DIX_CONFIG_H
  24. #include <dix-config.h>
  25. #endif
  26. #include "fb.h"
  27. void
  28. fbGetSpans(DrawablePtr pDrawable,
  29. int wMax,
  30. DDXPointPtr ppt, int *pwidth, int nspans, char *pchardstStart)
  31. {
  32. FbBits *src, *dst;
  33. FbStride srcStride;
  34. int srcBpp;
  35. int srcXoff, srcYoff;
  36. int xoff;
  37. /*
  38. * XFree86 DDX empties the root borderClip when the VT is
  39. * switched away; this checks for that case
  40. */
  41. if (!fbDrawableEnabled(pDrawable))
  42. return;
  43. if (pDrawable->bitsPerPixel != BitsPerPixel(pDrawable->depth)) {
  44. fb24_32GetSpans(pDrawable, wMax, ppt, pwidth, nspans, pchardstStart);
  45. return;
  46. }
  47. fbGetDrawable(pDrawable, src, srcStride, srcBpp, srcXoff, srcYoff);
  48. while (nspans--) {
  49. xoff = (int) (((long) pchardstStart) & (FB_MASK >> 3));
  50. dst = (FbBits *) (pchardstStart - xoff);
  51. xoff <<= 3;
  52. fbBlt(src + (ppt->y + srcYoff) * srcStride, srcStride,
  53. (ppt->x + srcXoff) * srcBpp,
  54. dst,
  55. 1,
  56. xoff,
  57. *pwidth * srcBpp, 1, GXcopy, FB_ALLONES, srcBpp, FALSE, FALSE);
  58. pchardstStart += PixmapBytePad(*pwidth, pDrawable->depth);
  59. ppt++;
  60. pwidth++;
  61. }
  62. }