Use pepper_region instead of pixman_region 64/96364/6
authorSangjin Lee <lsj119@samsung.com>
Tue, 8 Nov 2016 13:35:27 +0000 (22:35 +0900)
committerSangjin Lee <lsj119@samsung.com>
Mon, 21 Nov 2016 02:46:51 +0000 (11:46 +0900)
add pepper-utils-pixman.h.
this header should include inline function or useful define.

Change-Id: I339695a47d80388ce91e92476cbf349056c82dec

36 files changed:
configure.ac
packaging/pepper.spec
src/lib/desktop-shell/desktop-shell-internal.h
src/lib/desktop-shell/shell-surface.c
src/lib/desktop-shell/shell.c
src/lib/drm/drm-common.c
src/lib/drm/drm-internal.h
src/lib/drm/drm-output.c
src/lib/fbdev/fbdev-output.c
src/lib/pepper/Makefile.am
src/lib/pepper/compositor.c
src/lib/pepper/misc.c
src/lib/pepper/output.c
src/lib/pepper/pepper-internal.h
src/lib/pepper/pepper-output-backend.h
src/lib/pepper/pepper-utils-pixman.h [new file with mode: 0644]
src/lib/pepper/pepper-utils.h
src/lib/pepper/pepper.h
src/lib/pepper/plane.c
src/lib/pepper/pointer.c
src/lib/pepper/region.c
src/lib/pepper/subsurface.c
src/lib/pepper/surface.c
src/lib/pepper/utils-region.c
src/lib/pepper/view.c
src/lib/render/gl-renderer.c
src/lib/render/pepper-render-internal.h
src/lib/render/pepper-render.h
src/lib/render/pixman-renderer.c
src/lib/render/renderer.c
src/lib/tdm/tdm-internal.h
src/lib/tdm/tdm-output.c
src/lib/wayland/wayland-internal.h
src/lib/wayland/wayland-output.c
src/lib/wayland/wayland-shm-buffer.c
src/lib/x11/x11-output.c

index 245127a..efc178e 100644 (file)
@@ -29,7 +29,7 @@ fi
 AC_SUBST(GCC_CFLAGS)
 
 # pepper
-PEPPER_REQUIRES="wayland-server pixman-1 xkbcommon"
+PEPPER_REQUIRES="wayland-server xkbcommon"
 PKG_CHECK_MODULES(PEPPER, [$PEPPER_REQUIRES])
 PKG_CHECK_MODULES([TBM], [libtbm wayland-tbm-server], [have_tbm=yes], [have_tbm=no])
 if test x$have_tbm = xyes; then
@@ -57,7 +57,7 @@ fi
 # pepper-libinput
 PEPPER_LIBINPUT_REQUIRES="libinput"
 PKG_CHECK_MODULES(PEPPER_LIBINPUT, [$PEPPER_LIBINPUT_REQUIRES])
-PEPPER_LIBINPUT_REQUIRES="$PEPPER_LIBINPUT_REQUIRES pepper"
+#PEPPER_LIBINPUT_REQUIRES="$PEPPER_LIBINPUT_REQUIRES pepper"
 
 PEPPER_LIBINPUT_DIR="-I\$(top_srcdir)/src/lib/libinput"
 PEPPER_LIBINPUT_LIB="\$(top_srcdir)/src/lib/libinput/libpepper-libinput.la"
@@ -85,7 +85,6 @@ AC_SUBST(PEPPER_DESKTOP_SHELL_REQUIRES)
 # pepper-render
 PEPPER_RENDER_REQUIRES="pixman-1 egl glesv2"
 PKG_CHECK_MODULES(PEPPER_RENDER, [$PEPPER_RENDER_REQUIRES])
-PEPPER_RENDER_REQUIRES="$PEPPER_RENDER_REQUIRES pepper"
 
 PEPPER_RENDER_DIR="-I\$(top_srcdir)/src/lib/render"
 PEPPER_RENDER_LIB="\$(top_srcdir)/src/lib/render/libpepper-render.la"
@@ -98,9 +97,8 @@ AC_SUBST(PEPPER_RENDER_LIBS)
 AC_SUBST(PEPPER_RENDER_REQUIRES)
 
 # pepper-drm
-PEPPER_DRM_REQUIRES="libdrm gbm"
+PEPPER_DRM_REQUIRES="libdrm gbm pixman-1"
 PKG_CHECK_MODULES(PEPPER_DRM, [$PEPPER_DRM_REQUIRES])
-PEPPER_DRM_REQUIRES="$PEPPER_DRM_REQUIRES pepper pepper-render pepper-libinput"
 
 PKG_CHECK_MODULES([DRM_SPRD], [libdrm_sprd], [have_drm_sprd=yes], [have_drm_sprd=no])
 if test x$have_drm_sprd = xyes; then
