Back to index

lightning-sunbird  0.9+nobinonly
Functions
icpixels.c File Reference
#include "pixman-xserver-compat.h"

Go to the source code of this file.

Functions

static void FbPixelsInit (FbPixels *pixels, pixman_bits_t *buf, int width, int height, int depth, int bpp, int stride)
static unsigned int pixman_bits_per_pixel (unsigned int depth)
FbPixelsFbPixelsCreate (int width, int height, int depth)
FbPixelsFbPixelsCreateForData (pixman_bits_t *data, int width, int height, int depth, int bpp, int stride)
void FbPixelsDestroy (FbPixels *pixels)

Function Documentation

FbPixels* FbPixelsCreate ( int  width,
int  height,
int  depth 
)

Definition at line 51 of file icpixels.c.

{
    FbPixels         *pixels;
    pixman_bits_t           *buf;
    unsigned int     buf_size;
    unsigned int     bpp;
    unsigned int     stride;
    unsigned int     adjust;
    unsigned int     base;

    bpp = pixman_bits_per_pixel (depth);
    stride = ((width * bpp + FB_MASK) >> FB_SHIFT) * sizeof (pixman_bits_t);
    buf_size = height * stride;
    base = sizeof (FbPixels);
    adjust = 0;
    if (base & 7)
       adjust = 8 - (base & 7);
    buf_size += adjust;

    pixels = malloc(base + buf_size);
    if (!pixels)
       return NULL;

    buf = (pixman_bits_t *) ((char *)pixels + base + adjust);

    FbPixelsInit (pixels, buf, width, height, depth, bpp, stride);

    return pixels;
}

Here is the call graph for this function:

Here is the caller graph for this function:

FbPixels* FbPixelsCreateForData ( pixman_bits_t data,
int  width,
int  height,
int  depth,
int  bpp,
int  stride 
)

Definition at line 82 of file icpixels.c.

{
    FbPixels *pixels;

    pixels = malloc (sizeof (FbPixels));
    if (pixels == NULL)
       return NULL;

    FbPixelsInit (pixels, data, width, height, depth, bpp, stride);

    return pixels;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void FbPixelsDestroy ( FbPixels pixels)

Definition at line 110 of file icpixels.c.

{
    if(--pixels->refcnt)
       return;

    free(pixels);
}

Here is the caller graph for this function:

static void FbPixelsInit ( FbPixels pixels,
pixman_bits_t buf,
int  width,
int  height,
int  depth,
int  bpp,
int  stride 
) [static]

Definition at line 96 of file icpixels.c.

{
    pixels->data = buf;
    pixels->width = width;
    pixels->height = height;
    pixels->depth = depth;
    pixels->bpp = bpp;
    pixels->stride = stride;
    pixels->x = 0;
    pixels->y = 0;
    pixels->refcnt = 1;
}

Here is the caller graph for this function:

static unsigned int pixman_bits_per_pixel ( unsigned int  depth) [static]

Definition at line 34 of file icpixels.c.

{
    if (depth > 8)
       if (depth > 16)
           return 32;
       else
           return 16;
    else
       if (depth > 4)
           return 8;
       else if (depth > 1)
           return 4;
       else
           return 1;
}

Here is the caller graph for this function: