Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Typedefs | Functions
icimage.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  pixman_image
struct  _FbIndexed
struct  _FbCompositeOperand
struct  _FbAccessMap
struct  _FbCompSrc
union  _FbCompositeOperand.u
struct  _FbCompositeOperand.u.drawable
struct  _FbCompositeOperand.u.external
struct  _FbCompositeOperand.u.transform

Defines

#define _IC_MIPICT_H_
#define IC_MAX_INDEXED   256 /* XXX depth must be <= 8 */
#define FbCvtR8G8B8to15(s)
#define FbIndexToEnt15(icf, rgb15)   ((icf)->ent[rgb15])
#define FbIndexToEnt24(icf, rgb24)   FbIndexToEnt15(icf,FbCvtR8G8B8to15(rgb24))
#define FbIndexToEntY24(icf, rgb24)   ((icf)->ent[CvtR8G8B8toY15(rgb24)])

Typedefs

typedef uint8_t FbIndexType
typedef struct _FbIndexed FbIndexedRec
typedef struct _FbIndexedFbIndexedPtr
typedef void(* CompositeFunc )(pixman_operator_t op, pixman_image_t *iSrc, pixman_image_t *iMask, pixman_image_t *iDst, int16_t xSrc, int16_t ySrc, int16_t xMask, int16_t yMask, int16_t xDst, int16_t yDst, uint16_t width, uint16_t height)
typedef struct _FbCompositeOperand
typedef uint32_t(* pixman_compositeFetch )(FbCompositeOperand *op)
typedef void(* pixman_compositeStore )(FbCompositeOperand *op, uint32_t value)
typedef void(* pixman_compositeStep )(FbCompositeOperand *op)
typedef void(* pixman_compositeSet )(FbCompositeOperand *op, int x, int y)
typedef void(* FbCombineFunc )(FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst)
typedef struct _FbAccessMap FbAccessMap
typedef struct _FbCompSrc FbCompSrc

Functions

pixman_private void pixman_image_init (pixman_image_t *image)
pixman_private void pixman_image_destroyClip (pixman_image_t *image)
pixman_private int FbComputeCompositeRegion (pixman_region16_t *region, pixman_image_t *iSrc, pixman_image_t *iMask, pixman_image_t *iDst, int16_t xSrc, int16_t ySrc, int16_t xMask, int16_t yMask, int16_t xDst, int16_t yDst, uint16_t width, uint16_t height)
int miIsSolidAlpha (pixman_image_t *src)
pixman_private pixman_image_t * FbCreateAlphaPicture (pixman_image_t *dst, pixman_format_t *format, uint16_t width, uint16_t height)
pixman_private int fbBuildCompositeOperand (pixman_image_t *image, FbCompositeOperand op[4], int16_t x, int16_t y, int transform, int alpha)
pixman_private void pixman_compositeGeneral (pixman_operator_t op, pixman_image_t *iSrc, pixman_image_t *iMask, pixman_image_t *iDst, int16_t xSrc, int16_t ySrc, int16_t xMask, int16_t yMask, int16_t xDst, int16_t yDst, uint16_t width, uint16_t height)

Class Documentation

struct pixman_image

Definition at line 57 of file icimage.h.

Collaboration diagram for pixman_image:
Class Members
struct pixman_image * alphaMap
FbPoint alphaOrigin
void * clientClip
unsigned int clientClipType: 2
FbPoint clipOrigin
unsigned int componentAlpha: 1
unsigned int compositeClipSource: 1
unsigned long dither
pixman_filter_t filter
int filter_nparams
pixman_fixed16_16_t * filter_params
int format_code
unsigned int freeCompClip: 1
unsigned int freeSourceClip: 1
unsigned int graphicsExposures: 1
pixman_format_t image_format
int owns_pixels
pixman_region16_t * pCompositeClip
FbPixels * pixels
unsigned int polyEdge: 1
unsigned int polyMode: 1
pixman_region16_t * pSourceClip
int refcnt
unsigned int repeat: 1
unsigned long serialNumber
unsigned long stateChanges
unsigned int subWindowMode: 1
pixman_transform_t * transform
unsigned int unused: 21
struct _FbIndexed

