Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Typedefs | Enumerations | Functions
pixman.h File Reference
#include <stdint.h>
#include "pixman-remap.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pixman_box16
struct  pixman_point_fixed
struct  pixman_line_fixed
struct  pixman_rectangle
struct  pixman_triangle
struct  pixman_trapezoid
struct  pixman_vector
struct  pixman_transform
struct  pixman_color

Defines

#define rgnOUT   0
#define rgnIN   1
#define rgnPART   2
#define IC_SHIFT   5
#define FB_SHIFT   IC_SHIFT

Typedefs

typedef struct pixman_region16
typedef struct pixman_box16 pixman_box16_t
typedef enum pixman_operator pixman_operator_t
typedef enum pixman_format_name pixman_format_name_t
typedef struct pixman_format
typedef struct pixman_image
typedef uint32_t pixman_bits_t
typedef int32_t pixman_fixed16_16_t
typedef struct pixman_point_fixed pixman_point_fixed_t
typedef struct pixman_line_fixed pixman_line_fixed_t
typedef struct pixman_rectangle pixman_rectangle_t
typedef struct pixman_triangle pixman_triangle_t
typedef struct pixman_trapezoid pixman_trapezoid_t
typedef struct pixman_vector pixman_vector_t
typedef struct pixman_transform pixman_transform_t
typedef struct pixman_color pixman_color_t

Enumerations

enum  pixman_region_status_t { PIXMAN_REGION_STATUS_FAILURE, PIXMAN_REGION_STATUS_SUCCESS }
enum  pixman_operator {
  PIXMAN_OPERATOR_CLEAR, PIXMAN_OPERATOR_SRC, PIXMAN_OPERATOR_DST, PIXMAN_OPERATOR_OVER,
  PIXMAN_OPERATOR_OVER_REVERSE, PIXMAN_OPERATOR_IN, PIXMAN_OPERATOR_IN_REVERSE, PIXMAN_OPERATOR_OUT,
  PIXMAN_OPERATOR_OUT_REVERSE, PIXMAN_OPERATOR_ATOP, PIXMAN_OPERATOR_ATOP_REVERSE, PIXMAN_OPERATOR_XOR,
  PIXMAN_OPERATOR_ADD, PIXMAN_OPERATOR_SATURATE
}
enum  pixman_format_name { PIXMAN_FORMAT_NAME_ARGB32, PIXMAN_FORMAT_NAME_RGB24, PIXMAN_FORMAT_NAME_A8, PIXMAN_FORMAT_NAME_A1 }
enum  pixman_filter_t {
  PIXMAN_FILTER_FAST, PIXMAN_FILTER_GOOD, PIXMAN_FILTER_BEST, PIXMAN_FILTER_NEAREST,
  PIXMAN_FILTER_BILINEAR
}

Functions

pixman_region16_t * pixman_region_create (void)
pixman_region16_t * pixman_region_create_simple (pixman_box16_t *extents)
void pixman_region_destroy (pixman_region16_t *region)
void pixman_region_translate (pixman_region16_t *region, int x, int y)
pixman_region_status_t pixman_region_copy (pixman_region16_t *dest, pixman_region16_t *source)
pixman_region_status_t pixman_region_intersect (pixman_region16_t *newReg, pixman_region16_t *reg1, pixman_region16_t *reg2)
pixman_region_status_t pixman_region_union (pixman_region16_t *newReg, pixman_region16_t *reg1, pixman_region16_t *reg2)
pixman_region_status_t pixman_region_union_rect (pixman_region16_t *dest, pixman_region16_t *source, int x, int y, unsigned int width, unsigned int height)
pixman_region_status_t pixman_region_subtract (pixman_region16_t *regD, pixman_region16_t *regM, pixman_region16_t *regS)
pixman_region_status_t pixman_region_inverse (pixman_region16_t *newReg, pixman_region16_t *reg1, pixman_box16_t *invRect)
int pixman_region_num_rects (pixman_region16_t *region)
pixman_box16_tpixman_region_rects (pixman_region16_t *region)
int pixman_region_contains_point (pixman_region16_t *region, int x, int y, pixman_box16_t *box)
int pixman_region_contains_rectangle (pixman_region16_t *pixman_region16_t, pixman_box16_t *prect)
int pixman_region_not_empty (pixman_region16_t *region)
pixman_box16_tpixman_region_extents (pixman_region16_t *region)
pixman_region_status_t pixman_region_append (pixman_region16_t *dest, pixman_region16_t *region)
pixman_region_status_t pixman_region_validate (pixman_region16_t *badreg, int *pOverlap)
void pixman_region_reset (pixman_region16_t *region, pixman_box16_t *pBox)
void pixman_region_empty (pixman_region16_t *region)
pixman_format_t * pixman_format_create (pixman_format_name_t name)
pixman_format_t * pixman_format_create_masks (int bpp, int alpha_mask, int red_mask, int green_mask, int blue_mask)
void pixman_format_destroy (pixman_format_t *format)
void pixman_format_get_masks (pixman_format_t *format, int *bpp, int *alpha_mask, int *red_mask, int *green_mask, int *blue_mask)
pixman_image_t * pixman_image_create (pixman_format_t *format, int width, int height)
pixman_image_t * pixman_image_create_for_data (pixman_bits_t *data, pixman_format_t *format, int width, int height, int bpp, int stride)
void pixman_image_destroy (pixman_image_t *image)
int pixman_image_set_clip_region (pixman_image_t *image, pixman_region16_t *region)
void pixman_image_set_component_alpha (pixman_image_t *image, int component_alpha)
int pixman_image_set_transform (pixman_image_t *image, pixman_transform_t *transform)
void pixman_image_set_repeat (pixman_image_t *image, int repeat)
void pixman_image_set_filter (pixman_image_t *image, pixman_filter_t filter)
int pixman_image_get_width (pixman_image_t *image)
int pixman_image_get_height (pixman_image_t *image)
int pixman_image_get_stride (pixman_image_t *image)
int pixman_image_get_depth (pixman_image_t *image)
pixman_format_t * pixman_image_get_format (pixman_image_t *image)
pixman_bits_tpixman_image_get_data (pixman_image_t *image)
void pixman_color_to_pixel (const pixman_format_t *format, const pixman_color_t *color, pixman_bits_t *pixel)
void pixman_pixel_to_color (const pixman_format_t *format, pixman_bits_t pixel, pixman_color_t *color)
void pixman_fill_rectangle (pixman_operator_t op, pixman_image_t *dst, const pixman_color_t *color, int x, int y, unsigned int width, unsigned int height)
void pixman_fill_rectangles (pixman_operator_t op, pixman_image_t *dst, const pixman_color_t *color, const pixman_rectangle_t *rects, int nRects)
void pixman_composite_trapezoids (pixman_operator_t op, pixman_image_t *src, pixman_image_t *dst, int xSrc, int ySrc, const pixman_trapezoid_t *traps, int ntrap)
void pixman_add_trapezoids (pixman_image_t *dst, int x_off, int y_off, const pixman_trapezoid_t *traps, int ntraps)
void pixman_composite_triangles (pixman_operator_t op, pixman_image_t *src, pixman_image_t *dst, int xSrc, int ySrc, const pixman_triangle_t *tris, int ntris)
void pixman_composite_tri_strip (pixman_operator_t op, pixman_image_t *src, pixman_image_t *dst, int xSrc, int ySrc, const pixman_point_fixed_t *points, int npoints)
void pixman_composite_tri_fan (pixman_operator_t op, pixman_image_t *src, pixman_image_t *dst, int xSrc, int ySrc, const pixman_point_fixed_t *points, int npoints)
void pixman_composite (pixman_operator_t op, pixman_image_t *iSrc, pixman_image_t *iMask, pixman_image_t *iDst, int xSrc, int ySrc, int xMask, int yMask, int xDst, int yDst, int width, int height)

Class Documentation

struct pixman_box16

Definition at line 114 of file pixman.h.

Class Members
short x1
short x2
short y1
short y2
struct pixman_point_fixed

Definition at line 305 of file pixman.h.

Class Members
pixman_fixed16_16_t x
pixman_fixed16_16_t y
struct pixman_line_fixed

Definition at line 309 of file pixman.h.

Collaboration diagram for pixman_line_fixed:
Class Members
pixman_point_fixed_t p1
pixman_point_fixed_t p2
struct pixman_rectangle

Definition at line 316 of file pixman.h.

Class Members
unsigned short height
unsigned short width
short x
short y
struct pixman_triangle

Definition at line 321 of file pixman.h.

Collaboration diagram for pixman_triangle:
Class Members
pixman_point_fixed_t p1
pixman_point_fixed_t p2
pixman_point_fixed_t p3
struct pixman_trapezoid

Definition at line 325 of file pixman.h.

Collaboration diagram for pixman_trapezoid:
Class Members
pixman_fixed16_16_t bottom
pixman_line_fixed_t left
pixman_line_fixed_t right
pixman_fixed16_16_t top
struct pixman_vector

Definition at line 330 of file pixman.h.

Class Members
pixman_fixed16_16_t vector
struct pixman_transform

Definition at line 334 of file pixman.h.

Class Members
pixman_fixed16_16_t matrix
struct pixman_color

Definition at line 383 of file pixman.h.

Class Members
unsigned short alpha
unsigned short blue
unsigned short green
unsigned short red

Define Documentation

Definition at line 286 of file pixman.h.

#define IC_SHIFT   5

Definition at line 285 of file pixman.h.

#define rgnIN   1

Definition at line 174 of file pixman.h.

#define rgnOUT   0

Definition at line 173 of file pixman.h.

#define rgnPART   2

Definition at line 175 of file pixman.h.


Typedef Documentation

Definition at line 287 of file pixman.h.

typedef struct pixman_box16 pixman_box16_t
typedef struct pixman_color pixman_color_t

Definition at line 303 of file pixman.h.

typedef struct pixman_format

Definition at line 238 of file pixman.h.

typedef struct pixman_image

