~ubuntu-branches/ubuntu/karmic/virtualbox-ose/karmic-updates

« back to all changes in this revision

Viewing changes to src/VBox/Additions/x11/x11include/xorg-server-1.5.3/miscanfill.h

  • Committer: Bazaar Package Importer
  • Author(s): Felix Geyer
  • Date: 2009-09-14 18:25:07 UTC
  • mfrom: (0.4.1 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090914182507-c98g07mq16hjmn6d
Tags: 3.0.6-dfsg-1ubuntu1
* Merge from debian unstable (LP: #429697), remaining changes:
  - Enable DKMS support on virtualbox host and guest modules (LP: #267097)
    - Drop virtualbox-ose{-guest,}-modules-* package templates
    - Recommend *-source instead of *-modules packages
    - Replace error messages related to missing/mismatched
      kernel module accordingly
  - Autoload kernel module
    - LOAD_VBOXDRV_MODULE=1 in virtualbox-ose.default
  - Disable update action
    - patches/u01-disable-update-action.dpatch
  - Virtualbox should go in Accessories, not in System tools (LP: #288590)
    - virtualbox-ose-qt.files/virtualbox-ose.desktop
  - Add apport hook
    - virtualbox-ose.files/source_virtualbox-ose.py
    - virtualbox-ose.install
  - Add launchpad integration
    - control
    - lpi-bug.xpm
    - patches/u02-lp-integration.dpatch
  - virtualbox, virtualbox-* (names of the upstream proprietary packages)
    conflict with virtualbox-ose (LP: #379878)
* Make debug package depend on normal or guest utils package
* Drop patches/22-pulseaudio-stubs.dpatch (applied upstream)
* Rename Ubuntu specific patches to uXX-*.dpatch
* Fix lintian warnings in maintainer scripts

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
 
3
 
Copyright 1987, 1998  The Open Group
4
 
 
5
 
Permission to use, copy, modify, distribute, and sell this software and its
6
 
documentation for any purpose is hereby granted without fee, provided that
7
 
the above copyright notice appear in all copies and that both that
8
 
copyright notice and this permission notice appear in supporting
9
 
documentation.
10
 
 
11
 
The above copyright notice and this permission notice shall be included
12
 
in all copies or substantial portions of the Software.
13
 
 
14
 
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
15
 
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
 
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
17
 
IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR
18
 
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19
 
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20
 
OTHER DEALINGS IN THE SOFTWARE.
21
 
 
22
 
Except as contained in this notice, the name of The Open Group shall
23
 
not be used in advertising or otherwise to promote the sale, use or
24
 
other dealings in this Software without prior written authorization
25
 
from The Open Group.
26
 
 
27
 
*/
28
 
 
29
 
 
30
 
#ifdef HAVE_DIX_CONFIG_H
31
 
#include <dix-config.h>
32
 
#endif
33
 
 
34
 
#ifndef SCANFILLINCLUDED
35
 
#define SCANFILLINCLUDED
36
 
/*
37
 
 *     scanfill.h
38
 
 *
39
 
 *     Written by Brian Kelleher; Jan 1985
40
 
 *
41
 
 *     This file contains a few macros to help track
42
 
 *     the edge of a filled object.  The object is assumed
43
 
 *     to be filled in scanline order, and thus the
44
 
 *     algorithm used is an extension of Bresenham's line
45
 
 *     drawing algorithm which assumes that y is always the
46
 
 *     major axis.
47
 
 *     Since these pieces of code are the same for any filled shape,
48
 
 *     it is more convenient to gather the library in one
49
 
 *     place, but since these pieces of code are also in
50
 
 *     the inner loops of output primitives, procedure call
51
 
 *     overhead is out of the question.
52
 
 *     See the author for a derivation if needed.
53
 
 */
54
 
 
55
 
 
56
 
/*
57
 
 *  In scan converting polygons, we want to choose those pixels
58
 
 *  which are inside the polygon.  Thus, we add .5 to the starting
59
 
 *  x coordinate for both left and right edges.  Now we choose the
60
 
 *  first pixel which is inside the pgon for the left edge and the
61
 
 *  first pixel which is outside the pgon for the right edge.
62
 
 *  Draw the left pixel, but not the right.
63
 
 *
64
 
 *  How to add .5 to the starting x coordinate:
65
 
 *      If the edge is moving to the right, then subtract dy from the
66
 
 *  error term from the general form of the algorithm.
67
 
 *      If the edge is moving to the left, then add dy to the error term.
68
 
 *
69
 
 *  The reason for the difference between edges moving to the left
70
 
 *  and edges moving to the right is simple:  If an edge is moving
71
 
 *  to the right, then we want the algorithm to flip immediately.
72
 
 *  If it is moving to the left, then we don't want it to flip until
73
 
 *  we traverse an entire pixel.
74
 
 */
75
 
#define BRESINITPGON(dy, x1, x2, xStart, d, m, m1, incr1, incr2) { \
76
 
    int dx;      /* local storage */ \
77
 
\
78
 
    /* \
79
 
     *  if the edge is horizontal, then it is ignored \
80
 
     *  and assumed not to be processed.  Otherwise, do this stuff. \
81
 
     */ \
82
 
    if ((dy) != 0) { \
83
 
        xStart = (x1); \
84
 
        dx = (x2) - xStart; \
85
 
        if (dx < 0) { \
86
 
            m = dx / (dy); \
87
 
            m1 = m - 1; \
88
 
            incr1 = -2 * dx + 2 * (dy) * m1; \
89
 
            incr2 = -2 * dx + 2 * (dy) * m; \
90
 
            d = 2 * m * (dy) - 2 * dx - 2 * (dy); \
91
 
        } else { \
92
 
            m = dx / (dy); \
93
 
            m1 = m + 1; \
94
 
            incr1 = 2 * dx - 2 * (dy) * m1; \
95
 
            incr2 = 2 * dx - 2 * (dy) * m; \
96
 
            d = -2 * m * (dy) + 2 * dx; \
97
 
        } \
98
 
    } \
99
 
}
100
 
 
101
 
#define BRESINCRPGON(d, minval, m, m1, incr1, incr2) { \
102
 
    if (m1 > 0) { \
103
 
        if (d > 0) { \
104
 
            minval += m1; \
105
 
            d += incr1; \
106
 
        } \
107
 
        else { \
108
 
            minval += m; \
109
 
            d += incr2; \
110
 
        } \
111
 
    } else {\
112
 
        if (d >= 0) { \
113
 
            minval += m1; \
114
 
            d += incr1; \
115
 
        } \
116
 
        else { \
117
 
            minval += m; \
118
 
            d += incr2; \
119
 
        } \
120
 
    } \
121
 
}
122
 
 
123
 
 
124
 
/*
125
 
 *     This structure contains all of the information needed
126
 
 *     to run the bresenham algorithm.
127
 
 *     The variables may be hardcoded into the declarations
128
 
 *     instead of using this structure to make use of
129
 
 *     register declarations.
130
 
 */
131
 
typedef struct {
132
 
    int minor;         /* minor axis        */
133
 
    int d;           /* decision variable */
134
 
    int m, m1;       /* slope and slope+1 */
135
 
    int incr1, incr2; /* error increments */
136
 
} BRESINFO;
137
 
 
138
 
 
139
 
#define BRESINITPGONSTRUCT(dmaj, min1, min2, bres) \
140
 
        BRESINITPGON(dmaj, min1, min2, bres.minor, bres.d, \
141
 
                     bres.m, bres.m1, bres.incr1, bres.incr2)
142
 
 
143
 
#define BRESINCRPGONSTRUCT(bres) \
144
 
        BRESINCRPGON(bres.d, bres.minor, bres.m, bres.m1, bres.incr1, bres.incr2)
145
 
 
146
 
 
147
 
#endif