Definition at line 110 of file icimage.h.

Collaboration diagram for _FbIndexed:
Class Members
int color
FbIndexType ent
uint32_t rgba
struct _FbCompositeOperand

Definition at line 223 of file icimage.h.

Class Members
pixman_compositeStep down
pixman_region16_t * dst_clip
pixman_compositeFetch fetch
pixman_compositeFetch fetcha
pixman_compositeStep over
pixman_compositeSet set
pixman_region16_t * src_clip
pixman_compositeStore store
union _FbCompositeOperand u
struct _FbAccessMap

Definition at line 269 of file icimage.h.

Class Members
pixman_compositeFetch fetch
pixman_compositeFetch fetcha
uint32_t format_code
pixman_compositeStore store
struct _FbCompSrc

Definition at line 278 of file icimage.h.

Class Members
uint32_t alpha
uint32_t value
union _FbCompositeOperand.u

Definition at line 224 of file icimage.h.

Class Members
u drawable
u external
u transform
struct _FbCompositeOperand.u.drawable

Definition at line 225 of file icimage.h.

Class Members
int bpp
int left_offset
pixman_bits_t * line
uint32_t offset
int start_offset
FbStride stride
pixman_bits_t * top_line
struct _FbCompositeOperand.u.external

Definition at line 235 of file icimage.h.

Class Members
int alpha_dx
int alpha_dy
struct _FbCompositeOperand.u.transform

Definition at line 239 of file icimage.h.

Class Members
pixman_filter_t filter
int height
int left_x
int repeat
int start_x
int top_y
pixman_transform_t * transform
int width
int x
int y

Define Documentation

Definition at line 101 of file icimage.h.

Value:
((((s) >> 3) & 0x001f) | \
                          (((s) >> 6) & 0x03e0) | \
                          (((s) >> 9) & 0x7c00))

Definition at line 116 of file icimage.h.

#define FbIndexToEnt15 (   icf,
  rgb15 
)    ((icf)->ent[rgb15])

Definition at line 119 of file icimage.h.

#define FbIndexToEnt24 (   icf,
  rgb24 
)    FbIndexToEnt15(icf,FbCvtR8G8B8to15(rgb24))

Definition at line 120 of file icimage.h.

#define FbIndexToEntY24 (   icf,
  rgb24 
)    ((icf)->ent[CvtR8G8B8toY15(rgb24)])

Definition at line 122 of file icimage.h.

#define IC_MAX_INDEXED   256 /* XXX depth must be <= 8 */

Definition at line 103 of file icimage.h.


Typedef Documentation

typedef struct _FbCompositeOperand

Definition at line 215 of file icimage.h.

typedef void(* CompositeFunc)(pixman_operator_t op, pixman_image_t *iSrc, pixman_image_t *iMask, pixman_image_t *iDst, int16_t xSrc, int16_t ySrc, int16_t xMask, int16_t yMask, int16_t xDst, int16_t yDst, uint16_t width, uint16_t height)

Definition at line 202 of file icimage.h.

typedef struct _FbAccessMap FbAccessMap
typedef void(* FbCombineFunc)(FbCompositeOperand *src, FbCompositeOperand *msk, FbCompositeOperand *dst)

Definition at line 265 of file icimage.h.

typedef struct _FbCompSrc FbCompSrc
typedef struct _FbIndexed * FbIndexedPtr
typedef struct _FbIndexed FbIndexedRec

Definition at line 106 of file icimage.h.

typedef uint32_t(* pixman_compositeFetch)(FbCompositeOperand *op)

Definition at line 217 of file icimage.h.

typedef void(* pixman_compositeSet)(FbCompositeOperand *op, int x, int y)

Definition at line 221 of file icimage.h.