Definition at line 263 of file pixman.h.

typedef struct pixman_region16

Definition at line 112 of file pixman.h.


Enumeration Type Documentation

Enumerator:
PIXMAN_FILTER_FAST 
PIXMAN_FILTER_GOOD 
PIXMAN_FILTER_BEST 
PIXMAN_FILTER_NEAREST 
PIXMAN_FILTER_BILINEAR 

Definition at line 338 of file pixman.h.

Enumerator:
PIXMAN_FORMAT_NAME_ARGB32 
PIXMAN_FORMAT_NAME_RGB24 
PIXMAN_FORMAT_NAME_A8 
PIXMAN_FORMAT_NAME_A1 

Definition at line 231 of file pixman.h.

Enumerator:
PIXMAN_OPERATOR_CLEAR 
PIXMAN_OPERATOR_SRC 
PIXMAN_OPERATOR_DST 
PIXMAN_OPERATOR_OVER 
PIXMAN_OPERATOR_OVER_REVERSE 
PIXMAN_OPERATOR_IN 
PIXMAN_OPERATOR_IN_REVERSE 
PIXMAN_OPERATOR_OUT 
PIXMAN_OPERATOR_OUT_REVERSE 
PIXMAN_OPERATOR_ATOP 
PIXMAN_OPERATOR_ATOP_REVERSE 
PIXMAN_OPERATOR_XOR 
PIXMAN_OPERATOR_ADD 
PIXMAN_OPERATOR_SATURATE 

Definition at line 214 of file pixman.h.

Enumerator:
PIXMAN_REGION_STATUS_FAILURE 
PIXMAN_REGION_STATUS_SUCCESS 

Definition at line 118 of file pixman.h.


Function Documentation

void pixman_add_trapezoids ( pixman_image_t *  dst,
int  x_off,
int  y_off,
const pixman_trapezoid_t traps,
int  ntraps 
)

Definition at line 199 of file ictrap.c.

{
    for (; ntraps; ntraps--, traps++)
    {
       if (!xTrapezoidValid (traps))
           continue;

       fbRasterizeTrapezoid (dst, traps, x_off, y_off);
    }
}

Here is the call graph for this function:

void pixman_color_to_pixel ( const pixman_format_t *  format,
const pixman_color_t color,
pixman_bits_t pixel 
)

Definition at line 40 of file iccolor.c.

{
    uint32_t      r, g, b, a;

    r = color->red >> (16 - _FbOnes (format->redMask));
    g = color->green >> (16 - _FbOnes (format->greenMask));
    b = color->blue >> (16 - _FbOnes (format->blueMask));
    a = color->alpha >> (16 - _FbOnes (format->alphaMask));
    r = r << format->red;
    g = g << format->green;
    b = b << format->blue;
    a = a << format->alpha;
    *pixel = r|g|b|a;
}

Here is the call graph for this function:

void pixman_composite ( pixman_operator_t  op,
pixman_image_t *  iSrc,
pixman_image_t *  iMask,
pixman_image_t *  iDst,
int  xSrc,
int  ySrc,
int  xMask,
int  yMask,
int  xDst,
int  yDst,
int  width,
int  height 
)

Definition at line 1347 of file fbpict.c.

