~ubuntu-branches/ubuntu/precise/libxfont/precise-updates

« back to all changes in this revision

Viewing changes to src/Type1/lines.c

  • Committer: Bazaar Package Importer
  • Author(s): Bryce Harrington
  • Date: 2007-07-18 16:46:59 UTC
  • mto: This revision was merged to the branch mainline in revision 15.
  • Revision ID: james.westby@ubuntu.com-20070718164659-hbs3149rix062etp
Tags: upstream-1.3.0
ImportĀ upstreamĀ versionĀ 1.3.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
70
70
*/
71
71
 
72
72
/*
73
 
:h2.StepLine() - Produces Run Ends for a Line After Checks
74
 
 
75
 
The main work is done by Bresenham(); here we just perform checks and
76
 
get the line so that its Y direction is always increasing:
77
 
*/
78
 
 
79
 
void StepLine(R, x1, y1, x2, y2)
80
 
       register struct region *R;  /* region being built                     */
81
 
       register fractpel x1,y1;  /* starting point                           */
82
 
       register fractpel x2,y2;  /* ending point                             */
83
 
{
84
 
       register fractpel dy;
85
 
 
86
 
       dy = y2 - y1;
87
 
 
88
 
/*
89
 
We execute the "GOING_TO" macro to call back the REGIONS module, if
90
 
necessary (like if the Y direction of the edge has changed):
91
 
*/
92
 
       GOING_TO(R, x1, y1, x2, y2, dy);
93
 
 
94
 
       if (dy == 0)
95
 
               return;
96
 
 
97
 
       if (dy < 0)
98
 
               Bresenham(R->edge, x2, y2, x1, y1);
99
 
       else
100
 
               Bresenham(R->edge, x1, y1, x2, y2);
101
 
       return;
102
 
}
103
 
/*
104
73
:h3.Bresenham() - Actually Produces Run Ends
105
74
 
106
75
This routine runs a Bresenham line-stepping
124
93
#define  TruncFP(xy,b)   ((xy)>>(b))
125
94
 
126
95
 
127
 
void Bresenham(edgeP,x1,y1,x2,y2)
128
 
       register pel *edgeP;               /* pointer to top of list (y == 0) */
129
 
       register fractpel x1,y1;           /* starting point on line          */
130
 
       register fractpel x2,y2;           /* ending point on the line (down) */
 
96
static void
 
97
Bresenham(pel *edgeP, fractpel x1, fractpel y1, fractpel x2, fractpel y2)
131
98
{
132
99
       register long dx,dy;  /* change in x and y, in my own precision       */
133
100
       register long x,y;    /* integer pel starting point                   */
187
154
  }
188
155
 }
189
156
}
 
157
 
 
158
/*
 
159
:h2.StepLine() - Produces Run Ends for a Line After Checks
 
160
 
 
161
The main work is done by Bresenham(); here we just perform checks and
 
162
get the line so that its Y direction is always increasing:
 
163
*/
 
164
 
 
165
void StepLine(R, x1, y1, x2, y2)
 
166
       register struct region *R;  /* region being built                     */
 
167
       register fractpel x1,y1;  /* starting point                           */
 
168
       register fractpel x2,y2;  /* ending point                             */
 
169
{
 
170
       register fractpel dy;
 
171
 
 
172
       dy = y2 - y1;
 
173
 
 
174
/*
 
175
We execute the "GOING_TO" macro to call back the REGIONS module, if
 
176
necessary (like if the Y direction of the edge has changed):
 
177
*/
 
178
       GOING_TO(R, x1, y1, x2, y2, dy);
 
179
 
 
180
       if (dy == 0)
 
181
               return;
 
182
 
 
183
       if (dy < 0)
 
184
               Bresenham(R->edge, x2, y2, x1, y1);
 
185
       else
 
186
               Bresenham(R->edge, x1, y1, x2, y2);
 
187
       return;
 
188
}