typedef void(* pixman_compositeStep)(FbCompositeOperand *op)

Definition at line 220 of file icimage.h.

typedef void(* pixman_compositeStore)(FbCompositeOperand *op, uint32_t value)

Definition at line 218 of file icimage.h.


Function Documentation

pixman_private int fbBuildCompositeOperand ( pixman_image_t *  image,
FbCompositeOperand  op[4],
int16_t  x,
int16_t  y,
int  transform,
int  alpha 
)
pixman_private int FbComputeCompositeRegion ( pixman_region16_t *  region,
pixman_image_t *  iSrc,
pixman_image_t *  iMask,
pixman_image_t *  iDst,
int16_t  xSrc,
int16_t  ySrc,
int16_t  xMask,
int16_t  yMask,
int16_t  xDst,
int16_t  yDst,
uint16_t  width,
uint16_t  height 
)

Definition at line 599 of file icimage.c.

{
    int              v;
    int x1, y1, x2, y2;

    /* XXX: This code previously directly set the extents of the
       region here. I need to decide whether removing that has broken
       this. Also, it might be necessary to just make the pixman_region16_t
       data structure transparent anyway in which case I can just put
       the code back. */
    x1 = xDst;
    v = xDst + width;
    x2 = BOUND(v);
    y1 = yDst;
    v = yDst + height;
    y2 = BOUND(v);
    /* Check for empty operation */
    if (x1 >= x2 ||
       y1 >= y2)
    {
       pixman_region_empty (region);
       return 1;
    }
    /* clip against src */
    if (!FbClipImageSrc (region, iSrc, xDst - xSrc, yDst - ySrc))
    {
       pixman_region_destroy (region);
       return 0;
    }
    if (iSrc->alphaMap)
    {
       if (!FbClipImageSrc (region, iSrc->alphaMap,
                          xDst - (xSrc + iSrc->alphaOrigin.x),
                          yDst - (ySrc + iSrc->alphaOrigin.y)))
       {
           pixman_region_destroy (region);
           return 0;
       }
    }
    /* clip against mask */
    if (iMask)
    {
       if (!FbClipImageSrc (region, iMask, xDst - xMask, yDst - yMask))
       {
           pixman_region_destroy (region);
           return 0;
       }      
       if (iMask->alphaMap)
       {
           if (!FbClipImageSrc (region, iMask->alphaMap,
                             xDst - (xMask + iMask->alphaOrigin.x),
                             yDst - (yMask + iMask->alphaOrigin.y)))
           {
              pixman_region_destroy (region);
              return 0;
           }
       }
    }
    if (!FbClipImageReg (region, iDst->pCompositeClip, 0, 0))
    {
       pixman_region_destroy (region);
       return 0;
    }
    if (iDst->alphaMap)
    {
       if (!FbClipImageReg (region, iDst->alphaMap->pCompositeClip,
                          -iDst->alphaOrigin.x,
                          -iDst->alphaOrigin.y))
       {
           pixman_region_destroy (region);
           return 0;
       }
    }
    return 1;
}

Here is the call graph for this function:

Here is the caller graph for this function:

pixman_private pixman_image_t* FbCreateAlphaPicture ( pixman_image_t *  dst,
pixman_format_t *  format,
uint16_t  width,
uint16_t  height 
)

Definition at line 28 of file ictrap.c.

{
    pixman_image_t   *image;
    int own_format = 0;

    if (width > 32767 || height > 32767)
       return NULL;

    if (!format)
    {
       own_format = 1;
       if (dst->polyEdge == PolyEdgeSharp)
           format = pixman_format_create (PIXMAN_FORMAT_NAME_A1);
       else
           format = pixman_format_create (PIXMAN_FORMAT_NAME_A8);
       if (!format)
           return NULL;
    }

    image = pixman_image_create (format, width, height); 

    if (own_format)
       pixman_format_destroy (format);

    /* XXX: Is this a reasonable way to clear the image? Would
       probably be preferable to use pixman_image_fill_rectangle once such a
       beast exists. */
    memset (image->pixels->data, 0, height * image->pixels->stride);

    return image;
}