{
    pixman_region16_t           *region;
    int                  n;
    pixman_box16_t    *pbox;
    CompositeFunc   func = NULL;
    Bool          srcRepeat = pSrc->pDrawable && pSrc->repeat == RepeatNormal;
    Bool          maskRepeat = FALSE;
    Bool          srcTransform = pSrc->transform != 0;
    Bool          maskTransform = FALSE;
    Bool          srcAlphaMap = pSrc->alphaMap != 0;
    Bool          maskAlphaMap = FALSE;
    Bool          dstAlphaMap = pDst->alphaMap != 0;
    int                  x_msk, y_msk, x_src, y_src, x_dst, y_dst;
    int                  w, h, w_this, h_this;

#ifdef USE_MMX
    static Bool mmx_setup = FALSE;
    if (!mmx_setup) {
        fbComposeSetupMMX();
        mmx_setup = TRUE;
    }
#endif
        
    xDst += pDst->pDrawable->x;
    yDst += pDst->pDrawable->y;
    if (pSrc->pDrawable) {
        xSrc += pSrc->pDrawable->x;
        ySrc += pSrc->pDrawable->y;
    }

    if (srcRepeat && srcTransform &&
       pSrc->pDrawable->width == 1 &&
       pSrc->pDrawable->height == 1)
       srcTransform = FALSE;

    if (pMask && pMask->pDrawable)
    {
       xMask += pMask->pDrawable->x;
       yMask += pMask->pDrawable->y;
       maskRepeat = pMask->repeat == RepeatNormal;
       maskTransform = pMask->transform != 0;
#ifdef PIXMAN_CONVOLUTION
       if (pMask->filter == PictFilterConvolution)
           maskTransform = TRUE;
#endif

       maskAlphaMap = pMask->alphaMap != 0;

       if (maskRepeat && maskTransform &&
           pMask->pDrawable->width == 1 &&
           pMask->pDrawable->height == 1)
           maskTransform = FALSE;
    }

    if (pSrc->pDrawable && (!pMask || pMask->pDrawable)
        && !srcTransform && !maskTransform
        && !maskAlphaMap && !srcAlphaMap && !dstAlphaMap
#ifdef PIXMAN_CONVOLUTION
        && (pSrc->filter != PictFilterConvolution)
        && (!pMask || pMask->filter != PictFilterConvolution)
#endif
        )
    switch (op) {
    case PIXMAN_OPERATOR_OVER:
       if (pMask)
       {
           if (srcRepeat &&
              pSrc->pDrawable->width == 1 &&
              pSrc->pDrawable->height == 1)
           {
              if (PICT_FORMAT_COLOR(pSrc->format_code)) {
                  switch (pMask->format_code) {
                  case PICT_a8:
                     switch (pDst->format_code) {
                     case PICT_r5g6b5:
                     case PICT_b5g6r5:
#ifdef USE_MMX
                         if (fbHaveMMX())
                            func = fbCompositeSolidMask_nx8x0565mmx;
                         else
#endif
                            func = fbCompositeSolidMask_nx8x0565;
                         break;
                     case PICT_r8g8b8:
                     case PICT_b8g8r8:
                         func = fbCompositeSolidMask_nx8x0888;
                         break;
                     case PICT_a8r8g8b8:
                     case PICT_x8r8g8b8:
                     case PICT_a8b8g8r8:
                     case PICT_x8b8g8r8:
#ifdef USE_MMX
                         if (fbHaveMMX())
                            func = fbCompositeSolidMask_nx8x8888mmx;
                         else
#endif
                            func = fbCompositeSolidMask_nx8x8888;
                         break;
                     }
                     break;
                  case PICT_a8r8g8b8:
                     if (pMask->componentAlpha) {
                         switch (pDst->format_code) {
                         case PICT_a8r8g8b8:
                         case PICT_x8r8g8b8:
#ifdef USE_MMX
                            if (fbHaveMMX())
                                func = fbCompositeSolidMask_nx8888x8888Cmmx;
                            else
#endif
                                func = fbCompositeSolidMask_nx8888x8888C;
                            break;
                         case PICT_r5g6b5:
#ifdef USE_MMX
                            if (fbHaveMMX())
                                func = fbCompositeSolidMask_nx8888x0565Cmmx;
                            else
#endif
                                func = fbCompositeSolidMask_nx8888x0565C;
                            break;
                         }
                     }
                     else
                     {
                         switch (pDst->format_code) {
                         case PICT_r5g6b5:
                            func = fbCompositeSolidMask_nx8888x0565;
                            break;
                         }
                     }
                     break;
                  case PICT_a8b8g8r8:
                     if (pMask->componentAlpha) {
                         switch (pDst->format_code) {
                         case PICT_a8b8g8r8:
                         case PICT_x8b8g8r8:
#ifdef USE_MMX
                            if (fbHaveMMX())
                                func = fbCompositeSolidMask_nx8888x8888Cmmx;
                            else
#endif
                                func = fbCompositeSolidMask_nx8888x8888C;
                            break;
                         case PICT_b5g6r5:
#ifdef USE_MMX
                            if (fbHaveMMX())
                                func = fbCompositeSolidMask_nx8888x0565Cmmx;
                            else
#endif
                                func = fbCompositeSolidMask_nx8888x0565C;
                            break;
                         }
                     }
                     else
                     {
                         switch (pDst->format_code) {
                         case PICT_b5g6r5:
                            func = fbCompositeSolidMask_nx8888x0565;
                            break;
                         }
                     }
                     break;
                  case PICT_a1:
                     switch (pDst->format_code) {
                     case PICT_r5g6b5:
                     case PICT_b5g6r5:
                     case PICT_r8g8b8:
                     case PICT_b8g8r8:
                     case PICT_a8r8g8b8:
                     case PICT_x8r8g8b8:
                     case PICT_a8b8g8r8:
                     case PICT_x8b8g8r8:
                         func = fbCompositeSolidMask_nx1xn;
                         break;
                     }
                  }
              }
              if (func != pixman_compositeGeneral)
                  srcRepeat = FALSE;
           }
           else /* has mask and non-repeating source */
           {
              if (pSrc->pDrawable == pMask->pDrawable &&
                  xSrc == xMask && ySrc == yMask &&
                  !pMask->componentAlpha)
              {
                  /* source == mask: non-premultiplied data */
                  switch (pSrc->format_code) {
                  case PICT_x8b8g8r8:
                     switch (pMask->format_code) {
                     case PICT_a8r8g8b8:
                     case PICT_a8b8g8r8:
                         switch (pDst->format_code) {
                         case PICT_a8r8g8b8:
                         case PICT_x8r8g8b8:
#ifdef USE_MMX
                            if (fbHaveMMX())
                                func = fbCompositeSrc_8888RevNPx8888mmx;
#endif
                            break;
                         case PICT_r5g6b5:
#ifdef USE_MMX
                            if (fbHaveMMX())
                                func = fbCompositeSrc_8888RevNPx0565mmx;
#endif
                            break;
                         }
                         break;
                     }
                     break;
                  case PICT_x8r8g8b8:
                     switch (pMask->format_code) {
                     case PICT_a8r8g8b8:
                     case PICT_a8b8g8r8:
                         switch (pDst->format_code) {
                         case PICT_a8b8g8r8:
                         case PICT_x8b8g8r8:
#ifdef USE_MMX
                            if (fbHaveMMX())
                                func = fbCompositeSrc_8888RevNPx8888mmx;
#endif
                            break;
                         case PICT_r5g6b5:
#ifdef USE_MMX
                            if (fbHaveMMX())
                                func = fbCompositeSrc_8888RevNPx0565mmx;
#endif
                            break;
                         }
                         break;
                     }
                     break;
                  }
                  break;
              }
              else
              {
                  /* non-repeating source, repeating mask => translucent window */
                  if (maskRepeat &&
                     pMask->pDrawable->width == 1 &&
                     pMask->pDrawable->height == 1)
                  {
                     switch (pSrc->format_code) {
                     case PICT_r5g6b5:
                     case PICT_b5g6r5:
                         if (pDst->format_code == pSrc->format_code)
                            func = fbCompositeTrans_0565xnx0565;
                         break;
                     case PICT_r8g8b8:
                     case PICT_b8g8r8:
                         if (pDst->format_code == pSrc->format_code)
                            func = fbCompositeTrans_0888xnx0888;
                         break;
#ifdef USE_MMX
                     case PICT_x8r8g8b8:
                     case PICT_x8b8g8r8:
                         if (pDst->format_code == pSrc->format_code &&
                            pMask->format_code == PICT_a8 && fbHaveMMX())
                            func = fbCompositeSrc_x888x8x8888mmx;
                         break;
#if 0 /* This case fails rendercheck for me */
                     case PICT_a8r8g8b8:
                         if ((pDst->format == PICT_a8r8g8b8 ||
                             pDst->format == PICT_x8r8g8b8) &&
                            pMask->format == PICT_a8 && fbHaveMMX())
                            func = fbCompositeSrc_8888x8x8888mmx;
                         break;
#endif
                     case PICT_a8b8g8r8:
                         if ((pDst->format_code == PICT_a8b8g8r8 ||
                             pDst->format_code == PICT_x8b8g8r8) &&
                            pMask->format_code == PICT_a8 && fbHaveMMX())
                            func = fbCompositeSrc_8888x8x8888mmx;
                         break;
#endif
                     }

                        if (func != pixman_compositeGeneral)
                         maskRepeat = FALSE;
                  }
              }
           }
       }
       else /* no mask */
       {
           if (srcRepeat &&
              pSrc->pDrawable->width == 1 &&
              pSrc->pDrawable->height == 1)
           {
              /* no mask and repeating source */
              switch (pSrc->format_code) {
              case PICT_a8r8g8b8:
                  switch (pDst->format_code) {
                  case PICT_a8r8g8b8:
                  case PICT_x8r8g8b8:
#ifdef USE_MMX
                     if (fbHaveMMX())
                     {
                         srcRepeat = FALSE;
                         func = fbCompositeSolid_nx8888mmx;
                     }
#endif
                     break;
                  case PICT_r5g6b5:
#ifdef USE_MMX
                     if (fbHaveMMX())
                     {
                         srcRepeat = FALSE;
                         func = fbCompositeSolid_nx0565mmx;
                     }
#endif
                     break;
                  }
                  break;
              }
           }
           else
           {
              /*
               * Formats without alpha bits are just Copy with Over
               */
              if (pSrc->format_code == pDst->format_code && !PICT_FORMAT_A(pSrc->format_code))
              {
#ifdef USE_MMX
                     if (fbHaveMMX() &&
                         (pSrc->format_code == PICT_x8r8g8b8 || pSrc->format_code == PICT_x8b8g8r8))
                         func = fbCompositeCopyAreammx;
                     else
#endif
                         func = fbCompositeSrcSrc_nxn;
              }
              else switch (pSrc->format_code) {
              case PICT_a8r8g8b8:
                  switch (pDst->format_code) {
                  case PICT_a8r8g8b8:
                  case PICT_x8r8g8b8:
#ifdef USE_MMX
                     if (fbHaveMMX())
                         func = fbCompositeSrc_8888x8888mmx;
                     else
#endif
                         func = fbCompositeSrc_8888x8888;
                     break;
                  case PICT_r8g8b8:
                     func = fbCompositeSrc_8888x0888;
                     break;
                  case PICT_r5g6b5:
                     func = fbCompositeSrc_8888x0565;
                     break;
                  }
                  break;
              case PICT_a8b8g8r8:
                  switch (pDst->format_code) {
                  case PICT_a8b8g8r8:
                  case PICT_x8b8g8r8:
#ifdef USE_MMX
                     if (fbHaveMMX())
                         func = fbCompositeSrc_8888x8888mmx;
                     else
#endif
                         func = fbCompositeSrc_8888x8888;
                     break;
                  case PICT_b8g8r8:
                     func = fbCompositeSrc_8888x0888;
                     break;
                  case PICT_b5g6r5:
                     func = fbCompositeSrc_8888x0565;
                     break;
                  }
                  break;
              }
           }
       }
       break;
    case PIXMAN_OPERATOR_ADD:
       if (pMask == 0)
       {
           switch (pSrc->format_code) {
           case PICT_a8r8g8b8:
              switch (pDst->format_code) {
              case PICT_a8r8g8b8:
#ifdef USE_MMX
                  if (fbHaveMMX())
                     func = fbCompositeSrcAdd_8888x8888mmx;
                  else
#endif
                     func = fbCompositeSrcAdd_8888x8888;
                  break;
              }
              break;
           case PICT_a8b8g8r8:
              switch (pDst->format_code) {
              case PICT_a8b8g8r8:
#ifdef USE_MMX
                  if (fbHaveMMX())
                     func = fbCompositeSrcAdd_8888x8888mmx;
                  else
#endif
                     func = fbCompositeSrcAdd_8888x8888;
                  break;
              }
              break;
           case PICT_a8:
              switch (pDst->format_code) {
              case PICT_a8:
#ifdef USE_MMX
                  if (fbHaveMMX())
                     func = fbCompositeSrcAdd_8000x8000mmx;
                  else
#endif
                     func = fbCompositeSrcAdd_8000x8000;
                  break;
              }
              break;
           case PICT_a1:
              switch (pDst->format_code) {
              case PICT_a1:
                  func = fbCompositeSrcAdd_1000x1000;
                  break;
              }
              break;
           }
       }
       break;
    case PIXMAN_OPERATOR_SRC:
       if (pMask)
         {
#ifdef USE_MMX
           if (srcRepeat &&
              pSrc->pDrawable->width == 1 &&
              pSrc->pDrawable->height == 1)
           {
              if (pMask->format_code == PICT_a8)
              {
                  switch (pDst->format_code) {
                  case PICT_a8r8g8b8:
                  case PICT_x8r8g8b8:
                  case PICT_a8b8g8r8:
                  case PICT_x8b8g8r8:
                     if (fbHaveMMX())
                         func = fbCompositeSolidMaskSrc_nx8x8888mmx;
                     break;
                  }
              }
           }
#endif
         }
       else
       {
           if (pSrc->format_code == pDst->format_code)
           {
#ifdef USE_MMX
              if (pSrc->pDrawable != pDst->pDrawable &&
                    (PICT_FORMAT_BPP (pSrc->format_code) == 16 ||
                     PICT_FORMAT_BPP (pSrc->format_code) == 32))
                  func = fbCompositeCopyAreammx;
              else
#endif
                  func = fbCompositeSrcSrc_nxn;
           }
       }
       break;
    }

    if (!func) {
        /* no fast path, use the general code */
        pixman_compositeGeneral(op, pSrc, pMask, pDst, xSrc, ySrc, xMask, yMask, xDst, yDst, width, height);
        return;
    }

    /* if we are transforming, we handle repeats in IcFetch[a]_transform */
    if (srcTransform)
       srcRepeat = 0;
    if (maskTransform)
       maskRepeat = 0;

    region = pixman_region_create();
    pixman_region_union_rect (region, region, xDst, yDst, width, height);
    
    if (!FbComputeCompositeRegion (region,
                               pSrc,
                               pMask,
                               pDst,
                               xSrc,
                               ySrc,
                               xMask,
                               yMask,
                               xDst,
                               yDst,
                               width,
                               height))
       return;
    
    n = pixman_region_num_rects (region);
    pbox = pixman_region_rects (region);
    while (n--)
    {
       h = pbox->y2 - pbox->y1;
       y_src = pbox->y1 - yDst + ySrc;
       y_msk = pbox->y1 - yDst + yMask;
       y_dst = pbox->y1;
       while (h)
       {
           h_this = h;
           w = pbox->x2 - pbox->x1;
           x_src = pbox->x1 - xDst + xSrc;
           x_msk = pbox->x1 - xDst + xMask;
           x_dst = pbox->x1;
           if (maskRepeat)
           {
              y_msk = mod (y_msk, pMask->pDrawable->height);
              if (h_this > pMask->pDrawable->height - y_msk)
                  h_this = pMask->pDrawable->height - y_msk;
           }
           if (srcRepeat)
           {
              y_src = mod (y_src, pSrc->pDrawable->height);
              if (h_this > pSrc->pDrawable->height - y_src)
                  h_this = pSrc->pDrawable->height - y_src;
           }
           while (w)
           {
              w_this = w;
              if (maskRepeat)
              {
                  x_msk = mod (x_msk, pMask->pDrawable->width);
                  if (w_this > pMask->pDrawable->width - x_msk)
                     w_this = pMask->pDrawable->width - x_msk;
              }
              if (srcRepeat)
              {
                  x_src = mod (x_src, pSrc->pDrawable->width);
                  if (w_this > pSrc->pDrawable->width - x_src)
                     w_this = pSrc->pDrawable->width - x_src;
              }
              (*func) (op, pSrc, pMask, pDst,
                      x_src, y_src, x_msk, y_msk, x_dst, y_dst,
                      w_this, h_this);
              w -= w_this;
              x_src += w_this;
              x_msk += w_this;
              x_dst += w_this;
           }
           h -= h_this;
           y_src += h_this;
           y_msk += h_this;
           y_dst += h_this;
       }
       pbox++;
    }
    pixman_region_destroy (region);
}