@@ -131,9 +129,9 @@ AC_ARG_ENABLE(tdm,
 AM_CONDITIONAL(ENABLE_TDM, test x$enable_tdm = xyes)
 
 if test x$enable_tdm = xyes; then
-       PEPPER_TDM_REQUIRES="libtbm libtdm"
+       PEPPER_TDM_REQUIRES="libtbm libtdm pixman-1"
        PKG_CHECK_MODULES(PEPPER_TDM, [$PEPPER_TDM_REQUIRES])
-       PEPPER_TDM_REQUIRES="$PEPPER_TDM_REQUIRES pepper pepper-render pepper-libinput"
+       #PEPPER_TDM_REQUIRES="$PEPPER_TDM_REQUIRES pepper pepper-render pepper-libinput"
 
        PEPPER_TDM_DIR="-I\$(top_srcdir)/src/lib/tdm"
        PEPPER_TDM_LIB="\$(top_srcdir)/src/lib/tdm/libpepper-tdm.la"
@@ -148,23 +146,22 @@ if test x$enable_tdm = xyes; then
 fi
 
 # pepper-fbdev
-PEPPER_FBDEV_REQUIRES="pepper pepper-render"
+PEPPER_FBDEV_REQUIRES+="pixman-1"
+PKG_CHECK_MODULES(PEPPER_FBDEV, [$PEPPER_FBDEV_REQUIRES])
 
 PEPPER_FBDEV_DIR="-I\$(top_srcdir)/src/lib/fbdev"
 PEPPER_FBDEV_LIB="\$(top_srcdir)/src/lib/fbdev/libpepper-fbdev.la"
 
-PEPPER_FBDEV_CFLAGS="$PEPPER_DIR $PEPPER_RENDER_DIR $PEPPER_LIBINPUT_DIR $PEPPER_FBDEV_CFLAGS"
-PEPPER_FBDEV_CFLAGS="$PEPPER_FBDEV_CFLAGS $PEPPER_CFLAGS"
-PEPPER_FBDEV_LIBS="$PEPPER_LIB $PEPPER_RENDER_LIB $PEPPER_LIBINPUT_LIB $PEPPER_FBDEV_LIBS"
+PEPPER_FBDEV_CFLAGS+="$PEPPER_CFLAGS $PEPPER_DIR $PEPPER_RENDER_DIR $PEPPER_LIBINPUT_DIR"
+PEPPER_FBDEV_LIBS+="$PEPPER_LIB $PEPPER_RENDER_LIB $PEPPER_LIBINPUT_LIB"
 
 AC_SUBST(PEPPER_FBDEV_CFLAGS)
 AC_SUBST(PEPPER_FBDEV_LIBS)
 AC_SUBST(PEPPER_FBDEV_REQUIRES)
 
 # pepper-wayland
-PEPPER_WAYLAND_REQUIRES="wayland-client"
+PEPPER_WAYLAND_REQUIRES="wayland-client pixman-1"
 PKG_CHECK_MODULES(PEPPER_WAYLAND, [$PEPPER_WAYLAND_REQUIRES])
-PEPPER_WAYLAND_REQUIRES="$PEPPER_WAYLAND_REQUIRES pepper pepper-render"
 
 PEPPER_WAYLAND_DIR="-I\$(top_srcdir)/src/lib/wayland"
 PEPPER_WAYLAND_LIB="\$(top_srcdir)/src/lib/wayland/libpepper-wayland.la"
@@ -186,9 +183,8 @@ AC_ARG_ENABLE(x11,
 AM_CONDITIONAL(ENABLE_X11, test x$enable_x11 = xyes)
 
 if test x$enable_x11 = xyes; then
-    PEPPER_X11_REQUIRES="x11 xcb-shm x11-xcb"
+    PEPPER_X11_REQUIRES="x11 xcb-shm x11-xcb pixman-1"
     PKG_CHECK_MODULES(PEPPER_X11, [$PEPPER_X11_REQUIRES])
-    PEPPER_X11_REQUIRES="$PEPPER_X11_REQUIRES pepper pepper-render"
 
     PEPPER_X11_DIR="-I\$(top_srcdir)/src/lib/x11"
     PEPPER_X11_LIB="\$(top_srcdir)/src/lib/x11/libpepper-x11.la"
@@ -204,7 +200,6 @@ fi
 # doctor
 DOCTOR_REQUIRES="wayland-server pixman-1"
 PKG_CHECK_MODULES(DOCTOR, [$DOCTOR_REQUIRES])
-DOCTOR_REQUIRES="$DOCTOR_REQUIRES pepper pepper-drm pepper-desktop-shell"
 
 DOCTOR_CFLAGS="$PEPPER_DIR $PEPPER_DRM_DIR $PEPPER_DESKTOP_SHELL_DIR $DOCTOR_CFLAGS"
 DOCTOR_LIBS="$PEPPER_LIB $PEPPER_DRM_LIB $PEPPER_DESKTOP_SHELL_LIB $DOCTOR_LIBS"
index 2bce40e..1ec0939 100644 (file)
@@ -208,6 +208,7 @@ make %{?_smp_mflags}
 %defattr(-,root,root,-)
 %{_includedir}/pepper/pepper.h
 %{_includedir}/pepper/pepper-utils.h
+%{_includedir}/pepper/pepper-utils-pixman.h
 %{_includedir}/pepper/pepper-output-backend.h
 %{_includedir}/pepper/pepper-input-backend.h
 %{_libdir}/pkgconfig/pepper.pc
index dd0bcb7..d4ebfa3 100644 (file)
@@ -285,7 +285,7 @@ shell_surface_set_minimized(shell_surface_t *shsurf);
 
 void
 shell_get_output_workarea(desktop_shell_t *shell, pepper_output_t *output,
-                                                 pixman_rectangle32_t  *area);
+                                                 pepper_rectangle_t  *area);
 
 
 pepper_bool_t
index 74869bc..04d1ee5 100644 (file)
@@ -170,7 +170,7 @@ shsurf_xdg_surface_send_configure(shell_surface_t *shsurf, int32_t width,
                *state = XDG_SURFACE_STATE_MAXIMIZED;
 
                if (!width && !height) {
-                       pixman_rectangle32_t area;
+                       pepper_rectangle_t area;
                        shell_get_output_workarea(shsurf->shell, shsurf->maximized.output, &area);
 
                        width = area.width;
@@ -561,7 +561,7 @@ shell_surface_get_output(shell_surface_t *shsurf)
 
 static void
 shell_surface_get_geometry(shell_surface_t *shsurf,
-                                                  pixman_rectangle32_t *geometry)
+                                                  pepper_rectangle_t *geometry)
 {
        double x, y;
        int    w, h;
@@ -591,7 +591,7 @@ void
 shell_surface_set_maximized(shell_surface_t     *shsurf,
                                                        pepper_output_t     *output)
 {
-       pixman_rectangle32_t    area;
+       pepper_rectangle_t    area;
 
        if (shsurf->type == SHELL_SURFACE_TYPE_MAXIMIZED)
                return ;
@@ -816,22 +816,22 @@ shell_pointer_get_output(desktop_shell_t *shell, pepper_pointer_t *pointer)
 
                if (tmp_output) {
                        const pepper_output_geometry_t *geom;
-                       pixman_region32_t rect;
+                       pepper_region_t rect;
 
                        if (!output)
                                output = tmp_output;
 
                        geom = pepper_output_get_geometry(tmp_output);
 
-                       pixman_region32_init_rect(&rect, geom->x, geom->y, geom->w, geom->h);
+                       pepper_region_init_rect(&rect, geom->x, geom->y, geom->w, geom->h);
 
-                       if (pixman_region32_contains_point(&rect, px, py, NULL)) {
+                       if (pepper_region_contains_point(&rect, px, py, NULL)) {
                                output = tmp_output;
-                               pixman_region32_fini(&rect);
+                               pepper_region_fini(&rect);
                                break;
                        }
 
-                       pixman_region32_fini(&rect);
+                       pepper_region_fini(&rect);
                }
        }
 
@@ -1085,7 +1085,7 @@ shell_surface_map_transient(shell_surface_t *shsurf)
 static void
 shell_surface_map_maximized(shell_surface_t *shsurf)
 {
-       pixman_rectangle32_t area;
+       pepper_rectangle_t area;
 
        shell_get_output_workarea(shsurf->shell, shsurf->maximized.output, &area);
 
@@ -1124,7 +1124,7 @@ get_scale(float output_w, float output_h, float view_w, float view_h)
 static void
 shell_surface_center_on_output_by_scale(shell_surface_t                 *shsurf,
                                                                                const pepper_output_geometry_t  *output,
-                                                                               pixman_rectangle32_t            *surface_geom,
+                                                                               pepper_rectangle_t            *surface_geom,
                                                                                float                            scale)
 {
        double x, y;
@@ -1140,7 +1140,7 @@ shell_surface_place_fullscreen_surface(shell_surface_t *shsurf)
 {
        pepper_output_t                     *output;
        const pepper_output_geometry_t      *output_geom;
-       pixman_rectangle32_t                 shsurf_geom;
+       pepper_rectangle_t                 shsurf_geom;
        float                                scale = 0.f;
 
        output      = shsurf->fullscreen.output;
index 12b3481..596a12e 100644 (file)
@@ -32,7 +32,7 @@
 void
 shell_get_output_workarea(desktop_shell_t       *shell,
                                                  pepper_output_t       *output,
-                                                 pixman_rectangle32_t  *area)
+                                                 pepper_rectangle_t  *area)
 {
        const pepper_output_geometry_t *geom;
 
index 7c2f98d..f7a4541 100644 (file)
@@ -30,6 +30,8 @@
 #include <libudev.h>
 #include <fcntl.h>
 #include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
 #include "drm-internal.h"
 #ifdef HAVE_DRM_SPRD
 #include <sprd_drmif.h>
index af5a80e..3ecd793 100644 (file)
@@ -180,7 +180,7 @@ struct drm_output {
        drm_buffer_t           *fb[2];
        pepper_render_target_t *fb_target[2];
        int                     back_fb_index;
-       pixman_region32_t       previous_damage;
+       pepper_region_t       previous_damage;
 
        /* OpenGL */
        struct gbm_surface     *gbm_surface;
index e4c18a6..9368966 100644 (file)
@@ -227,8 +227,8 @@ assign_fb_plane(drm_output_t *output, pepper_view_t *view)
 
        /* TODO: Other alpha formats like ARGB4444, ABGR8888 ?? */
        if (gbm_bo_get_format(bo) == GBM_FORMAT_ARGB8888) {
-               pixman_box32_t      box;
-               pixman_region32_t  *opaque;
+               pepper_box_t      box;
+               pepper_region_t  *opaque;
 
                box.x1 = 0;
                box.y1 = 0;
@@ -237,7 +237,7 @@ assign_fb_plane(drm_output_t *output, pepper_view_t *view)
 
                opaque = pepper_surface_get_opaque_region(surface);
 
-               if (pixman_region32_contains_rectangle(opaque, &box) != PIXMAN_REGION_IN) {
+               if (pepper_region_contains_rectangle(opaque, &box) != PEPPER_REGION_IN) {
                        gbm_bo_destroy(bo);
                        return NULL;
                }
@@ -318,8 +318,8 @@ assign_overlay_plane(drm_output_t *output, pepper_view_t *view)
        format = gbm_bo_get_format(bo);
 
        if (format == GBM_FORMAT_ARGB8888) {
-               pixman_box32_t      box;
-               pixman_region32_t  *opaque;
+               pepper_box_t      box;
+               pepper_region_t  *opaque;
 
                box.x1 = 0;
                box.y1 = 0;
@@ -328,7 +328,7 @@ assign_overlay_plane(drm_output_t *output, pepper_view_t *view)
 
                opaque = pepper_surface_get_opaque_region(surface);
 
-               if (pixman_region32_contains_rectangle(opaque, &box) == PIXMAN_REGION_IN)
+               if (pepper_region_contains_rectangle(opaque, &box) == PEPPER_REGION_IN)
                        format = GBM_FORMAT_XRGB8888;
        }
 
@@ -399,7 +399,7 @@ drm_output_render_gl(drm_output_t *output)
 {
        const pepper_list_t *render_list = pepper_plane_get_render_list(
                                                                                   output->primary_plane);
-       pixman_region32_t   *damage = pepper_plane_get_damage_region(
+       pepper_region_t   *damage = pepper_plane_get_damage_region(
                                                                          output->primary_plane);
        struct gbm_bo       *bo;
 
@@ -422,23 +422,23 @@ drm_output_render_pixman(drm_output_t *output)
 {
        const pepper_list_t *render_list = pepper_plane_get_render_list(
                                                                                   output->primary_plane);
-       pixman_region32_t   *damage = pepper_plane_get_damage_region(
+       pepper_region_t   *damage = pepper_plane_get_damage_region(
                                                                          output->primary_plane);
-       pixman_region32_t    total_damage;
+       pepper_region_t    total_damage;
 
        output->back_fb_index ^= 1;
        output->back = output->fb[output->back_fb_index];
 
-       pixman_region32_init(&total_damage);
-       pixman_region32_union(&total_damage, damage, &output->previous_damage);
-       pixman_region32_copy(&output->previous_damage, damage);
+       pepper_region_init(&total_damage);
+       pepper_region_union(&total_damage, damage, &output->previous_damage);
+       pepper_region_copy(&output->previous_damage, damage);
 
        if (output->use_shadow) {
                pepper_renderer_repaint_output(output->renderer, output->base, render_list,
                                                                           damage);
 
                /* Copy shadow image to the back frame buffer. */
-               pixman_image_set_clip_region32(output->back->image, &total_damage);
+               pixman_image_set_clip_region32(output->back->image, (pixman_region32_t *)&total_damage);
                pixman_image_composite32(PIXMAN_OP_SRC,
                                                                 output->shadow_image, NULL, output->back->image,
                                                                 0, 0, 0, 0, 0, 0,
@@ -451,7 +451,7 @@ drm_output_render_pixman(drm_output_t *output)
                                                                           &total_damage);
        }
 
-       pixman_region32_fini(&total_damage);
+       pepper_region_fini(&total_damage);
        pepper_plane_clear_damage_region(output->primary_plane);
 }
 
@@ -717,7 +717,7 @@ fini_pixman_renderer(drm_output_t *output)
                output->fb_target[i] = NULL;
        }
 
-       pixman_region32_fini(&output->previous_damage);
+       pepper_region_fini(&output->previous_damage);
        output->renderer = NULL;
        output->render_target = NULL;
 }
@@ -743,7 +743,7 @@ init_pixman_renderer(drm_output_t *output)
                PEPPER_CHECK(output->fb[i], goto error, "drm_buffer_create_dumb() failed.\n");
        }
 
-       pixman_region32_init(&output->previous_damage);
+       pepper_region_init(&output->previous_damage);
        output->render_type = DRM_RENDER_TYPE_PIXMAN;
 
        if (output->use_shadow) {
index 00e42d9..a18aa0b 100644 (file)
@@ -41,6 +41,7 @@
 
 #include <pepper-pixman-renderer.h>
 #include <pepper-gl-renderer.h>
+#include <pepper-utils-pixman.h>
 
 #include "fbdev-internal.h"
 
@@ -214,7 +215,7 @@ fbdev_output_repaint(void *o, const pepper_list_t *plane_list)
 
                if (plane == output->primary_plane) {
                        const pepper_list_t *render_list = pepper_plane_get_render_list(plane);
-                       pixman_region32_t   *damage = pepper_plane_get_damage_region(plane);
+                       pepper_region_t   *damage = pepper_plane_get_damage_region(plane);
 
                        pepper_renderer_repaint_output(output->renderer, output->base, render_list,
                                                                                   damage);
@@ -366,7 +367,7 @@ pepper_fbdev_output_create(pepper_fbdev_t *fbdev, const char *renderer)
        /* TODO: read & set output->use_shadow value from somewhere */
        output->use_shadow = PEPPER_TRUE;
        if (output->use_shadow) {
-               pixman_format_code_t pixman_format = get_pixman_format(output->format);
+               pixman_format_code_t pixman_format = pepper_get_pixman_format(output->format);
 
                output->frame_buffer_image = pixman_image_create_bits(pixman_format,
                                                                         output->w, output->h,
index e100e59..858805a 100644 (file)
@@ -3,7 +3,7 @@ lib_LTLIBRARIES = libpepper.la
 AM_CFLAGS = $(GCC_CFLAGS)
 
 libpepper_includedir=$(includedir)/pepper
-libpepper_include_HEADERS = pepper.h pepper-utils.h pepper-output-backend.h pepper-input-backend.h
+libpepper_include_HEADERS = pepper.h pepper-utils.h pepper-utils-pixman.h pepper-output-backend.h pepper-input-backend.h
 
 libpepper_la_CFLAGS = $(AM_CFLAGS) $(PEPPER_CFLAGS)
 libpepper_la_LIBADD = $(PEPPER_LIBS) -lm
index 6836cca..c85530c 100644 (file)
@@ -452,7 +452,7 @@ pepper_compositor_pick_view(pepper_compositor_t *compositor,
                if (!view->surface)
                        continue;
 
-               if (!pixman_region32_contains_point(&view->bounding_region, ix, iy, NULL))
+               if (!pepper_region_contains_point(&view->bounding_region, ix, iy, NULL))
                        continue;
 
                pepper_view_get_local_coordinate(view, x, y, &lx, &ly);
@@ -463,7 +463,7 @@ pepper_compositor_pick_view(pepper_compositor_t *compositor,
                if (ilx < 0 || ily < 0 || ilx >= view->w || ily >= view->h)
                        continue;
 
-               if (!pixman_region32_contains_point(&view->surface->input_region, ilx, ily,
+               if (!pepper_region_contains_point(&view->surface->input_region, ilx, ily,
                                                                                        NULL))
                        continue;
 
index 78af39b..7320cb0 100644 (file)
 #include "pepper-internal.h"
 
 /**
- * Transforms a pixman region from global space to output local space
+ * Transforms a pepper region from global space to output local space
  *
- * @param region    pixman region
+ * @param region    pepper region
  * @param output    output object
  */
 PEPPER_API void
-pepper_pixman_region_global_to_output(pixman_region32_t *region,
+pepper_region_global_to_output(pepper_region_t *region,
                                                                          pepper_output_t *output)
 {
-       pixman_box32_t *box, b;
+       pepper_box_t *box, b;
        int             num_rects, i;
        int32_t         scale = output->scale;
        int32_t         w = output->geometry.w;
        int32_t         h = output->geometry.h;
 
        /* Transform into output geometry origin. */
-       pixman_region32_translate(region, output->geometry.x, output->geometry.y);
+       pepper_region_translate(region, output->geometry.x, output->geometry.y);
 
        if (output->geometry.transform == WL_OUTPUT_TRANSFORM_NORMAL && scale == 1)
                return;
 
-       box = pixman_region32_rectangles(region, &num_rects);
+       box = pepper_region_rectangles(region, &num_rects);
 
        switch (output->geometry.transform) {
        case WL_OUTPUT_TRANSFORM_NORMAL:
index 1bb6c17..5630e97 100644 (file)
@@ -120,14 +120,14 @@ static void
 output_update_planes(pepper_output_t *output)
 {
        pepper_plane_t     *plane;
-       pixman_region32_t   clip;
+       pepper_region_t   clip;
 
-       pixman_region32_init(&clip);
+       pepper_region_init(&clip);
 
        pepper_list_for_each_reverse(plane, &output->plane_list, link)
        pepper_plane_update(plane, &output->view_list, &clip);
 
-       pixman_region32_fini(&clip);
+       pepper_region_fini(&clip);
 }
 
 static void
@@ -203,7 +203,7 @@ pepper_output_schedule_repaint(pepper_output_t *output)
  */
 PEPPER_API void
 pepper_output_add_damage_region(pepper_output_t *output,
-                                                               pixman_region32_t *region)
+                                                               pepper_region_t *region)
 {
        pepper_plane_t *plane;
        pepper_list_for_each(plane, &output->plane_list, link)
index b9ccec7..9cdda3a 100644 (file)
@@ -33,7 +33,6 @@
 #include <config.h>
 #include "pepper.h"
 #include <wayland-util.h>
-#include <pixman.h>
 #include "pepper-output-backend.h"
 #include "pepper-input-backend.h"
 
@@ -166,9 +165,9 @@ struct pepper_surface_state {
        int32_t                     transform;
        int32_t                     scale;
 
-       pixman_region32_t           damage_region;
-       pixman_region32_t           opaque_region;
-       pixman_region32_t           input_region;
+       pepper_region_t           damage_region;
+       pepper_region_t           opaque_region;
+       pepper_region_t           input_region;
 
        struct wl_list              frame_callback_list;
        pepper_event_listener_t    *buffer_destroy_listener;
@@ -199,9 +198,9 @@ struct pepper_surface {
         * Buffer is transformed and scaled into surface local coordinate space. */
        int32_t                 w, h;
 
-       pixman_region32_t       damage_region;
-       pixman_region32_t       opaque_region;
-       pixman_region32_t       input_region;
+       pepper_region_t       damage_region;
+       pepper_region_t       opaque_region;
+       pepper_region_t       input_region;
        pepper_bool_t           pickable;
 
        struct wl_list          frame_callback_list;
@@ -243,7 +242,7 @@ struct pepper_wl_region {
        struct wl_resource     *resource;
        pepper_list_t           link;
 
-       pixman_region32_t       pixman_region;
+       pepper_region_t       region;
 };
 
 pepper_wl_region_t *
@@ -256,7 +255,7 @@ void
 pepper_wl_region_destroy(pepper_wl_region_t *region);
 
 void
-pepper_transform_pixman_region(pixman_region32_t *region,
+pepper_transform_region(pepper_region_t *region,
                                                           const pepper_mat4_t *matrix);
 
 /* Subcompositor */
@@ -514,8 +513,8 @@ struct pepper_view {
        pepper_mat4_t               global_transform;
        pepper_mat4_t               global_transform_inverse;
 
-       pixman_region32_t           bounding_region;
-       pixman_region32_t           opaque_region;
+       pepper_region_t           bounding_region;
+       pepper_region_t           opaque_region;
 
        /* Visibility. */
        pepper_bool_t               active;
@@ -549,8 +548,8 @@ struct pepper_plane {
        pepper_output_t    *output;
 
        pepper_list_t       entry_list;
-       pixman_region32_t   damage_region;
-       pixman_region32_t   clip_region;
+       pepper_region_t   damage_region;
+       pepper_region_t   clip_region;
 
        pepper_list_t       link;
 };
@@ -560,18 +559,18 @@ pepper_plane_create(pepper_object_t *output, pepper_object_t *above_plane);
 
 void
 pepper_plane_add_damage_region(pepper_plane_t *plane,
-                                                          pixman_region32_t *region);
+                                                          pepper_region_t *region);
 
 void
 pepper_plane_update(pepper_plane_t *plane, const pepper_list_t *view_list,
-                                       pixman_region32_t *clip);
+                                       pepper_region_t *clip);
 
 void
 pepper_surface_flush_damage(pepper_surface_t *surface);
 
 /* Misc. */
 void
-pepper_pixman_region_global_to_output(pixman_region32_t *region,
+pepper_region_global_to_output(pepper_region_t *region,
                                                                          pepper_output_t *output);
 
 void
index 64e0910..6cac97c 100644 (file)
@@ -137,7 +137,7 @@ struct pepper_render_item {
        pepper_mat4_t       transform;      /**< transform matrix of the view */
        pepper_mat4_t
        inverse;        /**< inverse matrix of the transform matrix */
-       pixman_region32_t   visible_region; /**< visible region of the view */
+       pepper_region_t   visible_region; /**< visible region of the view */
 };
 
 PEPPER_API pepper_plane_t *
@@ -146,10 +146,10 @@ pepper_output_add_plane(pepper_output_t *output, pepper_plane_t *above_plane);
 PEPPER_API void
 pepper_plane_destroy(pepper_plane_t *plane);
 
-PEPPER_API pixman_region32_t *
+PEPPER_API pepper_region_t *
 pepper_plane_get_damage_region(pepper_plane_t *plane);
 
-PEPPER_API pixman_region32_t *
+PEPPER_API pepper_region_t *
 pepper_plane_get_clip_region(pepper_plane_t *plane);
 
 PEPPER_API const pepper_list_t *
@@ -157,7 +157,7 @@ pepper_plane_get_render_list(pepper_plane_t *plane);
 
 PEPPER_API void
 pepper_plane_subtract_damage_region(pepper_plane_t *plane,
-                                                                       pixman_region32_t *damage);
+                                                                       pepper_region_t *damage);
 
 PEPPER_API void
 pepper_plane_clear_damage_region(pepper_plane_t *plane);
@@ -168,7 +168,7 @@ pepper_view_assign_plane(pepper_view_t *view, pepper_output_t *output,
 
 PEPPER_API void
 pepper_output_add_damage_region(pepper_output_t *output,
-                                                               pixman_region32_t *region);
+                                                               pepper_region_t *region);
 
 PEPPER_API void
 pepper_output_finish_frame(pepper_output_t *output, struct timespec *ts);
diff --git a/src/lib/pepper/pepper-utils-pixman.h b/src/lib/pepper/pepper-utils-pixman.h
new file mode 100644 (file)
index 0000000..39f256d
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+* Copyright Â© 2008-2012 Kristian Høgsberg
+* Copyright Â© 2010-2012 Intel Corporation
+* Copyright Â© 2011 Benjamin Franzke
+* Copyright Â© 2012 Collabora, Ltd.
+* Copyright Â© 2015 S-Core Corporation
+* Copyright Â© 2015-2016 Samsung Electronics co., Ltd. All Rights Reserved.
+*
+* Permission is hereby granted, free of charge, to any person obtaining a
+* copy of this software and associated documentation files (the "Software"),
+* to deal in the Software without restriction, including without limitation
+* the rights to use, copy, modify, merge, publish, distribute, sublicense,
+* and/or sell copies of the Software, and to permit persons to whom the
+* Software is furnished to do so, subject to the following conditions:
+*
+* The above copyright notice and this permission notice (including the next
+* paragraph) shall be included in all copies or substantial portions of the
+* Software.
+*
+* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
+* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+* DEALINGS IN THE SOFTWARE.
+*/
+
+#ifndef PEPPER_UTILS_PIXMAN_H
+#define PEPPER_UTILS_PXIMAN_H
+
+#include <pixman.h>
+#include <pepper-utils.h>
+
+/**
+ * Get pixman format from pepper_format_t
+ *
+ * @param format    pepper_format
+ *
+ * If use this inline function, you should include libpixman library.
+ */
+static inline pixman_format_code_t
+pepper_get_pixman_format(pepper_format_t format)
+{
+       switch (format) {
+       case PEPPER_FORMAT_ARGB8888:
+               return PIXMAN_a8r8g8b8;
+       case PEPPER_FORMAT_XRGB8888:
+               return PIXMAN_x8r8g8b8;
+       case PEPPER_FORMAT_RGB888:
+               return PIXMAN_r8g8b8;
+       case PEPPER_FORMAT_RGB565:
+               return PIXMAN_r5g6b5;
+       case PEPPER_FORMAT_ABGR8888:
+               return PIXMAN_a8b8g8r8;
+       case PEPPER_FORMAT_XBGR8888:
+               return PIXMAN_x8b8g8r8;
+       case PEPPER_FORMAT_BGR888:
+               return PIXMAN_b8g8r8;
+       case PEPPER_FORMAT_BGR565:
+               return PIXMAN_b5g6r5;
+       case PEPPER_FORMAT_ALPHA:
+               return PIXMAN_a8;
+       default:
+               break;
+       }
+
+       return (pixman_format_code_t)0;
+}
+
+#endif
index 9fa9619..14817c5 100644 (file)
@@ -35,8 +35,6 @@
 #include <math.h>
 #include <assert.h>
 
-#include <pixman.h>
-
 #ifdef __cplusplus
 extern "C" {
 #endif
@@ -99,35 +97,6 @@ typedef enum {
        PEPPER_FORMAT_ALPHA         = PEPPER_FORMAT(PEPPER_FORMAT_TYPE_ARGB,     8,  8,  0,  0,  0),
 } pepper_format_t;
 
-static inline pixman_format_code_t
-get_pixman_format(pepper_format_t format)
-{
-       switch (format) {
-       case PEPPER_FORMAT_ARGB8888:
-               return PIXMAN_a8r8g8b8;
-       case PEPPER_FORMAT_XRGB8888:
-               return PIXMAN_x8r8g8b8;
-       case PEPPER_FORMAT_RGB888:
-               return PIXMAN_r8g8b8;
-       case PEPPER_FORMAT_RGB565:
-               return PIXMAN_r5g6b5;
-       case PEPPER_FORMAT_ABGR8888:
-               return PIXMAN_a8b8g8r8;
-       case PEPPER_FORMAT_XBGR8888:
-               return PIXMAN_x8b8g8r8;
-       case PEPPER_FORMAT_BGR888:
-               return PIXMAN_b8g8r8;
-       case PEPPER_FORMAT_BGR565:
-               return PIXMAN_b5g6r5;
-       case PEPPER_FORMAT_ALPHA:
-               return PIXMAN_a8;
-       default:
-               break;
-       }
-
-       return (pixman_format_code_t)0;
-}
-
 typedef struct pepper_list      pepper_list_t;
 
 #define pepper_list_for_each_list(pos, head)                                \
index 853a0ed..f50b0eb 100644 (file)
@@ -1246,13 +1246,13 @@ pepper_surface_get_buffer_scale(pepper_surface_t *surface);
 PEPPER_API int32_t
 pepper_surface_get_buffer_transform(pepper_surface_t *surface);
 
-PEPPER_API pixman_region32_t *
+PEPPER_API pepper_region_t *
 pepper_surface_get_damage_region(pepper_surface_t *surface);
 
-PEPPER_API pixman_region32_t *
+PEPPER_API pepper_region_t *
 pepper_surface_get_opaque_region(pepper_surface_t *surface);
 
-PEPPER_API pixman_region32_t *
+PEPPER_API pepper_region_t *
 pepper_surface_get_input_region(pepper_surface_t *surface);
 
 PEPPER_API void
@@ -1371,7 +1371,7 @@ pepper_view_get_global_coordinate(pepper_view_t *view, double lx, double ly,
 
 /* Misc */
 PEPPER_API void
-pepper_pixman_region_global_to_output(pixman_region32_t *region,
+pepper_region_global_to_output(pepper_region_t *region,
                                                                          pepper_output_t *output);
 
 PEPPER_API void
index b81f3dd..4bbb37d 100644 (file)
 
 void
 pepper_plane_update(pepper_plane_t *plane, const pepper_list_t *view_list,
-                                       pixman_region32_t *clip)
+                                       pepper_region_t *clip)
 {
        int                 x = plane->output->geometry.x;
        int                 y = plane->output->geometry.y;
        int                 w = plane->output->geometry.w;
        int                 h = plane->output->geometry.h;
-       pixman_region32_t   plane_clip;
+       pepper_region_t   plane_clip;
        pepper_view_t      *view;
 
-       pixman_region32_init(&plane_clip);
+       pepper_region_init(&plane_clip);
        pepper_list_init(&plane->entry_list);
 
        pepper_list_for_each(view, view_list, link) {
@@ -56,15 +56,15 @@ pepper_plane_update(pepper_plane_t *plane, const pepper_list_t *view_list,
                        }
 
                        /* Calculate visible region (output space). */
-                       pixman_region32_subtract(&entry->base.visible_region,
+                       pepper_region_subtract(&entry->base.visible_region,
                                                                         &view->bounding_region, &plane_clip);
-                       pixman_region32_intersect_rect(&entry->base.visible_region,
+                       pepper_region_intersect_rect(&entry->base.visible_region,
                                                                                   &entry->base.visible_region, x, y, w, h);
-                       pepper_pixman_region_global_to_output(&entry->base.visible_region,
+                       pepper_region_global_to_output(&entry->base.visible_region,
                                                                                                  plane->output);
 
                        /* Accumulate opaque region of this view (global space). */
-                       pixman_region32_union(&plane_clip, &plane_clip, &view->opaque_region);
+                       pepper_region_union(&plane_clip, &plane_clip, &view->opaque_region);
 
                        /* Add damage for the new visible region. */
                        if (entry->need_damage) {
@@ -79,12 +79,12 @@ pepper_plane_update(pepper_plane_t *plane, const pepper_list_t *view_list,
        }
 
        /* Copy clip region of this plane. */
-       pixman_region32_copy(&plane->clip_region, clip);
+       pepper_region_copy(&plane->clip_region, clip);
 
        /* Accumulate clip region obsecured by this plane. */
-       pepper_pixman_region_global_to_output(&plane_clip, plane->output);
-       pixman_region32_union(clip, clip, &plane_clip);
-       pixman_region32_fini(&plane_clip);
+       pepper_region_global_to_output(&plane_clip, plane->output);
+       pepper_region_union(clip, clip, &plane_clip);
+       pepper_region_fini(&plane_clip);
 }
 
 /**
@@ -116,8 +116,8 @@ pepper_output_add_plane(pepper_output_t *output, pepper_plane_t *above)
                pepper_list_insert(output->plane_list.prev, &plane->link);
 
        pepper_list_init(&plane->entry_list);
-       pixman_region32_init(&plane->damage_region);
-       pixman_region32_init(&plane->clip_region);
+       pepper_region_init(&plane->damage_region);
+       pepper_region_init(&plane->clip_region);
 
        return plane;
 }
@@ -138,21 +138,21 @@ pepper_plane_destroy(pepper_plane_t *plane)
        pepper_view_assign_plane(entry->base.view, plane->output, NULL);
 
        pepper_list_remove(&plane->link);
-       pixman_region32_fini(&plane->damage_region);
-       pixman_region32_fini(&plane->clip_region);
+       pepper_region_fini(&plane->damage_region);
+       pepper_region_fini(&plane->clip_region);
 
        free(plane);
 }
 
 void
-pepper_plane_add_damage_region(pepper_plane_t *plane, pixman_region32_t *damage)
+pepper_plane_add_damage_region(pepper_plane_t *plane, pepper_region_t *damage)
 {
        if (!damage) {
-               pixman_region32_union_rect(&plane->damage_region, &plane->damage_region,
+               pepper_region_union_rect(&plane->damage_region, &plane->damage_region,
                                                                   0, 0, plane->output->geometry.w, plane->output->geometry.h);
                pepper_output_schedule_repaint(plane->output);
-       } else if (pixman_region32_not_empty(damage)) {
-               pixman_region32_union(&plane->damage_region, &plane->damage_region, damage);
+       } else if (pepper_region_not_empty(damage)) {
+               pepper_region_union(&plane->damage_region, &plane->damage_region, damage);
                pepper_output_schedule_repaint(plane->output);
        }
 }
@@ -162,9 +162,9 @@ pepper_plane_add_damage_region(pepper_plane_t *plane, pixman_region32_t *damage)
  *
  * @param plane     plane to get the damage region
  *
- * @returns         #pixman_region32_t
+ * @returns         #pepper_region_t
  */
-PEPPER_API pixman_region32_t *
+PEPPER_API pepper_region_t *
 pepper_plane_get_damage_region(pepper_plane_t *plane)
 {
        return &plane->damage_region;
@@ -176,9 +176,9 @@ pepper_plane_get_damage_region(pepper_plane_t *plane)
  *
  * @param plane     plane to get the clip region
  *
- * @returns         #pixman_region32_t
+ * @returns         #pepper_region_t
  */
-PEPPER_API pixman_region32_t *
+PEPPER_API pepper_region_t *
 pepper_plane_get_clip_region(pepper_plane_t *plane)
 {
        return &plane->clip_region;
@@ -206,9 +206,9 @@ pepper_plane_get_render_list(pepper_plane_t *plane)
  */
 PEPPER_API void
 pepper_plane_subtract_damage_region(pepper_plane_t *plane,
-                                                                       pixman_region32_t *damage)
+                                                                       pepper_region_t *damage)
 {
-       pixman_region32_subtract(&plane->damage_region, &plane->damage_region, damage);
+       pepper_region_subtract(&plane->damage_region, &plane->damage_region, damage);
 }
 
 /**
@@ -220,5 +220,5 @@ pepper_plane_subtract_damage_region(pepper_plane_t *plane,
 PEPPER_API void
 pepper_plane_clear_damage_region(pepper_plane_t *plane)
 {
-       pixman_region32_clear(&plane->damage_region);
+       pepper_region_clear(&plane->damage_region);
 }
index 0ec2147..4a6c354 100644 (file)
@@ -66,8 +66,8 @@ pointer_set_cursor(struct wl_client *client, struct wl_resource *resource,
 
        if (surface != pepper_view_get_surface(cursor_view)) {
                surface->pickable = PEPPER_FALSE;
-               pixman_region32_fini(&surface->input_region);
-               pixman_region32_init(&surface->input_region);
+               pepper_region_fini(&surface->input_region);
+               pepper_region_init(&surface->input_region);
                pepper_view_set_surface(cursor_view, surface);
        }
 
index 9cc4dc4..56f104d 100644 (file)
@@ -46,7 +46,7 @@ region_add(struct wl_client *client, struct wl_resource *resource,
                   int32_t x, int32_t y, int32_t w, int32_t h)
 {
        pepper_wl_region_t *region = wl_resource_get_user_data(resource);
-       pixman_region32_union_rect(&region->pixman_region, &region->pixman_region,
+       pepper_region_union_rect(&region->region, &region->region,
                                                           x, y, w, h);
 }
 
@@ -55,11 +55,11 @@ region_subtract(struct wl_client *client, struct wl_resource *resource,
                                int32_t x, int32_t y, int32_t w, int32_t h)
 {
        pepper_wl_region_t    *region = wl_resource_get_user_data(resource);
-       pixman_region32_t   rect;
+       pepper_region_t   rect;
 
-       pixman_region32_init_rect(&rect, x, y, w, h);
-       pixman_region32_subtract(&region->pixman_region, &region->pixman_region, &rect);
-       pixman_region32_fini(&rect);
+       pepper_region_init_rect(&rect, x, y, w, h);
+       pepper_region_subtract(&region->region, &region->region, &rect);
+       pepper_region_fini(&rect);
 }
 
 static const struct wl_region_interface region_implementation = {
@@ -86,7 +86,7 @@ pepper_wl_region_create(pepper_compositor_t   *compositor,
 
        region->link.item = region;
        pepper_list_insert(&compositor->region_list, &region->link);
-       pixman_region32_init(&region->pixman_region);
+       pepper_region_init(&region->region);
 
        return region;
 
@@ -100,7 +100,7 @@ error:
 void
 pepper_wl_region_destroy(pepper_wl_region_t *region)
 {
-       pixman_region32_fini(&region->pixman_region);
+       pepper_region_fini(&region->region);
        pepper_list_remove(&region->link);
        free(region);
 }
@@ -119,7 +119,7 @@ add_bbox_point(double *box, int x, int y, const pepper_mat4_t *matrix)
 }
 
 static inline void
-transform_bounding_box(pixman_box32_t *box, const pepper_mat4_t *matrix)
+transform_bounding_box(pepper_box_t *box, const pepper_mat4_t *matrix)
 {
        double          b[4] = { HUGE_VAL, HUGE_VAL, -HUGE_VAL, -HUGE_VAL };
 
@@ -135,25 +135,25 @@ transform_bounding_box(pixman_box32_t *box, const pepper_mat4_t *matrix)
 }
 
 void
-pepper_transform_pixman_region(pixman_region32_t *region,
+pepper_transform_region(pepper_region_t *region,
                                                           const pepper_mat4_t *matrix)
 
 {
-       pixman_region32_t   result;
-       pixman_box32_t     *rects;
+       pepper_region_t   result;
+       pepper_box_t     *rects;
        int                 i, num_rects;
 
-       pixman_region32_init(&result);
-       rects = pixman_region32_rectangles(region, &num_rects);
+       pepper_region_init(&result);
+       rects = pepper_region_rectangles(region, &num_rects);
 
        for (i = 0; i < num_rects; i++) {
-               pixman_box32_t box = rects[i];
+               pepper_box_t box = rects[i];
 
                transform_bounding_box(&box, matrix);
-               pixman_region32_union_rect(&result, &result,
+               pepper_region_union_rect(&result, &result,
                                                                   box.x1, box.y1, box.x2 - box.x1, box.y2 - box.y1);
        }
 
-       pixman_region32_copy(region, &result);
-       pixman_region32_fini(&result);
+       pepper_region_copy(region, &result);
+       pepper_region_fini(&result);
 }
index eeea1f9..5bf4124 100644 (file)
@@ -191,9 +191,9 @@ surface_state_move(pepper_surface_state_t *from, pepper_surface_state_t *to)
        /* FIXME: Need to create another one? */
        to->buffer_destroy_listener = from->buffer_destroy_listener;
 
-       pixman_region32_copy(&to->damage_region, &from->damage_region);
-       pixman_region32_copy(&to->opaque_region, &from->opaque_region);
-       pixman_region32_copy(&to->input_region,  &from->input_region);
+       pepper_region_copy(&to->damage_region, &from->damage_region);
+       pepper_region_copy(&to->opaque_region, &from->opaque_region);
+       pepper_region_copy(&to->input_region,  &from->input_region);
 
        wl_list_insert_list(&to->frame_callback_list, &from->frame_callback_list);
 
@@ -204,9 +204,9 @@ surface_state_move(pepper_surface_state_t *from, pepper_surface_state_t *to)
        from->transform = WL_OUTPUT_TRANSFORM_NORMAL;
        from->buffer_destroy_listener = NULL;
 
-       pixman_region32_clear(&from->damage_region);
-       pixman_region32_clear(&from->opaque_region);
-       pixman_region32_clear(&from->input_region);
+       pepper_region_clear(&from->damage_region);
+       pepper_region_clear(&from->opaque_region);
+       pepper_region_clear(&from->input_region);
 
        wl_list_init(&from->frame_callback_list);
 }
index dc230cb..4dcdc44 100644 (file)
@@ -83,9 +83,9 @@ pepper_surface_state_init(pepper_surface_state_t *state)
        state->transform = WL_OUTPUT_TRANSFORM_NORMAL;
        state->scale = 1;
 
-       pixman_region32_init(&state->damage_region);
-       pixman_region32_init(&state->opaque_region);
-       pixman_region32_init_rect(&state->input_region, INT32_MIN, INT32_MIN,
+       pepper_region_init(&state->damage_region);
+       pepper_region_init(&state->opaque_region);
+       pepper_region_init_rect(&state->input_region, INT32_MIN, INT32_MIN,
                                                          UINT32_MAX, UINT32_MAX);
 
        wl_list_init(&state->frame_callback_list);
@@ -96,9 +96,9 @@ pepper_surface_state_fini(pepper_surface_state_t *state)
 {
        struct wl_resource *callback, *next;
 
-       pixman_region32_fini(&state->damage_region);
-       pixman_region32_fini(&state->opaque_region);
-       pixman_region32_fini(&state->input_region);
+       pepper_region_fini(&state->damage_region);
+       pepper_region_fini(&state->opaque_region);
+       pepper_region_fini(&state->input_region);
 
        wl_resource_for_each_safe(callback, next, &state->frame_callback_list)
        wl_resource_destroy(callback);
@@ -165,7 +165,7 @@ surface_damage(struct wl_client    *client,
                           int32_t              h)
 {
        pepper_surface_t *surface = wl_resource_get_user_data(resource);
-       pixman_region32_union_rect(&surface->pending.damage_region,
+       pepper_region_union_rect(&surface->pending.damage_region,
                                                           &surface->pending.damage_region, x, y, w, h);
 }
 
@@ -205,9 +205,9 @@ surface_set_opaque_region(struct wl_client   *client,
 
        if (region_resource) {
                pepper_wl_region_t *region = wl_resource_get_user_data(region_resource);
-               pixman_region32_copy(&surface->pending.opaque_region, &region->pixman_region);
+               pepper_region_copy(&surface->pending.opaque_region, &region->region);
        } else {
-               pixman_region32_clear(&surface->pending.opaque_region);
+               pepper_region_clear(&surface->pending.opaque_region);
        }
 }
 
@@ -220,9 +220,9 @@ surface_set_input_region(struct wl_client   *client,
 
        if (region_resource) {
                pepper_wl_region_t *region = wl_resource_get_user_data(region_resource);
-               pixman_region32_copy(&surface->pending.input_region, &region->pixman_region);
+               pepper_region_copy(&surface->pending.input_region, &region->region);
        } else {
-               pixman_region32_init_rect(&surface->pending.input_region,
+               pepper_region_init_rect(&surface->pending.input_region,
                                                                  INT32_MIN, INT32_MIN, UINT32_MAX, UINT32_MAX);
        }
 }
@@ -311,9 +311,9 @@ pepper_surface_create(pepper_compositor_t *compositor,
        surface->buffer.transform = WL_OUTPUT_TRANSFORM_NORMAL;
        surface->buffer.scale = 1;
 
-       pixman_region32_init(&surface->damage_region);
-       pixman_region32_init(&surface->opaque_region);
-       pixman_region32_init_rect(&surface->input_region, INT32_MIN, INT32_MIN,
+       pepper_region_init(&surface->damage_region);
+       pepper_region_init(&surface->opaque_region);
+       pepper_region_init_rect(&surface->input_region, INT32_MIN, INT32_MIN,
                                                          UINT32_MAX, UINT32_MAX);
        surface->pickable = PEPPER_TRUE;
 
@@ -352,9 +352,9 @@ pepper_surface_destroy(pepper_surface_t *surface)
                        pepper_buffer_unreference(surface->buffer.buffer);
        }
 
-       pixman_region32_fini(&surface->damage_region);
-       pixman_region32_fini(&surface->opaque_region);
-       pixman_region32_fini(&surface->input_region);
+       pepper_region_fini(&surface->damage_region);
+       pepper_region_fini(&surface->opaque_region);
+       pepper_region_fini(&surface->input_region);
 
        pepper_list_remove(&surface->link);
 
@@ -433,14 +433,14 @@ pepper_surface_commit_state(pepper_surface_t *surface,
        wl_list_init(&state->frame_callback_list);
 
        /* surface.damage(). */
-       pixman_region32_copy(&surface->damage_region, &state->damage_region);
-       pixman_region32_clear(&state->damage_region);
+       pepper_region_copy(&surface->damage_region, &state->damage_region);
+       pepper_region_clear(&state->damage_region);
 
        /* surface.set_opaque_region(), surface.set_input_region(). */
-       pixman_region32_copy(&surface->opaque_region, &state->opaque_region);
+       pepper_region_copy(&surface->opaque_region, &state->opaque_region);
 
        if (surface->pickable)
-               pixman_region32_copy(&surface->input_region, &state->input_region);
+               pepper_region_copy(&surface->input_region, &state->input_region);
 
        pepper_list_for_each(view, &surface->view_list, surface_link) {
                /* TODO: Option for enabling/disabling auto resize */
@@ -600,7 +600,7 @@ pepper_surface_get_buffer_transform(pepper_surface_t *surface)
  *
  * The damage region is the current state of the surface which is updated on wl_surface.commit.
  */
-PEPPER_API pixman_region32_t *
+PEPPER_API pepper_region_t *
 pepper_surface_get_damage_region(pepper_surface_t *surface)
 {
        return &surface->damage_region;
@@ -616,7 +616,7 @@ pepper_surface_get_damage_region(pepper_surface_t *surface)
  *
  * The opaque region is the current state of the surface which is updated on wl_surface.commit.
  */
-PEPPER_API pixman_region32_t *
+PEPPER_API pepper_region_t *
 pepper_surface_get_opaque_region(pepper_surface_t *surface)
 {
        return &surface->opaque_region;
@@ -631,7 +631,7 @@ pepper_surface_get_opaque_region(pepper_surface_t *surface)
  *
  * The input region is the current state of the surface which is updated on wl_surface.commit.
  */
-PEPPER_API pixman_region32_t *
+PEPPER_API pepper_region_t *
 pepper_surface_get_input_region(pepper_surface_t *surface)
 {
        return &surface->input_region;
@@ -701,7 +701,7 @@ pepper_surface_flush_damage(pepper_surface_t *surface)
        pepper_output_t    *output;
        pepper_bool_t       release_buffer = PEPPER_TRUE;
 
-       if (!pixman_region32_not_empty(&surface->damage_region))
+       if (!pepper_region_not_empty(&surface->damage_region))
                return;
 
        pepper_list_for_each(view, &surface->view_list, surface_link)
@@ -716,7 +716,7 @@ pepper_surface_flush_damage(pepper_surface_t *surface)
                        release_buffer = PEPPER_FALSE;
        }
 
-       pixman_region32_clear(&surface->damage_region);
+       pepper_region_clear(&surface->damage_region);
 
        if (surface->buffer.buffer && release_buffer) {
                pepper_buffer_unreference(surface->buffer.buffer);
index 1196726..d1090c0 100644 (file)
 #include <limits.h>
 #include <string.h>
 #include <stdio.h>
-#include "pepper-utils.h"\r
-\r
-typedef int64_t                 overflow_int_t;\r
-\r
+#include "pepper-utils.h"
+
+typedef int64_t overflow_int_t;
+
 #ifndef INT32_MIN
-# define INT32_MIN              (-2147483647-1)
+#define INT32_MIN              (-2147483647-1)
 #endif
 
 #ifndef INT32_MAX
-# define INT32_MAX              (2147483647)
+#define INT32_MAX              (2147483647)
 #endif
-\r
-#if defined (__GNUC__)\r
-#  define unlikely(expr) __builtin_expect ((expr), 0)
+
+#if defined (__GNUC__)
+#define unlikely(expr) __builtin_expect ((expr), 0)
 #else
-#  define unlikely(expr)  (expr)
+#define unlikely(expr)  (expr)
 #endif
-\r
+
 #define return_if_fail(expr)                                            \
     do                                                                  \
     {                                                                   \
        if (unlikely (!(expr)))                                         \
        {                                                               \
-           PEPPER_ERROR("%s\n", "The expression " # expr " was false"); \\r
+           PEPPER_ERROR("%s\n", "The expression " # expr " was false"); \
            return;                                                     \
        }                                                               \
     }                                                                   \
@@ -101,7 +101,7 @@ typedef int64_t                 overflow_int_t;
     {                                                                   \
        if (unlikely (!(expr)))                                         \
        {                                                               \
-           PEPPER_ERROR("%s\n", "The expression " # expr " was false"); \\r
+           PEPPER_ERROR("%s\n", "The expression " # expr " was false"); \
            return (retval);                                            \
        }                                                               \
     }                                                                   \
@@ -111,19 +111,19 @@ typedef int64_t                 overflow_int_t;
     do                                                                 \
     {                                                                  \
        if (unlikely (!(expr)))                                         \
-           PEPPER_ERROR("%s\n", "The expression " # expr " was false"); \\r
+           PEPPER_ERROR("%s\n", "The expression " # expr " was false"); \
     }                                                                  \
     while (0)
-\r
-#define PIXREGION_NIL(reg) ((reg)->data && !(reg)->data->numRects)\r
+
+#define PIXREGION_NIL(reg) ((reg)->data && !(reg)->data->numRects)
 /* not a region */
-#define PIXREGION_NAR(reg)      ((reg)->data == pepper_broken_data)\r
+#define PIXREGION_NAR(reg)      ((reg)->data == pepper_broken_data)
 #define PIXREGION_NUMRECTS(reg) ((reg)->data ? (reg)->data->numRects : 1)
 #define PIXREGION_SIZE(reg) ((reg)->data ? (reg)->data->size : 0)
 #define PIXREGION_RECTS(reg) \
-    ((reg)->data ? (pepper_box_t *)((reg)->data + 1) \\r
+    ((reg)->data ? (pepper_box_t *)((reg)->data + 1) \
      : &(reg)->extents)
-#define PIXREGION_BOXPTR(reg) ((pepper_box_t *)((reg)->data + 1))\r
+#define PIXREGION_BOXPTR(reg) ((pepper_box_t *)((reg)->data + 1))
 #define PIXREGION_BOX(reg, i) (&PIXREGION_BOXPTR (reg)[i])
 #define PIXREGION_TOP(reg) PIXREGION_BOX (reg, (reg)->data->numRects)
 #define PIXREGION_END(reg) PIXREGION_BOX (reg, (reg)->data->numRects - 1)
@@ -136,8 +136,8 @@ typedef int64_t                 overflow_int_t;
 #define GOOD(reg)                                                      \
     do                                                                 \
     {                                                                  \
-       if (!pepper_region_selfcheck (reg))                                     \\r
-           PEPPER_ERROR("%s","Malformed region " # reg);       \\r
+       if (!pepper_region_selfcheck (reg))                                     \
+           PEPPER_ERROR("%s","Malformed region " # reg);       \
     } while (0)
 
 #else
@@ -146,23 +146,24 @@ typedef int64_t                 overflow_int_t;
 
 #endif
 
-static const pepper_box_t pepper_region_empty_box_ = { 0, 0, 0, 0 };\r
-static const pepper_region_data_t pepper_region_empty_data_ = { 0, 0 };\r
+static const pepper_box_t pepper_region_empty_box_ = { 0, 0, 0, 0 };
+static const pepper_region_data_t pepper_region_empty_data_ = { 0, 0 };
+
 #if defined (__llvm__) && !defined (__clang__)
-static const volatile pepper_region_data_t pepper_region_broken_data_ = { 0, 0 };\r
+static const volatile pepper_region_data_t pepper_region_broken_data_ =
+       { 0, 0 };
 #else
-static const pepper_region_data_t pepper_region_broken_data_ = { 0, 0 };\r
+static const pepper_region_data_t pepper_region_broken_data_ = { 0, 0 };
 #endif
 
-static pepper_box_t *pepper_region_empty_box =\r
-    (pepper_box_t *)&pepper_region_empty_box_;\r
-static pepper_region_data_t *pepper_region_empty_data =\r
-    (pepper_region_data_t *)&pepper_region_empty_data_;\r
-static pepper_region_data_t *pepper_broken_data =\r
-    (pepper_region_data_t *)&pepper_region_broken_data_;\r
+static pepper_box_t *pepper_region_empty_box =
+       (pepper_box_t *) & pepper_region_empty_box_;
+static pepper_region_data_t *pepper_region_empty_data =
+       (pepper_region_data_t *) & pepper_region_empty_data_;
+static pepper_region_data_t *pepper_broken_data =
+       (pepper_region_data_t *) & pepper_region_broken_data_;
 
-static pepper_bool_t\r
-pepper_break (pepper_region_t *region);\r
+static pepper_bool_t pepper_break(pepper_region_t * region);
 
 /*
  * The functions in this file implement the Region abstraction used extensively
@@ -205,8 +206,8 @@ pepper_break (pepper_region_t *region);
  *
  * Adam de Boor wrote most of the original region code.  Joel McCormack
  * substantially modified or rewrote most of the core arithmetic routines, and
- * added pepper_region_validate in order to support several speed improvements\r
- * to pepper_region_validate_tree.  Bob Scheifler changed the representation\r
+ * added pepper_region_validate in order to support several speed improvements
+ * to pepper_region_validate_tree.  Bob Scheifler changed the representation
  * to be more compact when empty or a single rectangle, and did a bunch of
  * gratuitous reformatting. Carl Worth did further gratuitous reformatting
  * while re-merging the server and client region code into libpixregion.
@@ -235,28 +236,28 @@ pepper_break (pepper_region_t *region);
       ((r1)->y2 >= (r2)->y2) )
 
 static size_t
-PIXREGION_SZOF (size_t n)
+PIXREGION_SZOF(size_t n)
 {
-    size_t size = n * sizeof(pepper_box_t);\r
-    
-    if (n > UINT32_MAX / sizeof(pepper_box_t))\r
-       return 0;
+       size_t size = n * sizeof(pepper_box_t);
+
+       if (n > UINT32_MAX / sizeof(pepper_box_t))
+               return 0;
 
-    if (sizeof(pepper_region_data_t) > UINT32_MAX - size)\r
-       return 0;
+       if (sizeof(pepper_region_data_t) > UINT32_MAX - size)
+               return 0;
 
-    return size + sizeof(pepper_region_data_t);\r
+       return size + sizeof(pepper_region_data_t);
 }
 
-static pepper_region_data_t *\r
-alloc_data (size_t n)
+static pepper_region_data_t *
+alloc_data(size_t n)
 {
-    size_t sz = PIXREGION_SZOF (n);
+       size_t sz = PIXREGION_SZOF(n);
 
-    if (!sz)
-       return NULL;
+       if (!sz)
+               return NULL;
 
-    return malloc (sz);
+       return malloc(sz);
 }
 
 #define FREE_DATA(reg) if ((reg)->data && (reg)->data->size) free ((reg)->data)
@@ -267,7 +268,7 @@ alloc_data (size_t n)
        if (!(region)->data ||                                          \
            (((region)->data->numRects + (n)) > (region)->data->size))  \
        {                                                               \
-           if (!pepper_rect_alloc (region, n))                         \\r
+           if (!pepper_rect_alloc (region, n))                         \
                goto bail;                                              \
        }                                                               \
     } while (0)
@@ -278,8 +279,8 @@ alloc_data (size_t n)
        if (!(region)->data ||                                          \
            (((region)->data->numRects + (n)) > (region)->data->size))  \
        {                                                               \
-           if (!pepper_rect_alloc (region, n)) {                       \\r
-               return PEPPER_FALSE;                                            \\r
+           if (!pepper_rect_alloc (region, n)) {                       \
+               return PEPPER_FALSE;                                            \
            }                                                           \
        }                                                               \
     } while (0)
@@ -301,8 +302,8 @@ alloc_data (size_t n)
        if (!(region)->data ||                                          \
            ((region)->data->numRects == (region)->data->size))         \
        {                                                               \
-           if (!pepper_rect_alloc (region, 1))                         \\r
-               return PEPPER_FALSE;                                            \\r
+           if (!pepper_rect_alloc (region, 1))                         \
+               return PEPPER_FALSE;                                            \
            next_rect = PIXREGION_TOP (region);                         \
        }                                                               \
        ADDRECT (next_rect, nx1, ny1, nx2, ny2);                        \
@@ -316,7 +317,7 @@ alloc_data (size_t n)
        if (((numRects) < ((reg)->data->size >> 1)) &&                  \
            ((reg)->data->size > 50))                                   \
        {                                                               \
-           pepper_region_data_t * new_data;                            \\r
+           pepper_region_data_t * new_data;                            \
            size_t data_size = PIXREGION_SZOF (numRects);               \
                                                                        \
            if (!data_size)                                             \
@@ -325,7 +326,7 @@ alloc_data (size_t n)
            }                                                           \
            else                                                        \
            {                                                           \
-               new_data = (pepper_region_data_t *)                     \\r
+               new_data = (pepper_region_data_t *)                     \
                    realloc ((reg)->data, data_size);                   \
            }                                                           \
                                                                        \
@@ -337,255 +338,234 @@ alloc_data (size_t n)
        }                                                               \
     } while (0)
 
-PEPPER_API pepper_bool_t\r
-pepper_region_equal (pepper_region_t *reg1, pepper_region_t *reg2)\r
+PEPPER_API pepper_bool_t
+pepper_region_equal(pepper_region_t * reg1, pepper_region_t * reg2)
 {
-    int i;
-    pepper_box_t *rects1;\r
-    pepper_box_t *rects2;\r
-
-    if (reg1->extents.x1 != reg2->extents.x1)
-       return PEPPER_FALSE;\r
-    
-    if (reg1->extents.x2 != reg2->extents.x2)
-       return PEPPER_FALSE;\r
-    
-    if (reg1->extents.y1 != reg2->extents.y1)
-       return PEPPER_FALSE;\r
-    
-    if (reg1->extents.y2 != reg2->extents.y2)
-       return PEPPER_FALSE;\r
-    
-    if (PIXREGION_NUMRECTS (reg1) != PIXREGION_NUMRECTS (reg2))
-       return PEPPER_FALSE;\r
-
-    rects1 = PIXREGION_RECTS (reg1);
-    rects2 = PIXREGION_RECTS (reg2);
-    
-    for (i = 0; i != PIXREGION_NUMRECTS (reg1); i++)
-    {
-       if (rects1[i].x1 != rects2[i].x1)
-           return PEPPER_FALSE;\r
-       
-       if (rects1[i].x2 != rects2[i].x2)
-           return PEPPER_FALSE;\r
-       
-       if (rects1[i].y1 != rects2[i].y1)
-           return PEPPER_FALSE;\r
-       
-       if (rects1[i].y2 != rects2[i].y2)
-           return PEPPER_FALSE;\r
-    }
+       int i;
+       pepper_box_t *rects1;
+       pepper_box_t *rects2;
+
+       if (reg1->extents.x1 != reg2->extents.x1)
+               return PEPPER_FALSE;
+
+       if (reg1->extents.x2 != reg2->extents.x2)
+               return PEPPER_FALSE;
+
+       if (reg1->extents.y1 != reg2->extents.y1)
+               return PEPPER_FALSE;
+
+       if (reg1->extents.y2 != reg2->extents.y2)
+               return PEPPER_FALSE;
+
+       if (PIXREGION_NUMRECTS(reg1) != PIXREGION_NUMRECTS(reg2))
+               return PEPPER_FALSE;
+
+       rects1 = PIXREGION_RECTS(reg1);
+       rects2 = PIXREGION_RECTS(reg2);
+
+       for (i = 0; i != PIXREGION_NUMRECTS(reg1); i++) {
+               if (rects1[i].x1 != rects2[i].x1)
+                       return PEPPER_FALSE;
+
+               if (rects1[i].x2 != rects2[i].x2)
+                       return PEPPER_FALSE;
+
+               if (rects1[i].y1 != rects2[i].y1)
+                       return PEPPER_FALSE;
+
+               if (rects1[i].y2 != rects2[i].y2)
+                       return PEPPER_FALSE;
+       }
 
-    return PEPPER_TRUE;\r
+       return PEPPER_TRUE;
 }
 
-PEPPER_API int\r
-pepper_region_print (pepper_region_t *rgn)\r
+PEPPER_API int
+pepper_region_print(pepper_region_t * rgn)
 {
-    int num, size;
-    int i;
-    pepper_box_t * rects;\r
-
-    num = PIXREGION_NUMRECTS (rgn);
-    size = PIXREGION_SIZE (rgn);
-    rects = PIXREGION_RECTS (rgn);
-
-    fprintf (stderr, "num: %d size: %d\n", num, size);
-    fprintf (stderr, "extents: %d %d %d %d\n",
-             rgn->extents.x1,
-            rgn->extents.y1,
-            rgn->extents.x2,
-            rgn->extents.y2);
-    
-    for (i = 0; i < num; i++)
-    {
-       fprintf (stderr, "%d %d %d %d \n",
-                rects[i].x1, rects[i].y1, rects[i].x2, rects[i].y2);
-    }
-    
-    fprintf (stderr, "\n");
+       int num, size;
+       int i;
+       pepper_box_t *rects;
+
+       num = PIXREGION_NUMRECTS(rgn);
+       size = PIXREGION_SIZE(rgn);
+       rects = PIXREGION_RECTS(rgn);
+
+       fprintf(stderr, "num: %d size: %d\n", num, size);
+       fprintf(stderr, "extents: %d %d %d %d\n",
+                       rgn->extents.x1,
+                       rgn->extents.y1, rgn->extents.x2, rgn->extents.y2);
+
+       for (i = 0; i < num; i++) {
+               fprintf(stderr, "%d %d %d %d \n",
+                               rects[i].x1, rects[i].y1, rects[i].x2, rects[i].y2);
+       }
 
-    return(num);
+       fprintf(stderr, "\n");
+
+       return (num);
 }
 
 
-PEPPER_API void\r
-pepper_region_init (pepper_region_t *region)\r
+PEPPER_API void
+pepper_region_init(pepper_region_t * region)
 {
-    region->extents = *pepper_region_empty_box;\r
-    region->data = pepper_region_empty_data;\r
+       region->extents = *pepper_region_empty_box;
+       region->data = pepper_region_empty_data;
 }
 
-PEPPER_API void\r
-pepper_region_init_rect (pepper_region_t *     region,\r
-                     int               x,
-                    int                y,
-                    unsigned int       width,
-                    unsigned int       height)
+PEPPER_API void
+pepper_region_init_rect(pepper_region_t * region,
+                                               int x, int y, unsigned int width, unsigned int height)
 {
-    region->extents.x1 = x;
-    region->extents.y1 = y;
-    region->extents.x2 = x + width;
-    region->extents.y2 = y + height;
-
-    if (!GOOD_RECT (&region->extents))
-    {
-        if (BAD_RECT (&region->extents))
-            PEPPER_ERROR("%s", "Invalid rectangle passed");\r
-        pepper_region_init (region);\r
-        return;
-    }
+       region->extents.x1 = x;
+       region->extents.y1 = y;
+       region->extents.x2 = x + width;
+       region->extents.y2 = y + height;
+
+       if (!GOOD_RECT(&region->extents)) {
+               if (BAD_RECT(&region->extents))
+                       PEPPER_ERROR("%s", "Invalid rectangle passed");
+               pepper_region_init(region);
+               return;
+       }
 
-    region->data = NULL;
+       region->data = NULL;
 }
 
-PEPPER_API void\r
-pepper_region_init_with_extents (pepper_region_t *region, pepper_box_t *extents)\r
+PEPPER_API void
+pepper_region_init_with_extents(pepper_region_t * region,
+                                                               pepper_box_t * extents)
 {
-    if (!GOOD_RECT (extents))
-    {
-        if (BAD_RECT (extents))
-            PEPPER_ERROR("%s", "Invalid rectangle passed");\r
-        pepper_region_init (region);\r
-        return;
-    }
-    region->extents = *extents;
+       if (!GOOD_RECT(extents)) {
+               if (BAD_RECT(extents))
+                       PEPPER_ERROR("%s", "Invalid rectangle passed");
+               pepper_region_init(region);
+               return;
+       }
+       region->extents = *extents;
 
-    region->data = NULL;
+       region->data = NULL;
 }
 
-PEPPER_API void\r
-pepper_region_fini (pepper_region_t *region)\r
+PEPPER_API void
+pepper_region_fini(pepper_region_t * region)
 {
-    GOOD (region);
-    FREE_DATA (region);
+       GOOD(region);
+       FREE_DATA(region);
 }
 
-PEPPER_API int\r
-pepper_region_n_rects (pepper_region_t *region)\r
+PEPPER_API int
+pepper_region_n_rects(pepper_region_t * region)
 {
-    return PIXREGION_NUMRECTS (region);
+       return PIXREGION_NUMRECTS(region);
 }
 
-PEPPER_API pepper_box_t *\r
-pepper_region_rectangles (pepper_region_t *region,\r
-                      int               *n_rects)
+PEPPER_API pepper_box_t *
+pepper_region_rectangles(pepper_region_t * region, int *n_rects)
 {
-    if (n_rects)
-       *n_rects = PIXREGION_NUMRECTS (region);
+       if (n_rects)
+               *n_rects = PIXREGION_NUMRECTS(region);
 
-    return PIXREGION_RECTS (region);
+       return PIXREGION_RECTS(region);
 }
 
-static pepper_bool_t\r
-pepper_break (pepper_region_t *region)\r
+static pepper_bool_t
+pepper_break(pepper_region_t * region)
 {
-    FREE_DATA (region);
+       FREE_DATA(region);
 
-    region->extents = *pepper_region_empty_box;\r
-    region->data = pepper_broken_data;\r
+       region->extents = *pepper_region_empty_box;
+       region->data = pepper_broken_data;
 
-    return PEPPER_FALSE;\r
+       return PEPPER_FALSE;
 }
 
-static pepper_bool_t\r
-pepper_rect_alloc (pepper_region_t * region,\r
-                   int             n)
+static pepper_bool_t
+pepper_rect_alloc(pepper_region_t * region, int n)
 {
-    pepper_region_data_t *data;\r
+       pepper_region_data_t *data;
 
-    if (!region->data)
-    {
-       n++;
-       region->data = alloc_data (n);
+       if (!region->data) {
+               n++;
+               region->data = alloc_data(n);
 
-       if (!region->data)
-           return pepper_break (region);\r
+               if (!region->data)
+                       return pepper_break(region);
 
-       region->data->numRects = 1;
-       *PIXREGION_BOXPTR (region) = region->extents;
-    }
-    else if (!region->data->size)
-    {
-       region->data = alloc_data (n);
+               region->data->numRects = 1;
+               *PIXREGION_BOXPTR(region) = region->extents;
+       } else if (!region->data->size) {
+               region->data = alloc_data(n);
 
-       if (!region->data)
-           return pepper_break (region);\r
+               if (!region->data)
+                       return pepper_break(region);
 
-       region->data->numRects = 0;
-    }
-    else
-    {
-       size_t data_size;
-
-       if (n == 1)
-       {
-           n = region->data->numRects;
-           if (n > 500) /* XXX pick numbers out of a hat */
-               n = 250;
-       }
+               region->data->numRects = 0;
+       } else {
+               size_t data_size;
 
-       n += region->data->numRects;
-       data_size = PIXREGION_SZOF (n);
+               if (n == 1) {
+                       n = region->data->numRects;
+                       if (n > 500)            /* XXX pick numbers out of a hat */
+                               n = 250;
+               }
 
-       if (!data_size)
-       {
-           data = NULL;
-       }
-       else
-       {
-           data = (pepper_region_data_t *)\r
-               realloc (region->data, PIXREGION_SZOF (n));
+               n += region->data->numRects;
+               data_size = PIXREGION_SZOF(n);
+
+               if (!data_size) {
+                       data = NULL;
+               } else {
+                       data = (pepper_region_data_t *)
+                               realloc(region->data, PIXREGION_SZOF(n));
+               }
+
+               if (!data)
+                       return pepper_break(region);
+
+               region->data = data;
        }
-       
-       if (!data)
-           return pepper_break (region);\r
-       
-       region->data = data;
-    }
-    
-    region->data->size = n;
 
-    return PEPPER_TRUE;\r
+       region->data->size = n;
+
+       return PEPPER_TRUE;
 }
 
-PEPPER_API pepper_bool_t\r
-pepper_region_copy (pepper_region_t *dst, pepper_region_t *src)\r
+PEPPER_API pepper_bool_t
+pepper_region_copy(pepper_region_t * dst, pepper_region_t * src)
 {
-    GOOD (dst);
-    GOOD (src);
-
-    if (dst == src)
-       return PEPPER_TRUE;\r
-    
-    dst->extents = src->extents;
-
-    if (!src->data || !src->data->size)
-    {
-       FREE_DATA (dst);
-       dst->data = src->data;
-       return PEPPER_TRUE;\r
-    }
-    
-    if (!dst->data || (dst->data->size < src->data->numRects))
-    {
-       FREE_DATA (dst);
+       GOOD(dst);
+       GOOD(src);
 
-       dst->data = alloc_data (src->data->numRects);
+       if (dst == src)
+               return PEPPER_TRUE;
 
-       if (!dst->data)
-           return pepper_break (dst);\r
+       dst->extents = src->extents;
 
-       dst->data->size = src->data->numRects;
-    }
+       if (!src->data || !src->data->size) {
+               FREE_DATA(dst);
+               dst->data = src->data;
+               return PEPPER_TRUE;
+       }
+
+       if (!dst->data || (dst->data->size < src->data->numRects)) {
+               FREE_DATA(dst);
+
+               dst->data = alloc_data(src->data->numRects);
+
+               if (!dst->data)
+                       return pepper_break(dst);
 
-    dst->data->numRects = src->data->numRects;
+               dst->data->size = src->data->numRects;
+       }
+
+       dst->data->numRects = src->data->numRects;
 
-    memmove ((char *)PIXREGION_BOXPTR (dst), (char *)PIXREGION_BOXPTR (src),
-             dst->data->numRects * sizeof(pepper_box_t));\r
+       memmove((char *)PIXREGION_BOXPTR(dst), (char *)PIXREGION_BOXPTR(src),
+                       dst->data->numRects * sizeof(pepper_box_t));
 
-    return PEPPER_TRUE;\r
+       return PEPPER_TRUE;
 }
 
 /*======================================================================
@@ -594,10 +574,10 @@ pepper_region_copy (pepper_region_t *dst, pepper_region_t *src)
 
 /*-
  *-----------------------------------------------------------------------
- * pepper_coalesce --\r
+ * pepper_coalesce --
  *     Attempt to merge the boxes in the current band with those in the
  *     previous one.  We are guaranteed that the current band extends to
- *      the end of the rects array.  Used only by pepper_op.\r
+ *      the end of the rects array.  Used only by pepper_op.
  *
  * Results:
  *     The new index for the previous band.
@@ -611,82 +591,82 @@ pepper_region_copy (pepper_region_t *dst, pepper_region_t *src)
  *-----------------------------------------------------------------------
  */
 static inline int
-pepper_coalesce (pepper_region_t * region,      /* Region to coalesce           */\r
-                int             prev_start,  /* Index of start of previous band */
-                int             cur_start)   /* Index of start of current band  */
-{
-    pepper_box_t *prev_box;       /* Current box in previous band           */\r
-    pepper_box_t *cur_box;        /* Current box in current band       */\r
-    int numRects;               /* Number rectangles in both bands   */
-    int y2;                     /* Bottom of current band           */
-
-    /*
-     * Figure out how many rectangles are in the band.
-     */
-    numRects = cur_start - prev_start;
-    critical_if_fail (numRects == region->data->numRects - cur_start);
-
-    if (!numRects) return cur_start;
-
-    /*
-     * The bands may only be coalesced if the bottom of the previous
-     * matches the top scanline of the current.
-     */
-    prev_box = PIXREGION_BOX (region, prev_start);
-    cur_box = PIXREGION_BOX (region, cur_start);
-    if (prev_box->y2 != cur_box->y1) return cur_start;
-
-    /*
-     * Make sure the bands have boxes in the same places. This
-     * assumes that boxes have been added in such a way that they
-     * cover the most area possible. I.e. two boxes in a band must
-     * have some horizontal space between them.
-     */
-    y2 = cur_box->y2;
-
-    do
-    {
-       if ((prev_box->x1 != cur_box->x1) || (prev_box->x2 != cur_box->x2))
-           return (cur_start);
-       
-       prev_box++;
-       cur_box++;
-       numRects--;
-    }
-    while (numRects);
-
-    /*
-     * The bands may be merged, so set the bottom y of each box
-     * in the previous band to the bottom y of the current band.
-     */
-    numRects = cur_start - prev_start;
-    region->data->numRects -= numRects;
-
-    do
-    {
-       prev_box--;
-       prev_box->y2 = y2;
-       numRects--;
-    }
-    while (numRects);
+pepper_coalesce(pepper_region_t * region,      /* Region to coalesce        */
+                               int prev_start, /* Index of start of previous band */
+                               int cur_start)
+{                                                              /* Index of start of current band  */
+       pepper_box_t *prev_box;         /* Current box in previous band        */
+       pepper_box_t *cur_box;          /* Current box in current band       */
+       int numRects;                           /* Number rectangles in both bands   */
+       int y2;                                         /* Bottom of current band        */
+
+       /*
+        * Figure out how many rectangles are in the band.
+        */
+       numRects = cur_start - prev_start;
+       critical_if_fail(numRects == region->data->numRects - cur_start);
+
+       if (!numRects)
+               return cur_start;
 
-    return prev_start;
+       /*
+        * The bands may only be coalesced if the bottom of the previous
+        * matches the top scanline of the current.
+        */
+       prev_box = PIXREGION_BOX(region, prev_start);
+       cur_box = PIXREGION_BOX(region, cur_start);
+       if (prev_box->y2 != cur_box->y1)
+               return cur_start;
+
+       /*
+        * Make sure the bands have boxes in the same places. This
+        * assumes that boxes have been added in such a way that they
+        * cover the most area possible. I.e. two boxes in a band must
+        * have some horizontal space between them.
+        */
+       y2 = cur_box->y2;
+
+       do {
+               if ((prev_box->x1 != cur_box->x1) || (prev_box->x2 != cur_box->x2))
+                       return (cur_start);
+
+               prev_box++;
+               cur_box++;
+               numRects--;
+       }
+       while (numRects);
+
+       /*
+        * The bands may be merged, so set the bottom y of each box
+        * in the previous band to the bottom y of the current band.
+        */
+       numRects = cur_start - prev_start;
+       region->data->numRects -= numRects;
+
+       do {
+               prev_box--;
+               prev_box->y2 = y2;
+               numRects--;
+       }
+       while (numRects);
+
+       return prev_start;
 }
 
-/* Quicky macro to avoid trivial reject procedure calls to pepper_coalesce */\r
+/* Quicky macro to avoid trivial reject procedure calls to pepper_coalesce */
 
 #define COALESCE(new_reg, prev_band, cur_band)                          \
     do                                                                 \
     {                                                                  \
        if (cur_band - prev_band == new_reg->data->numRects - cur_band) \
-           prev_band = pepper_coalesce (new_reg, prev_band, cur_band); \\r
+           prev_band = pepper_coalesce (new_reg, prev_band, cur_band); \
        else                                                            \
            prev_band = cur_band;                                       \
     } while (0)
 
 /*-
  *-----------------------------------------------------------------------
- * pepper_region_append_non_o --\r
+ * pepper_region_append_non_o --
  *     Handle a non-overlapping band for the union and subtract operations.
  *      Just adds the (top/bottom-clipped) rectangles into the region.
  *      Doesn't have to check for subsumption or anything.
@@ -700,35 +680,32 @@ pepper_coalesce (pepper_region_t * region,      /* Region to coalesce              */
  *
  *-----------------------------------------------------------------------
  */
-static inline pepper_bool_t\r
-pepper_region_append_non_o (pepper_region_t * region,\r
-                           pepper_box_t *    r,\r
-                           pepper_box_t *    r_end,\r
-                           int             y1,
-                           int             y2)
+static inline pepper_bool_t
+pepper_region_append_non_o(pepper_region_t * region,
+                                                  pepper_box_t * r,
+                                                  pepper_box_t * r_end, int y1, int y2)
 {
-    pepper_box_t *next_rect;\r
-    int new_rects;
+       pepper_box_t *next_rect;
+       int new_rects;
 
-    new_rects = r_end - r;
+       new_rects = r_end - r;
 
-    critical_if_fail (y1 < y2);
-    critical_if_fail (new_rects != 0);
+       critical_if_fail(y1 < y2);
+       critical_if_fail(new_rects != 0);
 
-    /* Make sure we have enough space for all rectangles to be added */
-    RECTALLOC (region, new_rects);
-    next_rect = PIXREGION_TOP (region);
-    region->data->numRects += new_rects;
+       /* Make sure we have enough space for all rectangles to be added */
+       RECTALLOC(region, new_rects);
+       next_rect = PIXREGION_TOP(region);
+       region->data->numRects += new_rects;
 
-    do
-    {
-       critical_if_fail (r->x1 < r->x2);
-       ADDRECT (next_rect, r->x1, y1, r->x2, y2);
-       r++;
-    }
-    while (r != r_end);
+       do {
+               critical_if_fail(r->x1 < r->x2);
+               ADDRECT(next_rect, r->x1, y1, r->x2, y2);
+               r++;
+       }
+       while (r != r_end);
 
-    return PEPPER_TRUE;\r
+       return PEPPER_TRUE;
 }
 
 #define FIND_BAND(r, r_band_end, r_end, ry1)                        \
@@ -748,24 +725,24 @@ pepper_region_append_non_o (pepper_region_t * region,
        if ((new_rects = r_end - r)) {                                  \
            RECTALLOC_BAIL (new_reg, new_rects, bail);                  \
            memmove ((char *)PIXREGION_TOP (new_reg), (char *)r,        \
-                    new_rects * sizeof(pepper_box_t));                 \\r
+                    new_rects * sizeof(pepper_box_t));                 \
            new_reg->data->numRects += new_rects;                       \
        }                                                               \
     } while (0)
 
 /*-
  *-----------------------------------------------------------------------
- * pepper_op --\r
- *     Apply an operation to two regions. Called by pepper_region_union, pepper_region_inverse,\r
- *     pepper_region_subtract, pepper_region_intersect....  Both regions MUST have at least one\r
+ * pepper_op --
+ *     Apply an operation to two regions. Called by pepper_region_union, pepper_region_inverse,
+ *     pepper_region_subtract, pepper_region_intersect....  Both regions MUST have at least one
  *      rectangle, and cannot be the same object.
  *
  * Results:
- *     PEPPER_TRUE if successful.\r
+ *     PEPPER_TRUE if successful.
  *
  * Side Effects:
  *     The new region is overwritten.
- *     overlap set to PEPPER_TRUE if overlap_func ever returns PEPPER_TRUE.\r
+ *     overlap set to PEPPER_TRUE if overlap_func ever returns PEPPER_TRUE.
  *
  * Notes:
  *     The idea behind this function is to view the two regions as sets.
@@ -782,304 +759,279 @@ pepper_region_append_non_o (pepper_region_t * region,
  *-----------------------------------------------------------------------
  */
 
-typedef pepper_bool_t (*overlap_proc_ptr) (pepper_region_t *region,\r
-                                          pepper_box_t *   r1,\r
-                                          pepper_box_t *   r1_end,\r
-                                          pepper_box_t *   r2,\r
-                                          pepper_box_t *   r2_end,\r
-                                          int            y1,
-                                          int            y2);
-
-static pepper_bool_t\r
-pepper_op (pepper_region_t *  new_reg,               /* Place to store result      */\r
-          pepper_region_t *  reg1,                  /* First region in operation     */\r
-          pepper_region_t *  reg2,                  /* 2d region in operation        */\r
-          overlap_proc_ptr overlap_func,          /* Function to call for over-
-                                                   * lapping bands                 */
-          int              append_non1,           /* Append non-overlapping bands  
-                                                   * in region 1 ?
-                                                   */
-          int              append_non2            /* Append non-overlapping bands
-                                                   * in region 2 ?
-                                                   */
-    )
+typedef pepper_bool_t(*overlap_proc_ptr) (pepper_region_t * region,
+                                                                                 pepper_box_t * r1,
+                                                                                 pepper_box_t * r1_end,
+                                                                                 pepper_box_t * r2,
+                                                                                 pepper_box_t * r2_end,
+                                                                                 int y1, int y2);
+
+static pepper_bool_t
+pepper_op(pepper_region_t * new_reg,   /* Place to store result       */
+                 pepper_region_t * reg1,       /* First region in operation     */
+                 pepper_region_t * reg2,       /* 2d region in operation        */
+                 overlap_proc_ptr overlap_func,        /* Function to call for over-
+                                                                                        * lapping bands         */
+                 int append_non1,              /* Append non-overlapping bands  
+                                                                * in region 1 ?
+                                                                */
+                 int append_non2               /* Append non-overlapping bands
+                                                                * in region 2 ?
+                                                                */
+       )
 {
-    pepper_box_t *r1;                 /* Pointer into first region     */\r
-    pepper_box_t *r2;                 /* Pointer into 2d region             */\r
-    pepper_box_t *r1_end;             /* End of 1st region          */\r
-    pepper_box_t *r2_end;             /* End of 2d region                   */\r
-    int ybot;                       /* Bottom of intersection       */
-    int ytop;                       /* Top of intersection          */
-    pepper_region_data_t *old_data;   /* Old data for new_reg       */\r
-    int prev_band;                  /* Index of start of
-                                    * previous band in new_reg       */
-    int cur_band;                   /* Index of start of current
-                                    * band in new_reg               */
-    pepper_box_t * r1_band_end;       /* End of current band in r1     */\r
-    pepper_box_t * r2_band_end;       /* End of current band in r2     */\r
-    int top;                        /* Top of non-overlapping band   */
-    int bot;                        /* Bottom of non-overlapping band*/
-    int r1y1;                       /* Temps for r1->y1 and r2->y1   */
-    int r2y1;
-    int new_size;
-    int numRects;
-
-    /*
-     * Break any region computed from a broken region
-     */
-    if (PIXREGION_NAR (reg1) || PIXREGION_NAR (reg2))
-       return pepper_break (new_reg);\r
-
-    /*
-     * Initialization:
-     * set r1, r2, r1_end and r2_end appropriately, save the rectangles
-     * of the destination region until the end in case it's one of
-     * the two source regions, then mark the "new" region empty, allocating
-     * another array of rectangles for it to use.
-     */
-
-    r1 = PIXREGION_RECTS (reg1);
-    new_size = PIXREGION_NUMRECTS (reg1);
-    r1_end = r1 + new_size;
-
-    numRects = PIXREGION_NUMRECTS (reg2);
-    r2 = PIXREGION_RECTS (reg2);
-    r2_end = r2 + numRects;
-    
-    critical_if_fail (r1 != r1_end);
-    critical_if_fail (r2 != r2_end);
-
-    old_data = (pepper_region_data_t *)NULL;\r
-
-    if (((new_reg == reg1) && (new_size > 1)) ||
-        ((new_reg == reg2) && (numRects > 1)))
-    {
-        old_data = new_reg->data;
-        new_reg->data = pepper_region_empty_data;\r
-    }
+       pepper_box_t *r1;                       /* Pointer into first region     */
+       pepper_box_t *r2;                       /* Pointer into 2d region      */
+       pepper_box_t *r1_end;           /* End of 1st region       */
+       pepper_box_t *r2_end;           /* End of 2d region            */
+       int ybot;                                       /* Bottom of intersection        */
+       int ytop;                                       /* Top of intersection       */
+       pepper_region_data_t *old_data; /* Old data for new_reg        */
+       int prev_band;                          /* Index of start of
+                                                                * previous band in new_reg       */
+       int cur_band;                           /* Index of start of current
+                                                                * band in new_reg           */
+       pepper_box_t *r1_band_end;      /* End of current band in r1     */
+       pepper_box_t *r2_band_end;      /* End of current band in r2     */
+       int top;                                        /* Top of non-overlapping band   */
+       int bot;                                        /* Bottom of non-overlapping band */
+       int r1y1;                                       /* Temps for r1->y1 and r2->y1   */
+       int r2y1;
+       int new_size;
+       int numRects;
+
+       /*
+        * Break any region computed from a broken region
+        */
+       if (PIXREGION_NAR(reg1) || PIXREGION_NAR(reg2))
+               return pepper_break(new_reg);
+
+       /*
+        * Initialization:
+        *  set r1, r2, r1_end and r2_end appropriately, save the rectangles
+        * of the destination region until the end in case it's one of
+        * the two source regions, then mark the "new" region empty, allocating
+        * another array of rectangles for it to use.
+        */
 
-    /* guess at new size */
-    if (numRects > new_size)
-       new_size = numRects;
+       r1 = PIXREGION_RECTS(reg1);
+       new_size = PIXREGION_NUMRECTS(reg1);
+       r1_end = r1 + new_size;
 
-    new_size <<= 1;
+       numRects = PIXREGION_NUMRECTS(reg2);
+       r2 = PIXREGION_RECTS(reg2);
+       r2_end = r2 + numRects;
 
-    if (!new_reg->data)
-       new_reg->data = pepper_region_empty_data;\r
-    else if (new_reg->data->size)
-       new_reg->data->numRects = 0;
+       critical_if_fail(r1 != r1_end);
+       critical_if_fail(r2 != r2_end);
 
-    if (new_size > new_reg->data->size)
-    {
-        if (!pepper_rect_alloc (new_reg, new_size))\r
-        {
-            free (old_data);
-            return PEPPER_FALSE;\r
+       old_data = (pepper_region_data_t *) NULL;
+
+       if (((new_reg == reg1) && (new_size > 1)) ||
+               ((new_reg == reg2) && (numRects > 1))) {
+               old_data = new_reg->data;
+               new_reg->data = pepper_region_empty_data;
        }
-    }
 
-    /*
-     * Initialize ybot.
-     * In the upcoming loop, ybot and ytop serve different functions depending
-     * on whether the band being handled is an overlapping or non-overlapping
-     * band.
-     *  In the case of a non-overlapping band (only one of the regions
-     * has points in the band), ybot is the bottom of the most recent
-     * intersection and thus clips the top of the rectangles in that band.
-     * ytop is the top of the next intersection between the two regions and
-     * serves to clip the bottom of the rectangles in the current band.
-     * For an overlapping band (where the two regions intersect), ytop clips
-     * the top of the rectangles of both regions and ybot clips the bottoms.
-     */
-
-    ybot = PEPPER_MIN (r1->y1, r2->y1);\r
-
-    /*
-     * prev_band serves to mark the start of the previous band so rectangles
-     * can be coalesced into larger rectangles. qv. pepper_coalesce, above.\r
-     * In the beginning, there is no previous band, so prev_band == cur_band
-     * (cur_band is set later on, of course, but the first band will always
-     * start at index 0). prev_band and cur_band must be indices because of
-     * the possible expansion, and resultant moving, of the new region's
-     * array of rectangles.
-     */
-    prev_band = 0;
-
-    do
-    {
-        /*
-        * This algorithm proceeds one source-band (as opposed to a
-        * destination band, which is determined by where the two regions
-        * intersect) at a time. r1_band_end and r2_band_end serve to mark the
-        * rectangle after the last one in the current band for their
-        * respective regions.
+       /* guess at new size */
+       if (numRects > new_size)
+               new_size = numRects;
+
+       new_size <<= 1;
+
+       if (!new_reg->data)
+               new_reg->data = pepper_region_empty_data;
+       else if (new_reg->data->size)
+               new_reg->data->numRects = 0;
+
+       if (new_size > new_reg->data->size) {
+               if (!pepper_rect_alloc(new_reg, new_size)) {
+                       free(old_data);
+                       return PEPPER_FALSE;
+               }
+       }
+
+       /*
+        * Initialize ybot.
+        * In the upcoming loop, ybot and ytop serve different functions depending
+        * on whether the band being handled is an overlapping or non-overlapping
+        * band.
+        *  In the case of a non-overlapping band (only one of the regions
+        * has points in the band), ybot is the bottom of the most recent
+        * intersection and thus clips the top of the rectangles in that band.
+        * ytop is the top of the next intersection between the two regions and
+        * serves to clip the bottom of the rectangles in the current band.
+        *  For an overlapping band (where the two regions intersect), ytop clips
+        * the top of the rectangles of both regions and ybot clips the bottoms.
         */
-        critical_if_fail (r1 != r1_end);
-        critical_if_fail (r2 != r2_end);
 
-        FIND_BAND (r1, r1_band_end, r1_end, r1y1);
-        FIND_BAND (r2, r2_band_end, r2_end, r2y1);
+       ybot = PEPPER_MIN(r1->y1, r2->y1);
 
-        /*
-        * First handle the band that doesn't intersect, if any.
-        *
-        * Note that attention is restricted to one band in the
-        * non-intersecting region at once, so if a region has n
-        * bands between the current position and the next place it overlaps
-        * the other, this entire loop will be passed through n times.
+       /*
+        * prev_band serves to mark the start of the previous band so rectangles
+        * can be coalesced into larger rectangles. qv. pepper_coalesce, above.
+        * In the beginning, there is no previous band, so prev_band == cur_band
+        * (cur_band is set later on, of course, but the first band will always
+        * start at index 0). prev_band and cur_band must be indices because of
+        * the possible expansion, and resultant moving, of the new region's
+        * array of rectangles.
         */
-        if (r1y1 < r2y1)
-        {
-            if (append_non1)
-            {
-                top = PEPPER_MAX (r1y1, ybot);\r
-                bot = PEPPER_MIN (r1->y2, r2y1);\r
-                if (top != bot)
-                {
-                    cur_band = new_reg->data->numRects;
-                    if (!pepper_region_append_non_o (new_reg, r1, r1_band_end, top, bot))\r
-                       goto bail;
-                    COALESCE (new_reg, prev_band, cur_band);
+       prev_band = 0;
+
+       do {
+               /*
+                * This algorithm proceeds one source-band (as opposed to a
+                * destination band, which is determined by where the two regions
+                * intersect) at a time. r1_band_end and r2_band_end serve to mark the
+                * rectangle after the last one in the current band for their
+                * respective regions.
+                */
+               critical_if_fail(r1 != r1_end);
+               critical_if_fail(r2 != r2_end);
+
+               FIND_BAND(r1, r1_band_end, r1_end, r1y1);
+               FIND_BAND(r2, r2_band_end, r2_end, r2y1);
+
+               /*
+                * First handle the band that doesn't intersect, if any.
+                *
+                * Note that attention is restricted to one band in the
+                * non-intersecting region at once, so if a region has n
+                * bands between the current position and the next place it overlaps
+                * the other, this entire loop will be passed through n times.
+                */
+               if (r1y1 < r2y1) {
+                       if (append_non1) {
+                               top = PEPPER_MAX(r1y1, ybot);
+                               bot = PEPPER_MIN(r1->y2, r2y1);
+                               if (top != bot) {
+                                       cur_band = new_reg->data->numRects;
+                                       if (!pepper_region_append_non_o
+                                               (new_reg, r1, r1_band_end, top, bot))
+                                               goto bail;
+                                       COALESCE(new_reg, prev_band, cur_band);
+                               }
+                       }
+                       ytop = r2y1;
+               } else if (r2y1 < r1y1) {
+                       if (append_non2) {
+                               top = PEPPER_MAX(r2y1, ybot);
+                               bot = PEPPER_MIN(r2->y2, r1y1);
+
+                               if (top != bot) {
+                                       cur_band = new_reg->data->numRects;
+
+                                       if (!pepper_region_append_non_o
+                                               (new_reg, r2, r2_band_end, top, bot))
+                                               goto bail;
+
+                                       COALESCE(new_reg, prev_band, cur_band);
+                               }
+                       }
+                       ytop = r1y1;
+               } else {
+                       ytop = r1y1;
                }
-           }
-            ytop = r2y1;
-       }
-        else if (r2y1 < r1y1)
-        {
-            if (append_non2)
-            {
-                top = PEPPER_MAX (r2y1, ybot);\r
-                bot = PEPPER_MIN (r2->y2, r1y1);\r
-               
-                if (top != bot)
-                {
-                    cur_band = new_reg->data->numRects;
-
-                    if (!pepper_region_append_non_o (new_reg, r2, r2_band_end, top, bot))\r
-                       goto bail;
 
-                    COALESCE (new_reg, prev_band, cur_band);
+               /*
+                * Now see if we've hit an intersecting band. The two bands only
+                * intersect if ybot > ytop
+                */
+               ybot = PEPPER_MIN(r1->y2, r2->y2);
+               if (ybot > ytop) {
+                       cur_band = new_reg->data->numRects;
+
+                       if (!(*overlap_func) (new_reg,
+                                                                 r1, r1_band_end,
+                                                                 r2, r2_band_end, ytop, ybot)) {
+                               goto bail;
+                       }
+
+                       COALESCE(new_reg, prev_band, cur_band);
                }
-           }
-            ytop = r1y1;
-       }
-        else
-        {
-            ytop = r1y1;
-       }
 
-        /*
-        * Now see if we've hit an intersecting band. The two bands only
-        * intersect if ybot > ytop
-        */
-        ybot = PEPPER_MIN (r1->y2, r2->y2);\r
-        if (ybot > ytop)
-        {
-            cur_band = new_reg->data->numRects;
-
-            if (!(*overlap_func)(new_reg,
-                                 r1, r1_band_end,
-                                 r2, r2_band_end,
-                                 ytop, ybot))
-           {
-               goto bail;
-           }
-           
-            COALESCE (new_reg, prev_band, cur_band);
+               /*
+                * If we've finished with a band (y2 == ybot) we skip forward
+                * in the region to the next band.
+                */
+               if (r1->y2 == ybot)
+                       r1 = r1_band_end;
+
+               if (r2->y2 == ybot)
+                       r2 = r2_band_end;
+
        }
+       while (r1 != r1_end && r2 != r2_end);
 
-        /*
-        * If we've finished with a band (y2 == ybot) we skip forward
-        * in the region to the next band.
+       /*
+        * Deal with whichever region (if any) still has rectangles left.
+        *
+        * We only need to worry about banding and coalescing for the very first
+        * band left.  After that, we can just group all remaining boxes,
+        * regardless of how many bands, into one final append to the list.
         */
-        if (r1->y2 == ybot)
-           r1 = r1_band_end;
 
-        if (r2->y2 == ybot)
-           r2 = r2_band_end;
+       if ((r1 != r1_end) && append_non1) {
+               /* Do first non_overlap1Func call, which may be able to coalesce */
+               FIND_BAND(r1, r1_band_end, r1_end, r1y1);
 
-    }
-    while (r1 != r1_end && r2 != r2_end);
-
-    /*
-     * Deal with whichever region (if any) still has rectangles left.
-     *
-     * We only need to worry about banding and coalescing for the very first
-     * band left.  After that, we can just group all remaining boxes,
-     * regardless of how many bands, into one final append to the list.
-     */
-
-    if ((r1 != r1_end) && append_non1)
-    {
-        /* Do first non_overlap1Func call, which may be able to coalesce */
-        FIND_BAND (r1, r1_band_end, r1_end, r1y1);
-       
-        cur_band = new_reg->data->numRects;
-       
-        if (!pepper_region_append_non_o (new_reg,\r
-                                         r1, r1_band_end,
-                                         PEPPER_MAX (r1y1, ybot), r1->y2))\r
-       {
-           goto bail;
-       }
-       
-        COALESCE (new_reg, prev_band, cur_band);
+               cur_band = new_reg->data->numRects;
 
-        /* Just append the rest of the boxes  */
-        APPEND_REGIONS (new_reg, r1_band_end, r1_end);
-    }
-    else if ((r2 != r2_end) && append_non2)
-    {
-        /* Do first non_overlap2Func call, which may be able to coalesce */
-        FIND_BAND (r2, r2_band_end, r2_end, r2y1);
-
-       cur_band = new_reg->data->numRects;
-
-        if (!pepper_region_append_non_o (new_reg,\r
-                                         r2, r2_band_end,
-                                         PEPPER_MAX (r2y1, ybot), r2->y2))\r
-       {
-           goto bail;
-       }
+               if (!pepper_region_append_non_o(new_reg,
+                                                                               r1, r1_band_end,
+                                                                               PEPPER_MAX(r1y1, ybot), r1->y2)) {
+                       goto bail;
+               }
 
-        COALESCE (new_reg, prev_band, cur_band);
+               COALESCE(new_reg, prev_band, cur_band);
 
-        /* Append rest of boxes */
-        APPEND_REGIONS (new_reg, r2_band_end, r2_end);
-    }
+               /* Just append the rest of the boxes  */
+               APPEND_REGIONS(new_reg, r1_band_end, r1_end);
+       } else if ((r2 != r2_end) && append_non2) {
+               /* Do first non_overlap2Func call, which may be able to coalesce */
+               FIND_BAND(r2, r2_band_end, r2_end, r2y1);
 
-    free (old_data);
+               cur_band = new_reg->data->numRects;
 
-    if (!(numRects = new_reg->data->numRects))
-    {
-        FREE_DATA (new_reg);
-        new_reg->data = pepper_region_empty_data;\r
-    }
-    else if (numRects == 1)
-    {
-        new_reg->extents = *PIXREGION_BOXPTR (new_reg);
-        FREE_DATA (new_reg);
-        new_reg->data = (pepper_region_data_t *)NULL;\r
-    }
-    else
-    {
-        DOWNSIZE (new_reg, numRects);
-    }
+               if (!pepper_region_append_non_o(new_reg,
+                                                                               r2, r2_band_end,
+                                                                               PEPPER_MAX(r2y1, ybot), r2->y2)) {
+                       goto bail;
+               }
 
-    return PEPPER_TRUE;\r
+               COALESCE(new_reg, prev_band, cur_band);
+
+               /* Append rest of boxes */
+               APPEND_REGIONS(new_reg, r2_band_end, r2_end);
+       }
+
+       free(old_data);
+
+       if (!(numRects = new_reg->data->numRects)) {
+               FREE_DATA(new_reg);
+               new_reg->data = pepper_region_empty_data;
+       } else if (numRects == 1) {
+               new_reg->extents = *PIXREGION_BOXPTR(new_reg);
+               FREE_DATA(new_reg);
+               new_reg->data = (pepper_region_data_t *) NULL;
+       } else {
+               DOWNSIZE(new_reg, numRects);
+       }
 
-bail:
-    free (old_data);
+       return PEPPER_TRUE;
 
-    return pepper_break (new_reg);\r
+  bail:
+       free(old_data);
+
+       return pepper_break(new_reg);
 }
 
 /*-
  *-----------------------------------------------------------------------
- * pepper_set_extents --\r
+ * pepper_set_extents --
  *     Reset the extents of a region to what they should be. Called by
- *     pepper_region_subtract and pepper_region_intersect as they can't\r
- *      figure it out along the way or do so easily, as pepper_region_union can.\r
+ *     pepper_region_subtract and pepper_region_intersect as they can't
+ *      figure it out along the way or do so easily, as pepper_region_union can.
  *
  * Results:
  *     None.
@@ -1090,47 +1042,45 @@ bail:
  *-----------------------------------------------------------------------
  */
 static void
-pepper_set_extents (pepper_region_t *region)\r
+pepper_set_extents(pepper_region_t * region)
 {
-    pepper_box_t *box, *box_end;\r
+       pepper_box_t *box, *box_end;
 
-    if (!region->data)
-       return;
+       if (!region->data)
+               return;
 
-    if (!region->data->size)
-    {
-        region->extents.x2 = region->extents.x1;
-        region->extents.y2 = region->extents.y1;
-        return;
-    }
+       if (!region->data->size) {
+               region->extents.x2 = region->extents.x1;
+               region->extents.y2 = region->extents.y1;
+               return;
+       }
 
-    box = PIXREGION_BOXPTR (region);
-    box_end = PIXREGION_END (region);
-
-    /*
-     * Since box is the first rectangle in the region, it must have the
-     * smallest y1 and since box_end is the last rectangle in the region,
-     * it must have the largest y2, because of banding. Initialize x1 and
-     * x2 from  box and box_end, resp., as good things to initialize them
-     * to...
-     */
-    region->extents.x1 = box->x1;
-    region->extents.y1 = box->y1;
-    region->extents.x2 = box_end->x2;
-    region->extents.y2 = box_end->y2;
-
-    critical_if_fail (region->extents.y1 < region->extents.y2);
-
-    while (box <= box_end)
-    {
-        if (box->x1 < region->extents.x1)
-           region->extents.x1 = box->x1;
-        if (box->x2 > region->extents.x2)
-           region->extents.x2 = box->x2;
-        box++;
-    }
+       box = PIXREGION_BOXPTR(region);
+       box_end = PIXREGION_END(region);
 
-    critical_if_fail (region->extents.x1 < region->extents.x2);
+       /*
+        * Since box is the first rectangle in the region, it must have the
+        * smallest y1 and since box_end is the last rectangle in the region,
+        * it must have the largest y2, because of banding. Initialize x1 and
+        * x2 from  box and box_end, resp., as good things to initialize them
+        * to...
+        */
+       region->extents.x1 = box->x1;
+       region->extents.y1 = box->y1;
+       region->extents.x2 = box_end->x2;
+       region->extents.y2 = box_end->y2;
+
+       critical_if_fail(region->extents.y1 < region->extents.y2);
+
+       while (box <= box_end) {
+               if (box->x1 < region->extents.x1)
+                       region->extents.x1 = box->x1;
+               if (box->x2 > region->extents.x2)
+                       region->extents.x2 = box->x2;
+               box++;
+       }
+
+       critical_if_fail(region->extents.x1 < region->extents.x2);
 }
 
 /*======================================================================
@@ -1138,130 +1088,111 @@ pepper_set_extents (pepper_region_t *region)
  *====================================================================*/
 /*-
  *-----------------------------------------------------------------------
- * pepper_region_intersect_o --\r
- *     Handle an overlapping band for pepper_region_intersect.\r
+ * pepper_region_intersect_o --
+ *     Handle an overlapping band for pepper_region_intersect.
  *
  * Results:
- *     PEPPER_TRUE if successful.\r
+ *     PEPPER_TRUE if successful.
  *
  * Side Effects:
  *     Rectangles may be added to the region.
  *
  *-----------------------------------------------------------------------
  */
-/*ARGSUSED*/
-static pepper_bool_t\r
-pepper_region_intersect_o (pepper_region_t *region,\r
-                           pepper_box_t *   r1,\r
-                           pepper_box_t *   r1_end,\r
-                           pepper_box_t *   r2,\r
-                           pepper_box_t *   r2_end,\r
-                           int            y1,
-                           int            y2)
+ /*ARGSUSED*/ static pepper_bool_t
+pepper_region_intersect_o(pepper_region_t * region,
+                                                 pepper_box_t * r1,
+                                                 pepper_box_t * r1_end,
+                                                 pepper_box_t * r2,
+                                                 pepper_box_t * r2_end, int y1, int y2)
 {
-    int x1;
-    int x2;
-    pepper_box_t *        next_rect;\r
+       int x1;
+       int x2;
+       pepper_box_t *next_rect;
 
-    next_rect = PIXREGION_TOP (region);
+       next_rect = PIXREGION_TOP(region);
 
-    critical_if_fail (y1 < y2);
-    critical_if_fail (r1 != r1_end && r2 != r2_end);
+       critical_if_fail(y1 < y2);
+       critical_if_fail(r1 != r1_end && r2 != r2_end);
 
-    do
-    {
-        x1 = PEPPER_MAX (r1->x1, r2->x1);\r
-        x2 = PEPPER_MIN (r1->x2, r2->x2);\r
+       do {
+               x1 = PEPPER_MAX(r1->x1, r2->x1);
+               x2 = PEPPER_MIN(r1->x2, r2->x2);
 
-        /*
-        * If there's any overlap between the two rectangles, add that
-        * overlap to the new region.
-        */
-        if (x1 < x2)
-           NEWRECT (region, next_rect, x1, y1, x2, y2);
+               /*
+                * If there's any overlap between the two rectangles, add that
+                * overlap to the new region.
+                */
+               if (x1 < x2)
+                       NEWRECT(region, next_rect, x1, y1, x2, y2);
 
-        /*
-        * Advance the pointer(s) with the leftmost right side, since the next
-        * rectangle on that list may still overlap the other region's
-        * current rectangle.
-        */
-        if (r1->x2 == x2)
-        {
-            r1++;
-       }
-        if (r2->x2 == x2)
-        {
-            r2++;
+               /*
+                * Advance the pointer(s) with the leftmost right side, since the next
+                * rectangle on that list may still overlap the other region's
+                * current rectangle.
+                */
+               if (r1->x2 == x2) {
+                       r1++;
+               }
+               if (r2->x2 == x2) {
+                       r2++;
+               }
        }
-    }
-    while ((r1 != r1_end) && (r2 != r2_end));
+       while ((r1 != r1_end) && (r2 != r2_end));
 
-    return PEPPER_TRUE;\r
+       return PEPPER_TRUE;
 }
 
-PEPPER_API pepper_bool_t\r
-pepper_region_intersect (pepper_region_t *     new_reg,\r
-                     pepper_region_t *        reg1,\r
-                     pepper_region_t *        reg2)\r
+PEPPER_API pepper_bool_t
+pepper_region_intersect(pepper_region_t * new_reg,
+                                               pepper_region_t * reg1, pepper_region_t * reg2)
 {
-    GOOD (reg1);
-    GOOD (reg2);
-    GOOD (new_reg);
-
-    /* check for trivial reject */
-    if (PIXREGION_NIL (reg1) || PIXREGION_NIL (reg2) ||
-        !EXTENTCHECK (&reg1->extents, &reg2->extents))
-    {
-        /* Covers about 20% of all cases */
-        FREE_DATA (new_reg);
-        new_reg->extents.x2 = new_reg->extents.x1;
-        new_reg->extents.y2 = new_reg->extents.y1;
-        if (PIXREGION_NAR (reg1) || PIXREGION_NAR (reg2))
-        {
-            new_reg->data = pepper_broken_data;\r
-            return PEPPER_FALSE;\r
-       }
-        else
-       {
-           new_reg->data = pepper_region_empty_data;\r
+       GOOD(reg1);
+       GOOD(reg2);
+       GOOD(new_reg);
+
+       /* check for trivial reject */
+       if (PIXREGION_NIL(reg1) || PIXREGION_NIL(reg2) ||
+               !EXTENTCHECK(&reg1->extents, &reg2->extents)) {
+               /* Covers about 20% of all cases */
+               FREE_DATA(new_reg);
+               new_reg->extents.x2 = new_reg->extents.x1;
+               new_reg->extents.y2 = new_reg->extents.y1;
+               if (PIXREGION_NAR(reg1) || PIXREGION_NAR(reg2)) {
+                       new_reg->data = pepper_broken_data;
+                       return PEPPER_FALSE;
+               } else {
+                       new_reg->data = pepper_region_empty_data;
+               }
+       } else if (!reg1->data && !reg2->data) {
+               /* Covers about 80% of cases that aren't trivially rejected */
+               new_reg->extents.x1 = PEPPER_MAX(reg1->extents.x1, reg2->extents.x1);
+               new_reg->extents.y1 = PEPPER_MAX(reg1->extents.y1, reg2->extents.y1);
+               new_reg->extents.x2 = PEPPER_MIN(reg1->extents.x2, reg2->extents.x2);
+               new_reg->extents.y2 = PEPPER_MIN(reg1->extents.y2, reg2->extents.y2);
+
+               FREE_DATA(new_reg);
+
+               new_reg->data = (pepper_region_data_t *) NULL;
+       } else if (!reg2->data && SUBSUMES(&reg2->extents, &reg1->extents)) {
+               return pepper_region_copy(new_reg, reg1);
+       } else if (!reg1->data && SUBSUMES(&reg1->extents, &reg2->extents)) {
+               return pepper_region_copy(new_reg, reg2);
+       } else if (reg1 == reg2) {
+               return pepper_region_copy(new_reg, reg1);
+       } else {
+               /* General purpose intersection */
+
+               if (!pepper_op
+                       (new_reg, reg1, reg2, pepper_region_intersect_o, PEPPER_FALSE,
+                        PEPPER_FALSE))
+                       return PEPPER_FALSE;
+
+               pepper_set_extents(new_reg);
        }
-    }
-    else if (!reg1->data && !reg2->data)
-    {
-        /* Covers about 80% of cases that aren't trivially rejected */
-        new_reg->extents.x1 = PEPPER_MAX (reg1->extents.x1, reg2->extents.x1);\r
-        new_reg->extents.y1 = PEPPER_MAX (reg1->extents.y1, reg2->extents.y1);\r
-        new_reg->extents.x2 = PEPPER_MIN (reg1->extents.x2, reg2->extents.x2);\r
-        new_reg->extents.y2 = PEPPER_MIN (reg1->extents.y2, reg2->extents.y2);\r
-
-        FREE_DATA (new_reg);
 
-       new_reg->data = (pepper_region_data_t *)NULL;\r
-    }
-    else if (!reg2->data && SUBSUMES (&reg2->extents, &reg1->extents))
-    {
-        return pepper_region_copy (new_reg, reg1);\r
-    }
-    else if (!reg1->data && SUBSUMES (&reg1->extents, &reg2->extents))
-    {
-        return pepper_region_copy (new_reg, reg2);\r
-    }
-    else if (reg1 == reg2)
-    {
-        return pepper_region_copy (new_reg, reg1);\r
-    }
-    else
-    {
-        /* General purpose intersection */
-
-        if (!pepper_op (new_reg, reg1, reg2, pepper_region_intersect_o, PEPPER_FALSE, PEPPER_FALSE))\r
-           return PEPPER_FALSE;\r
-       
-        pepper_set_extents (new_reg);\r
-    }
-
-    GOOD (new_reg);
-    return(PEPPER_TRUE);\r
+       GOOD(new_reg);
+       return (PEPPER_TRUE);
 }
 
 #define MERGERECT(r)                                                   \
@@ -1289,211 +1220,193 @@ pepper_region_intersect (pepper_region_t *     new_reg,
 
 /*-
  *-----------------------------------------------------------------------
- * pepper_region_union_o --\r
+ * pepper_region_union_o --
  *     Handle an overlapping band for the union operation. Picks the
  *     left-most rectangle each time and merges it into the region.
  *
  * Results:
- *     PEPPER_TRUE if successful.\r
+ *     PEPPER_TRUE if successful.
  *
  * Side Effects:
  *     region is overwritten.
- *     overlap is set to PEPPER_TRUE if any boxes overlap.\r
+ *     overlap is set to PEPPER_TRUE if any boxes overlap.
  *
  *-----------------------------------------------------------------------
  */
-static pepper_bool_t\r
-pepper_region_union_o (pepper_region_t *region,\r
-                      pepper_box_t *   r1,\r
-                      pepper_box_t *   r1_end,\r
-                      pepper_box_t *   r2,\r
-                      pepper_box_t *   r2_end,\r
-                      int            y1,
-                      int            y2)
+static pepper_bool_t
+pepper_region_union_o(pepper_region_t * region,
+                                         pepper_box_t * r1,
+                                         pepper_box_t * r1_end,
+                                         pepper_box_t * r2,
+                                         pepper_box_t * r2_end, int y1, int y2)
 {
-    pepper_box_t *next_rect;\r
-    int x1;            /* left and right side of current union */
-    int x2;
+       pepper_box_t *next_rect;
+       int x1;                                         /* left and right side of current union */
+       int x2;
 
-    critical_if_fail (y1 < y2);
-    critical_if_fail (r1 != r1_end && r2 != r2_end);
+       critical_if_fail(y1 < y2);
+       critical_if_fail(r1 != r1_end && r2 != r2_end);
 
-    next_rect = PIXREGION_TOP (region);
+       next_rect = PIXREGION_TOP(region);
 
-    /* Start off current rectangle */
-    if (r1->x1 < r2->x1)
-    {
-        x1 = r1->x1;
-        x2 = r1->x2;
-        r1++;
-    }
-    else
-    {
-        x1 = r2->x1;
-        x2 = r2->x2;
-        r2++;
-    }
-    while (r1 != r1_end && r2 != r2_end)
-    {
-        if (r1->x1 < r2->x1)
-           MERGERECT (r1);
-       else
-           MERGERECT (r2);
-    }
-
-    /* Finish off whoever (if any) is left */
-    if (r1 != r1_end)
-    {
-        do
-        {
-            MERGERECT (r1);
+       /* Start off current rectangle */
+       if (r1->x1 < r2->x1) {
+               x1 = r1->x1;
+               x2 = r1->x2;
+               r1++;
+       } else {
+               x1 = r2->x1;
+               x2 = r2->x2;
+               r2++;
        }
-        while (r1 != r1_end);
-    }
-    else if (r2 != r2_end)
-    {
-        do
-        {
-            MERGERECT (r2);
+       while (r1 != r1_end && r2 != r2_end) {
+               if (r1->x1 < r2->x1)
+                       MERGERECT(r1);
+               else
+                       MERGERECT(r2);
+       }
+
+       /* Finish off whoever (if any) is left */
+       if (r1 != r1_end) {
+               do {
+                       MERGERECT(r1);
+               }
+               while (r1 != r1_end);
+       } else if (r2 != r2_end) {
+               do {
+                       MERGERECT(r2);
+               }
+               while (r2 != r2_end);
        }
-        while (r2 != r2_end);
-    }
 
-    /* Add current rectangle */
-    NEWRECT (region, next_rect, x1, y1, x2, y2);
+       /* Add current rectangle */
+       NEWRECT(region, next_rect, x1, y1, x2, y2);
 
-    return PEPPER_TRUE;\r
+       return PEPPER_TRUE;
 }
 
-PEPPER_API pepper_bool_t\r
-pepper_region_intersect_rect (pepper_region_t *dest,\r
-                        pepper_region_t *source,\r
-                        int x, int y,
-                        unsigned int width,
-                        unsigned int height)
+PEPPER_API pepper_bool_t
+pepper_region_intersect_rect(pepper_region_t * dest,
+                                                        pepper_region_t * source,
+                                                        int x, int y,
+                                                        unsigned int width, unsigned int height)
 {
-    pepper_region_t region;\r
+       pepper_region_t region;
 
-    region.data = NULL;
-    region.extents.x1 = x;
-    region.extents.y1 = y;
-    region.extents.x2 = x + width;
-    region.extents.y2 = y + height;
+       region.data = NULL;
+       region.extents.x1 = x;
+       region.extents.y1 = y;
+       region.extents.x2 = x + width;
+       region.extents.y2 = y + height;
 
-    return pepper_region_intersect (dest, source, &region);\r
+       return pepper_region_intersect(dest, source, &region);
 }
 
 /* Convenience function for performing union of region with a
  * single rectangle
  */
-PEPPER_API pepper_bool_t\r
-pepper_region_union_rect (pepper_region_t *dest,\r
-                      pepper_region_t *source,\r
-                      int            x,
-                     int            y,
-                      unsigned int   width,
-                     unsigned int   height)
+PEPPER_API pepper_bool_t
+pepper_region_union_rect(pepper_region_t * dest,
+                                                pepper_region_t * source,
+                                                int x,
+                                                int y, unsigned int width, unsigned int height)
 {
-    pepper_region_t region;\r
-
-    region.extents.x1 = x;
-    region.extents.y1 = y;
-    region.extents.x2 = x + width;
-    region.extents.y2 = y + height;
-
-    if (!GOOD_RECT (&region.extents))
-    {
-        if (BAD_RECT (&region.extents))
-            PEPPER_ERROR("%s", "Invalid rectangle passed");\r
-       return pepper_region_copy (dest, source);\r
-    }
+       pepper_region_t region;
 
-    region.data = NULL;
+       region.extents.x1 = x;
+       region.extents.y1 = y;
+       region.extents.x2 = x + width;
+       region.extents.y2 = y + height;
+
+       if (!GOOD_RECT(&region.extents)) {
+               if (BAD_RECT(&region.extents))
+                       PEPPER_ERROR("%s", "Invalid rectangle passed");
+               return pepper_region_copy(dest, source);
+       }
 
-    return pepper_region_union (dest, source, &region);\r
+       region.data = NULL;
+
+       return pepper_region_union(dest, source, &region);
 }
 
-PEPPER_API pepper_bool_t\r
-pepper_region_union (pepper_region_t *new_reg,\r
-                 pepper_region_t *reg1,\r
-                 pepper_region_t *reg2)\r
+PEPPER_API pepper_bool_t
+pepper_region_union(pepper_region_t * new_reg,
+                                       pepper_region_t * reg1, pepper_region_t * reg2)
 {
-    /* Return PEPPER_TRUE if some overlap\r
-     * between reg1, reg2
-     */
-    GOOD (reg1);
-    GOOD (reg2);
-    GOOD (new_reg);
-
-    /*  checks all the simple cases */
-
-    /*
-     * Region 1 and 2 are the same
-     */
-    if (reg1 == reg2)
-        return pepper_region_copy (new_reg, reg1);\r
-
-    /*
-     * Region 1 is empty
-     */
-    if (PIXREGION_NIL (reg1))
-    {
-        if (PIXREGION_NAR (reg1))
-           return pepper_break (new_reg);\r
-
-        if (new_reg != reg2)
-           return pepper_region_copy (new_reg, reg2);\r
-
-       return PEPPER_TRUE;\r
-    }
+       /* Return PEPPER_TRUE if some overlap
+        * between reg1, reg2
+        */
+       GOOD(reg1);
+       GOOD(reg2);
+       GOOD(new_reg);
+
+       /*  checks all the simple cases */
 
-    /*
-     * Region 2 is empty
-     */
-    if (PIXREGION_NIL (reg2))
-    {
-        if (PIXREGION_NAR (reg2))
-           return pepper_break (new_reg);\r
+       /*
+        * Region 1 and 2 are the same
+        */
+       if (reg1 == reg2)
+               return pepper_region_copy(new_reg, reg1);
 
-       if (new_reg != reg1)
-           return pepper_region_copy (new_reg, reg1);\r
+       /*
+        * Region 1 is empty
+        */
+       if (PIXREGION_NIL(reg1)) {
+               if (PIXREGION_NAR(reg1))
+                       return pepper_break(new_reg);
 
-       return PEPPER_TRUE;\r
-    }
+               if (new_reg != reg2)
+                       return pepper_region_copy(new_reg, reg2);
 
-    /*
-     * Region 1 completely subsumes region 2
-     */
-    if (!reg1->data && SUBSUMES (&reg1->extents, &reg2->extents))
-    {
-        if (new_reg != reg1)
-           return pepper_region_copy (new_reg, reg1);\r
+               return PEPPER_TRUE;
+       }
 
-       return PEPPER_TRUE;\r
-    }
+       /*
+        * Region 2 is empty
+        */
+       if (PIXREGION_NIL(reg2)) {
+               if (PIXREGION_NAR(reg2))
+                       return pepper_break(new_reg);
 
-    /*
-     * Region 2 completely subsumes region 1
-     */
-    if (!reg2->data && SUBSUMES (&reg2->extents, &reg1->extents))
-    {
-        if (new_reg != reg2)
-           return pepper_region_copy (new_reg, reg2);\r
+               if (new_reg != reg1)
+                       return pepper_region_copy(new_reg, reg1);
 
-       return PEPPER_TRUE;\r
-    }
+               return PEPPER_TRUE;
+       }
+
+       /*
+        * Region 1 completely subsumes region 2
+        */
+       if (!reg1->data && SUBSUMES(&reg1->extents, &reg2->extents)) {
+               if (new_reg != reg1)
+                       return pepper_region_copy(new_reg, reg1);
 
-    if (!pepper_op (new_reg, reg1, reg2, pepper_region_union_o, PEPPER_TRUE, PEPPER_TRUE))\r
-       return PEPPER_FALSE;\r
+               return PEPPER_TRUE;
+       }
 
-    new_reg->extents.x1 = PEPPER_MIN (reg1->extents.x1, reg2->extents.x1);\r
-    new_reg->extents.y1 = PEPPER_MIN (reg1->extents.y1, reg2->extents.y1);\r
-    new_reg->extents.x2 = PEPPER_MAX (reg1->extents.x2, reg2->extents.x2);\r
-    new_reg->extents.y2 = PEPPER_MAX (reg1->extents.y2, reg2->extents.y2);\r
-    
-    GOOD (new_reg);
+       /*
+        * Region 2 completely subsumes region 1
+        */
+       if (!reg2->data && SUBSUMES(&reg2->extents, &reg1->extents)) {
+               if (new_reg != reg2)
+                       return pepper_region_copy(new_reg, reg2);
+
+               return PEPPER_TRUE;
+       }
 
-    return PEPPER_TRUE;\r
+       if (!pepper_op
+               (new_reg, reg1, reg2, pepper_region_union_o, PEPPER_TRUE,
+                PEPPER_TRUE))
+               return PEPPER_FALSE;
+
+       new_reg->extents.x1 = PEPPER_MIN(reg1->extents.x1, reg2->extents.x1);
+       new_reg->extents.y1 = PEPPER_MIN(reg1->extents.y1, reg2->extents.y1);
+       new_reg->extents.x2 = PEPPER_MAX(reg1->extents.x2, reg2->extents.x2);
+       new_reg->extents.y2 = PEPPER_MAX(reg1->extents.y2, reg2->extents.y2);
+
+       GOOD(new_reg);
+
+       return PEPPER_TRUE;
 }
 
 /*======================================================================
@@ -1502,96 +1415,89 @@ pepper_region_union (pepper_region_t *new_reg,
 
 #define EXCHANGE_RECTS(a, b)   \
     {                           \
-        pepper_box_t t;                \\r
+        pepper_box_t t;                \
         t = rects[a];           \
         rects[a] = rects[b];    \
         rects[b] = t;           \
     }
 
 static void
-quick_sort_rects (
-    pepper_box_t rects[],\r
-    int        numRects)
+quick_sort_rects(pepper_box_t rects[], int numRects)
 {
-    int y1;
-    int x1;
-    int i, j;
-    pepper_box_t *r;\r
-
-    /* Always called with numRects > 1 */
-
-    do
-    {
-        if (numRects == 2)
-        {
-            if (rects[0].y1 > rects[1].y1 ||
-                (rects[0].y1 == rects[1].y1 && rects[0].x1 > rects[1].x1))
-           {
-               EXCHANGE_RECTS (0, 1);
-           }
-
-            return;
-       }
+       int y1;
+       int x1;
+       int i, j;
+       pepper_box_t *r;
 
-        /* Choose partition element, stick in location 0 */
-        EXCHANGE_RECTS (0, numRects >> 1);
-        y1 = rects[0].y1;
-        x1 = rects[0].x1;
-
-        /* Partition array */
-        i = 0;
-        j = numRects;
-
-        do
-        {
-            r = &(rects[i]);
-            do
-            {
-                r++;
-                i++;
-           }
-           while (i != numRects && (r->y1 < y1 || (r->y1 == y1 && r->x1 < x1)));
-
-           r = &(rects[j]);
-            do
-            {
-                r--;
-                j--;
-           }
-            while (y1 < r->y1 || (y1 == r->y1 && x1 < r->x1));
-           
-            if (i < j)
-               EXCHANGE_RECTS (i, j);
-       }
-        while (i < j);
+       /* Always called with numRects > 1 */
 
-        /* Move partition element back to middle */
-        EXCHANGE_RECTS (0, j);
+       do {
+               if (numRects == 2) {
+                       if (rects[0].y1 > rects[1].y1 ||
+                               (rects[0].y1 == rects[1].y1 && rects[0].x1 > rects[1].x1)) {
+                               EXCHANGE_RECTS(0, 1);
+                       }
 
-        /* Recurse */
-        if (numRects - j - 1 > 1)
-           quick_sort_rects (&rects[j + 1], numRects - j - 1);
+                       return;
+               }
 
-        numRects = j;
-    }
-    while (numRects > 1);
+               /* Choose partition element, stick in location 0 */
+               EXCHANGE_RECTS(0, numRects >> 1);
+               y1 = rects[0].y1;
+               x1 = rects[0].x1;
+
+               /* Partition array */
+               i = 0;
+               j = numRects;
+
+               do {
+                       r = &(rects[i]);
+                       do {
+                               r++;
+                               i++;
+                       }
+                       while (i != numRects
+                                  && (r->y1 < y1 || (r->y1 == y1 && r->x1 < x1)));
+
+                       r = &(rects[j]);
+                       do {
+                               r--;
+                               j--;
+                       }
+                       while (y1 < r->y1 || (y1 == r->y1 && x1 < r->x1));
+
+                       if (i < j)
+                               EXCHANGE_RECTS(i, j);
+               }
+               while (i < j);
+
+               /* Move partition element back to middle */
+               EXCHANGE_RECTS(0, j);
+
+               /* Recurse */
+               if (numRects - j - 1 > 1)
+                       quick_sort_rects(&rects[j + 1], numRects - j - 1);
+
+               numRects = j;
+       }
+       while (numRects > 1);
 }
 
 /*-
  *-----------------------------------------------------------------------
- * pepper_region_validate --\r
+ * pepper_region_validate --
  *
  *      Take a ``region'' which is a non-y-x-banded random collection of
  *      rectangles, and compute a nice region which is the union of all the
  *      rectangles.
  *
  * Results:
- *     PEPPER_TRUE if successful.\r
+ *     PEPPER_TRUE if successful.
  *
  * Side Effects:
  *      The passed-in ``region'' may be modified.
- *     overlap set to PEPPER_TRUE if any retangles overlapped,\r
- *      else PEPPER_FALSE;\r
+ *     overlap set to PEPPER_TRUE if any retangles overlapped,
+ *      else PEPPER_FALSE;
  *
  * Strategy:
  *      Step 1. Sort the rectangles into ascending order with primary key y1
@@ -1604,254 +1510,233 @@ quick_sort_rects (
  *             or a coalescing into 1 box (ala Menus).
  *
  *     Step 3. Merge the separate regions down to a single region by calling
- *             pepper_region_union.  Maximize the work each pepper_region_union call does by using\r
+ *             pepper_region_union.  Maximize the work each pepper_region_union call does by using
  *             a binary merge.
  *
  *-----------------------------------------------------------------------
  */
 
-static pepper_bool_t\r
-validate (pepper_region_t * badreg)\r
+static pepper_bool_t
+validate(pepper_region_t * badreg)
 {
-    /* Descriptor for regions under construction  in Step 2. */
-    typedef struct
-    {
-        pepper_region_t reg;\r
-        int prev_band;
-        int cur_band;
-    } region_info_t;
-
-    region_info_t stack_regions[64];
-
-    int numRects;                   /* Original numRects for badreg        */
-    region_info_t *ri;              /* Array of current regions                    */
-    int num_ri;                     /* Number of entries used in ri        */
-    int size_ri;                    /* Number of entries available in ri    */
-    int i;                          /* Index into rects                            */
-    int j;                          /* Index into ri                       */
-    region_info_t *rit;             /* &ri[j]                              */
-    pepper_region_t *reg;             /* ri[j].reg                         */\r
-    pepper_box_t *box;                /* Current box in rects              */\r
-    pepper_box_t *ri_box;             /* Last box in ri[j].reg             */\r
-    pepper_region_t *hreg;            /* ri[j_half].reg                            */\r
-    pepper_bool_t ret = PEPPER_TRUE;\r
-
-    if (!badreg->data)
-    {
-        GOOD (badreg);
-        return PEPPER_TRUE;\r
-    }
-    
-    numRects = badreg->data->numRects;
-    if (!numRects)
-    {
-        if (PIXREGION_NAR (badreg))
-           return PEPPER_FALSE;\r
-        GOOD (badreg);
-        return PEPPER_TRUE;\r
-    }
-    
-    if (badreg->extents.x1 < badreg->extents.x2)
-    {
-        if ((numRects) == 1)
-        {
-            FREE_DATA (badreg);
-            badreg->data = (pepper_region_data_t *) NULL;\r
+       /* Descriptor for regions under construction  in Step 2. */
+       typedef struct {
+               pepper_region_t reg;
+               int prev_band;
+               int cur_band;
+       } region_info_t;
+
+       region_info_t stack_regions[64];
+
+       int numRects;                           /* Original numRects for badreg     */
+       region_info_t *ri;                      /* Array of current regions         */
+       int num_ri;                                     /* Number of entries used in ri     */
+       int size_ri;                            /* Number of entries available in ri    */
+       int i;                                          /* Index into rects             */
+       int j;                                          /* Index into ri                */
+       region_info_t *rit;                     /* &ri[j]                   */
+       pepper_region_t *reg;           /* ri[j].reg              */
+       pepper_box_t *box;                      /* Current box in rects           */
+       pepper_box_t *ri_box;           /* Last box in ri[j].reg          */
+       pepper_region_t *hreg;          /* ri[j_half].reg             */
+       pepper_bool_t ret = PEPPER_TRUE;
+
+       if (!badreg->data) {
+               GOOD(badreg);
+               return PEPPER_TRUE;
        }
-        else
-        {
-            DOWNSIZE (badreg, numRects);
+
+       numRects = badreg->data->numRects;
+       if (!numRects) {
+               if (PIXREGION_NAR(badreg))
+                       return PEPPER_FALSE;
+               GOOD(badreg);
+               return PEPPER_TRUE;
        }
 
-        GOOD (badreg);
+       if (badreg->extents.x1 < badreg->extents.x2) {
+               if ((numRects) == 1) {
+                       FREE_DATA(badreg);
+                       badreg->data = (pepper_region_data_t *) NULL;
+               } else {
+                       DOWNSIZE(badreg, numRects);
+               }
 
-       return PEPPER_TRUE;\r
-    }
+               GOOD(badreg);
 
-    /* Step 1: Sort the rects array into ascending (y1, x1) order */
-    quick_sort_rects (PIXREGION_BOXPTR (badreg), numRects);
-
-    /* Step 2: Scatter the sorted array into the minimum number of regions */
-
-    /* Set up the first region to be the first rectangle in badreg */
-    /* Note that step 2 code will never overflow the ri[0].reg rects array */
-    ri = stack_regions;
-    size_ri = sizeof (stack_regions) / sizeof (stack_regions[0]);
-    num_ri = 1;
-    ri[0].prev_band = 0;
-    ri[0].cur_band = 0;
-    ri[0].reg = *badreg;
-    box = PIXREGION_BOXPTR (&ri[0].reg);
-    ri[0].reg.extents = *box;
-    ri[0].reg.data->numRects = 1;
-    badreg->extents = *pepper_region_empty_box;\r
-    badreg->data = pepper_region_empty_data;\r
-
-    /* Now scatter rectangles into the minimum set of valid regions.  If the
-     * next rectangle to be added to a region would force an existing rectangle
-     * in the region to be split up in order to maintain y-x banding, just
-     * forget it.  Try the next region.  If it doesn't fit cleanly into any
-     * region, make a new one.
-     */
-
-    for (i = numRects; --i > 0;)
-    {
-        box++;
-        /* Look for a region to append box to */
-        for (j = num_ri, rit = ri; --j >= 0; rit++)
-        {
-            reg = &rit->reg;
-            ri_box = PIXREGION_END (reg);
-
-            if (box->y1 == ri_box->y1 && box->y2 == ri_box->y2)
-            {
-                /* box is in same band as ri_box.  Merge or append it */
-                if (box->x1 <= ri_box->x2)
-                {
-                    /* Merge it with ri_box */
-                    if (box->x2 > ri_box->x2)
-                       ri_box->x2 = box->x2;
+               return PEPPER_TRUE;
+       }
+
+       /* Step 1: Sort the rects array into ascending (y1, x1) order */
+       quick_sort_rects(PIXREGION_BOXPTR(badreg), numRects);
+
+       /* Step 2: Scatter the sorted array into the minimum number of regions */
+
+       /* Set up the first region to be the first rectangle in badreg */
+       /* Note that step 2 code will never overflow the ri[0].reg rects array */
+       ri = stack_regions;
+       size_ri = sizeof(stack_regions) / sizeof(stack_regions[0]);
+       num_ri = 1;
+       ri[0].prev_band = 0;
+       ri[0].cur_band = 0;
+       ri[0].reg = *badreg;
+       box = PIXREGION_BOXPTR(&ri[0].reg);
+       ri[0].reg.extents = *box;
+       ri[0].reg.data->numRects = 1;
+       badreg->extents = *pepper_region_empty_box;
+       badreg->data = pepper_region_empty_data;
+
+       /* Now scatter rectangles into the minimum set of valid regions.  If the
+        * next rectangle to be added to a region would force an existing rectangle
+        * in the region to be split up in order to maintain y-x banding, just
+        * forget it.  Try the next region.  If it doesn't fit cleanly into any
+        * region, make a new one.
+        */
+
+       for (i = numRects; --i > 0;) {
+               box++;
+               /* Look for a region to append box to */
+               for (j = num_ri, rit = ri; --j >= 0; rit++) {
+                       reg = &rit->reg;
+                       ri_box = PIXREGION_END(reg);
+
+                       if (box->y1 == ri_box->y1 && box->y2 == ri_box->y2) {
+                               /* box is in same band as ri_box.  Merge or append it */
+                               if (box->x1 <= ri_box->x2) {
+                                       /* Merge it with ri_box */
+                                       if (box->x2 > ri_box->x2)
+                                               ri_box->x2 = box->x2;
+                               } else {
+                                       RECTALLOC_BAIL(reg, 1, bail);
+                                       *PIXREGION_TOP(reg) = *box;
+                                       reg->data->numRects++;
+                               }
+
+                               goto next_rect; /* So sue me */
+                       } else if (box->y1 >= ri_box->y2) {
+                               /* Put box into new band */
+                               if (reg->extents.x2 < ri_box->x2)
+                                       reg->extents.x2 = ri_box->x2;
+
+                               if (reg->extents.x1 > box->x1)
+                                       reg->extents.x1 = box->x1;
+
+                               COALESCE(reg, rit->prev_band, rit->cur_band);
+                               rit->cur_band = reg->data->numRects;
+                               RECTALLOC_BAIL(reg, 1, bail);
+                               *PIXREGION_TOP(reg) = *box;
+                               reg->data->numRects++;
+
+                               goto next_rect;
+                       }
+                       /* Well, this region was inappropriate.  Try the next one. */
+               }                                               /* for j */
+
+               /* Uh-oh.  No regions were appropriate.  Create a new one. */
+               if (size_ri == num_ri) {
+                       size_t data_size;
+
+                       /* Oops, allocate space for new region information */
+                       size_ri <<= 1;
+
+                       data_size = size_ri * sizeof(region_info_t);
+                       if (data_size / size_ri != sizeof(region_info_t))
+                               goto bail;
+
+                       if (ri == stack_regions) {
+                               rit = malloc(data_size);
+                               if (!rit)
+                                       goto bail;
+                               memcpy(rit, ri, num_ri * sizeof(region_info_t));
+                       } else {
+                               rit = (region_info_t *) realloc(ri, data_size);
+                               if (!rit)
+                                       goto bail;
+                       }
+                       ri = rit;
+                       rit = &ri[num_ri];
                }
-                else
-                {
-                    RECTALLOC_BAIL (reg, 1, bail);
-                    *PIXREGION_TOP (reg) = *box;
-                    reg->data->numRects++;
+               num_ri++;
+               rit->prev_band = 0;
+               rit->cur_band = 0;
+               rit->reg.extents = *box;
+               rit->reg.data = (pepper_region_data_t *) NULL;
+
+               /* MUST force allocation */
+               if (!pepper_rect_alloc(&rit->reg, (i + num_ri) / num_ri))
+                       goto bail;
+
+         next_rect:;
+       }                                                       /* for i */
+
+       /* Make a final pass over each region in order to COALESCE and set
+        * extents.x2 and extents.y2
+        */
+       for (j = num_ri, rit = ri; --j >= 0; rit++) {
+               reg = &rit->reg;
+               ri_box = PIXREGION_END(reg);
+               reg->extents.y2 = ri_box->y2;
+
+               if (reg->extents.x2 < ri_box->x2)
+                       reg->extents.x2 = ri_box->x2;
+
+               COALESCE(reg, rit->prev_band, rit->cur_band);
+
+               if (reg->data->numRects == 1) { /* keep unions happy below */
+                       FREE_DATA(reg);
+                       reg->data = (pepper_region_data_t *) NULL;
                }
-               
-                goto next_rect;   /* So sue me */
-           }
-            else if (box->y1 >= ri_box->y2)
-            {
-                /* Put box into new band */
-                if (reg->extents.x2 < ri_box->x2)
-                   reg->extents.x2 = ri_box->x2;
-               
-                if (reg->extents.x1 > box->x1)
-                   reg->extents.x1 = box->x1;
-               
-                COALESCE (reg, rit->prev_band, rit->cur_band);
-                rit->cur_band = reg->data->numRects;
-                RECTALLOC_BAIL (reg, 1, bail);
-                *PIXREGION_TOP (reg) = *box;
-                reg->data->numRects++;
-
-                goto next_rect;
-           }
-            /* Well, this region was inappropriate.  Try the next one. */
-       } /* for j */
-
-        /* Uh-oh.  No regions were appropriate.  Create a new one. */
-        if (size_ri == num_ri)
-        {
-            size_t data_size;
-
-            /* Oops, allocate space for new region information */
-            size_ri <<= 1;
-
-            data_size = size_ri * sizeof(region_info_t);
-            if (data_size / size_ri != sizeof(region_info_t))
-               goto bail;
-
-            if (ri == stack_regions)
-            {
-                rit = malloc (data_size);
-                if (!rit)
-                   goto bail;
-                memcpy (rit, ri, num_ri * sizeof (region_info_t));
-           }
-            else
-            {
-                rit = (region_info_t *) realloc (ri, data_size);
-                if (!rit)
-                   goto bail;
-           }
-            ri = rit;
-            rit = &ri[num_ri];
-       }
-        num_ri++;
-        rit->prev_band = 0;
-        rit->cur_band = 0;
-        rit->reg.extents = *box;
-        rit->reg.data = (pepper_region_data_t *)NULL;\r
-
-       /* MUST force allocation */
-        if (!pepper_rect_alloc (&rit->reg, (i + num_ri) / num_ri))\r
-           goto bail;
-       
-    next_rect: ;
-    } /* for i */
-
-    /* Make a final pass over each region in order to COALESCE and set
-     * extents.x2 and extents.y2
-     */
-    for (j = num_ri, rit = ri; --j >= 0; rit++)
-    {
-        reg = &rit->reg;
-        ri_box = PIXREGION_END (reg);
-        reg->extents.y2 = ri_box->y2;
-
-        if (reg->extents.x2 < ri_box->x2)
-           reg->extents.x2 = ri_box->x2;
-       
-        COALESCE (reg, rit->prev_band, rit->cur_band);
-
-       if (reg->data->numRects == 1) /* keep unions happy below */
-        {
-            FREE_DATA (reg);
-            reg->data = (pepper_region_data_t *)NULL;\r
        }
-    }
 
-    /* Step 3: Union all regions into a single region */
-    while (num_ri > 1)
-    {
-        int half = num_ri / 2;
-        for (j = num_ri & 1; j < (half + (num_ri & 1)); j++)
-        {
-            reg = &ri[j].reg;
-            hreg = &ri[j + half].reg;
+       /* Step 3: Union all regions into a single region */
+       while (num_ri > 1) {
+               int half = num_ri / 2;
+               for (j = num_ri & 1; j < (half + (num_ri & 1)); j++) {
+                       reg = &ri[j].reg;
+                       hreg = &ri[j + half].reg;
 
-            if (!pepper_op (reg, reg, hreg, pepper_region_union_o, PEPPER_TRUE, PEPPER_TRUE))\r
-               ret = PEPPER_FALSE;\r
+                       if (!pepper_op
+                               (reg, reg, hreg, pepper_region_union_o, PEPPER_TRUE,
+                                PEPPER_TRUE))
+                               ret = PEPPER_FALSE;
 
-            if (hreg->extents.x1 < reg->extents.x1)
-               reg->extents.x1 = hreg->extents.x1;
+                       if (hreg->extents.x1 < reg->extents.x1)
+                               reg->extents.x1 = hreg->extents.x1;
 
-            if (hreg->extents.y1 < reg->extents.y1)
-               reg->extents.y1 = hreg->extents.y1;
+                       if (hreg->extents.y1 < reg->extents.y1)
+                               reg->extents.y1 = hreg->extents.y1;
 
-            if (hreg->extents.x2 > reg->extents.x2)
-               reg->extents.x2 = hreg->extents.x2;
+                       if (hreg->extents.x2 > reg->extents.x2)
+                               reg->extents.x2 = hreg->extents.x2;
 
-            if (hreg->extents.y2 > reg->extents.y2)
-               reg->extents.y2 = hreg->extents.y2;
+                       if (hreg->extents.y2 > reg->extents.y2)
+                               reg->extents.y2 = hreg->extents.y2;
 
-            FREE_DATA (hreg);
-       }
+                       FREE_DATA(hreg);
+               }
 
-        num_ri -= half;
+               num_ri -= half;
 
-       if (!ret)
-           goto bail;
-    }
+               if (!ret)
+                       goto bail;
+       }
 
-    *badreg = ri[0].reg;
+       *badreg = ri[0].reg;
 
-    if (ri != stack_regions)
-       free (ri);
+       if (ri != stack_regions)
+               free(ri);
 
-    GOOD (badreg);
-    return ret;
+       GOOD(badreg);
+       return ret;
 
-bail:
-    for (i = 0; i < num_ri; i++)
-       FREE_DATA (&ri[i].reg);
+  bail:
+       for (i = 0; i < num_ri; i++)
+               FREE_DATA(&ri[i].reg);
 
-    if (ri != stack_regions)
-       free (ri);
+       if (ri != stack_regions)
+               free(ri);
 
-    return pepper_break (badreg);\r
+       return pepper_break(badreg);
 }
 
 /*======================================================================
@@ -1860,189 +1745,169 @@ bail:
 
 /*-
  *-----------------------------------------------------------------------
- * pepper_region_subtract_o --\r
+ * pepper_region_subtract_o --
  *     Overlapping band subtraction. x1 is the left-most point not yet
  *     checked.
  *
  * Results:
- *     PEPPER_TRUE if successful.\r
+ *     PEPPER_TRUE if successful.
  *
  * Side Effects:
  *     region may have rectangles added to it.
  *
  *-----------------------------------------------------------------------
  */
-/*ARGSUSED*/
-static pepper_bool_t\r
-pepper_region_subtract_o (pepper_region_t * region,\r
-                         pepper_box_t *    r1,\r
-                         pepper_box_t *    r1_end,\r
-                         pepper_box_t *    r2,\r
-                         pepper_box_t *    r2_end,\r
-                         int             y1,
-                         int             y2)
+ /*ARGSUSED*/ static pepper_bool_t
+pepper_region_subtract_o(pepper_region_t * region,
+                                                pepper_box_t * r1,
+                                                pepper_box_t * r1_end,
+                                                pepper_box_t * r2,
+                                                pepper_box_t * r2_end, int y1, int y2)
 {
-    pepper_box_t *        next_rect;\r
-    int x1;
-
-    x1 = r1->x1;
-
-    critical_if_fail (y1 < y2);
-    critical_if_fail (r1 != r1_end && r2 != r2_end);
-
-    next_rect = PIXREGION_TOP (region);
-
-    do
-    {
-        if (r2->x2 <= x1)
-        {
-            /*
-            * Subtrahend entirely to left of minuend: go to next subtrahend.
-            */
-            r2++;
-       }
-        else if (r2->x1 <= x1)
-        {
-            /*
-            * Subtrahend precedes minuend: nuke left edge of minuend.
-            */
-            x1 = r2->x2;
-            if (x1 >= r1->x2)
-            {
-                /*
-                * Minuend completely covered: advance to next minuend and
-                * reset left fence to edge of new minuend.
-                */
-                r1++;
-                if (r1 != r1_end)
-                   x1 = r1->x1;
-           }
-            else
-            {
-                /*
-                * Subtrahend now used up since it doesn't extend beyond
-                * minuend
-                */
-                r2++;
-           }
-       }
-        else if (r2->x1 < r1->x2)
-        {
-            /*
-            * Left part of subtrahend covers part of minuend: add uncovered
-            * part of minuend to region and skip to next subtrahend.
-            */
-            critical_if_fail (x1 < r2->x1);
-            NEWRECT (region, next_rect, x1, y1, r2->x1, y2);
-
-            x1 = r2->x2;
-            if (x1 >= r1->x2)
-            {
-                /*
-                * Minuend used up: advance to new...
-                */
-                r1++;
-                if (r1 != r1_end)
-                   x1 = r1->x1;
-           }
-            else
-            {
-                /*
-                * Subtrahend used up
-                */
-                r2++;
-           }
-       }
-        else
-        {
-            /*
-            * Minuend used up: add any remaining piece before advancing.
-            */
-            if (r1->x2 > x1)
-               NEWRECT (region, next_rect, x1, y1, r1->x2, y2);
-
-            r1++;
-
-           if (r1 != r1_end)
-               x1 = r1->x1;
+       pepper_box_t *next_rect;
+       int x1;
+
+       x1 = r1->x1;
+
+       critical_if_fail(y1 < y2);
+       critical_if_fail(r1 != r1_end && r2 != r2_end);
+
+       next_rect = PIXREGION_TOP(region);
+
+       do {
+               if (r2->x2 <= x1) {
+                       /*
+                        * Subtrahend entirely to left of minuend: go to next subtrahend.
+                        */
+                       r2++;
+               } else if (r2->x1 <= x1) {
+                       /*
+                        * Subtrahend precedes minuend: nuke left edge of minuend.
+                        */
+                       x1 = r2->x2;
+                       if (x1 >= r1->x2) {
+                               /*
+                                * Minuend completely covered: advance to next minuend and
+                                * reset left fence to edge of new minuend.
+                                */
+                               r1++;
+                               if (r1 != r1_end)
+                                       x1 = r1->x1;
+                       } else {
+                               /*
+                                * Subtrahend now used up since it doesn't extend beyond
+                                * minuend
+                                */
+                               r2++;
+                       }
+               } else if (r2->x1 < r1->x2) {
+                       /*
+                        * Left part of subtrahend covers part of minuend: add uncovered
+                        * part of minuend to region and skip to next subtrahend.
+                        */
+                       critical_if_fail(x1 < r2->x1);
+                       NEWRECT(region, next_rect, x1, y1, r2->x1, y2);
+
+                       x1 = r2->x2;
+                       if (x1 >= r1->x2) {
+                               /*
+                                * Minuend used up: advance to new...
+                                */
+                               r1++;
+                               if (r1 != r1_end)
+                                       x1 = r1->x1;
+                       } else {
+                               /*
+                                * Subtrahend used up
+                                */
+                               r2++;
+                       }
+               } else {
+                       /*
+                        * Minuend used up: add any remaining piece before advancing.
+                        */
+                       if (r1->x2 > x1)
+                               NEWRECT(region, next_rect, x1, y1, r1->x2, y2);
+
+                       r1++;
+
+                       if (r1 != r1_end)
+                               x1 = r1->x1;
+               }
        }
-    }
-    while ((r1 != r1_end) && (r2 != r2_end));
+       while ((r1 != r1_end) && (r2 != r2_end));
 
-    /*
-     * Add remaining minuend rectangles to region.
-     */
-    while (r1 != r1_end)
-    {
-        critical_if_fail (x1 < r1->x2);
+       /*
+        * Add remaining minuend rectangles to region.
+        */
+       while (r1 != r1_end) {
+               critical_if_fail(x1 < r1->x2);
 
-        NEWRECT (region, next_rect, x1, y1, r1->x2, y2);
+               NEWRECT(region, next_rect, x1, y1, r1->x2, y2);
 
-        r1++;
-        if (r1 != r1_end)
-           x1 = r1->x1;
-    }
-    return PEPPER_TRUE;\r
+               r1++;
+               if (r1 != r1_end)
+                       x1 = r1->x1;
+       }
+       return PEPPER_TRUE;
 }
 
 /*-
  *-----------------------------------------------------------------------
- * pepper_region_subtract --\r
+ * pepper_region_subtract --
  *     Subtract reg_s from reg_m and leave the result in reg_d.
  *     S stands for subtrahend, M for minuend and D for difference.
  *
  * Results:
- *     PEPPER_TRUE if successful.\r
+ *     PEPPER_TRUE if successful.
  *
  * Side Effects:
  *     reg_d is overwritten.
  *
  *-----------------------------------------------------------------------
  */
-PEPPER_API pepper_bool_t\r
-pepper_region_subtract (pepper_region_t *reg_d,\r
-                    pepper_region_t *reg_m,\r
-                    pepper_region_t *reg_s)\r
+PEPPER_API pepper_bool_t
+pepper_region_subtract(pepper_region_t * reg_d,
+                                          pepper_region_t * reg_m, pepper_region_t * reg_s)
 {
-    GOOD (reg_m);
-    GOOD (reg_s);
-    GOOD (reg_d);
-    
-    /* check for trivial rejects */
-    if (PIXREGION_NIL (reg_m) || PIXREGION_NIL (reg_s) ||
-        !EXTENTCHECK (&reg_m->extents, &reg_s->extents))
-    {
-        if (PIXREGION_NAR (reg_s))
-           return pepper_break (reg_d);\r
-       
-        return pepper_region_copy (reg_d, reg_m);\r
-    }
-    else if (reg_m == reg_s)
-    {
-        FREE_DATA (reg_d);
-        reg_d->extents.x2 = reg_d->extents.x1;
-        reg_d->extents.y2 = reg_d->extents.y1;
-        reg_d->data = pepper_region_empty_data;\r
-
-        return PEPPER_TRUE;\r
-    }
+       GOOD(reg_m);
+       GOOD(reg_s);
+       GOOD(reg_d);
+
+       /* check for trivial rejects */
+       if (PIXREGION_NIL(reg_m) || PIXREGION_NIL(reg_s) ||
+               !EXTENTCHECK(&reg_m->extents, &reg_s->extents)) {
+               if (PIXREGION_NAR(reg_s))
+                       return pepper_break(reg_d);
+
+               return pepper_region_copy(reg_d, reg_m);
+       } else if (reg_m == reg_s) {
+               FREE_DATA(reg_d);
+               reg_d->extents.x2 = reg_d->extents.x1;
+               reg_d->extents.y2 = reg_d->extents.y1;
+               reg_d->data = pepper_region_empty_data;
+
+               return PEPPER_TRUE;
+       }
 
-    /* Add those rectangles in region 1 that aren't in region 2,
-       do yucky subtraction for overlaps, and
-       just throw away rectangles in region 2 that aren't in region 1 */
-    if (!pepper_op (reg_d, reg_m, reg_s, pepper_region_subtract_o, PEPPER_TRUE, PEPPER_FALSE))\r
-       return PEPPER_FALSE;\r
-
-    /*
-     * Can't alter reg_d's extents before we call pepper_op because\r
-     * it might be one of the source regions and pepper_op depends\r
-     * on the extents of those regions being unaltered. Besides, this
-     * way there's no checking against rectangles that will be nuked
-     * due to coalescing, so we have to examine fewer rectangles.
-     */
-    pepper_set_extents (reg_d);\r
-    GOOD (reg_d);
-    return PEPPER_TRUE;\r
+       /* Add those rectangles in region 1 that aren't in region 2,
+          do yucky subtraction for overlaps, and
+          just throw away rectangles in region 2 that aren't in region 1 */
+       if (!pepper_op
+               (reg_d, reg_m, reg_s, pepper_region_subtract_o, PEPPER_TRUE,
+                PEPPER_FALSE))
+               return PEPPER_FALSE;
+
+       /*
+        * Can't alter reg_d's extents before we call pepper_op because
+        * it might be one of the source regions and pepper_op depends
+        * on the extents of those regions being unaltered. Besides, this
+        * way there's no checking against rectangles that will be nuked
+        * due to coalescing, so we have to examine fewer rectangles.
+        */
+       pepper_set_extents(reg_d);
+       GOOD(reg_d);
+       return PEPPER_TRUE;
 }
 
 /*======================================================================
@@ -2051,95 +1916,92 @@ pepper_region_subtract (pepper_region_t *reg_d,
 
 /*-
  *-----------------------------------------------------------------------
- * pepper_region_inverse --\r
+ * pepper_region_inverse --
  *     Take a region and a box and return a region that is everything
  *     in the box but not in the region. The careful reader will note
  *     that this is the same as subtracting the region from the box...
  *
  * Results:
- *     PEPPER_TRUE.\r
+ *     PEPPER_TRUE.
  *
  * Side Effects:
  *     new_reg is overwritten.
  *
  *-----------------------------------------------------------------------
  */
-PEPPER_API pepper_bool_t\r
-pepper_region_inverse (pepper_region_t *new_reg,  /* Destination region */\r
-                  pepper_region_t *reg1,     /* Region to invert */\r
-                  pepper_box_t *   inv_rect) /* Bounding box for inversion */\r
-{
-    pepper_region_t inv_reg; /* Quick and dirty region made from the\r
-                           * bounding box */
-    GOOD (reg1);
-    GOOD (new_reg);
-    
-    /* check for trivial rejects */
-    if (PIXREGION_NIL (reg1) || !EXTENTCHECK (inv_rect, &reg1->extents))
-    {
-        if (PIXREGION_NAR (reg1))
-           return pepper_break (new_reg);\r
-       
-        new_reg->extents = *inv_rect;
-        FREE_DATA (new_reg);
-        new_reg->data = (pepper_region_data_t *)NULL;\r
-       
-        return PEPPER_TRUE;\r
-    }
+PEPPER_API pepper_bool_t
+pepper_region_inverse(pepper_region_t * new_reg,       /* Destination region */
+                                         pepper_region_t * reg1,       /* Region to invert */
+                                         pepper_box_t * inv_rect)
+{                                                              /* Bounding box for inversion */
+       pepper_region_t inv_reg;        /* Quick and dirty region made from the
+                                                                * bounding box */
+       GOOD(reg1);
+       GOOD(new_reg);
+
+       /* check for trivial rejects */
+       if (PIXREGION_NIL(reg1) || !EXTENTCHECK(inv_rect, &reg1->extents)) {
+               if (PIXREGION_NAR(reg1))
+                       return pepper_break(new_reg);
+
+               new_reg->extents = *inv_rect;
+               FREE_DATA(new_reg);
+               new_reg->data = (pepper_region_data_t *) NULL;
+
+               return PEPPER_TRUE;
+       }
 
-    /* Add those rectangles in region 1 that aren't in region 2,
-     * do yucky subtraction for overlaps, and
-     * just throw away rectangles in region 2 that aren't in region 1
-     */
-    inv_reg.extents = *inv_rect;
-    inv_reg.data = (pepper_region_data_t *)NULL;\r
-    if (!pepper_op (new_reg, &inv_reg, reg1, pepper_region_subtract_o, PEPPER_TRUE, PEPPER_FALSE))\r
-       return PEPPER_FALSE;\r
-
-    /*
-     * Can't alter new_reg's extents before we call pepper_op because\r
-     * it might be one of the source regions and pepper_op depends\r
-     * on the extents of those regions being unaltered. Besides, this
-     * way there's no checking against rectangles that will be nuked
-     * due to coalescing, so we have to examine fewer rectangles.
-     */
-    pepper_set_extents (new_reg);\r
-    GOOD (new_reg);
-    return PEPPER_TRUE;\r
+       /* Add those rectangles in region 1 that aren't in region 2,
+        * do yucky subtraction for overlaps, and
+        * just throw away rectangles in region 2 that aren't in region 1
+        */
+       inv_reg.extents = *inv_rect;
+       inv_reg.data = (pepper_region_data_t *) NULL;
+       if (!pepper_op
+               (new_reg, &inv_reg, reg1, pepper_region_subtract_o, PEPPER_TRUE,
+                PEPPER_FALSE))
+               return PEPPER_FALSE;
+
+       /*
+        * Can't alter new_reg's extents before we call pepper_op because
+        * it might be one of the source regions and pepper_op depends
+        * on the extents of those regions being unaltered. Besides, this
+        * way there's no checking against rectangles that will be nuked
+        * due to coalescing, so we have to examine fewer rectangles.
+        */
+       pepper_set_extents(new_reg);
+       GOOD(new_reg);
+       return PEPPER_TRUE;
 }
 
 /* In time O(log n), locate the first box whose y2 is greater than y.
  * Return @end if no such box exists.
  */
-static pepper_box_t *\r
-find_box_for_y (pepper_box_t *begin, pepper_box_t *end, int y)\r
+static pepper_box_t *
+find_box_for_y(pepper_box_t * begin, pepper_box_t * end, int y)
 {
-    pepper_box_t *mid;\r
+       pepper_box_t *mid;
 
-    if (end == begin)
-       return end;
+       if (end == begin)
+               return end;
 
-    if (end - begin == 1)
-    {
-       if (begin->y2 > y)
-           return begin;
-       else
-           return end;
-    }
+       if (end - begin == 1) {
+               if (begin->y2 > y)
+                       return begin;
+               else
+                       return end;
+       }
 
-    mid = begin + (end - begin) / 2;
-    if (mid->y2 > y)
-    {
-       /* If no box is found in [begin, mid], the function
-        * will return @mid, which is then known to be the
-        * correct answer.
-        */
-       return find_box_for_y (begin, mid, y);
-    }
-    else
-    {
-       return find_box_for_y (mid, end, y);
-    }
+       mid = begin + (end - begin) / 2;
+       if (mid->y2 > y) {
+               /* If no box is found in [begin, mid], the function
+                * will return @mid, which is then known to be the
+                * correct answer.
+                */
+               return find_box_for_y(begin, mid, y);
+       } else {
+               return find_box_for_y(mid, end, y);
+       }
 }
 
 /*
@@ -2149,303 +2011,280 @@ find_box_for_y (pepper_box_t *begin, pepper_box_t *end, int y)
  *
  *   The idea is to travel through the list of rectangles trying to cover the
  *   passed box with them. Anytime a piece of the rectangle isn't covered
- *   by a band of rectangles, part_out is set PEPPER_TRUE. Any time a rectangle in\r
- *   the region covers part of the box, part_in is set PEPPER_TRUE. The process ends\r
+ *   by a band of rectangles, part_out is set PEPPER_TRUE. Any time a rectangle in
+ *   the region covers part of the box, part_in is set PEPPER_TRUE. The process ends
  *   when either the box has been completely covered (we reached a band that
- *   doesn't overlap the box, part_in is PEPPER_TRUE and part_out is false), the\r
- *   box has been partially covered (part_in == part_out == PEPPER_TRUE -- because of\r
+ *   doesn't overlap the box, part_in is PEPPER_TRUE and part_out is false), the
+ *   box has been partially covered (part_in == part_out == PEPPER_TRUE -- because of
  *   the banding, the first time this is true we know the box is only
  *   partially in the region) or is outside the region (we reached a band
  *   that doesn't overlap the box at all and part_in is false)
  */
-PEPPER_API pepper_region_overlap_t\r
-pepper_region_contains_rectangle (pepper_region_t *  region,\r
-                             pepper_box_t *     prect)\r
+PEPPER_API pepper_region_overlap_t
+pepper_region_contains_rectangle(pepper_region_t * region,
+                                                                pepper_box_t * prect)
 {
-    pepper_box_t *     pbox;\r
-    pepper_box_t *     pbox_end;\r
-    int part_in, part_out;
-    int numRects;
-    int x, y;
-
-    GOOD (region);
-
-    numRects = PIXREGION_NUMRECTS (region);
-
-    /* useful optimization */
-    if (!numRects || !EXTENTCHECK (&region->extents, prect))
-       return(PEPPER_REGION_OUT);\r
-
-    if (numRects == 1)
-    {
-        /* We know that it must be PEPPER_REGION_IN or PEPPER_REGION_PART */\r
-        if (SUBSUMES (&region->extents, prect))
-           return(PEPPER_REGION_IN);\r
-        else
-           return(PEPPER_REGION_PART);\r
-    }
-
-    part_out = PEPPER_FALSE;\r
-    part_in = PEPPER_FALSE;\r
-
-    /* (x,y) starts at upper left of rect, moving to the right and down */
-    x = prect->x1;
-    y = prect->y1;
-
-    /* can stop when both part_out and part_in are PEPPER_TRUE, or we reach prect->y2 */\r
-    for (pbox = PIXREGION_BOXPTR (region), pbox_end = pbox + numRects;
-        pbox != pbox_end;
-        pbox++)
-    {
-       /* getting up to speed or skipping remainder of band */
-       if (pbox->y2 <= y)
-       {
-           if ((pbox = find_box_for_y (pbox, pbox_end, y)) == pbox_end)
-               break;
+       pepper_box_t *pbox;
+       pepper_box_t *pbox_end;
+       int part_in, part_out;
+       int numRects;
+       int x, y;
+
+       GOOD(region);
+
+       numRects = PIXREGION_NUMRECTS(region);
+
+       /* useful optimization */
+       if (!numRects || !EXTENTCHECK(&region->extents, prect))
+               return (PEPPER_REGION_OUT);
+
+       if (numRects == 1) {
+               /* We know that it must be PEPPER_REGION_IN or PEPPER_REGION_PART */
+               if (SUBSUMES(&region->extents, prect))
+                       return (PEPPER_REGION_IN);
+               else
+                       return (PEPPER_REGION_PART);
        }
 
-        if (pbox->y1 > y)
-        {
-            part_out = PEPPER_TRUE;     /* missed part of rectangle above */\r
-            if (part_in || (pbox->y1 >= prect->y2))
-               break;
-            y = pbox->y1;       /* x guaranteed to be == prect->x1 */
-       }
+       part_out = PEPPER_FALSE;
+       part_in = PEPPER_FALSE;
 
-        if (pbox->x2 <= x)
-           continue;           /* not far enough over yet */
+       /* (x,y) starts at upper left of rect, moving to the right and down */
+       x = prect->x1;
+       y = prect->y1;
 
-        if (pbox->x1 > x)
-        {
-            part_out = PEPPER_TRUE;     /* missed part of rectangle to left */\r
-            if (part_in)
-               break;
-       }
+       /* can stop when both part_out and part_in are PEPPER_TRUE, or we reach prect->y2 */
+       for (pbox = PIXREGION_BOXPTR(region), pbox_end = pbox + numRects;
+                pbox != pbox_end; pbox++) {
+               /* getting up to speed or skipping remainder of band */
+               if (pbox->y2 <= y) {
+                       if ((pbox = find_box_for_y(pbox, pbox_end, y)) == pbox_end)
+                               break;
+               }
 
-        if (pbox->x1 < prect->x2)
-        {
-            part_in = PEPPER_TRUE;      /* definitely overlap */\r
-            if (part_out)
-               break;
-       }
+               if (pbox->y1 > y) {
+                       part_out = PEPPER_TRUE; /* missed part of rectangle above */
+                       if (part_in || (pbox->y1 >= prect->y2))
+                               break;
+                       y = pbox->y1;           /* x guaranteed to be == prect->x1 */
+               }
 
-        if (pbox->x2 >= prect->x2)
-        {
-            y = pbox->y2;       /* finished with this band */
-            if (y >= prect->y2)
-               break;
-            x = prect->x1;      /* reset x out to left again */
-       }
-        else
-        {
-            /*
-            * Because boxes in a band are maximal width, if the first box
-            * to overlap the rectangle doesn't completely cover it in that
-            * band, the rectangle must be partially out, since some of it
-            * will be uncovered in that band. part_in will have been set true
-            * by now...
-            */
-            part_out = PEPPER_TRUE;\r
-            break;
+               if (pbox->x2 <= x)
+                       continue;                       /* not far enough over yet */
+
+               if (pbox->x1 > x) {
+                       part_out = PEPPER_TRUE; /* missed part of rectangle to left */
+                       if (part_in)
+                               break;
+               }
+
+               if (pbox->x1 < prect->x2) {
+                       part_in = PEPPER_TRUE;  /* definitely overlap */
+                       if (part_out)
+                               break;
+               }
+
+               if (pbox->x2 >= prect->x2) {
+                       y = pbox->y2;           /* finished with this band */
+                       if (y >= prect->y2)
+                               break;
+                       x = prect->x1;          /* reset x out to left again */
+               } else {
+                       /*
+                        * Because boxes in a band are maximal width, if the first box
+                        * to overlap the rectangle doesn't completely cover it in that
+                        * band, the rectangle must be partially out, since some of it
+                        * will be uncovered in that band. part_in will have been set true
+                        * by now...
+                        */
+                       part_out = PEPPER_TRUE;
+                       break;
+               }
        }
-    }
 
-    if (part_in)
-    {
-        if (y < prect->y2)
-           return PEPPER_REGION_PART;\r
-        else
-           return PEPPER_REGION_IN;\r
-    }
-    else
-    {
-        return PEPPER_REGION_OUT;\r
-    }
+       if (part_in) {
+               if (y < prect->y2)
+                       return PEPPER_REGION_PART;
+               else
+                       return PEPPER_REGION_IN;
+       } else {
+               return PEPPER_REGION_OUT;
+       }
 }
 
-/* pepper_region_translate (region, x, y)\r
+/* pepper_region_translate (region, x, y)
  * translates in place
  */
 
-PEPPER_API void\r
-pepper_region_translate (pepper_region_t *region, int x, int y)\r
+PEPPER_API void
+pepper_region_translate(pepper_region_t * region, int x, int y)
 {
-    overflow_int_t x1, x2, y1, y2;
-    int nbox;
-    pepper_box_t * pbox;\r
-
-    GOOD (region);
-    region->extents.x1 = x1 = region->extents.x1 + x;
-    region->extents.y1 = y1 = region->extents.y1 + y;
-    region->extents.x2 = x2 = region->extents.x2 + x;
-    region->extents.y2 = y2 = region->extents.y2 + y;
-    
-    if (((x1 - INT32_MIN) | (y1 - INT32_MIN) | (INT32_MAX - x2) | (INT32_MAX - y2)) >= 0)\r
-    {
-        if (region->data && (nbox = region->data->numRects))
-        {
-            for (pbox = PIXREGION_BOXPTR (region); nbox--; pbox++)
-            {
-                pbox->x1 += x;
-                pbox->y1 += y;
-                pbox->x2 += x;
-                pbox->y2 += y;
-           }
+       overflow_int_t x1, x2, y1, y2;
+       int nbox;
+       pepper_box_t *pbox;
+
+       GOOD(region);
+       region->extents.x1 = x1 = region->extents.x1 + x;
+       region->extents.y1 = y1 = region->extents.y1 + y;
+       region->extents.x2 = x2 = region->extents.x2 + x;
+       region->extents.y2 = y2 = region->extents.y2 + y;
+
+       if (((x1 - INT32_MIN) | (y1 - INT32_MIN) | (INT32_MAX - x2) | (INT32_MAX -
+                                                                                                                                  y2)) >=
+               0) {
+               if (region->data && (nbox = region->data->numRects)) {
+                       for (pbox = PIXREGION_BOXPTR(region); nbox--; pbox++) {
+                               pbox->x1 += x;
+                               pbox->y1 += y;
+                               pbox->x2 += x;
+                               pbox->y2 += y;
+                       }
+               }
+               return;
        }
-        return;
-    }
-
-    if (((x2 - INT32_MIN) | (y2 - INT32_MIN) | (INT32_MAX - x1) | (INT32_MAX - y1)) <= 0)\r
-    {
-        region->extents.x2 = region->extents.x1;
-        region->extents.y2 = region->extents.y1;
-        FREE_DATA (region);
-        region->data = pepper_region_empty_data;\r
-        return;
-    }
 
-    if (x1 < INT32_MIN)\r
-       region->extents.x1 = INT32_MIN;\r
-    else if (x2 > INT32_MAX)\r
-       region->extents.x2 = INT32_MAX;\r
-
-    if (y1 < INT32_MIN)\r
-       region->extents.y1 = INT32_MIN;\r
-    else if (y2 > INT32_MAX)\r
-       region->extents.y2 = INT32_MAX;\r
-
-    if (region->data && (nbox = region->data->numRects))
-    {
-        pepper_box_t * pbox_out;\r
-
-        for (pbox_out = pbox = PIXREGION_BOXPTR (region); nbox--; pbox++)
-        {
-            pbox_out->x1 = x1 = pbox->x1 + x;
-            pbox_out->y1 = y1 = pbox->y1 + y;
-            pbox_out->x2 = x2 = pbox->x2 + x;
-            pbox_out->y2 = y2 = pbox->y2 + y;
-
-            if (((x2 - INT32_MIN) | (y2 - INT32_MIN) |\r
-                 (INT32_MAX - x1) | (INT32_MAX - y1)) <= 0)\r
-            {
-                region->data->numRects--;
-                continue;
-           }
-
-            if (x1 < INT32_MIN)\r
-               pbox_out->x1 = INT32_MIN;\r
-            else if (x2 > INT32_MAX)\r
-               pbox_out->x2 = INT32_MAX;\r
-
-            if (y1 < INT32_MIN)\r
-               pbox_out->y1 = INT32_MIN;\r
-            else if (y2 > INT32_MAX)\r
-               pbox_out->y2 = INT32_MAX;\r
-
-            pbox_out++;
+       if (((x2 - INT32_MIN) | (y2 - INT32_MIN) | (INT32_MAX - x1) | (INT32_MAX -
+                                                                                                                                  y1)) <=
+               0) {
+               region->extents.x2 = region->extents.x1;
+               region->extents.y2 = region->extents.y1;
+               FREE_DATA(region);
+               region->data = pepper_region_empty_data;
+               return;
        }
 
-        if (pbox_out != pbox)
-        {
-            if (region->data->numRects == 1)
-            {
-                region->extents = *PIXREGION_BOXPTR (region);
-                FREE_DATA (region);
-                region->data = (pepper_region_data_t *)NULL;\r
-           }
-            else
-           {
-               pepper_set_extents (region);\r
-           }
+       if (x1 < INT32_MIN)
+               region->extents.x1 = INT32_MIN;
+       else if (x2 > INT32_MAX)
+               region->extents.x2 = INT32_MAX;
+
+       if (y1 < INT32_MIN)
+               region->extents.y1 = INT32_MIN;
+       else if (y2 > INT32_MAX)
+               region->extents.y2 = INT32_MAX;
+
+       if (region->data && (nbox = region->data->numRects)) {
+               pepper_box_t *pbox_out;
+
+               for (pbox_out = pbox = PIXREGION_BOXPTR(region); nbox--; pbox++) {
+                       pbox_out->x1 = x1 = pbox->x1 + x;
+                       pbox_out->y1 = y1 = pbox->y1 + y;
+                       pbox_out->x2 = x2 = pbox->x2 + x;
+                       pbox_out->y2 = y2 = pbox->y2 + y;
+
+                       if (((x2 - INT32_MIN) | (y2 - INT32_MIN) |
+                                (INT32_MAX - x1) | (INT32_MAX - y1)) <= 0) {
+                               region->data->numRects--;
+                               continue;
+                       }
+
+                       if (x1 < INT32_MIN)
+                               pbox_out->x1 = INT32_MIN;
+                       else if (x2 > INT32_MAX)
+                               pbox_out->x2 = INT32_MAX;
+
+                       if (y1 < INT32_MIN)
+                               pbox_out->y1 = INT32_MIN;
+                       else if (y2 > INT32_MAX)
+                               pbox_out->y2 = INT32_MAX;
+
+                       pbox_out++;
+               }
+
+               if (pbox_out != pbox) {
+                       if (region->data->numRects == 1) {
+                               region->extents = *PIXREGION_BOXPTR(region);
+                               FREE_DATA(region);
+                               region->data = (pepper_region_data_t *) NULL;
+                       } else {
+                               pepper_set_extents(region);
+                       }
+               }
        }
-    }
 
-    GOOD (region);
+       GOOD(region);
 }
 
-PEPPER_API void\r
-pepper_region_reset (pepper_region_t *region, pepper_box_t *box)\r
+PEPPER_API void
+pepper_region_reset(pepper_region_t * region, pepper_box_t * box)
 {
-    GOOD (region);
+       GOOD(region);
 
-    critical_if_fail (GOOD_RECT (box));
+       critical_if_fail(GOOD_RECT(box));
 
-    region->extents = *box;
+       region->extents = *box;
 
-    FREE_DATA (region);
+       FREE_DATA(region);
 
-    region->data = NULL;
+       region->data = NULL;
 }
 
-PEPPER_API void\r
-pepper_region_clear (pepper_region_t *region)\r
+PEPPER_API void
+pepper_region_clear(pepper_region_t * region)
 {
-    GOOD (region);
-    FREE_DATA (region);
+       GOOD(region);
+       FREE_DATA(region);
 
-    region->extents = *pepper_region_empty_box;\r
-    region->data = pepper_region_empty_data;\r
+       region->extents = *pepper_region_empty_box;
+       region->data = pepper_region_empty_data;
 }
 
 /* box is "return" value */
-PEPPER_API pepper_bool_t\r
-pepper_region_contains_point (pepper_region_t * region,\r
-                          int x, int y,
-                          pepper_box_t * box)\r
+PEPPER_API pepper_bool_t
+pepper_region_contains_point(pepper_region_t * region,
+                                                        int x, int y, pepper_box_t * box)
 {
-    pepper_box_t *pbox, *pbox_end;\r
-    int numRects;
+       pepper_box_t *pbox, *pbox_end;
+       int numRects;
 
-    GOOD (region);
-    numRects = PIXREGION_NUMRECTS (region);
+       GOOD(region);
+       numRects = PIXREGION_NUMRECTS(region);
 
-    if (!numRects || !INBOX (&region->extents, x, y))
-       return(PEPPER_FALSE);\r
+       if (!numRects || !INBOX(&region->extents, x, y))
+               return (PEPPER_FALSE);
 
-    if (numRects == 1)
-    {
-        if (box)
-           *box = region->extents;
+       if (numRects == 1) {
+               if (box)
+                       *box = region->extents;
 
-        return(PEPPER_TRUE);\r
-    }
+               return (PEPPER_TRUE);
+       }
 
-    pbox = PIXREGION_BOXPTR (region);
-    pbox_end = pbox + numRects;
+       pbox = PIXREGION_BOXPTR(region);
+       pbox_end = pbox + numRects;
 
-    pbox = find_box_for_y (pbox, pbox_end, y);
+       pbox = find_box_for_y(pbox, pbox_end, y);
 
-    for (;pbox != pbox_end; pbox++)
-    {
-        if ((y < pbox->y1) || (x < pbox->x1))
-           break;              /* missed it */
+       for (; pbox != pbox_end; pbox++) {
+               if ((y < pbox->y1) || (x < pbox->x1))
+                       break;                          /* missed it */
 
-        if (x >= pbox->x2)
-           continue;           /* not there yet */
+               if (x >= pbox->x2)
+                       continue;                       /* not there yet */
 
-        if (box)
-           *box = *pbox;
+               if (box)
+                       *box = *pbox;
 
-        return(PEPPER_TRUE);\r
-    }
+               return (PEPPER_TRUE);
+       }
 
-    return(PEPPER_FALSE);\r
+       return (PEPPER_FALSE);
 }
 
-PEPPER_API pepper_bool_t\r
-pepper_region_not_empty (pepper_region_t * region)\r
+PEPPER_API pepper_bool_t
+pepper_region_not_empty(pepper_region_t * region)
 {
-    GOOD (region);
+       GOOD(region);
 
-    return(!PIXREGION_NIL (region));
+       return (!PIXREGION_NIL(region));
 }
 
-PEPPER_API pepper_box_t *\r
-pepper_region_extents (pepper_region_t * region)\r
+PEPPER_API pepper_box_t *
+pepper_region_extents(pepper_region_t * region)
 {
-    GOOD (region);
+       GOOD(region);
 
-    return(&region->extents);
+       return (&region->extents);
 }
 
 /*
@@ -2455,146 +2294,131 @@ pepper_region_extents (pepper_region_t * region)
  * returns the number of new, clipped scanlines.
  */
 
-PEPPER_API pepper_bool_t\r
-pepper_region_selfcheck (pepper_region_t *reg)\r
+PEPPER_API pepper_bool_t
+pepper_region_selfcheck(pepper_region_t * reg)
 {
-    int i, numRects;
-
-    if ((reg->extents.x1 > reg->extents.x2) ||
-        (reg->extents.y1 > reg->extents.y2))
-    {
-       return PEPPER_FALSE;\r
-    }
+       int i, numRects;
 
-    numRects = PIXREGION_NUMRECTS (reg);
-    if (!numRects)
-    {
-       return ((reg->extents.x1 == reg->extents.x2) &&
-               (reg->extents.y1 == reg->extents.y2) &&
-               (reg->data->size || (reg->data == pepper_region_empty_data)));\r
-    }
-    else if (numRects == 1)
-    {
-       return (!reg->data);
-    }
-    else
-    {
-        pepper_box_t * pbox_p, * pbox_n;\r
-        pepper_box_t box;\r
-
-        pbox_p = PIXREGION_RECTS (reg);
-        box = *pbox_p;
-        box.y2 = pbox_p[numRects - 1].y2;
-        pbox_n = pbox_p + 1;
-
-        for (i = numRects; --i > 0; pbox_p++, pbox_n++)
-        {
-            if ((pbox_n->x1 >= pbox_n->x2) ||
-                (pbox_n->y1 >= pbox_n->y2))
-           {
-               return PEPPER_FALSE;\r
-           }
-
-            if (pbox_n->x1 < box.x1)
-               box.x1 = pbox_n->x1;
-           
-            if (pbox_n->x2 > box.x2)
-               box.x2 = pbox_n->x2;
-           
-            if ((pbox_n->y1 < pbox_p->y1) ||
-                ((pbox_n->y1 == pbox_p->y1) &&
-                 ((pbox_n->x1 < pbox_p->x2) || (pbox_n->y2 != pbox_p->y2))))
-           {
-               return PEPPER_FALSE;\r
-           }
+       if ((reg->extents.x1 > reg->extents.x2) ||
+               (reg->extents.y1 > reg->extents.y2)) {
+               return PEPPER_FALSE;
        }
 
-        return ((box.x1 == reg->extents.x1) &&
-                (box.x2 == reg->extents.x2) &&
-                (box.y1 == reg->extents.y1) &&
-                (box.y2 == reg->extents.y2));
-    }
+       numRects = PIXREGION_NUMRECTS(reg);
+       if (!numRects) {
+               return ((reg->extents.x1 == reg->extents.x2) &&
+                               (reg->extents.y1 == reg->extents.y2) &&
+                               (reg->data->size || (reg->data == pepper_region_empty_data)));
+       } else if (numRects == 1) {
+               return (!reg->data);
+       } else {
+               pepper_box_t *pbox_p, *pbox_n;
+               pepper_box_t box;
+
+               pbox_p = PIXREGION_RECTS(reg);
+               box = *pbox_p;
+               box.y2 = pbox_p[numRects - 1].y2;
+               pbox_n = pbox_p + 1;
+
+               for (i = numRects; --i > 0; pbox_p++, pbox_n++) {
+                       if ((pbox_n->x1 >= pbox_n->x2) || (pbox_n->y1 >= pbox_n->y2)) {
+                               return PEPPER_FALSE;
+                       }
+
+                       if (pbox_n->x1 < box.x1)
+                               box.x1 = pbox_n->x1;
+
+                       if (pbox_n->x2 > box.x2)
+                               box.x2 = pbox_n->x2;
+
+                       if ((pbox_n->y1 < pbox_p->y1) ||
+                               ((pbox_n->y1 == pbox_p->y1) &&
+                                ((pbox_n->x1 < pbox_p->x2) || (pbox_n->y2 != pbox_p->y2)))) {
+                               return PEPPER_FALSE;
+                       }
+               }
+
+               return ((box.x1 == reg->extents.x1) &&
+                               (box.x2 == reg->extents.x2) &&
+                               (box.y1 == reg->extents.y1) && (box.y2 == reg->extents.y2));
+       }
 }
 
-PEPPER_API pepper_bool_t\r
-pepper_region_init_rects (pepper_region_t *region,\r
-                      const pepper_box_t *boxes, int count)\r
+PEPPER_API pepper_bool_t
+pepper_region_init_rects(pepper_region_t * region,
+                                                const pepper_box_t * boxes, int count)
 {
-    pepper_box_t *rects;\r
-    int displacement;
-    int i;
-
-    /* if it's 1, then we just want to set the extents, so call
-     * the existing method. */
-    if (count == 1)
-    {
-        pepper_region_init_rect (region,\r
-                             boxes[0].x1,
-                             boxes[0].y1,
-                             boxes[0].x2 - boxes[0].x1,
-                             boxes[0].y2 - boxes[0].y1);
-        return PEPPER_TRUE;\r
-    }
+       pepper_box_t *rects;
+       int displacement;
+       int i;
+
+       /* if it's 1, then we just want to set the extents, so call
+        * the existing method. */
+       if (count == 1) {
+               pepper_region_init_rect(region,
+                                                               boxes[0].x1,
+                                                               boxes[0].y1,
+                                                               boxes[0].x2 - boxes[0].x1,
+                                                               boxes[0].y2 - boxes[0].y1);
+               return PEPPER_TRUE;
+       }
 
-    pepper_region_init (region);\r
+       pepper_region_init(region);
 
-    /* if it's 0, don't call pepper_rect_alloc -- 0 rectangles is\r
-     * a special case, and causing pepper_rect_alloc would cause\r
-     * us to leak memory (because the 0-rect case should be the
-     * static pepper_region_empty_data data).\r
-     */
-    if (count == 0)
-       return PEPPER_TRUE;\r
+       /* if it's 0, don't call pepper_rect_alloc -- 0 rectangles is
+        * a special case, and causing pepper_rect_alloc would cause
+        * us to leak memory (because the 0-rect case should be the
+        * static pepper_region_empty_data data).
+        */
+       if (count == 0)
+               return PEPPER_TRUE;
 
-    if (!pepper_rect_alloc (region, count))\r
-       return PEPPER_FALSE;\r
+       if (!pepper_rect_alloc(region, count))
+               return PEPPER_FALSE;
 
-    rects = PIXREGION_RECTS (region);
+       rects = PIXREGION_RECTS(region);
 
-    /* Copy in the rects */
-    memcpy (rects, boxes, sizeof(pepper_box_t) * count);\r
-    region->data->numRects = count;
+       /* Copy in the rects */
+       memcpy(rects, boxes, sizeof(pepper_box_t) * count);
+       region->data->numRects = count;
 
-    /* Eliminate empty and malformed rectangles */
-    displacement = 0;
+       /* Eliminate empty and malformed rectangles */
+       displacement = 0;
 
-    for (i = 0; i < count; ++i)
-    {
-        pepper_box_t *box = &rects[i];\r
+       for (i = 0; i < count; ++i) {
+               pepper_box_t *box = &rects[i];
 
-        if (box->x1 >= box->x2 || box->y1 >= box->y2)
-           displacement++;
-        else if (displacement)
-           rects[i - displacement] = rects[i];
-    }
+               if (box->x1 >= box->x2 || box->y1 >= box->y2)
+                       displacement++;
+               else if (displacement)
+                       rects[i - displacement] = rects[i];
+       }
 
-    region->data->numRects -= displacement;
+       region->data->numRects -= displacement;
 
-    /* If eliminating empty rectangles caused there
-     * to be only 0 or 1 rectangles, deal with that.
-     */
-    if (region->data->numRects == 0)
-    {
-        FREE_DATA (region);
-        pepper_region_init (region);\r
+       /* If eliminating empty rectangles caused there
+        * to be only 0 or 1 rectangles, deal with that.
+        */
+       if (region->data->numRects == 0) {
+               FREE_DATA(region);
+               pepper_region_init(region);
 
-        return PEPPER_TRUE;\r
-    }
+               return PEPPER_TRUE;
+       }
 
-    if (region->data->numRects == 1)
-    {
-        region->extents = rects[0];
+       if (region->data->numRects == 1) {
+               region->extents = rects[0];
 
-        FREE_DATA (region);
-        region->data = NULL;
+               FREE_DATA(region);
+               region->data = NULL;
 
-        GOOD (region);
+               GOOD(region);
 
-        return PEPPER_TRUE;\r
-    }
+               return PEPPER_TRUE;
+       }
 
-    /* Validate */
-    region->extents.x1 = region->extents.x2 = 0;
+       /* Validate */
+       region->extents.x1 = region->extents.x2 = 0;
 
-    return validate (region);
-}\r
+       return validate(region);
+}
index 5288dfe..ded296f 100644 (file)
@@ -67,17 +67,17 @@ pepper_view_surface_damage(pepper_view_t *view)
                pepper_plane_entry_t *entry = &view->plane_entries[i];
 
                if (entry->plane) {
-                       pixman_region32_t damage;
+                       pepper_region_t damage;
 
-                       pixman_region32_init(&damage);
-                       pixman_region32_copy(&damage, &view->surface->damage_region);
-                       pixman_region32_intersect_rect(&damage, &damage, 0, 0, view->w, view->h);
+                       pepper_region_init(&damage);
+                       pepper_region_copy(&damage, &view->surface->damage_region);
+                       pepper_region_intersect_rect(&damage, &damage, 0, 0, view->w, view->h);
 
-                       pepper_transform_pixman_region(&damage, &view->global_transform);
-                       pixman_region32_translate(&damage,
+                       pepper_transform_region(&damage, &view->global_transform);
+                       pepper_region_translate(&damage,
                                                                          -entry->plane->output->geometry.x,
                                                                          -entry->plane->output->geometry.y);
-                       pixman_region32_intersect(&damage, &damage, &entry->base.visible_region);
+                       pepper_region_intersect(&damage, &damage, &entry->base.visible_region);
                        pepper_plane_add_damage_region(entry->plane, &damage);
                }
        }
@@ -114,13 +114,13 @@ plane_entry_set_plane(pepper_plane_entry_t *entry, pepper_plane_t *plane)
        if (entry->plane) {
                pepper_plane_add_damage_region(entry->plane, &entry->base.visible_region);
                entry->plane = NULL;
-               pixman_region32_fini(&entry->base.visible_region);
+               pepper_region_fini(&entry->base.visible_region);
        }
 
        entry->plane = plane;
 
        if (entry->plane) {
-               pixman_region32_init(&entry->base.visible_region);
+               pepper_region_init(&entry->base.visible_region);
                entry->need_damage = PEPPER_TRUE;
        }
 }
@@ -207,17 +207,17 @@ pepper_view_update(pepper_view_t *view)
                pepper_mat4_inverse(&view->global_transform_inverse, &view->global_transform);
 
                /* Bounding region. */
-               pixman_region32_fini(&view->bounding_region);
-               pixman_region32_init_rect(&view->bounding_region, 0, 0, view->w, view->h);
-               pepper_transform_pixman_region(&view->bounding_region, &view->global_transform);
+               pepper_region_fini(&view->bounding_region);
+               pepper_region_init_rect(&view->bounding_region, 0, 0, view->w, view->h);
+               pepper_transform_region(&view->bounding_region, &view->global_transform);
 
                /* Opaque region. */
                if (view->surface && pepper_mat4_is_translation(&view->global_transform)) {
-                       pixman_region32_copy(&view->opaque_region, &view->surface->opaque_region);
-                       pixman_region32_translate(&view->opaque_region,
+                       pepper_region_copy(&view->opaque_region, &view->surface->opaque_region);
+                       pepper_region_translate(&view->opaque_region,
                                                                          view->global_transform.m[12], view->global_transform.m[13]);
                } else {
-                       pixman_region32_clear(&view->opaque_region);
+                       pepper_region_clear(&view->opaque_region);
                }
 
                /* Output overlap. */
@@ -226,15 +226,15 @@ pepper_view_update(pepper_view_t *view)
 
                 if (view->surface) {
                        pepper_list_for_each(output, &view->compositor->output_list, link) {
-                               pixman_box32_t   box = {
+                               pepper_box_t   box = {
                                        output->geometry.x,
                                        output->geometry.y,
                                        output->geometry.x + output->geometry.w,
                                        output->geometry.y + output->geometry.h
                                };
 
-                               if (pixman_region32_contains_rectangle(&view->bounding_region,
-                                                                                                          &box) != PIXMAN_REGION_OUT) {
+                               if (pepper_region_contains_rectangle(&view->bounding_region,
+                                                                                                          &box) != PEPPER_REGION_OUT) {
                                        view->output_overlap |= (1 << output->id);
                                        if (!(output_overlap_prev & (1 << output->id)))
                                                pepper_surface_send_enter(view->surface, output);
@@ -271,8 +271,8 @@ view_init(pepper_view_t *view, pepper_compositor_t *compositor)
 
        pepper_mat4_init_identity(&view->transform);
        pepper_mat4_init_identity(&view->global_transform);
-       pixman_region32_init(&view->bounding_region);
-       pixman_region32_init(&view->opaque_region);
+       pepper_region_init(&view->bounding_region);
+       pepper_region_init(&view->opaque_region);
 
        for (i = 0; i < PEPPER_MAX_OUTPUT_COUNT; i++) {
                view->plane_entries[i].base.view = view;
@@ -383,8 +383,8 @@ pepper_view_destroy(pepper_view_t *view)
        if (view->surface)
                pepper_list_remove(&view->surface_link);
 
-       pixman_region32_fini(&view->opaque_region);
-       pixman_region32_fini(&view->bounding_region);
+       pepper_region_fini(&view->opaque_region);
+       pepper_region_fini(&view->bounding_region);
 
        free(view);
 }
@@ -855,7 +855,7 @@ pepper_view_is_opaque(pepper_view_t *view)
        pepper_surface_t       *surface = view->surface;
        struct wl_shm_buffer   *shm_buffer = wl_shm_buffer_get(
                        surface->buffer.buffer->resource);
-       pixman_box32_t          extent;
+       pepper_box_t          extent;
 
        if (shm_buffer) {
                uint32_t shm_format = wl_shm_buffer_get_format(shm_buffer);
@@ -871,8 +871,8 @@ pepper_view_is_opaque(pepper_view_t *view)
        extent.x2 = view->surface->w;
        extent.y2 = view->surface->h;
 
-       if (pixman_region32_contains_rectangle(&surface->opaque_region,
-                                                                                  &extent) == PIXMAN_REGION_IN)
+       if (pepper_region_contains_rectangle(&surface->opaque_region,
+                                                                                  &extent) == PEPPER_REGION_IN)
                return PEPPER_TRUE;
 
        return PEPPER_FALSE;
index 572c9de..6a70042 100644 (file)
@@ -231,7 +231,7 @@ struct gl_render_target {
 
        pepper_mat4_t               proj_mat;
 
-       pixman_region32_t           damages[MAX_BUFFER_COUNT];
+       pepper_region_t           damages[MAX_BUFFER_COUNT];
        int32_t                     damage_index;
 };
 
@@ -816,11 +816,11 @@ surface_state_flush_shm(gl_surface_state_t *state)
                state->shm.need_full_upload = PEPPER_FALSE;
        } else {
                int                 i, nrects;
-               pixman_box32_t     *rects;
-               pixman_region32_t  *damage;
+               pepper_box_t     *rects;
+               pepper_region_t  *damage;
 
                damage = pepper_surface_get_damage_region(state->surface);
-               rects = pixman_region32_rectangles(damage, &nrects);
+               rects = pepper_region_rectangles(damage, &nrects);
 
                glPixelStorei(GL_UNPACK_ROW_LENGTH_EXT, state->shm.pitch);
                wl_shm_buffer_begin_access(state->shm.buffer);
@@ -974,7 +974,7 @@ clip_line(pepper_vec2_t *in_vertices, pepper_vec2_t *out_vertices, int in_len,
 }
 
 static void
-clip(pepper_vec2_t *vertices, int *len, pixman_box32_t *clip_rect,
+clip(pepper_vec2_t *vertices, int *len, pepper_box_t *clip_rect,
         pepper_bool_t is_rect)
 {
        if (is_rect) {
@@ -1046,7 +1046,7 @@ float_difference(float a, float b)
 static void
 calc_vertices(gl_renderer_t *gr, gl_surface_state_t *state,
                          pepper_render_item_t *node,
-                         pixman_region32_t *region, pixman_region32_t *surface_region)
+                         pepper_region_t *region, pepper_region_t *surface_region)
 {
        int             i, j, k, n;
        int             len;
@@ -1056,12 +1056,12 @@ calc_vertices(gl_renderer_t *gr, gl_surface_state_t *state,
        pepper_mat4_t  *transform = &node->transform;
 
        int             nrects, surface_nrects;
-       pixman_box32_t *rects, *surface_rects;
+       pepper_box_t *rects, *surface_rects;
 
        GLfloat        *vertex_array;
 
-       surface_rects = pixman_region32_rectangles(surface_region, &surface_nrects);
-       rects = pixman_region32_rectangles(region, &nrects);
+       surface_rects = pepper_region_rectangles(surface_region, &surface_nrects);
+       rects = pepper_region_rectangles(region, &nrects);
        vertex_array = wl_array_add(&gr->vertex_array,
                                                                surface_nrects * nrects * (8 - 2) * 3 * 2 * 2 * sizeof(GLfloat));
        gr->triangles = 0;
@@ -1139,7 +1139,7 @@ calc_vertices(gl_renderer_t *gr, gl_surface_state_t *state,
 static void
 repaint_region_clip(gl_renderer_t *gr, gl_surface_state_t *state,
                                        pepper_render_item_t *node,
-                                       pixman_region32_t *damage, pixman_region32_t *surface_region)
+                                       pepper_region_t *damage, pepper_region_t *surface_region)
 {
        GLfloat        *vertex_array;
 
@@ -1160,7 +1160,7 @@ repaint_region_clip(gl_renderer_t *gr, gl_surface_state_t *state,
 
 static void
 repaint_view_clip(pepper_renderer_t *renderer, pepper_output_t *output,
-                                 pepper_render_item_t *node, pixman_region32_t *damage)
+                                 pepper_render_item_t *node, pepper_region_t *damage)
 {
        gl_renderer_t      *gr = (gl_renderer_t *)renderer;
        gl_render_target_t *gt = (gl_render_target_t *)renderer->target;
@@ -1169,22 +1169,22 @@ repaint_view_clip(pepper_renderer_t *renderer, pepper_output_t *output,
        gl_surface_state_t *state = get_surface_state(renderer, surface);
 
        gl_shader_t        *shader;
-       pixman_region32_t   repaint;
-       pixman_region32_t   surface_blend;
-       pixman_region32_t  *surface_opaque;
+       pepper_region_t   repaint;
+       pepper_region_t   surface_blend;
+       pepper_region_t  *surface_opaque;
 
-       pixman_region32_init(&repaint);
-       pixman_region32_intersect(&repaint, &node->visible_region, damage);
+       pepper_region_init(&repaint);
+       pepper_region_intersect(&repaint, &node->visible_region, damage);
 
-       if (pixman_region32_not_empty(&repaint)) {
+       if (pepper_region_not_empty(&repaint)) {
                int32_t             i, w, h;
                float               trans[16];
                GLint               filter;
 
                pepper_surface_get_size(surface, &w, &h);
                surface_opaque = pepper_surface_get_opaque_region(surface);
-               pixman_region32_init_rect(&surface_blend, 0, 0, w, h);
-               pixman_region32_subtract(&surface_blend, &surface_blend, surface_opaque);
+               pepper_region_init_rect(&surface_blend, 0, 0, w, h);
+               pepper_region_subtract(&surface_blend, &surface_blend, surface_opaque);
 
                for (i = 0; i < 16; i++)
                        trans[i] = (float)gt->proj_mat.m[i];
@@ -1200,7 +1200,7 @@ repaint_view_clip(pepper_renderer_t *renderer, pepper_output_t *output,
 
                glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
 
-               if (pixman_region32_not_empty(surface_opaque)) {
+               if (pepper_region_not_empty(surface_opaque)) {
                        if (state->sampler == GL_SHADER_SAMPLER_RGBA)
                                shader = &gr->shaders[GL_SHADER_SAMPLER_RGBX];
                        else
@@ -1216,7 +1216,7 @@ repaint_view_clip(pepper_renderer_t *renderer, pepper_output_t *output,
                        repaint_region_clip(gr, state, node, &repaint, surface_opaque);
                }
 
-               if (pixman_region32_not_empty(&surface_blend)) {
+               if (pepper_region_not_empty(&surface_blend)) {
                        shader = &gr->shaders[state->sampler];
 
                        gl_shader_use(gr, shader);
@@ -1231,10 +1231,10 @@ repaint_view_clip(pepper_renderer_t *renderer, pepper_output_t *output,
                        glDisable(GL_BLEND);
                }
 
-               pixman_region32_fini(&surface_blend);
+               pepper_region_fini(&surface_blend);
        }
 
-       pixman_region32_fini(&repaint);
+       pepper_region_fini(&repaint);
 }
 
 static void
@@ -1256,15 +1256,15 @@ set_vertex(gl_surface_state_t *state, int32_t sx, int32_t sy,
 
 static void
 repaint_region_scissor(gl_renderer_t *gr, gl_surface_state_t *state,
-                                          pixman_region32_t *damage, pixman_region32_t *surface_region)
+                                          pepper_region_t *damage, pepper_region_t *surface_region)
 {
        int                 i, j;
        int                 nrects, surface_nrects;
-       pixman_box32_t     *rects, *surface_rects;
+       pepper_box_t     *rects, *surface_rects;
        GLfloat             vertex_array[16];
        gl_render_target_t *gt = (gl_render_target_t *)gr->base.target;
 
-       surface_rects = pixman_region32_rectangles(surface_region, &surface_nrects);
+       surface_rects = pepper_region_rectangles(surface_region, &surface_nrects);
 
        for (i = 0; i < surface_nrects; i++) {
                set_vertex(state, surface_rects[i].x1, surface_rects[i].y1, &vertex_array[0]);
@@ -1279,7 +1279,7 @@ repaint_region_scissor(gl_renderer_t *gr, gl_surface_state_t *state,
                                                          &vertex_array[2]);
                glEnableVertexAttribArray(1);
 
-               rects = pixman_region32_rectangles(damage, &nrects);
+               rects = pepper_region_rectangles(damage, &nrects);
                for (j = 0; j < nrects; j++) {
                        glScissor(rects[j].x1, gt->height - rects[j].y2,
                                          rects[j].x2 - rects[j].x1, rects[j].y2 - rects[j].y1);
@@ -1290,7 +1290,7 @@ repaint_region_scissor(gl_renderer_t *gr, gl_surface_state_t *state,
 
 static void
 repaint_view_scissor(pepper_renderer_t *renderer, pepper_output_t *output,
-                                        pepper_render_item_t *node, pixman_region32_t *damage)
+                                        pepper_render_item_t *node, pepper_region_t *damage)
 {
        gl_renderer_t      *gr = (gl_renderer_t *)renderer;
        gl_render_target_t *gt = (gl_render_target_t *)renderer->target;
@@ -1299,18 +1299,18 @@ repaint_view_scissor(pepper_renderer_t *renderer, pepper_output_t *output,
        gl_surface_state_t *state = get_surface_state(renderer, surface);
 
        gl_shader_t        *shader;
-       pixman_region32_t   repaint;
-       pixman_region32_t   surface_blend;
-       pixman_region32_t  *surface_opaque;
+       pepper_region_t   repaint;
+       pepper_region_t   surface_blend;
+       pepper_region_t  *surface_opaque;
 
        int                 i, w, h;
        float               trans[16];
        GLint               filter;
 
-       pixman_region32_init(&repaint);
-       pixman_region32_intersect(&repaint, &node->visible_region, damage);
+       pepper_region_init(&repaint);
+       pepper_region_intersect(&repaint, &node->visible_region, damage);
 
-       if (!pixman_region32_not_empty(&repaint))
+       if (!pepper_region_not_empty(&repaint))
                goto done;
 
        if (node->transform.flags <= PEPPER_MATRIX_TRANSLATE) {
@@ -1345,12 +1345,12 @@ repaint_view_scissor(pepper_renderer_t *renderer, pepper_output_t *output,
 
        pepper_surface_get_size(surface, &w, &h);
        surface_opaque = pepper_surface_get_opaque_region(surface);
-       pixman_region32_init_rect(&surface_blend, 0, 0, w, h);
-       pixman_region32_subtract(&surface_blend, &surface_blend, surface_opaque);
+       pepper_region_init_rect(&surface_blend, 0, 0, w, h);
+       pepper_region_subtract(&surface_blend, &surface_blend, surface_opaque);
 
        glEnable(GL_SCISSOR_TEST);
 
-       if (pixman_region32_not_empty(surface_opaque)) {
+       if (pepper_region_not_empty(surface_opaque)) {
                if (state->sampler == GL_SHADER_SAMPLER_RGBA)
                        shader = &gr->shaders[GL_SHADER_SAMPLER_RGBX];
                else
@@ -1366,7 +1366,7 @@ repaint_view_scissor(pepper_renderer_t *renderer, pepper_output_t *output,
                repaint_region_scissor(gr, state, &repaint, surface_opaque);
        }
 
-       if (pixman_region32_not_empty(&surface_blend)) {
+       if (pepper_region_not_empty(&surface_blend)) {
                shader = &gr->shaders[state->sampler];
                gl_shader_use(gr, shader);
 
@@ -1381,15 +1381,15 @@ repaint_view_scissor(pepper_renderer_t *renderer, pepper_output_t *output,
        }
 
        glDisable(GL_SCISSOR_TEST);
-       pixman_region32_fini(&surface_blend);
+       pepper_region_fini(&surface_blend);
 
 done:
-       pixman_region32_fini(&repaint);
+       pepper_region_fini(&repaint);
 }
 
 static void
 gl_renderer_repaint_output(pepper_renderer_t *renderer, pepper_output_t *output,
-                                                  const pepper_list_t *list, pixman_region32_t *damage)
+                                                  const pepper_list_t *list, pepper_region_t *damage)
 {
        gl_renderer_t                  *gr = (gl_renderer_t *)renderer;
        gl_render_target_t             *gt = (gl_render_target_t *)renderer->target;
@@ -1397,7 +1397,7 @@ gl_renderer_repaint_output(pepper_renderer_t *renderer, pepper_output_t *output,
 
        int                             i;
        EGLint                          buffer_age = 0;
-       pixman_region32_t               total_damage;
+       pepper_region_t               total_damage;
 
        if (!gl_renderer_use(gr))
                return;
@@ -1410,34 +1410,34 @@ gl_renderer_repaint_output(pepper_renderer_t *renderer, pepper_output_t *output,
                                                EGL_BUFFER_AGE_EXT, &buffer_age);
 
        if (!buffer_age || buffer_age - 1 > MAX_BUFFER_COUNT) {
-               pixman_region32_init_rect(&total_damage, geom->x, geom->y, geom->w, geom->h);
+               pepper_region_init_rect(&total_damage, geom->x, geom->y, geom->w, geom->h);
        } else {
                int first = gt->damage_index + MAX_BUFFER_COUNT - (buffer_age - 1);
 
-               pixman_region32_init(&total_damage);
-               pixman_region32_copy(&total_damage, damage);
+               pepper_region_init(&total_damage);
+               pepper_region_copy(&total_damage, damage);
 
                for (i = 0; i < buffer_age - 1; i++)
-                       pixman_region32_union(&total_damage, &total_damage,
+                       pepper_region_union(&total_damage, &total_damage,
                                                                  &gt->damages[(first + i) % MAX_BUFFER_COUNT]);
 
-               pixman_region32_copy(&gt->damages[gt->damage_index], damage);
+               pepper_region_copy(&gt->damages[gt->damage_index], damage);
 
                gt->damage_index += 1;
                gt->damage_index %= MAX_BUFFER_COUNT;
        }
 
-       if (pixman_region32_not_empty(&total_damage)) {
+       if (pepper_region_not_empty(&total_damage)) {
                pepper_list_t *l;
 
                if (gr->clear_background) {
                        int                 i, nrects;
-                       pixman_box32_t     *rects;
+                       pepper_box_t     *rects;
 
                        glEnable(GL_SCISSOR_TEST);
                        glClearColor(0.0, 0.0, 0.0, 1.0);
 
-                       rects = pixman_region32_rectangles(&total_damage, &nrects);
+                       rects = pepper_region_rectangles(&total_damage, &nrects);
 
                        glEnable(GL_SCISSOR_TEST);
                        for (i = 0; i < nrects; i++) {
@@ -1458,7 +1458,7 @@ gl_renderer_repaint_output(pepper_renderer_t *renderer, pepper_output_t *output,
                                                                 &total_damage);
        }
 
-       pixman_region32_fini(&total_damage);
+       pepper_region_fini(&total_damage);
 
        eglSwapBuffers(gr->display, ((gl_render_target_t *)renderer->target)->surface);
 
@@ -1697,7 +1697,7 @@ gl_render_target_destroy(pepper_render_target_t *target)
        gl_renderer_t      *gr = (gl_renderer_t *)target->renderer;
 
        for (i = 0; i < MAX_BUFFER_COUNT; i++)
-               pixman_region32_fini(&gt->damages[i]);
+               pepper_region_fini(&gt->damages[i]);
 
        if (gt->surface != EGL_NO_SURFACE)
                eglDestroySurface(gr->display, gt->surface);
@@ -1853,7 +1853,7 @@ pepper_gl_renderer_create_target(pepper_renderer_t *renderer,
                                          1);
 
        for (i = 0; i < MAX_BUFFER_COUNT; i++)
-               pixman_region32_init(&target->damages[i]);
+               pepper_region_init(&target->damages[i]);
 
        return &target->base;
 
index 614894b..ddc59a7 100644 (file)
@@ -57,7 +57,7 @@ struct pepper_renderer {
        void            (*repaint_output)(pepper_renderer_t *renderer,
                                                                          pepper_output_t *output,
                                                                          const pepper_list_t *render_list,
-                                                                         pixman_region32_t *damage);
+                                                                         pepper_region_t *damage);
 };
 
 #endif /* PEPPER_RENDER_INTERNAL_H */
index 1fdbc68..39ddbde 100644 (file)
@@ -62,7 +62,7 @@ pepper_renderer_flush_surface_damage(pepper_renderer_t *renderer,
 PEPPER_API void
 pepper_renderer_repaint_output(pepper_renderer_t *renderer,
                                                           pepper_output_t *output,
-                                                          const pepper_list_t *view_list, pixman_region32_t *damage);
+                                                          const pepper_list_t *view_list, pepper_region_t *damage);
 
 PEPPER_API pepper_bool_t
 pepper_renderer_read_pixels(pepper_renderer_t *renderer, int x, int y, int w,
index 438d575..fadb9be 100644 (file)
@@ -30,6 +30,7 @@
 #include "pepper-pixman-renderer.h"
 #include "pepper-render-internal.h"
 #include <pepper-output-backend.h>
+#include <pepper-utils-pixman.h>
 
 #ifdef HAVE_TBM
 #include <tbm_surface.h>
@@ -352,7 +353,7 @@ pixman_renderer_read_pixels(pepper_renderer_t *renderer,
        if (!src)
                return PEPPER_FALSE;
 
-       pixman_format = get_pixman_format(format);
+       pixman_format = pepper_get_pixman_format(format);
 
        if (!pixman_format) {
                /* PEPPER_ERROR("Invalid format.\n"); */
@@ -390,21 +391,21 @@ pixman_transform_from_pepper_mat4(pixman_transform_t *transform,
 
 static void
 repaint_view(pepper_renderer_t *renderer, pepper_output_t *output,
-                        pepper_render_item_t *node, pixman_region32_t *damage)
+                        pepper_render_item_t *node, pepper_region_t *damage)
 {
        int32_t                  x, y, w, h, scale;
        pepper_surface_t        *surface = pepper_view_get_surface(node->view);
 
        pixman_render_target_t  *target = (pixman_render_target_t *)renderer->target;
-       pixman_region32_t        repaint, repaint_surface;
-       pixman_region32_t        surface_blend, *surface_opaque;
+       pepper_region_t        repaint, repaint_surface;
+       pepper_region_t        surface_blend, *surface_opaque;
        pixman_surface_state_t  *ps = get_surface_state(renderer,
                                                                  pepper_view_get_surface(node->view));
 
-       pixman_region32_init(&repaint);
-       pixman_region32_intersect(&repaint, &node->visible_region, damage);
+       pepper_region_init(&repaint);
+       pepper_region_intersect(&repaint, &node->visible_region, damage);
 
-       if (pixman_region32_not_empty(&repaint)) {
+       if (pepper_region_not_empty(&repaint)) {
                pixman_transform_t  trans;
                pixman_filter_t     filter;
 
@@ -465,19 +466,19 @@ repaint_view(pepper_renderer_t *renderer, pepper_output_t *output,
                pixman_image_set_transform(ps->image, &trans);
                pixman_image_set_filter(ps->image, filter, NULL, 0);
 
-               pixman_region32_init(&repaint_surface);
-               pixman_region32_init_rect(&surface_blend, 0, 0, w, h);
+               pepper_region_init(&repaint_surface);
+               pepper_region_init_rect(&surface_blend, 0, 0, w, h);
 
                if (node->transform.flags <= PEPPER_MATRIX_TRANSLATE) {
                        surface_opaque = pepper_surface_get_opaque_region(surface);
-                       pixman_region32_subtract(&surface_blend, &surface_blend, surface_opaque);
+                       pepper_region_subtract(&surface_blend, &surface_blend, surface_opaque);
 
-                       if (pixman_region32_not_empty(surface_opaque)) {
-                               pixman_region32_translate(surface_opaque,
+                       if (pepper_region_not_empty(surface_opaque)) {
+                               pepper_region_translate(surface_opaque,
                                                                                  (int)node->transform.m[12], (int)node->transform.m[13]);
-                               pepper_pixman_region_global_to_output(surface_opaque, output);
-                               pixman_region32_intersect(&repaint_surface, &repaint, surface_opaque);
-                               pixman_image_set_clip_region32(target->image, &repaint_surface);
+                               pepper_region_global_to_output(surface_opaque, output);
+                               pepper_region_intersect(&repaint_surface, &repaint, surface_opaque);
+                               pixman_image_set_clip_region32(target->image, (pixman_region32_t*)&repaint_surface);
 
                                surface_state_begin_access(ps);
                                pixman_image_composite32(PIXMAN_OP_SRC, ps->image, NULL, target->image,
@@ -489,12 +490,12 @@ repaint_view(pepper_renderer_t *renderer, pepper_output_t *output,
                                surface_state_end_access(ps);
                        }
 
-                       if (pixman_region32_not_empty(&surface_blend)) {
-                               pixman_region32_translate(&surface_blend,
+                       if (pepper_region_not_empty(&surface_blend)) {
+                               pepper_region_translate(&surface_blend,
                                                                                  (int)node->transform.m[12], (int)node->transform.m[13]);
-                               pepper_pixman_region_global_to_output(&surface_blend, output);
-                               pixman_region32_intersect(&repaint_surface, &repaint, &surface_blend);
-                               pixman_image_set_clip_region32(target->image, &repaint_surface);
+                               pepper_region_global_to_output(&surface_blend, output);
+                               pepper_region_intersect(&repaint_surface, &repaint, &surface_blend);
+                               pixman_image_set_clip_region32(target->image, (pixman_region32_t*)&repaint_surface);
 
                                surface_state_begin_access(ps);
                                pixman_image_composite32(PIXMAN_OP_OVER, ps->image, NULL, target->image,
@@ -506,11 +507,11 @@ repaint_view(pepper_renderer_t *renderer, pepper_output_t *output,
                                surface_state_end_access(ps);
                        }
                } else {
-                       pixman_region32_translate(&surface_blend,
+                       pepper_region_translate(&surface_blend,
                                                                          (int)node->transform.m[12], (int)node->transform.m[13]);
-                       pepper_pixman_region_global_to_output(&surface_blend, output);
-                       pixman_region32_intersect(&repaint_surface, &repaint, &surface_blend);
-                       pixman_image_set_clip_region32(target->image, &repaint_surface);
+                       pepper_region_global_to_output(&surface_blend, output);
+                       pepper_region_intersect(&repaint_surface, &repaint, &surface_blend);
+                       pixman_image_set_clip_region32(target->image, (pixman_region32_t*)&repaint_surface);
 
                        surface_state_begin_access(ps);
                        pixman_image_composite32(PIXMAN_OP_OVER, ps->image, NULL, target->image,
@@ -522,20 +523,20 @@ repaint_view(pepper_renderer_t *renderer, pepper_output_t *output,
                        surface_state_end_access(ps);
                }
 
-               pixman_region32_fini(&repaint_surface);
-               pixman_region32_fini(&surface_blend);
+               pepper_region_fini(&repaint_surface);
+               pepper_region_fini(&surface_blend);
        }
 
-       pixman_region32_fini(&repaint);
+       pepper_region_fini(&repaint);
 }
 
 static void
-clear_background(pixman_renderer_t *renderer, pixman_region32_t *damage)
+clear_background(pixman_renderer_t *renderer, pepper_region_t *damage)
 {
        pixman_render_target_t *target = (pixman_render_target_t *)
                                                                         renderer->base.target;
 
-       pixman_image_set_clip_region32(target->image, damage);
+       pixman_image_set_clip_region32(target->image, (pixman_region32_t*)damage);
        pixman_image_composite32(PIXMAN_OP_SRC, renderer->background, NULL,
                                                         target->image,
                                                         0, 0, 0, 0, 0, 0,
@@ -547,9 +548,9 @@ static void
 pixman_renderer_repaint_output(pepper_renderer_t *renderer,
                                                           pepper_output_t *output,
                                                           const pepper_list_t *render_list,
-                                                          pixman_region32_t *damage)
+                                                          pepper_region_t *damage)
 {
-       if (pixman_region32_not_empty(damage)) {
+       if (pepper_region_not_empty(damage)) {
                pepper_list_t       *l;
                pixman_renderer_t   *pr = (pixman_renderer_t *)renderer;
 
@@ -614,7 +615,7 @@ pepper_pixman_renderer_create_target(pepper_format_t format, void *pixels,
 
        target->base.destroy    = pixman_render_target_destroy;
 
-       pixman_format = get_pixman_format(format);
+       pixman_format = pepper_get_pixman_format(format);
        if (!pixman_format)
                goto error;
 
index c58f105..2e076db 100644 (file)
@@ -74,7 +74,7 @@ pepper_renderer_flush_surface_damage(pepper_renderer_t *renderer,
 PEPPER_API void
 pepper_renderer_repaint_output(pepper_renderer_t *renderer,
                                                           pepper_output_t *output,
-                                                          const pepper_list_t *view_list, pixman_region32_t *damage)
+                                                          const pepper_list_t *view_list, pepper_region_t *damage)
 {
        renderer->repaint_output(renderer, output, view_list, damage);
 }
index 1e724ed..1a8d919 100644 (file)
@@ -83,7 +83,7 @@ struct pepper_tdm_output {
        tbm_surface_h           back, front;
        pepper_bool_t           page_flip_pending;
        /*For pixman*/
-       pixman_region32_t       previous_damage;
+       pepper_region_t       previous_damage;
 };
 
 struct pepper_tdm_plane {
index 164cebc..4ee40ec 100644 (file)
@@ -89,9 +89,9 @@ __tdm_renderer_pixman_render(pepper_tdm_output_t *output)
 {
        const pepper_list_t *render_list = pepper_plane_get_render_list(
                                                                                   output->primary_plane->base);
-       pixman_region32_t   *damage = pepper_plane_get_damage_region(
+       pepper_region_t   *damage = pepper_plane_get_damage_region(
                                                                          output->primary_plane->base);
-       pixman_region32_t    total_damage;
+       pepper_region_t    total_damage;
        tbm_surface_h       back;
        pepper_render_target_t *target;
 
@@ -108,14 +108,14 @@ __tdm_renderer_pixman_render(pepper_tdm_output_t *output)
                return;
        }
 
-       pixman_region32_init(&total_damage);
-       pixman_region32_union(&total_damage, damage, &output->previous_damage);
-       pixman_region32_copy(&output->previous_damage, damage);
+       pepper_region_init(&total_damage);
+       pepper_region_union(&total_damage, damage, &output->previous_damage);
+       pepper_region_copy(&output->previous_damage, damage);
 
        pepper_renderer_repaint_output(output->renderer, output->base, render_list,
                                                                   &total_damage);
 
-       pixman_region32_fini(&total_damage);
+       pepper_region_fini(&total_damage);
        pepper_plane_clear_damage_region(output->primary_plane->base);
 
        output->back = back;
@@ -124,7 +124,7 @@ __tdm_renderer_pixman_render(pepper_tdm_output_t *output)
 static void
 __tdm_renderer_pixman_fini(pepper_tdm_output_t *output)
 {
-       pixman_region32_fini(&output->previous_damage);
+       pepper_region_fini(&output->previous_damage);
 
        if (output->render_target)
                pepper_render_target_destroy(output->render_target);
@@ -158,7 +158,7 @@ __tdm_renderer_pixman_init(pepper_tdm_output_t *output)
        PEPPER_CHECK(output->tbm_surface_queue, goto error,
                                 "tbm_surface_queue_create() failed.\n");
 
-       pixman_region32_init(&output->previous_damage);
+       pepper_region_init(&output->previous_damage);
        output->render_type = TDM_RENDER_TYPE_PIXMAN;
 
        return;
@@ -174,7 +174,7 @@ __tdm_renderer_gl_render(pepper_tdm_output_t *output)
 
        const pepper_list_t *render_list = pepper_plane_get_render_list(
                                                                                   output->primary_plane->base);
-       pixman_region32_t   *damage = pepper_plane_get_damage_region(
+       pepper_region_t   *damage = pepper_plane_get_damage_region(
                                                                          output->primary_plane->base);
 
        pepper_renderer_repaint_output(output->renderer, output->base, render_list,
index 9e6b676..28ad2f4 100644 (file)
@@ -81,7 +81,7 @@ struct wayland_shm_buffer {
        int                     w, h;
 
        pepper_render_target_t *target;
-       pixman_region32_t       damage;
+       pepper_region_t       damage;
 
        void                   *data;
 };
index ee8b1b6..0b9c691 100644 (file)
@@ -208,7 +208,7 @@ wayland_output_repaint(void *o, const pepper_list_t *plane_list)
 
                if (plane == output->primary_plane) {
                        const pepper_list_t *render_list = pepper_plane_get_render_list(plane);
-                       pixman_region32_t   *damage = pepper_plane_get_damage_region(plane);
+                       pepper_region_t   *damage = pepper_plane_get_damage_region(plane);
 
                        if (output->render_pre)
                                output->render_pre(output);
index b43584e..d87e720 100644 (file)
@@ -101,7 +101,7 @@ wayland_shm_buffer_create(wayland_output_t *output)
        if (!buffer->target)
                goto error;
 
-       pixman_region32_init_rect(&buffer->damage, 0, 0, buffer->w, buffer->h);
+       pepper_region_init_rect(&buffer->damage, 0, 0, buffer->w, buffer->h);
        return buffer;
 
 error:
@@ -121,7 +121,7 @@ void
 wayland_shm_buffer_destroy(wayland_shm_buffer_t *buffer)
 {
        pepper_render_target_destroy(buffer->target);
-       pixman_region32_fini(&buffer->damage);
+       pepper_region_fini(&buffer->damage);
        wl_buffer_destroy(buffer->buffer);
        munmap(buffer->pixels, buffer->size);
        pepper_list_remove(&buffer->link);
index 01d2835..52568a6 100644 (file)
@@ -457,7 +457,7 @@ x11_output_repaint(void *o, const pepper_list_t *plane_list)
 
                if (plane == output->primary_plane) {
                        const pepper_list_t *render_list = pepper_plane_get_render_list(plane);
-                       pixman_region32_t   *damage = pepper_plane_get_damage_region(plane);
+                       pepper_region_t   *damage = pepper_plane_get_damage_region(plane);
 
                        pepper_renderer_set_target(output->renderer, output->target);
                        pepper_renderer_repaint_output(output->renderer, output->base, render_list,