Here is the call graph for this function:

Here is the caller graph for this function:

int miIsSolidAlpha ( pixman_image_t *  src)

Definition at line 687 of file icimage.c.

{
    char      line[1];
    
    /* Alpha-only */
    if (PICT_FORMAT_TYPE (src->format_code) != PICT_TYPE_A)
       return 0;
    /* repeat */
    if (!src->repeat)
       return 0;
    /* 1x1 */
    if (src->pixels->width != 1 || src->pixels->height != 1)
       return 0;
    line[0] = 1;
    /* XXX: For the next line, fb has:
       (*pScreen->GetImage) (src->pixels, 0, 0, 1, 1, ZPixmap, ~0L, line);
       Is the following simple assignment sufficient?
    */
    line[0] = src->pixels->data[0];
    switch (src->pixels->bpp) {
    case 1:
       return (uint8_t) line[0] == 1 || (uint8_t) line[0] == 0x80;
    case 4:
       return (uint8_t) line[0] == 0xf || (uint8_t) line[0] == 0xf0;
    case 8:
       return (uint8_t) line[0] == 0xff;
    default:
       return 0;
    }
}
pixman_private void pixman_compositeGeneral ( pixman_operator_t  op,
pixman_image_t *  iSrc,
pixman_image_t *  iMask,
pixman_image_t *  iDst,
int16_t  xSrc,
int16_t  ySrc,
int16_t  xMask,
int16_t  yMask,
int16_t  xDst,
int16_t  yDst,
uint16_t  width,
uint16_t  height 
)

Definition at line 3577 of file fbcompose.c.

{
    pixman_region16_t *region;
    int                  n;
    BoxPtr        pbox;
    Bool          srcRepeat = FALSE;
    Bool          maskRepeat = FALSE;
    int                  w, h;
    CARD32 _scanline_buffer[SCANLINE_BUFFER_LENGTH*3];
    CARD32 *scanline_buffer = _scanline_buffer;
    FbComposeData compose_data;
    
    if (pSrc->pDrawable)
        srcRepeat = pSrc->repeat == RepeatNormal && !pSrc->transform
                    && (pSrc->pDrawable->width != 1 || pSrc->pDrawable->height != 1);

    if (pMask && pMask->pDrawable)
       maskRepeat = pMask->repeat == RepeatNormal && !pMask->transform
                     && (pMask->pDrawable->width != 1 || pMask->pDrawable->height != 1);

    if (op == PIXMAN_OPERATOR_OVER && !pMask && !pSrc->transform && !PICT_FORMAT_A(pSrc->format_code) && !pSrc->alphaMap)
        op = PIXMAN_OPERATOR_SRC;

    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;

    compose_data.op = op;
    compose_data.src = pSrc;
    compose_data.mask = pMask;
    compose_data.dest = pDst;
    if (width > SCANLINE_BUFFER_LENGTH)
        scanline_buffer = (CARD32 *) malloc(width * 3 * sizeof(CARD32));

    n = pixman_region_num_rects (region);
    pbox = pixman_region_rects (region);
    while (n--)
    {
       h = pbox->y2 - pbox->y1;
       compose_data.ySrc = pbox->y1 - yDst + ySrc;
       compose_data.yMask = pbox->y1 - yDst + yMask;
       compose_data.yDest = pbox->y1;
       while (h)
       {
           compose_data.height = h;
           w = pbox->x2 - pbox->x1;
           compose_data.xSrc = pbox->x1 - xDst + xSrc;
           compose_data.xMask = pbox->x1 - xDst + xMask;
           compose_data.xDest = pbox->x1;
           if (maskRepeat)
           {
              compose_data.yMask = mod (compose_data.yMask, pMask->pDrawable->height);
              if (compose_data.height > pMask->pDrawable->height - compose_data.yMask)
                  compose_data.height = pMask->pDrawable->height - compose_data.yMask;
           }
           if (srcRepeat)
           {
              compose_data.ySrc = mod (compose_data.ySrc, pSrc->pDrawable->height);
              if (compose_data.height > pSrc->pDrawable->height - compose_data.ySrc)
                  compose_data.height = pSrc->pDrawable->height - compose_data.ySrc;
           }
           while (w)
           {
              compose_data.width = w;
              if (maskRepeat)
              {
                  compose_data.xMask = mod (compose_data.xMask, pMask->pDrawable->width);
                  if (compose_data.width > pMask->pDrawable->width - compose_data.xMask)
                     compose_data.width = pMask->pDrawable->width - compose_data.xMask;
              }
              if (srcRepeat)
              {
                  compose_data.xSrc = mod (compose_data.xSrc, pSrc->pDrawable->width);
                  if (compose_data.width > pSrc->pDrawable->width - compose_data.xSrc)
                     compose_data.width = pSrc->pDrawable->width - compose_data.xSrc;
              }
              fbCompositeRect(&compose_data, scanline_buffer);
              w -= compose_data.width;
              compose_data.xSrc += compose_data.width;
              compose_data.xMask += compose_data.width;
              compose_data.xDest += compose_data.width;
           }
           h -= compose_data.height;
           compose_data.ySrc += compose_data.height;
           compose_data.yMask += compose_data.height;
           compose_data.yDest += compose_data.height;
       }
       pbox++;
    }
    pixman_region_destroy (region);

    if (scanline_buffer != _scanline_buffer)
        free(scanline_buffer);
}