Here is the call graph for this function:

void pixman_composite_trapezoids ( pixman_operator_t  op,
pixman_image_t *  src,
pixman_image_t *  dst,
int  xSrc,
int  ySrc,
const pixman_trapezoid_t traps,
int  ntrap 
)

Definition at line 111 of file ictrap.c.

{
    pixman_image_t   *image = NULL;
    pixman_box16_t   traps_bounds, dst_bounds, bounds;
    pixman_region16_t       *traps_region, *dst_region;
    int16_t          xDst, yDst;
    int16_t          xRel, yRel;
    pixman_format_t  *format;

    if (ntraps == 0)
       return;

    /*
     * Check for solid alpha add
     */
    if (op == PIXMAN_OPERATOR_ADD && miIsSolidAlpha (src))
    {
       for (; ntraps; ntraps--, traps++)
           fbRasterizeTrapezoid (dst, traps, 0, 0);
       return;
    }

    xDst = traps[0].left.p1.x >> 16;
    yDst = traps[0].left.p1.y >> 16;
    
    pixman_trapezoid_bounds (ntraps, traps, &traps_bounds);

    traps_region = pixman_region_create_simple (&traps_bounds);

    /* XXX: If the image has a clip region set, we should really be
     * fetching it here instead, but it looks like we don't yet expose
     * a pixman_image_get_clip_region function. */
    dst_bounds.x1 = 0;
    dst_bounds.y1 = 0;
    dst_bounds.x2 = pixman_image_get_width (dst);
    dst_bounds.y2 = pixman_image_get_height (dst);

    dst_region = pixman_region_create_simple (&dst_bounds);

    pixman_region_intersect (traps_region, traps_region, dst_region);

    bounds = *(pixman_region_extents (traps_region));

    pixman_region_destroy (traps_region);
    pixman_region_destroy (dst_region);

    if (bounds.y1 >= bounds.y2 || bounds.x1 >= bounds.x2)
       return;

    format = pixman_format_create (PIXMAN_FORMAT_NAME_A8);
    if (!format)
       return;

    image = FbCreateAlphaPicture (dst, format,
                              bounds.x2 - bounds.x1,
                              bounds.y2 - bounds.y1);
    if (!image)
    {
       pixman_format_destroy (format);
       return;
    }

    for (; ntraps; ntraps--, traps++)
    {
       if (!xTrapezoidValid(traps))
           continue;
       fbRasterizeTrapezoid (image, traps, 
                           -bounds.x1, -bounds.y1);
    }

    xRel = bounds.x1 + xSrc - xDst;
    yRel = bounds.y1 + ySrc - yDst;
    pixman_composite (op, src, image, dst,
                    xRel, yRel, 0, 0, bounds.x1, bounds.y1,
                    bounds.x2 - bounds.x1,
                    bounds.y2 - bounds.y1);
    pixman_image_destroy (image);

    pixman_format_destroy (format);
}

Here is the call graph for this function:

void pixman_composite_tri_fan ( pixman_operator_t  op,
pixman_image_t *  src,
pixman_image_t *  dst,
int  xSrc,
int  ySrc,
const pixman_point_fixed_t points,
int  npoints 
)

Definition at line 285 of file ictri.c.

{
    pixman_triangle_t              tri;
    pixman_box16_t   bounds;
    pixman_image_t          *image = NULL;
    const pixman_point_fixed_t     *first;
    int              xDst, yDst;
    int              xRel, yRel;
    pixman_format_t  *format;
    
    xDst = points[0].x >> 16;
    yDst = points[0].y >> 16;

    format = pixman_format_create (PIXMAN_FORMAT_NAME_A8);
    
    if (npoints < 3)
       return;
    if (format)
    {
       pixman_point_fixed_bounds (npoints, points, &bounds);
       if (bounds.x2 <= bounds.x1 || bounds.y2 <= bounds.y1)
           return;
       image = FbCreateAlphaPicture (dst,
                                  format,
                                  bounds.x2 - bounds.x1,
                                  bounds.y2 - bounds.y1);
       if (!image)
           return;
    }
    first = points++;
    npoints--;
    for (; npoints >= 2; npoints--, points++)
    {
       tri.p1 = *first;
       tri.p2 = points[0];
       tri.p3 = points[1];
       if (!format)
       {
           pixman_triangle_bounds (1, &tri, &bounds);
           if (bounds.x2 <= bounds.x1 || bounds.y2 <= bounds.y1)
              continue;
           image = FbCreateAlphaPicture (dst,
                                     format, 
                                     bounds.x2 - bounds.x1,
                                     bounds.y2 - bounds.y1);
           if (!image)
              continue;
       }
       FbRasterizeTriangle (image, &tri, -bounds.x1, -bounds.y1);
       if (!format)
       {
           xRel = bounds.x1 + xSrc - xDst;
           yRel = bounds.y1 + ySrc - yDst;
           pixman_composite (op, src, image, dst,
                      xRel, yRel, 0, 0, bounds.x1, bounds.y1,
                      bounds.x2 - bounds.x1, bounds.y2 - bounds.y1);
           pixman_image_destroy (image);
       }
    }
    if (format)
    {
       xRel = bounds.x1 + xSrc - xDst;
       yRel = bounds.y1 + ySrc - yDst;
       pixman_composite (op, src, image, dst,
                   xRel, yRel, 0, 0, bounds.x1, bounds.y1,
                   bounds.x2 - bounds.x1, bounds.y2 - bounds.y1);
       pixman_image_destroy (image);
    }

    pixman_format_destroy (format);
}

Here is the call graph for this function:

void pixman_composite_tri_strip ( pixman_operator_t  op,
pixman_image_t *  src,
pixman_image_t *  dst,
int  xSrc,
int  ySrc,
const pixman_point_fixed_t points,
int  npoints 
)

Definition at line 209 of file ictri.c.

{
    pixman_triangle_t              tri;
    pixman_box16_t   bounds;
    pixman_image_t          *image = NULL;
    int              xDst, yDst;
    int              xRel, yRel;
    pixman_format_t  *format;
    
    xDst = points[0].x >> 16;
    yDst = points[0].y >> 16;

    format = pixman_format_create (PIXMAN_FORMAT_NAME_A8);
    
    if (npoints < 3)
       return;
    if (format)
    {
       pixman_point_fixed_bounds (npoints, points, &bounds);
       if (bounds.x2 <= bounds.x1 || bounds.y2 <= bounds.y1)
           return;
       image = FbCreateAlphaPicture (dst,
                                  format,
                                  bounds.x2 - bounds.x1,
                                  bounds.y2 - bounds.y1);
       if (!image)
           return;
    }
    for (; npoints >= 3; npoints--, points++)
    {
       tri.p1 = points[0];
       tri.p2 = points[1];
       tri.p3 = points[2];
       if (!format)
       {
           pixman_triangle_bounds (1, &tri, &bounds);
           if (bounds.x2 <= bounds.x1 || bounds.y2 <= bounds.y1)
              continue;
           image = FbCreateAlphaPicture (dst,
                                     format, 
                                     bounds.x2 - bounds.x1,
                                     bounds.y2 - bounds.y1);
           if (!image)
              continue;
       }
       FbRasterizeTriangle (image, &tri, -bounds.x1, -bounds.y1);
       if (!format)
       {
           xRel = bounds.x1 + xSrc - xDst;
           yRel = bounds.y1 + ySrc - yDst;
           pixman_composite (op, src, image, dst,
                      xRel, yRel, 0, 0, bounds.x1, bounds.y1,
                      bounds.x2 - bounds.x1, bounds.y2 - bounds.y1);
           pixman_image_destroy (image);
       }
    }
    if (format)
    {
       xRel = bounds.x1 + xSrc - xDst;
       yRel = bounds.y1 + ySrc - yDst;
       pixman_composite (op, src, image, dst,
                   xRel, yRel, 0, 0, bounds.x1, bounds.y1,
                   bounds.x2 - bounds.x1, bounds.y2 - bounds.y1);
       pixman_image_destroy (image);
    }

    pixman_format_destroy (format);
}

Here is the call graph for this function:

void pixman_composite_triangles ( pixman_operator_t  op,
pixman_image_t *  src,
pixman_image_t *  dst,
int  xSrc,
int  ySrc,
const pixman_triangle_t tris,
int  ntris 
)

Definition at line 138 of file ictri.c.

{
    pixman_box16_t   bounds;
    pixman_image_t          *image = NULL;
    int              xDst, yDst;
    int              xRel, yRel;
    pixman_format_t  *format;
    
    xDst = tris[0].p1.x >> 16;
    yDst = tris[0].p1.y >> 16;

    format = pixman_format_create (PIXMAN_FORMAT_NAME_A8);
    
    if (format)
    {
       pixman_triangle_bounds (ntris, tris, &bounds);
       if (bounds.x2 <= bounds.x1 || bounds.y2 <= bounds.y1)
           return;
       image = FbCreateAlphaPicture (dst,
                                  format,
                                  bounds.x2 - bounds.x1,
                                  bounds.y2 - bounds.y1);
       if (!image)
           return;
    }
    for (; ntris; ntris--, tris++)
    {
       if (!format)
       {
           pixman_triangle_bounds (1, tris, &bounds);
           if (bounds.x2 <= bounds.x1 || bounds.y2 <= bounds.y1)
              continue;
           image = FbCreateAlphaPicture (dst,
                                     format,
                                     bounds.x2 - bounds.x1,
                                     bounds.y2 - bounds.y1);
           if (!image)
              break;
       }
       FbRasterizeTriangle (image, tris, -bounds.x1, -bounds.y1);
       if (!format)
       {
           xRel = bounds.x1 + xSrc - xDst;
           yRel = bounds.y1 + ySrc - yDst;
           pixman_composite (op, src, image, dst,
                      xRel, yRel, 0, 0, bounds.x1, bounds.y1,
                      bounds.x2 - bounds.x1, bounds.y2 - bounds.y1);
           pixman_image_destroy (image);
       }
       /* XXX adjust xSrc and ySrc */
    }
    if (format)
    {
       xRel = bounds.x1 + xSrc - xDst;
       yRel = bounds.y1 + ySrc - yDst;
       pixman_composite (op, src, image, dst,
                   xRel, yRel, 0, 0, bounds.x1, bounds.y1,
                   bounds.x2 - bounds.x1, bounds.y2 - bounds.y1);
       pixman_image_destroy (image);
    }

    pixman_format_destroy (format);
}

