Back to index

lightning-sunbird  0.9+nobinonly
Classes | Defines | Functions
renderedge.h File Reference
#include "pixman-xserver-compat.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  RenderEdge

Defines

#define MAX_ALPHA(n)   ((1 << (n)) - 1)
#define N_Y_FRAC(n)   ((n) == 1 ? 1 : (1 << ((n)/2)) - 1)
#define N_X_FRAC(n)   ((1 << ((n)/2)) + 1)
#define STEP_Y_SMALL(n)   (xFixed1 / N_Y_FRAC(n))
#define STEP_Y_BIG(n)   (xFixed1 - (N_Y_FRAC(n) - 1) * STEP_Y_SMALL(n))
#define Y_FRAC_FIRST(n)   (STEP_Y_SMALL(n) / 2)
#define Y_FRAC_LAST(n)   (Y_FRAC_FIRST(n) + (N_Y_FRAC(n) - 1) * STEP_Y_SMALL(n))
#define STEP_X_SMALL(n)   (xFixed1 / N_X_FRAC(n))
#define STEP_X_BIG(n)   (xFixed1 - (N_X_FRAC(n) - 1) * STEP_X_SMALL(n))
#define X_FRAC_FIRST(n)   (STEP_X_SMALL(n) / 2)
#define X_FRAC_LAST(n)   (X_FRAC_FIRST(n) + (N_X_FRAC(n) - 1) * STEP_X_SMALL(n))
#define RenderSamplesX(x, n)   ((n) == 1 ? 0 : (xFixedFrac (x) + X_FRAC_FIRST(n)) / STEP_X_SMALL(n))
#define RenderEdgeStepSmall(edge)
#define RenderEdgeStepBig(edge)

Functions

xFixed RenderSampleCeilY (xFixed y, int bpp)
xFixed RenderSampleFloorY (xFixed y, int bpp)
void RenderEdgeStep (RenderEdge *e, int n)
void RenderEdgeInit (RenderEdge *e, int bpp, xFixed y_start, xFixed x_top, xFixed y_top, xFixed x_bot, xFixed y_bot)
void RenderLineFixedEdgeInit (RenderEdge *e, int bpp, xFixed y, const pixman_line_fixed_t *line, int x_off, int y_off)

Class Documentation

struct RenderEdge

Definition at line 93 of file renderedge.h.

Class Members
xFixed dx
xFixed dx_big
xFixed dx_small
xFixed dy
xFixed e
xFixed signdx
xFixed stepx
xFixed stepx_big
xFixed stepx_small
xFixed x

Define Documentation

#define MAX_ALPHA (   n)    ((1 << (n)) - 1)

Definition at line 69 of file renderedge.h.

#define N_X_FRAC (   n)    ((1 << ((n)/2)) + 1)

Definition at line 71 of file renderedge.h.

#define N_Y_FRAC (   n)    ((n) == 1 ? 1 : (1 << ((n)/2)) - 1)

Definition at line 70 of file renderedge.h.

Value:
{   \
    (edge)->x += (edge)->stepx_big;           \
    (edge)->e += (edge)->dx_big;       \
    if ((edge)->e > 0)                 \
    {                           \
       (edge)->e -= (edge)->dy;        \
       (edge)->x += (edge)->signdx;    \
    }                           \
}

Definition at line 123 of file renderedge.h.

Value:
{ \
    (edge)->x += (edge)->stepx_small;   \
    (edge)->e += (edge)->dx_small;     \
    if ((edge)->e > 0)                 \
    {                           \
       (edge)->e -= (edge)->dy;        \
       (edge)->x += (edge)->signdx;    \
    }                           \
}

Definition at line 110 of file renderedge.h.

#define RenderSamplesX (   x,
  n 
)    ((n) == 1 ? 0 : (xFixedFrac (x) + X_FRAC_FIRST(n)) / STEP_X_SMALL(n))

Definition at line 85 of file renderedge.h.

#define STEP_X_BIG (   n)    (xFixed1 - (N_X_FRAC(n) - 1) * STEP_X_SMALL(n))

Definition at line 80 of file renderedge.h.

#define STEP_X_SMALL (   n)    (xFixed1 / N_X_FRAC(n))

Definition at line 79 of file renderedge.h.

#define STEP_Y_BIG (   n)    (xFixed1 - (N_Y_FRAC(n) - 1) * STEP_Y_SMALL(n))

Definition at line 74 of file renderedge.h.

#define STEP_Y_SMALL (   n)    (xFixed1 / N_Y_FRAC(n))

Definition at line 73 of file renderedge.h.

