glamor_triangles.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. /*
  2. * Copyright © 2009 Intel Corporation
  3. * Copyright © 1998 Keith Packard
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining a
  6. * copy of this software and associated documentation files (the "Software"),
  7. * to deal in the Software without restriction, including without limitation
  8. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  9. * and/or sell copies of the Software, and to permit persons to whom the
  10. * Software is furnished to do so, subject to the following conditions:
  11. *
  12. * The above copyright notice and this permission notice (including the next
  13. * paragraph) shall be included in all copies or substantial portions of the
  14. * Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  19. * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  20. * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
  21. * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
  22. * IN THE SOFTWARE.
  23. *
  24. * Authors:
  25. * Zhigang Gong <zhigang.gong@gmail.com>
  26. *
  27. */
  28. #include "glamor_priv.h"
  29. static Bool
  30. _glamor_triangles(CARD8 op,
  31. PicturePtr pSrc,
  32. PicturePtr pDst,
  33. PictFormatPtr maskFormat,
  34. INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris,
  35. Bool fallback)
  36. {
  37. if (!fallback && glamor_ddx_fallback_check_pixmap(pDst->pDrawable)
  38. && (!pSrc->pDrawable
  39. || glamor_ddx_fallback_check_pixmap(pSrc->pDrawable)))
  40. return FALSE;
  41. if (glamor_prepare_access_picture(pDst, GLAMOR_ACCESS_RW) &&
  42. glamor_prepare_access_picture(pSrc, GLAMOR_ACCESS_RO)) {
  43. fbTriangles(op, pSrc, pDst, maskFormat, xSrc, ySrc, ntris, tris);
  44. }
  45. glamor_finish_access_picture(pSrc);
  46. glamor_finish_access_picture(pDst);
  47. return TRUE;
  48. }
  49. void
  50. glamor_triangles(CARD8 op,
  51. PicturePtr pSrc,
  52. PicturePtr pDst,
  53. PictFormatPtr maskFormat,
  54. INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris)
  55. {
  56. _glamor_triangles(op, pSrc, pDst, maskFormat,
  57. xSrc, ySrc, ntris, tris, TRUE);
  58. }
  59. Bool
  60. glamor_triangles_nf(CARD8 op,
  61. PicturePtr pSrc,
  62. PicturePtr pDst,
  63. PictFormatPtr maskFormat,
  64. INT16 xSrc, INT16 ySrc, int ntris, xTriangle * tris)
  65. {
  66. return _glamor_triangles(op, pSrc, pDst, maskFormat,
  67. xSrc, ySrc, ntris, tris, FALSE);
  68. }