Here is the call graph for this function:

void pixman_fill_rectangle ( pixman_operator_t  op,
pixman_image_t *  dst,
const pixman_color_t color,
int  x,
int  y,
unsigned int  width,
unsigned int  height 
)

Definition at line 275 of file icrect.c.

{
    pixman_rectangle_t rect;

    rect.x = x;
    rect.y = y;
    rect.width = width;
    rect.height = height;

    pixman_fill_rectangles (op, dst, color, &rect, 1);
}
void pixman_fill_rectangles ( pixman_operator_t  op,
pixman_image_t *  dst,
const pixman_color_t color,
const pixman_rectangle_t rects,
int  nRects 
)

Definition at line 294 of file icrect.c.

{
    pixman_color_t color_s = *color;

    if (color_s.alpha == 0xffff)
    {
       if (op == PIXMAN_OPERATOR_OVER)
           op = PIXMAN_OPERATOR_SRC;
    }
    if (op == PIXMAN_OPERATOR_CLEAR)
       color_s.red = color_s.green = color_s.blue = color_s.alpha = 0;

    if (op == PIXMAN_OPERATOR_SRC || op == PIXMAN_OPERATOR_CLEAR)
    {
      /* We cast away the constness of rects here, because pixman_color_rects
        temporarily modifies it */
       pixman_color_rects (dst, dst, &color_s, nRects, (pixman_rectangle_t *)rects, 0, 0);
       if (dst->alphaMap)
           pixman_color_rects (dst->alphaMap, dst,
                       &color_s, nRects, (pixman_rectangle_t *)rects,
                       dst->alphaOrigin.x,
                       dst->alphaOrigin.y);
    }
    else
    {
       pixman_format_t      rgbaFormat;
       FbPixels      *pixels;
       pixman_image_t              *src;
       pixman_bits_t        pixel;

       pixman_format_init (&rgbaFormat, PICT_a8r8g8b8);
       
       pixels = FbPixelsCreate (1, 1, rgbaFormat.depth);
       if (!pixels)
           goto bail1;
       
       pixman_color_to_pixel (&rgbaFormat, &color_s, &pixel);

       /* XXX: Originally, fb had the following:

          (*pGC->ops->PolyFillRect) (&pPixmap->drawable, pGC, 1, &one);

          I haven't checked to see what I might be breaking with a
          trivial assignment instead.
       */
       pixels->data[0] = pixel;

       src = pixman_image_createForPixels (pixels, &rgbaFormat);
       if (!src)
           goto bail2;

       pixman_image_set_repeat (src, 1);

       while (nRects--)
       {
           pixman_composite (op, src, NULL, dst, 0, 0, 0, 0, 
                      rects->x,
                      rects->y,
                      rects->width,
                      rects->height);
           rects++;
       }

       pixman_image_destroy (src);
bail2:
       FbPixelsDestroy (pixels);
bail1:
       ;
    }
}

Here is the call graph for this function:

pixman_format_t* pixman_format_create ( pixman_format_name_t  name)

Definition at line 29 of file icformat.c.

{
    switch (name) {
    case PIXMAN_FORMAT_NAME_ARGB32:
       return pixman_format_create_masks (32,
                                0xff000000,
                                0x00ff0000,
                                0x0000ff00,
                                0x000000ff);
    case PIXMAN_FORMAT_NAME_RGB24:
       return pixman_format_create_masks (32,
                                0x0,
                                0xff0000,
                                0x00ff00,
                                0x0000ff);
    case PIXMAN_FORMAT_NAME_A8:
       return pixman_format_create_masks (8, 0xff,
                                0, 0, 0);
    case PIXMAN_FORMAT_NAME_A1:
       return pixman_format_create_masks (1, 0x1,
                                0, 0, 0);
    }

    return NULL;
}
pixman_format_t* pixman_format_create_masks ( int  bpp,
int  alpha_mask,
int  red_mask,
int  green_mask,
int  blue_mask 
)

Definition at line 61 of file icformat.c.

{
    int type;
    int format_code;
    pixman_format_t *format;

    if (red_mask == 0 && green_mask == 0 && blue_mask == 0)
       type = PICT_TYPE_A;
    else if (red_mask > blue_mask)
       type = PICT_TYPE_ARGB;
    else
       type = PICT_TYPE_ABGR;

    format_code = PICT_FORMAT (bpp, type,
                            _FbOnes (alpha_mask),
                            _FbOnes (red_mask),
                            _FbOnes (green_mask),
                            _FbOnes (blue_mask));

    format = malloc (sizeof (pixman_format_t));
    if (format == NULL)
       return NULL;

    pixman_format_init (format, format_code);

    return format;
}

Here is the call graph for this function:

void pixman_format_destroy ( pixman_format_t *  format)

Definition at line 159 of file icformat.c.

{
    free (format);
}
void pixman_format_get_masks ( pixman_format_t *  format,
int bpp,
int alpha_mask,
int red_mask,
int green_mask,
int blue_mask 
)

Definition at line 165 of file icformat.c.

{
    *bpp = PICT_FORMAT_BPP (format->format_code);

    if (format->alphaMask)
       *alpha_mask = format->alphaMask << format->alpha;
    else
       *alpha_mask = 0;

    if (format->redMask)
       *red_mask = format->redMask << format->red;
    else
       *red_mask = 0;

    if (format->greenMask)
       *green_mask = format->greenMask << format->green;
    else
       *green_mask = 0;

    if (format->blueMask)
       *blue_mask = format->blueMask << format->blue;
    else
       *blue_mask = 0;
}
pixman_image_t* pixman_image_create ( pixman_format_t *  format,
int  width,
int  height 
)

Definition at line 27 of file icimage.c.

{
    pixman_image_t   *image;
    FbPixels  *pixels;

    pixels = FbPixelsCreate (width, height, format->depth);
    if (pixels == NULL)
       return NULL;
    
    image = pixman_image_createForPixels (pixels, format);
    if (image == NULL) {
       FbPixelsDestroy (pixels);
       return NULL;
    }

    image->owns_pixels = 1;

    return image;
}

Here is the call graph for this function:

pixman_image_t* pixman_image_create_for_data ( pixman_bits_t data,
pixman_format_t *  format,
int  width,
int  height,
int  bpp,
int  stride 
)

Definition at line 51 of file icimage.c.

{
    pixman_image_t   *image;
    FbPixels  *pixels;

    pixels = FbPixelsCreateForData (data, width, height, format->depth, bpp, stride);
    if (pixels == NULL)
       return NULL;

    image = pixman_image_createForPixels (pixels, format);
    if (image == NULL) {
       FbPixelsDestroy (pixels);
       return NULL;
    }

    image->owns_pixels = 1;

    return image;
}

Here is the call graph for this function:

void pixman_image_destroy ( pixman_image_t *  image)

Definition at line 255 of file icimage.c.

{
    pixman_image_destroyClip (image);

    if (image->freeCompClip) {
       pixman_region_destroy (image->pCompositeClip);
       image->pCompositeClip = NULL;
    }
    
    if (image->freeSourceClip) {
       pixman_region_destroy (image->pSourceClip);
       image->pSourceClip = NULL;
    }

    if (image->owns_pixels) {
       FbPixelsDestroy (image->pixels);
       image->pixels = NULL;
    }

    if (image->transform) {
       free (image->transform);
       image->transform = NULL;
    }

    free (image);
}

Here is the call graph for this function:

pixman_bits_t* pixman_image_get_data ( pixman_image_t *  image)

Definition at line 249 of file icimage.c.

{
    return image->pixels->data;
}
int pixman_image_get_depth ( pixman_image_t *  image)

Definition at line 231 of file icimage.c.

{
    return image->pixels->depth;
}
pixman_format_t* pixman_image_get_format ( pixman_image_t *  image)

Definition at line 243 of file icimage.c.

{
    return &image->image_format;
}
int pixman_image_get_height ( pixman_image_t *  image)

Definition at line 225 of file icimage.c.

{
    return image->pixels->height;
}
int pixman_image_get_stride ( pixman_image_t *  image)

Definition at line 237 of file icimage.c.

{
    return image->pixels->stride;
}
int pixman_image_get_width ( pixman_image_t *  image)

Definition at line 219 of file icimage.c.

{
    return image->pixels->width;
}
int pixman_image_set_clip_region ( pixman_image_t *  image,
pixman_region16_t *  region 
)

Definition at line 301 of file icimage.c.

{
    pixman_image_destroyClip (image);
    if (region) {
       image->clientClip = pixman_region_create ();
       pixman_region_copy (image->clientClip, region);
       image->clientClipType = CT_REGION;
    }
    
    if (image->freeCompClip)
       pixman_region_destroy (image->pCompositeClip);
    image->pCompositeClip = pixman_region_create();
    pixman_region_union_rect (image->pCompositeClip, image->pCompositeClip,
                           0, 0, image->pixels->width, image->pixels->height);
    image->freeCompClip = 1;
    if (region) {
       pixman_region_translate (image->pCompositeClip,
                             - image->clipOrigin.x,
                             - image->clipOrigin.y);
       pixman_region_intersect (image->pCompositeClip,
                             image->pCompositeClip,
                             region);
       pixman_region_translate (image->pCompositeClip,
                             image->clipOrigin.x,
                             image->clipOrigin.y);
    }
    
    image->stateChanges |= CPClipMask;
    return 0;
}

