Back to index

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

Go to the source code of this file.

Defines

#define _div(a, b)   ((a) >= 0 ? (a) / (b) : -((-(a) + (b) - 1) / (b)))

Functions

xFixed RenderSampleCeilY (xFixed y, int n)
xFixed RenderSampleFloorY (xFixed y, int n)
void RenderEdgeStep (RenderEdge *e, int n)
static void _RenderEdgeMultiInit (RenderEdge *e, int n, xFixed *stepx_p, xFixed *dx_p)
void RenderEdgeInit (RenderEdge *e, int n, xFixed y_start, xFixed x_top, xFixed y_top, xFixed x_bot, xFixed y_bot)
void RenderLineFixedEdgeInit (RenderEdge *e, int n, xFixed y, const xLineFixed *line, int x_off, int y_off)

Define Documentation

#define _div (   a,
  b 
)    ((a) >= 0 ? (a) / (b) : -((-(a) + (b) - 1) / (b)))

Definition at line 47 of file renderedge.c.


Function Documentation

static void _RenderEdgeMultiInit ( RenderEdge e,
int  n,
xFixed stepx_p,
xFixed dx_p 
) [static]

Definition at line 105 of file renderedge.c.

{
    xFixed    stepx;
    xFixed_48_16     ne;
    
    ne = n * (xFixed_48_16) e->dx;
    stepx = n * e->stepx;
    if (ne > 0)
    {
       int nx = ne / e->dy;
       ne -= nx * e->dy;
       stepx += nx * e->signdx;
    }
    *dx_p = ne;
    *stepx_p = stepx;
}

Here is the call graph for this function:

Here is the caller graph for this function:

void RenderEdgeInit ( RenderEdge e,
int  n,
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  n,
xFixed  y,
const xLineFixed 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);
}

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);
}

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);
}