summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSoren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com>2007-05-23 13:08:26 -0400
committerSoren Sandmann Pedersen <ssp@dhcp83-218.boston.redhat.com>2007-05-23 13:08:26 -0400
commit2a960c442bd7560630f52b55d82ec0517542ee5a (patch)
tree7b8d02e4c162ee412a061114b9d0c944794b1328
parent3ba3ede9bbdfc6376b6f6e0b6ce8280a05e6584d (diff)
Port renderedge.c to pixman
-rw-r--r--render/renderedge.c119
-rw-r--r--render/renderedge.h15
2 files changed, 6 insertions, 128 deletions
diff --git a/render/renderedge.c b/render/renderedge.c
index c2ffabe03..e92174f90 100644
--- a/render/renderedge.c
+++ b/render/renderedge.c
@@ -36,16 +36,7 @@
_X_EXPORT xFixed
RenderSampleCeilY (xFixed y, int n)
{
- 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);
+ return pixman_sample_ceil_y (y, n);
}
#define _div(a,b) ((a) >= 0 ? (a) / (b) : -((-(a) + (b) - 1) / (b)))
@@ -57,16 +48,7 @@ RenderSampleCeilY (xFixed y, int n)
_X_EXPORT xFixed
RenderSampleFloorY (xFixed y, int n)
{
- 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);
+ return pixman_sample_floor_y (y, n);
}
/*
@@ -75,52 +57,7 @@ RenderSampleFloorY (xFixed y, int n)
_X_EXPORT void
RenderEdgeStep (RenderEdge *e, int n)
{
- 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;
- }
- }
-}
-
-/*
- * A private routine to initialize the multi-step
- * elements of an edge structure
- */
-static void
-_RenderEdgeMultiInit (RenderEdge *e, int n, xFixed *stepx_p, xFixed *dx_p)
-{
- 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;
+ pixman_edge_step (e, n);
}
/*
@@ -136,35 +73,7 @@ RenderEdgeInit (RenderEdge *e,
xFixed x_bot,
xFixed y_bot)
{
- xFixed dx, dy;
-
- e->x = x_top;
- e->e = 0;
- dx = x_bot - x_top;
- dy = y_bot - y_top;
- e->dy = dy;
- e->dx = 0;
- 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);
+ pixman_edge_init (e, n, y_start, x_top, y_top, x_bot, y_bot);
}
/*
@@ -179,24 +88,6 @@ RenderLineFixedEdgeInit (RenderEdge *e,
int x_off,
int y_off)
{
- xFixed x_off_fixed = IntToxFixed(x_off);
- xFixed y_off_fixed = IntToxFixed(y_off);
- 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);
+ pixman_line_fixed_edge_init (e, n, y, (pixman_line_fixed_t *)line, x_off, y_off);
}
diff --git a/render/renderedge.h b/render/renderedge.h
index d621d9dcf..38f9f0914 100644
--- a/render/renderedge.h
+++ b/render/renderedge.h
@@ -50,20 +50,7 @@
* and can be quickly stepped across small or large gaps in the
* sample grid
*/
-
-typedef struct {
- xFixed x;
- xFixed e;
- xFixed stepx;
- xFixed signdx;
- xFixed dy;
- xFixed dx;
-
- xFixed stepx_small;
- xFixed stepx_big;
- xFixed dx_small;
- xFixed dx_big;
-} RenderEdge;
+typedef pixman_edge_t RenderEdge;
/*
* Step across a small sample grid gap