Here is the call graph for this function:

void pixman_image_set_component_alpha ( pixman_image_t *  image,
int  component_alpha 
)

Definition at line 159 of file icimage.c.

{
    if (image)
       image->componentAlpha = component_alpha;
}
void pixman_image_set_filter ( pixman_image_t *  image,
pixman_filter_t  filter 
)

Definition at line 211 of file icimage.c.

{
    if (image)
       image->filter = filter;
}
void pixman_image_set_repeat ( pixman_image_t *  image,
int  repeat 
)

Definition at line 202 of file icimage.c.

{
    if (image)
       image->repeat = repeat;
}
int pixman_image_set_transform ( pixman_image_t *  image,
pixman_transform_t transform 
)

Definition at line 168 of file icimage.c.

{
    static const pixman_transform_t       identity = { {
       { xFixed1, 0x00000, 0x00000 },
       { 0x00000, xFixed1, 0x00000 },
       { 0x00000, 0x00000, xFixed1 },
    } };

    if (transform && memcmp (transform, &identity, sizeof (pixman_transform_t)) == 0)
       transform = NULL;
    
    if (transform)
    {
       if (!image->transform)
       {
           image->transform = malloc (sizeof (pixman_transform_t));
           if (!image->transform)
              return 1;
       }
       *image->transform = *transform;
    }
    else
    {
       if (image->transform)
       {
           free (image->transform);
           image->transform = NULL;
       }
    }
    return 0;
}

Here is the call graph for this function:

void pixman_pixel_to_color ( const pixman_format_t *  format,
pixman_bits_t  pixel,
pixman_color_t color 
)

Definition at line 70 of file iccolor.c.

{
    uint32_t      r, g, b, a;

    r = (pixel >> format->red) & format->redMask;
    g = (pixel >> format->green) & format->greenMask;
    b = (pixel >> format->blue) & format->blueMask;
    a = (pixel >> format->alpha) & format->alphaMask;
    color->red = FbFillColor (r, _FbOnes (format->redMask));
    color->green = FbFillColor (r, _FbOnes (format->greenMask));
    color->blue = FbFillColor (r, _FbOnes (format->blueMask));
    color->alpha = FbFillColor (r, _FbOnes (format->alphaMask));
}

Here is the call graph for this function:

pixman_region_status_t pixman_region_append ( pixman_region16_t *  dest,
pixman_region16_t *  region 
)

Definition at line 1269 of file pixregion.c.

{
    int numRects, dnumRects, size;
    pixman_box16_t *new, *old;
    int prepend;

    if (PIXREGION_NAR(rgn))
       return pixman_break (dstrgn);
    
    if (!rgn->data && (dstrgn->data == &pixman_region_emptyData))
    {
       dstrgn->extents = rgn->extents;
       dstrgn->data = (pixman_region16_data_t *)NULL;
       return PIXMAN_REGION_STATUS_SUCCESS;
    }

    numRects = PIXREGION_NUM_RECTS(rgn);
    if (!numRects)
       return PIXMAN_REGION_STATUS_SUCCESS;
    prepend = PIXMAN_REGION_STATUS_FAILURE;
    size = numRects;
    dnumRects = PIXREGION_NUM_RECTS(dstrgn);
    if (!dnumRects && (size < 200))
       size = 200; /* XXX pick numbers out of a hat */
    RECTALLOC(dstrgn, size);
    old = PIXREGION_RECTS(rgn);
    if (!dnumRects)
       dstrgn->extents = rgn->extents;
    else if (dstrgn->extents.x2 > dstrgn->extents.x1)
    {
       pixman_box16_t *first, *last;

       first = old;
       last = PIXREGION_BOXPTR(dstrgn) + (dnumRects - 1);
       if ((first->y1 > last->y2) ||
           ((first->y1 == last->y1) && (first->y2 == last->y2) &&
            (first->x1 > last->x2)))
       {
           if (rgn->extents.x1 < dstrgn->extents.x1)
              dstrgn->extents.x1 = rgn->extents.x1;
           if (rgn->extents.x2 > dstrgn->extents.x2)
              dstrgn->extents.x2 = rgn->extents.x2;
           dstrgn->extents.y2 = rgn->extents.y2;
       }
       else
       {
           first = PIXREGION_BOXPTR(dstrgn);
           last = old + (numRects - 1);
           if ((first->y1 > last->y2) ||
              ((first->y1 == last->y1) && (first->y2 == last->y2) &&
               (first->x1 > last->x2)))
           {
              prepend = PIXMAN_REGION_STATUS_SUCCESS;
              if (rgn->extents.x1 < dstrgn->extents.x1)
                  dstrgn->extents.x1 = rgn->extents.x1;
              if (rgn->extents.x2 > dstrgn->extents.x2)
                  dstrgn->extents.x2 = rgn->extents.x2;
              dstrgn->extents.y1 = rgn->extents.y1;
           }
           else
              dstrgn->extents.x2 = dstrgn->extents.x1;
       }
    }
    if (prepend)
    {
       new = PIXREGION_BOX(dstrgn, numRects);
       if (dnumRects == 1)
           *new = *PIXREGION_BOXPTR(dstrgn);
       else
           memmove((char *)new,(char *)PIXREGION_BOXPTR(dstrgn), 
                dnumRects * sizeof(pixman_box16_t));
       new = PIXREGION_BOXPTR(dstrgn);
    }
    else
       new = PIXREGION_BOXPTR(dstrgn) + dnumRects;
    if (numRects == 1)
       *new = *old;
    else
       memmove((char *)new, (char *)old, numRects * sizeof(pixman_box16_t));
    dstrgn->data->numRects += numRects;
    return PIXMAN_REGION_STATUS_SUCCESS;
}

Here is the call graph for this function:

int pixman_region_contains_point ( pixman_region16_t *  region,
int  x,
int  y,
pixman_box16_t box 
)

Definition at line 2216 of file pixregion.c.

{
    pixman_box16_t *pbox, *pboxEnd;
    int numRects;

    good(region);
    numRects = PIXREGION_NUM_RECTS(region);
    if (!numRects || !INBOX(&region->extents, x, y))
        return(PIXMAN_REGION_STATUS_FAILURE);
    if (numRects == 1)
    {
       *box = region->extents;
       return(PIXMAN_REGION_STATUS_SUCCESS);
    }
    for (pbox = PIXREGION_BOXPTR(region), pboxEnd = pbox + numRects;
        pbox != pboxEnd;
        pbox++)
    {
        if (y >= pbox->y2)
          continue;         /* not there yet */
       if ((y < pbox->y1) || (x < pbox->x1))
          break;            /* missed it */
       if (x >= pbox->x2)
          continue;         /* not there yet */
       *box = *pbox;
       return(PIXMAN_REGION_STATUS_SUCCESS);
    }
    return(PIXMAN_REGION_STATUS_FAILURE);
}
int pixman_region_contains_rectangle ( pixman_region16_t *  pixman_region16_t,
pixman_box16_t prect 
)

Definition at line 1998 of file pixregion.c.

{
    int       x;
    int       y;
    pixman_box16_t *     pbox;
    pixman_box16_t *     pboxEnd;
    int                     partIn, partOut;
    int                     numRects;

    good(region);
    numRects = PIXREGION_NUM_RECTS(region);
    /* useful optimization */
    if (!numRects || !EXTENTCHECK(&region->extents, prect))
        return(rgnOUT);

    if (numRects == 1)
    {
       /* We know that it must be rgnIN or rgnPART */
       if (SUBSUMES(&region->extents, prect))
           return(rgnIN);
       else
           return(rgnPART);
    }

    partOut = PIXMAN_REGION_STATUS_FAILURE;
    partIn = PIXMAN_REGION_STATUS_FAILURE;

    /* (x,y) starts at upper left of rect, moving to the right and down */
    x = prect->x1;
    y = prect->y1;

    /* can stop when both partOut and partIn are PIXMAN_REGION_STATUS_SUCCESS, or we reach prect->y2 */
    for (pbox = PIXREGION_BOXPTR(region), pboxEnd = pbox + numRects;
         pbox != pboxEnd;
         pbox++)
    {

        if (pbox->y2 <= y)
           continue;    /* getting up to speed or skipping remainder of band */

        if (pbox->y1 > y)
        {
           partOut = PIXMAN_REGION_STATUS_SUCCESS;      /* missed part of rectangle above */
           if (partIn || (pbox->y1 >= prect->y2))
              break;
           y = pbox->y1;        /* x guaranteed to be == prect->x1 */
        }

        if (pbox->x2 <= x)
           continue;            /* not far enough over yet */

        if (pbox->x1 > x)
        {
           partOut = PIXMAN_REGION_STATUS_SUCCESS;      /* missed part of rectangle to left */
           if (partIn)
              break;
        }

        if (pbox->x1 < prect->x2)
        {
            partIn = PIXMAN_REGION_STATUS_SUCCESS;      /* definitely overlap */
            if (partOut)
               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. partIn will have been set true
            * by now...
            */
           partOut = PIXMAN_REGION_STATUS_SUCCESS;
           break;
       }
    }

    return(partIn ? ((y < prect->y2) ? rgnPART : rgnIN) : rgnOUT);
}
pixman_region_status_t pixman_region_copy ( pixman_region16_t *  dest,
pixman_region16_t *  source 
)

Definition at line 434 of file pixregion.c.