Here is the call graph for this function:

Here is the caller graph for this function:

pixman_private void pixman_image_destroyClip ( pixman_image_t *  image)

Definition at line 284 of file icimage.c.

{
    switch (image->clientClipType) {
    case CT_NONE:
       return;
    case CT_PIXMAP:
       pixman_image_destroy (image->clientClip);
       break;
    default:
       pixman_region_destroy (image->clientClip);
       break;
    }
    image->clientClip = NULL;
    image->clientClipType = CT_NONE;
}    

Here is the caller graph for this function:

pixman_private void pixman_image_init ( pixman_image_t *  image)

Definition at line 105 of file icimage.c.

{
    image->refcnt = 1;
    image->repeat = 0;
    image->graphicsExposures = 0;
    image->subWindowMode = ClipByChildren;
    image->polyEdge = PolyEdgeSharp;
    image->polyMode = PolyModePrecise;
    /* 
     * In the server this was 0 because the composite clip list
     * can be referenced from a window (and often is)
     */
    image->freeCompClip = 0;
    image->freeSourceClip = 0;
    image->clientClipType = CT_NONE;
    image->componentAlpha = 0;
    image->compositeClipSource = 0;

    image->alphaMap = NULL;
    image->alphaOrigin.x = 0;
    image->alphaOrigin.y = 0;

    image->clipOrigin.x = 0;
    image->clipOrigin.y = 0;
    image->clientClip = NULL;

    image->dither = 0L;

    image->stateChanges = (1 << (CPLastBit+1)) - 1;
/* XXX: What to lodge here?
    image->serialNumber = GC_CHANGE_SERIAL_BIT;
*/

    image->pCompositeClip = pixman_region_create();
    pixman_region_union_rect (image->pCompositeClip, image->pCompositeClip,
                     0, 0, image->pixels->width, image->pixels->height);
    image->freeCompClip = 1;

    image->pSourceClip = pixman_region_create ();
    pixman_region_union_rect (image->pSourceClip, image->pSourceClip,
                     0, 0, image->pixels->width, image->pixels->height);
    image->freeSourceClip = 1;
    
    image->transform = NULL;

    image->filter = PIXMAN_FILTER_NEAREST;
    image->filter_params = NULL;
    image->filter_nparams = 0;


    image->owns_pixels = 0;
}

Here is the call graph for this function:

Here is the caller graph for this function: