Cross Reference: region-translate-test.c
xref: /xsrc/external/mit/pixman/dist/test/region-translate-test.c
  • Home
  • History
  • AnnotateAnnotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /xsrc/external/mit/pixman/dist/test/
11b18d63aSmrg#include <assert.h>
29ad247e8Sjmcneill#include "utils.h"
31b18d63aSmrg
41b18d63aSmrg/* Pixman had a bug where 32bit regions where clipped to 16bit sizes when
51b18d63aSmrg * pixman_region32_translate() was called. This test exercises that bug.
61b18d63aSmrg */
71b18d63aSmrg
81b18d63aSmrg#define LARGE 32000
91b18d63aSmrg
101b18d63aSmrgint
111b18d63aSmrgmain (int argc, char **argv)
121b18d63aSmrg{
131b18d63aSmrg  pixman_box32_t rect = { -LARGE, -LARGE, LARGE, LARGE };
141b18d63aSmrg  pixman_region32_t r1, r2;
151b18d63aSmrg
161b18d63aSmrg  pixman_region32_init_rects (&r1, &rect, 1);
171b18d63aSmrg  pixman_region32_init_rect (&r2, rect.x1, rect.y1, rect.x2 - rect.x1, rect.y2 - rect.y1);
181b18d63aSmrg
191b18d63aSmrg  assert (pixman_region32_equal (&r1,  &r2));
201b18d63aSmrg
211b18d63aSmrg  pixman_region32_translate (&r1, -LARGE, LARGE);
221b18d63aSmrg  pixman_region32_translate (&r1, LARGE, -LARGE);
231b18d63aSmrg
241b18d63aSmrg  assert (pixman_region32_equal (&r1,  &r2));
251b18d63aSmrg
261b18d63aSmrg  pixman_region32_fini (&r1);
271b18d63aSmrg  pixman_region32_fini (&r2);
281b18d63aSmrg
291b18d63aSmrg  return 0;
301b18d63aSmrg}
31

Indexes created Sat Nov 29 09:09:30 GMT 2025