{
    good(dst);
    good(src);
    if (dst == src)
       return PIXMAN_REGION_STATUS_SUCCESS;
    dst->extents = src->extents;
    if (!src->data || !src->data->size)
    {
       freeData(dst);
       dst->data = src->data;
       return PIXMAN_REGION_STATUS_SUCCESS;
    }
    if (!dst->data || (dst->data->size < src->data->numRects))
    {
       freeData(dst);
       dst->data = allocData(src->data->numRects);
       if (!dst->data)
           return pixman_break (dst);
       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(pixman_box16_t));
    return PIXMAN_REGION_STATUS_SUCCESS;
}

Here is the call graph for this function:

pixman_region16_t* pixman_region_create ( void  )

Here is the caller graph for this function:

pixman_region16_t* pixman_region_create_simple ( pixman_box16_t extents)

Definition at line 323 of file pixregion.c.

{
    pixman_region16_t *region;
   
    region = malloc (sizeof (pixman_region16_t));
    if (region == NULL)
       return &pixman_brokenregion;

    pixman_init (region, extents);

    return region;
}

Here is the call graph for this function:

void pixman_region_destroy ( pixman_region16_t *  region)

Definition at line 365 of file pixregion.c.

{
    pixman_uninit (region);

    if (region != &pixman_brokenregion)
       free (region);
}

Here is the call graph for this function:

void pixman_region_empty ( pixman_region16_t *  region)

Definition at line 2267 of file pixregion.c.

{
    good(region);
    freeData(region);
    region->extents.x2 = region->extents.x1;
    region->extents.y2 = region->extents.y1;
    region->data = &pixman_region_emptyData;
}
pixman_box16_t* pixman_region_extents ( pixman_region16_t *  region)

Definition at line 2278 of file pixregion.c.

{
    good(region);
    return(&region->extents);
}
pixman_region_status_t pixman_region_intersect ( pixman_region16_t *  newReg,
pixman_region16_t *  reg1,
pixman_region16_t *  reg2 
)

Definition at line 999 of file pixregion.c.

{
    good(reg1);
    good(reg2);
    good(newReg);
   /* check for trivial reject */
    if (PIXREGION_NIL(reg1)  || PIXREGION_NIL(reg2) ||
       !EXTENTCHECK(&reg1->extents, &reg2->extents))
    {
       /* Covers about 20% of all cases */
       freeData(newReg);
       newReg->extents.x2 = newReg->extents.x1;
       newReg->extents.y2 = newReg->extents.y1;
       if (PIXREGION_NAR(reg1) || PIXREGION_NAR(reg2))
       {
           newReg->data = &pixman_brokendata;
           return PIXMAN_REGION_STATUS_FAILURE;
       }
       else
           newReg->data = &pixman_region_emptyData;
    }
    else if (!reg1->data && !reg2->data)
    {
       /* Covers about 80% of cases that aren't trivially rejected */
       newReg->extents.x1 = MAX(reg1->extents.x1, reg2->extents.x1);
       newReg->extents.y1 = MAX(reg1->extents.y1, reg2->extents.y1);
       newReg->extents.x2 = MIN(reg1->extents.x2, reg2->extents.x2);
       newReg->extents.y2 = MIN(reg1->extents.y2, reg2->extents.y2);
       freeData(newReg);
       newReg->data = (pixman_region16_data_t *)NULL;
    }
    else if (!reg2->data && SUBSUMES(&reg2->extents, &reg1->extents))
    {
       return pixman_region_copy(newReg, reg1);
    }
    else if (!reg1->data && SUBSUMES(&reg1->extents, &reg2->extents))
    {
       return pixman_region_copy(newReg, reg2);
    }
    else if (reg1 == reg2)
    {
       return pixman_region_copy(newReg, reg1);
    }
    else
    {
       /* General purpose intersection */
       int overlap; /* result ignored */
       if (!pixman_op(newReg, reg1, reg2, pixman_region_intersectO, PIXMAN_REGION_STATUS_FAILURE, PIXMAN_REGION_STATUS_FAILURE,
                     &overlap))
           return PIXMAN_REGION_STATUS_FAILURE;
       pixman_set_extents(newReg);
    }

    good(newReg);
    return(PIXMAN_REGION_STATUS_SUCCESS);
}

Here is the call graph for this function:

pixman_region_status_t pixman_region_inverse ( pixman_region16_t *  newReg,
pixman_region16_t *  reg1,
pixman_box16_t invRect 
)

Definition at line 1938 of file pixregion.c.

{
    pixman_region16_t         invReg;     /* Quick and dirty region made from the
                             * bounding box */
    int         overlap;    /* result ignored */

    good(reg1);
    good(newReg);
   /* check for trivial rejects */
    if (PIXREGION_NIL(reg1) || !EXTENTCHECK(invRect, &reg1->extents))
    {
       if (PIXREGION_NAR(reg1))
           return pixman_break (newReg);
       newReg->extents = *invRect;
       freeData(newReg);
       newReg->data = (pixman_region16_data_t *)NULL;
        return PIXMAN_REGION_STATUS_SUCCESS;
    }

    /* Add those rectangles in region 1 that aren't in region 2,
       do yucky substraction for overlaps, and
       just throw away rectangles in region 2 that aren't in region 1 */
    invReg.extents = *invRect;
    invReg.data = (pixman_region16_data_t *)NULL;
    if (!pixman_op(newReg, &invReg, reg1, pixman_region_subtractO, PIXMAN_REGION_STATUS_SUCCESS, PIXMAN_REGION_STATUS_FAILURE, &overlap))
       return PIXMAN_REGION_STATUS_FAILURE;

    /*
     * Can't alter newReg's extents before we call pixman_op because
     * it might be one of the source regions and pixman_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.
     */
    pixman_set_extents(newReg);
    good(newReg);
    return PIXMAN_REGION_STATUS_SUCCESS;
}

Here is the call graph for this function:

int pixman_region_not_empty ( pixman_region16_t *  region)

Definition at line 2250 of file pixregion.c.

{
    good(region);
    return(!PIXREGION_NIL(region));
}
int pixman_region_num_rects ( pixman_region16_t *  region)

Definition at line 374 of file pixregion.c.

{
    return PIXREGION_NUM_RECTS (region);
}
pixman_box16_t* pixman_region_rects ( pixman_region16_t *  region)

Definition at line 380 of file pixregion.c.

{
    return PIXREGION_RECTS (region);
}
void pixman_region_reset ( pixman_region16_t *  region,
pixman_box16_t pBox 
)

Definition at line 2205 of file pixregion.c.

{
    good(region);
    assert(box->x1<=box->x2);
    assert(box->y1<=box->y2);
    region->extents = *box;
    freeData(region);
    region->data = (pixman_region16_data_t *)NULL;
}
pixman_region_status_t pixman_region_subtract ( pixman_region16_t *  regD,
pixman_region16_t *  regM,
pixman_region16_t *  regS 
)

Definition at line 1873 of file pixregion.c.

{
    int overlap; /* result ignored */

    good(regM);
    good(regS);
    good(regD);
   /* check for trivial rejects */
    if (PIXREGION_NIL(regM) || PIXREGION_NIL(regS) ||
       !EXTENTCHECK(&regM->extents, &regS->extents))
    {
       if (PIXREGION_NAR (regS))
           return pixman_break (regD);
       return pixman_region_copy(regD, regM);
    }
    else if (regM == regS)
    {
       freeData(regD);
       regD->extents.x2 = regD->extents.x1;
       regD->extents.y2 = regD->extents.y1;
       regD->data = &pixman_region_emptyData;
       return PIXMAN_REGION_STATUS_SUCCESS;
    }
 
    /* Add those rectangles in region 1 that aren't in region 2,
       do yucky substraction for overlaps, and
       just throw away rectangles in region 2 that aren't in region 1 */
    if (!pixman_op(regD, regM, regS, pixman_region_subtractO, PIXMAN_REGION_STATUS_SUCCESS, PIXMAN_REGION_STATUS_FAILURE, &overlap))
       return PIXMAN_REGION_STATUS_FAILURE;

    /*
     * Can't alter RegD's extents before we call pixman_op because
     * it might be one of the source regions and pixman_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.
     */
    pixman_set_extents(regD);
    good(regD);
    return PIXMAN_REGION_STATUS_SUCCESS;
}

Here is the call graph for this function:

void pixman_region_translate ( pixman_region16_t *  region,
int  x,
int  y 
)

Definition at line 2094 of file pixregion.c.

{
    int x1, x2, y1, y2;
    int nbox;
    pixman_box16_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 - SHRT_MIN)|(y1 - SHRT_MIN)|(SHRT_MAX - x2)|(SHRT_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;
    }
    if (((x2 - SHRT_MIN)|(y2 - SHRT_MIN)|(SHRT_MAX - x1)|(SHRT_MAX - y1)) <= 0)
    {
       region->extents.x2 = region->extents.x1;
       region->extents.y2 = region->extents.y1;
       freeData(region);
       region->data = &pixman_region_emptyData;
       return;
    }
    if (x1 < SHRT_MIN)
       region->extents.x1 = SHRT_MIN;
    else if (x2 > SHRT_MAX)
       region->extents.x2 = SHRT_MAX;
    if (y1 < SHRT_MIN)
       region->extents.y1 = SHRT_MIN;
    else if (y2 > SHRT_MAX)
       region->extents.y2 = SHRT_MAX;
    if (region->data && (nbox = region->data->numRects))
    {
       pixman_box16_t * pboxout;

       for (pboxout = pbox = PIXREGION_BOXPTR(region); nbox--; pbox++)
       {
           pboxout->x1 = x1 = pbox->x1 + x;
           pboxout->y1 = y1 = pbox->y1 + y;
           pboxout->x2 = x2 = pbox->x2 + x;
           pboxout->y2 = y2 = pbox->y2 + y;
           if (((x2 - SHRT_MIN)|(y2 - SHRT_MIN)|
               (SHRT_MAX - x1)|(SHRT_MAX - y1)) <= 0)
           {
              region->data->numRects--;
              continue;
           }
           if (x1 < SHRT_MIN)
              pboxout->x1 = SHRT_MIN;
           else if (x2 > SHRT_MAX)
              pboxout->x2 = SHRT_MAX;
           if (y1 < SHRT_MIN)
              pboxout->y1 = SHRT_MIN;
           else if (y2 > SHRT_MAX)
              pboxout->y2 = SHRT_MAX;
           pboxout++;
       }
       if (pboxout != pbox)
       {
           if (region->data->numRects == 1)
           {
              region->extents = *PIXREGION_BOXPTR(region);
              freeData(region);
              region->data = (pixman_region16_data_t *)NULL;
           }
           else
              pixman_set_extents(region);
       }
    }
}

