2
* $Id: renderedge.h,v 1.4 2005/08/24 11:18:33 daniels Exp $
4
* Copyright © 2004 Keith Packard
6
* Permission to use, copy, modify, distribute, and sell this software and its
7
* documentation for any purpose is hereby granted without fee, provided that
8
* the above copyright notice appear in all copies and that both that
9
* copyright notice and this permission notice appear in supporting
10
* documentation, and that the name of Keith Packard not be used in
11
* advertising or publicity pertaining to distribution of the software without
12
* specific, written prior permission. Keith Packard makes no
13
* representations about the suitability of this software for any purpose. It
14
* is provided "as is" without express or implied warranty.
16
* KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
17
* INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
18
* EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
19
* CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
20
* DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
21
* TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
22
* PERFORMANCE OF THIS SOFTWARE.
25
#ifndef _RENDEREDGE_H_
26
#define _RENDEREDGE_H_
28
#include "picturestr.h"
30
#define MAX_ALPHA(n) ((1 << (n)) - 1)
31
#define N_Y_FRAC(n) ((n) == 1 ? 1 : (1 << ((n)/2)) - 1)
32
#define N_X_FRAC(n) ((1 << ((n)/2)) + 1)
34
#define STEP_Y_SMALL(n) (xFixed1 / N_Y_FRAC(n))
35
#define STEP_Y_BIG(n) (xFixed1 - (N_Y_FRAC(n) - 1) * STEP_Y_SMALL(n))
37
#define Y_FRAC_FIRST(n) (STEP_Y_SMALL(n) / 2)
38
#define Y_FRAC_LAST(n) (Y_FRAC_FIRST(n) + (N_Y_FRAC(n) - 1) * STEP_Y_SMALL(n))
40
#define STEP_X_SMALL(n) (xFixed1 / N_X_FRAC(n))
41
#define STEP_X_BIG(n) (xFixed1 - (N_X_FRAC(n) - 1) * STEP_X_SMALL(n))
43
#define X_FRAC_FIRST(n) (STEP_X_SMALL(n) / 2)
44
#define X_FRAC_LAST(n) (X_FRAC_FIRST(n) + (N_X_FRAC(n) - 1) * STEP_X_SMALL(n))
46
#define RenderSamplesX(x,n) ((n) == 1 ? 0 : (xFixedFrac (x) + X_FRAC_FIRST(n)) / STEP_X_SMALL(n))
49
* An edge structure. This represents a single polygon edge
50
* and can be quickly stepped across small or large gaps in the
69
* Step across a small sample grid gap
71
#define RenderEdgeStepSmall(edge) { \
72
edge->x += edge->stepx_small; \
73
edge->e += edge->dx_small; \
76
edge->e -= edge->dy; \
77
edge->x += edge->signdx; \
82
* Step across a large sample grid gap
84
#define RenderEdgeStepBig(edge) { \
85
edge->x += edge->stepx_big; \
86
edge->e += edge->dx_big; \
89
edge->e -= edge->dy; \
90
edge->x += edge->signdx; \
95
RenderSampleCeilY (xFixed y, int bpp);
98
RenderSampleFloorY (xFixed y, int bpp);
101
RenderEdgeStep (RenderEdge *e, int n);
104
RenderEdgeInit (RenderEdge *e,
113
RenderLineFixedEdgeInit (RenderEdge *e,
120
#endif /* _RENDEREDGE_H_ */