#define X_FRAC_FIRST (   n)    (STEP_X_SMALL(n) / 2)

Definition at line 82 of file renderedge.h.

#define X_FRAC_LAST (   n)    (X_FRAC_FIRST(n) + (N_X_FRAC(n) - 1) * STEP_X_SMALL(n))

Definition at line 83 of file renderedge.h.

#define Y_FRAC_FIRST (   n)    (STEP_Y_SMALL(n) / 2)

Definition at line 76 of file renderedge.h.

#define Y_FRAC_LAST (   n)    (Y_FRAC_FIRST(n) + (N_Y_FRAC(n) - 1) * STEP_Y_SMALL(n))

Definition at line 77 of file renderedge.h.


Function Documentation

void RenderEdgeInit ( RenderEdge e,
int  bpp,
xFixed  y_start,
xFixed  x_top,
xFixed  y_top,
xFixed  x_bot,
xFixed  y_bot 
)

Definition at line 127 of file renderedge.c.

{
    xFixed    dx, dy;

    e->x = x_top;
    e->e = 0;
    dx = x_bot - x_top;
    dy = y_bot - y_top;
    e->dy = dy;
    if (dy)
    {
       if (dx >= 0)
       {
           e->signdx = 1;
           e->stepx = dx / dy;
           e->dx = dx % dy;
           e->e = -dy;
       }
       else
       {
           e->signdx = -1;
           e->stepx = -(-dx / dy);
           e->dx = -dx % dy;
           e->e = 0;
       }
    
       _RenderEdgeMultiInit (e, STEP_Y_SMALL(n), &e->stepx_small, &e->dx_small);
       _RenderEdgeMultiInit (e, STEP_Y_BIG(n), &e->stepx_big, &e->dx_big);
    }
    RenderEdgeStep (e, y_start - y_top);
}

Here is the call graph for this function:

void RenderEdgeStep ( RenderEdge e,
int  n 
)

Definition at line 72 of file renderedge.c.

{
    xFixed_48_16     ne;

    e->x += n * e->stepx;
    
    ne = e->e + n * (xFixed_48_16) e->dx;
    
    if (n >= 0)
    {
       if (ne > 0)
       {
           int nx = (ne + e->dy - 1) / e->dy;
           e->e = ne - nx * (xFixed_48_16) e->dy;
           e->x += nx * e->signdx;
       }
    }
    else
    {
       if (ne <= -e->dy)
       {
           int nx = (-ne) / e->dy;
           e->e = ne + nx * (xFixed_48_16) e->dy;
           e->x -= nx * e->signdx;
       }
    }
}

Here is the call graph for this function:

void RenderLineFixedEdgeInit ( RenderEdge e,
int  bpp,
xFixed  y,
const pixman_line_fixed_t line,
int  x_off,
int  y_off 
)

Definition at line 170 of file renderedge.c.

{
    xFixed    x_off_fixed = IntToxFixed(x_off);
    xFixed    y_off_fixed = IntToxFixed(y_off);
    const xPointFixed *top, *bot;

    if (line->p1.y <= line->p2.y)
    {
       top = &line->p1;
       bot = &line->p2;
    }
    else
    {
       top = &line->p2;
       bot = &line->p1;
    }
    RenderEdgeInit (e, n, y,
                  top->x + x_off_fixed,
                  top->y + y_off_fixed,
                  bot->x + x_off_fixed,
                  bot->y + y_off_fixed);
}
xFixed RenderSampleCeilY ( xFixed  y,
int  bpp 
)

Definition at line 33 of file renderedge.c.

{
    xFixed   f = xFixedFrac(y);
    xFixed   i = xFixedFloor(y);
    
    f = ((f + Y_FRAC_FIRST(n)) / STEP_Y_SMALL(n)) * STEP_Y_SMALL(n) + Y_FRAC_FIRST(n);
    if (f > Y_FRAC_LAST(n))
    {
       f = Y_FRAC_FIRST(n);
       i += xFixed1;
    }
    return (i | f);
}
xFixed RenderSampleFloorY ( xFixed  y,
int  bpp 
)

Definition at line 54 of file renderedge.c.

{
    xFixed   f = xFixedFrac(y);
    xFixed   i = xFixedFloor (y);
    
    f = _div(f - Y_FRAC_FIRST(n), STEP_Y_SMALL(n)) * STEP_Y_SMALL(n) + Y_FRAC_FIRST(n);
    if (f < Y_FRAC_FIRST(n))
    {
       f = Y_FRAC_LAST(n);
       i -= xFixed1;
    }
    return (i | f);
}