stroke-clipped.c 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Permission is hereby granted, free of charge, to any person
  3. * obtaining a copy of this software and associated documentation
  4. * files (the "Software"), to deal in the Software without
  5. * restriction, including without limitation the rights to use, copy,
  6. * modify, merge, publish, distribute, sublicense, and/or sell copies
  7. * of the Software, and to permit persons to whom the Software is
  8. * furnished to do so, subject to the following conditions:
  9. *
  10. * The above copyright notice and this permission notice shall be
  11. * included in all copies or substantial portions of the Software.
  12. *
  13. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
  14. * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
  15. * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
  16. * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS
  17. * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
  18. * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
  19. * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
  20. * SOFTWARE.
  21. */
  22. #include "cairo-test.h"
  23. #define SIZE 200
  24. static cairo_test_status_t
  25. draw (cairo_t *cr, int width, int height)
  26. {
  27. int row;
  28. cairo_set_source_rgb(cr, 1, 1, 1);
  29. cairo_paint(cr);
  30. cairo_set_source_rgb(cr, 1, 0, 0);
  31. for(row = 0; row < SIZE; row++) {
  32. cairo_rectangle(cr, 0, row, SIZE, 1);
  33. cairo_clip(cr);
  34. cairo_arc(cr, SIZE/2, SIZE/2, SIZE/2-8, 0, 2*M_PI);
  35. cairo_stroke(cr);
  36. cairo_reset_clip(cr);
  37. }
  38. return CAIRO_TEST_SUCCESS;
  39. }
  40. CAIRO_TEST (stroke_clipped,
  41. "Check that the stroke is accurately drawn through smaller clips",
  42. "stroke", /* keywords */
  43. NULL, /* requirements */
  44. SIZE, SIZE,
  45. NULL, draw)