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.
29
rasterizeEdges (pixman_image_t *image,
37
uint32_t *buf = (image)->bits.bits;
38
uint32_t stride = (image)->bits.rowstride;
39
uint32_t width = (image)->bits.width;
41
line = buf + pixman_fixed_to_int (y) * stride;
55
if (pixman_fixed_to_int (rx) >= width)
56
rx = pixman_int_to_fixed (width);
58
/* Skip empty (or backwards) sections */
62
/* Find pixel bounds for span */
63
lxi = pixman_fixed_to_int (lx);
64
rxi = pixman_fixed_to_int (rx);
72
int width = rxi - lxi;
78
FbMaskBits (x, width, startmask, nmiddle, endmask);
80
WRITE(a, READ(a) | startmask);
84
WRITE(a++, FB_ALLONES);
86
WRITE(a, READ(a) | endmask);
90
DefineAlpha(line,lxi);
94
/* Sample coverage for edge pixels */
95
lxs = RenderSamplesX (lx, N_BITS);
96
rxs = RenderSamplesX (rx, N_BITS);
98
/* Add coverage across row */
101
AddAlpha (rxs - lxs);
107
AddAlpha (N_X_FRAC(N_BITS) - lxs);
109
for (xi = lxi + 1; xi < rxi; xi++)
111
AddAlpha (N_X_FRAC(N_BITS));
114
/* Do not add in a 0 alpha here. This check is necessary
115
* to avoid a buffer overrun when rx is exactly on a pixel
129
if (pixman_fixed_frac (y) != Y_FRAC_LAST(N_BITS))
131
RenderEdgeStepSmall (l);
132
RenderEdgeStepSmall (r);
133
y += STEP_Y_SMALL(N_BITS);
138
RenderEdgeStepBig (l);
139
RenderEdgeStepBig (r);
140
y += STEP_Y_BIG(N_BITS);