Here is the call graph for this function:

pixman_region_status_t pixman_region_union ( pixman_region16_t *  newReg,
pixman_region16_t *  reg1,
pixman_region16_t *  reg2 
)

Definition at line 1172 of file pixregion.c.

{
    int overlap; /* result ignored */

    /* Return PIXMAN_REGION_STATUS_SUCCESS if some overlap between reg1, reg2 */
    good(reg1);
    good(reg2);
    good(newReg);
    /*  checks all the simple cases */

    /*
     * Region 1 and 2 are the same
     */
    if (reg1 == reg2)
    {
       return pixman_region_copy(newReg, reg1);
    }

    /*
     * Region 1 is empty
     */
    if (PIXREGION_NIL(reg1))
    {
       if (PIXREGION_NAR(reg1))
           return pixman_break (newReg);
        if (newReg != reg2)
           return pixman_region_copy(newReg, reg2);
        return PIXMAN_REGION_STATUS_SUCCESS;
    }

    /*
     * Region 2 is empty
     */
    if (PIXREGION_NIL(reg2))
    {
       if (PIXREGION_NAR(reg2))
           return pixman_break (newReg);
        if (newReg != reg1)
           return pixman_region_copy(newReg, reg1);
        return PIXMAN_REGION_STATUS_SUCCESS;
    }

    /*
     * Region 1 completely subsumes region 2
     */
    if (!reg1->data && SUBSUMES(&reg1->extents, &reg2->extents))
    {
        if (newReg != reg1)
           return pixman_region_copy(newReg, reg1);
        return PIXMAN_REGION_STATUS_SUCCESS;
    }

    /*
     * Region 2 completely subsumes region 1
     */
    if (!reg2->data && SUBSUMES(&reg2->extents, &reg1->extents))
    {
        if (newReg != reg2)
           return pixman_region_copy(newReg, reg2);
        return PIXMAN_REGION_STATUS_SUCCESS;
    }

    if (!pixman_op(newReg, reg1, reg2, pixman_region_unionO, PIXMAN_REGION_STATUS_SUCCESS, PIXMAN_REGION_STATUS_SUCCESS, &overlap))
       return PIXMAN_REGION_STATUS_FAILURE;

    newReg->extents.x1 = MIN(reg1->extents.x1, reg2->extents.x1);
    newReg->extents.y1 = MIN(reg1->extents.y1, reg2->extents.y1);
    newReg->extents.x2 = MAX(reg1->extents.x2, reg2->extents.x2);
    newReg->extents.y2 = MAX(reg1->extents.y2, reg2->extents.y2);
    good(newReg);
    return PIXMAN_REGION_STATUS_SUCCESS;
}

Here is the call graph for this function:

pixman_region_status_t pixman_region_union_rect ( pixman_region16_t *  dest,
pixman_region16_t *  source,
int  x,
int  y,
unsigned int  width,
unsigned int  height 
)

Definition at line 1155 of file pixregion.c.

{
    pixman_region16_t region;

    if (!width || !height)
       return pixman_region_copy (dest, source);
    region.data = NULL;
    region.extents.x1 = x;
    region.extents.y1 = y;
    region.extents.x2 = x + width;
    region.extents.y2 = y + height;

    return pixman_region_union (dest, source, &region);
}
pixman_region_status_t pixman_region_validate ( pixman_region16_t *  badreg,
int pOverlap 
)

Definition at line 1455 of file pixregion.c.

{
    /* Descriptor for regions under construction  in Step 2. */
    typedef struct {
       pixman_region16_t   reg;
       int        prevBand;
       int        curBand;
    } RegionInfo;

            int      numRects;   /* Original numRects for badreg          */
            RegionInfo *ri;     /* Array of current regions               */
            int      numRI;      /* Number of entries used in ri          */
            int      sizeRI;           /* Number of entries available in ri    */
            int      i;         /* Index into rects                       */
    int       j;         /* Index into ri                   */
    RegionInfo *rit;       /* &ri[j]                               */
    pixman_region16_t *  reg;        /* ri[j].reg                         */
    pixman_box16_t * box;       /* Current box in rects            */
    pixman_box16_t * riBox;      /* Last box in ri[j].reg                 */
    pixman_region16_t *  hreg;       /* ri[j_half].reg                    */
    int              ret = PIXMAN_REGION_STATUS_SUCCESS;

    *pOverlap = PIXMAN_REGION_STATUS_FAILURE;
    if (!badreg->data)
    {
       good(badreg);
       return PIXMAN_REGION_STATUS_SUCCESS;
    }
    numRects = badreg->data->numRects;
    if (!numRects)
    {
       if (PIXREGION_NAR(badreg))
           return PIXMAN_REGION_STATUS_FAILURE;
       good(badreg);
       return PIXMAN_REGION_STATUS_SUCCESS;
    }
    if (badreg->extents.x1 < badreg->extents.x2)
    {
       if ((numRects) == 1)
       {
           freeData(badreg);
           badreg->data = (pixman_region16_data_t *) NULL;
       }
       else
       {
           DOWNSIZE(badreg, numRects);
       }
       good(badreg);
       return PIXMAN_REGION_STATUS_SUCCESS;
    }

    /* Step 1: Sort the rects array into ascending (y1, x1) order */
    QuickSortRects(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 = (RegionInfo *) malloc(4 * sizeof(RegionInfo));
    if (!ri)
       return pixman_break (badreg);
    sizeRI = 4;
    numRI = 1;
    ri[0].prevBand = 0;
    ri[0].curBand = 0;
    ri[0].reg = *badreg;
    box = PIXREGION_BOXPTR(&ri[0].reg);
    ri[0].reg.extents = *box;
    ri[0].reg.data->numRects = 1;

    /* 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 = numRI, rit = ri; --j >= 0; rit++)
       {
           reg = &rit->reg;
           riBox = PIXREGION_END(reg);

           if (box->y1 == riBox->y1 && box->y2 == riBox->y2)
           {
              /* box is in same band as riBox.  Merge or append it */
              if (box->x1 <= riBox->x2)
              {
                  /* Merge it with riBox */
                  if (box->x1 < riBox->x2) *pOverlap = PIXMAN_REGION_STATUS_SUCCESS;
                  if (box->x2 > riBox->x2) riBox->x2 = box->x2;
              }
              else
              {
                  RECTALLOC_BAIL(reg, 1, bail);
                  *PIXREGION_TOP(reg) = *box;
                  reg->data->numRects++;
              }
              goto NextRect;   /* So sue me */
           }
           else if (box->y1 >= riBox->y2)
           {
              /* Put box into new band */
              if (reg->extents.x2 < riBox->x2) reg->extents.x2 = riBox->x2;
              if (reg->extents.x1 > box->x1)   reg->extents.x1 = box->x1;
              Coalesce(reg, rit->prevBand, rit->curBand);
              rit->curBand = reg->data->numRects;
              RECTALLOC_BAIL(reg, 1, bail);
              *PIXREGION_TOP(reg) = *box;
              reg->data->numRects++;
              goto NextRect;
           }
           /* Well, this region was inappropriate.  Try the next one. */
       } /* for j */

       /* Uh-oh.  No regions were appropriate.  Create a new one. */
       if (sizeRI == numRI)
       {
           /* Oops, allocate space for new region information */
           sizeRI <<= 1;
           rit = (RegionInfo *) realloc(ri, sizeRI * sizeof(RegionInfo));
           if (!rit)
              goto bail;
           ri = rit;
           rit = &ri[numRI];
       }
       numRI++;
       rit->prevBand = 0;
       rit->curBand = 0;
       rit->reg.extents = *box;
       rit->reg.data = (pixman_region16_data_t *)NULL;
       if (!pixman_rect_alloc(&rit->reg, (i+numRI) / numRI)) /* MUST force allocation */
           goto bail;
NextRect: ;
    } /* for i */

    /* Make a final pass over each region in order to Coalesce and set
       extents.x2 and extents.y2 */

    for (j = numRI, rit = ri; --j >= 0; rit++)
    {
       reg = &rit->reg;
       riBox = PIXREGION_END(reg);
       reg->extents.y2 = riBox->y2;
       if (reg->extents.x2 < riBox->x2) reg->extents.x2 = riBox->x2;
       Coalesce(reg, rit->prevBand, rit->curBand);
       if (reg->data->numRects == 1) /* keep unions happy below */
       {
           freeData(reg);
           reg->data = (pixman_region16_data_t *)NULL;
       }
    }

    /* Step 3: Union all regions into a single region */
    while (numRI > 1)
    {
       int half = numRI/2;
       for (j = numRI & 1; j < (half + (numRI & 1)); j++)
       {
           reg = &ri[j].reg;
           hreg = &ri[j+half].reg;
           if (!pixman_op(reg, reg, hreg, pixman_region_unionO, PIXMAN_REGION_STATUS_SUCCESS, PIXMAN_REGION_STATUS_SUCCESS, pOverlap))
              ret = PIXMAN_REGION_STATUS_FAILURE;
           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.x2 > reg->extents.x2)
              reg->extents.x2 = hreg->extents.x2;
           if (hreg->extents.y2 > reg->extents.y2)
              reg->extents.y2 = hreg->extents.y2;
           freeData(hreg);
       }
       numRI -= half;
    }
    *badreg = ri[0].reg;
    free(ri);
    good(badreg);
    return ret;
bail:
    for (i = 0; i < numRI; i++)
       freeData(&ri[i].reg);
    free (ri);
    return pixman_break (badreg);
}

Here is the call graph for this function: