glamor_copywindow.c 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /*
  2. * Copyright © 2008 Intel Corporation
  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. #include "glamor_priv.h"
  24. /** @file glamor_copywindow.c
  25. *
  26. * Screen CopyWindow implementation.
  27. */
  28. void
  29. glamor_copy_window(WindowPtr win, DDXPointRec old_origin, RegionPtr src_region)
  30. {
  31. RegionRec dst_region;
  32. int dx, dy;
  33. PixmapPtr pixmap = win->drawable.pScreen->GetWindowPixmap(win);
  34. dx = old_origin.x - win->drawable.x;
  35. dy = old_origin.y - win->drawable.y;
  36. REGION_TRANSLATE(win->drawable.pScreen, src_region, -dx, -dy);
  37. REGION_INIT(win->drawable.pScreen, &dst_region, NullBox, 0);
  38. REGION_INTERSECT(win->drawable.pScreen, &dst_region,
  39. &win->borderClip, src_region);
  40. #ifdef COMPOSITE
  41. if (pixmap->screen_x || pixmap->screen_y)
  42. REGION_TRANSLATE(win->drawable.pScreen, &dst_region,
  43. -pixmap->screen_x, -pixmap->screen_y);
  44. #endif
  45. miCopyRegion(&pixmap->drawable, &pixmap->drawable,
  46. NULL, &dst_region, dx, dy, glamor_copy_n_to_n, 0, NULL);
  47. REGION_UNINIT(win->drawable.pScreen, &dst_region);
  48. }