First import
[xorg_rtime.git] / xorg-server-1.4 / render / renderedge.c
blobd0ee30716a64fe5c735c0711622e3df373933f37
1 /*
2 * Copyright © 2004 Keith Packard
4 * Permission to use, copy, modify, distribute, and sell this software and its
5 * documentation for any purpose is hereby granted without fee, provided that
6 * the above copyright notice appear in all copies and that both that
7 * copyright notice and this permission notice appear in supporting
8 * documentation, and that the name of Keith Packard not be used in
9 * advertising or publicity pertaining to distribution of the software without
10 * specific, written prior permission. Keith Packard makes no
11 * representations about the suitability of this software for any purpose. It
12 * is provided "as is" without express or implied warranty.
14 * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
15 * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
16 * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
17 * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
18 * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
19 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
20 * PERFORMANCE OF THIS SOFTWARE.
23 #ifdef HAVE_DIX_CONFIG_H
24 #include <dix-config.h>
25 #endif
27 #include "renderedge.h"
30 * Compute the smallest value no less than y which is on a
31 * grid row
34 _X_EXPORT xFixed
35 RenderSampleCeilY (xFixed y, int n)
37 return pixman_sample_ceil_y (y, n);
40 #define _div(a,b) ((a) >= 0 ? (a) / (b) : -((-(a) + (b) - 1) / (b)))
43 * Compute the largest value no greater than y which is on a
44 * grid row
46 _X_EXPORT xFixed
47 RenderSampleFloorY (xFixed y, int n)
49 return pixman_sample_floor_y (y, n);
53 * Step an edge by any amount (including negative values)
55 _X_EXPORT void
56 RenderEdgeStep (RenderEdge *e, int n)
58 pixman_edge_step (e, n);
62 * Initialize one edge structure given the line endpoints and a
63 * starting y value
65 _X_EXPORT void
66 RenderEdgeInit (RenderEdge *e,
67 int n,
68 xFixed y_start,
69 xFixed x_top,
70 xFixed y_top,
71 xFixed x_bot,
72 xFixed y_bot)
74 pixman_edge_init (e, n, y_start, x_top, y_top, x_bot, y_bot);
78 * Initialize one edge structure given a line, starting y value
79 * and a pixel offset for the line
81 _X_EXPORT void
82 RenderLineFixedEdgeInit (RenderEdge *e,
83 int n,
84 xFixed y,
85 xLineFixed *line,
86 int x_off,
87 int y_off)
89 pixman_line_fixed_edge_init (e, n, y, (pixman_line_fixed_t *)line, x_off, y_off);