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

« back to all changes in this revision

Viewing changes to src/Speedo/out_util.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:
40
40
/* absolute value function */
41
41
#define   ABS(X)     ( (X < 0) ? -X : X)
42
42
#if INCL_BLACK || INCL_2D || INCL_SCREEN
43
 
 
 
43
 
 
44
static FUNCTION void restart_intercepts_out(void)
 
45
GDECL
 
46
/*  Called by sp_make_char when a new sub character is started
 
47
 *  Freezes current sorted lists
 
48
 */
 
49
{
 
50
#if DEBUG
 
51
printf("    Restart intercepts:\n");
 
52
#endif
 
53
sp_globals.first_offset = sp_globals.next_offset;
 
54
}
 
55
 
 
56
static FUNCTION void set_first_band_out(
 
57
GDECL
 
58
point_t Pmin,
 
59
point_t Pmax)
 
60
{
 
61
 
 
62
sp_globals.ymin = Pmin.y;
 
63
sp_globals.ymax = Pmax.y;
 
64
 
 
65
sp_globals.ymin = (sp_globals.ymin - sp_globals.onepix + 1) >> sp_globals.pixshift;
 
66
sp_globals.ymax = (sp_globals.ymax + sp_globals.onepix - 1) >> sp_globals.pixshift;
 
67
 
 
68
#if INCL_CLIPPING
 
69
    switch(sp_globals.tcb0.xtype)
 
70
       {
 
71
       case 1: /* 180 degree rotation */
 
72
            if (sp_globals.specs.flags & CLIP_TOP)
 
73
               {
 
74
               sp_globals.clip_ymin = (fix31)((fix31)EM_TOP * sp_globals.tcb0.yppo + ((1<<sp_globals.multshift)/2));
 
75
               sp_globals.clip_ymin = sp_globals.clip_ymin >> sp_globals.multshift;
 
76
               sp_globals.clip_ymin = -1* sp_globals.clip_ymin;
 
77
               if (sp_globals.ymin < sp_globals.clip_ymin)
 
78
                    sp_globals.ymin = sp_globals.clip_ymin;
 
79
               }
 
80
            if (sp_globals.specs.flags & CLIP_BOTTOM)
 
81
               {
 
82
               sp_globals.clip_ymax = (fix31)((fix31)(-1 * EM_BOT) * sp_globals.tcb0.yppo + ((1<<sp_globals.multshift)/2));
 
83
               sp_globals.clip_ymax = sp_globals.clip_ymax >> sp_globals.multshift;
 
84
               if (sp_globals.ymax > sp_globals.clip_ymax)
 
85
                    sp_globals.ymax = sp_globals.clip_ymax;
 
86
               }
 
87
               break;
 
88
       case 2: /* 90 degree rotation */
 
89
            sp_globals.clip_ymax = 0;
 
90
            if ((sp_globals.specs.flags & CLIP_TOP) &&
 
91
                (sp_globals.ymax > sp_globals.clip_ymax))
 
92
                 sp_globals.ymax = sp_globals.clip_ymax;
 
93
            sp_globals.clip_ymin = ((sp_globals.set_width.y+32768L) >> 16);
 
94
            if ((sp_globals.specs.flags & CLIP_BOTTOM) &&
 
95
                (sp_globals.ymin < sp_globals.clip_ymin))
 
96
                 sp_globals.ymin = sp_globals.clip_ymin;
 
97
            break;
 
98
       case 3: /* 270 degree rotation */
 
99
               sp_globals.clip_ymax = ((sp_globals.set_width.y+32768L) >> 16);
 
100
               if ((sp_globals.specs.flags & CLIP_TOP) &&
 
101
                   (sp_globals.ymax > sp_globals.clip_ymax))
 
102
                    sp_globals.ymax = sp_globals.clip_ymax;
 
103
               sp_globals.clip_ymin = 0;
 
104
               if ((sp_globals.specs.flags & CLIP_BOTTOM) &&
 
105
                   (sp_globals.ymin < sp_globals.clip_ymin))
 
106
                    sp_globals.ymin = sp_globals.clip_ymin;
 
107
               break;
 
108
       default: /* this is for zero degree rotation and arbitrary rotation */
 
109
            if (sp_globals.specs.flags & CLIP_TOP)
 
110
               {
 
111
               sp_globals.clip_ymax = (fix31)((fix31)EM_TOP * sp_globals.tcb0.yppo +  ((1<<sp_globals.multshift)/2));
 
112
               sp_globals.clip_ymax = sp_globals.clip_ymax >> sp_globals.multshift;
 
113
               if (sp_globals.ymax > sp_globals.clip_ymax)
 
114
                    sp_globals.ymax = sp_globals.clip_ymax;
 
115
               }
 
116
            if (sp_globals.specs.flags & CLIP_BOTTOM)
 
117
               {
 
118
               sp_globals.clip_ymin = (fix31)((fix31)(-1 * EM_BOT) * sp_globals.tcb0.yppo +  ((1<<sp_globals.multshift)/2));
 
119
               sp_globals.clip_ymin = sp_globals.clip_ymin >> sp_globals.multshift;
 
120
               sp_globals.clip_ymin = - sp_globals.clip_ymin;
 
121
               if (sp_globals.ymin < sp_globals.clip_ymin)
 
122
                    sp_globals.ymin = sp_globals.clip_ymin;
 
123
               }
 
124
               break;
 
125
       }
 
126
#endif
 
127
sp_globals.y_band.band_min = sp_globals.ymin;
 
128
sp_globals.y_band.band_max = sp_globals.ymax - 1; 
 
129
 
 
130
sp_globals.xmin = (Pmin.x + sp_globals.pixrnd) >> sp_globals.pixshift;
 
131
sp_globals.xmax = (Pmax.x + sp_globals.pixrnd) >> sp_globals.pixshift;
 
132
 
 
133
 
 
134
#if INCL_2D
 
135
sp_globals.x_band.band_min = sp_globals.xmin - 1; /* subtract one pixel of "safety margin" */
 
136
sp_globals.x_band.band_max = sp_globals.xmax /* - 1 + 1 */; /* Add one pixel of "safety margin" */
 
137
#endif
 
138
}
 
139
 
44
140
FUNCTION  void init_char_out(
45
141
GDECL
46
142
point_t Psw, point_t Pmin, point_t Pmax)
203
299
}
204
300
 
205
301
 
206
 
FUNCTION void restart_intercepts_out()
207
 
GDECL
208
 
 
209
 
/*  Called by sp_make_char when a new sub character is started
210
 
 *  Freezes current sorted lists
211
 
 */
212
 
 
213
 
{
214
 
 
215
 
#if DEBUG
216
 
printf("    Restart intercepts:\n");
217
 
#endif
218
 
sp_globals.first_offset = sp_globals.next_offset;
219
 
}
220
302
 
221
303
 
222
304
 
223
 
FUNCTION void set_first_band_out(
224
 
GDECL
225
 
point_t Pmin,
226
 
point_t Pmax)
227
 
{
228
 
 
229
 
sp_globals.ymin = Pmin.y;
230
 
sp_globals.ymax = Pmax.y;
231
 
 
232
 
sp_globals.ymin = (sp_globals.ymin - sp_globals.onepix + 1) >> sp_globals.pixshift;
233
 
sp_globals.ymax = (sp_globals.ymax + sp_globals.onepix - 1) >> sp_globals.pixshift;
234
 
 
235
 
#if INCL_CLIPPING
236
 
    switch(sp_globals.tcb0.xtype)
237
 
       {
238
 
       case 1: /* 180 degree rotation */
239
 
            if (sp_globals.specs.flags & CLIP_TOP)
240
 
               {
241
 
               sp_globals.clip_ymin = (fix31)((fix31)EM_TOP * sp_globals.tcb0.yppo + ((1<<sp_globals.multshift)/2));
242
 
               sp_globals.clip_ymin = sp_globals.clip_ymin >> sp_globals.multshift;
243
 
               sp_globals.clip_ymin = -1* sp_globals.clip_ymin;
244
 
               if (sp_globals.ymin < sp_globals.clip_ymin)
245
 
                    sp_globals.ymin = sp_globals.clip_ymin;
246
 
               }
247
 
            if (sp_globals.specs.flags & CLIP_BOTTOM)
248
 
               {
249
 
               sp_globals.clip_ymax = (fix31)((fix31)(-1 * EM_BOT) * sp_globals.tcb0.yppo + ((1<<sp_globals.multshift)/2));
250
 
               sp_globals.clip_ymax = sp_globals.clip_ymax >> sp_globals.multshift;
251
 
               if (sp_globals.ymax > sp_globals.clip_ymax)
252
 
                    sp_globals.ymax = sp_globals.clip_ymax;
253
 
               }
254
 
               break;
255
 
       case 2: /* 90 degree rotation */
256
 
            sp_globals.clip_ymax = 0;
257
 
            if ((sp_globals.specs.flags & CLIP_TOP) &&
258
 
                (sp_globals.ymax > sp_globals.clip_ymax))
259
 
                 sp_globals.ymax = sp_globals.clip_ymax;
260
 
            sp_globals.clip_ymin = ((sp_globals.set_width.y+32768L) >> 16);
261
 
            if ((sp_globals.specs.flags & CLIP_BOTTOM) &&
262
 
                (sp_globals.ymin < sp_globals.clip_ymin))
263
 
                 sp_globals.ymin = sp_globals.clip_ymin;
264
 
            break;
265
 
       case 3: /* 270 degree rotation */
266
 
               sp_globals.clip_ymax = ((sp_globals.set_width.y+32768L) >> 16);
267
 
               if ((sp_globals.specs.flags & CLIP_TOP) &&
268
 
                   (sp_globals.ymax > sp_globals.clip_ymax))
269
 
                    sp_globals.ymax = sp_globals.clip_ymax;
270
 
               sp_globals.clip_ymin = 0;
271
 
               if ((sp_globals.specs.flags & CLIP_BOTTOM) &&
272
 
                   (sp_globals.ymin < sp_globals.clip_ymin))
273
 
                    sp_globals.ymin = sp_globals.clip_ymin;
274
 
               break;
275
 
       default: /* this is for zero degree rotation and arbitrary rotation */
276
 
            if (sp_globals.specs.flags & CLIP_TOP)
277
 
               {
278
 
               sp_globals.clip_ymax = (fix31)((fix31)EM_TOP * sp_globals.tcb0.yppo +  ((1<<sp_globals.multshift)/2));
279
 
               sp_globals.clip_ymax = sp_globals.clip_ymax >> sp_globals.multshift;
280
 
               if (sp_globals.ymax > sp_globals.clip_ymax)
281
 
                    sp_globals.ymax = sp_globals.clip_ymax;
282
 
               }
283
 
            if (sp_globals.specs.flags & CLIP_BOTTOM)
284
 
               {
285
 
               sp_globals.clip_ymin = (fix31)((fix31)(-1 * EM_BOT) * sp_globals.tcb0.yppo +  ((1<<sp_globals.multshift)/2));
286
 
               sp_globals.clip_ymin = sp_globals.clip_ymin >> sp_globals.multshift;
287
 
               sp_globals.clip_ymin = - sp_globals.clip_ymin;
288
 
               if (sp_globals.ymin < sp_globals.clip_ymin)
289
 
                    sp_globals.ymin = sp_globals.clip_ymin;
290
 
               }
291
 
               break;
292
 
       }
293
 
#endif
294
 
sp_globals.y_band.band_min = sp_globals.ymin;
295
 
sp_globals.y_band.band_max = sp_globals.ymax - 1; 
296
 
 
297
 
sp_globals.xmin = (Pmin.x + sp_globals.pixrnd) >> sp_globals.pixshift;
298
 
sp_globals.xmax = (Pmax.x + sp_globals.pixrnd) >> sp_globals.pixshift;
299
 
 
300
 
 
301
 
#if INCL_2D
302
 
sp_globals.x_band.band_min = sp_globals.xmin - 1; /* subtract one pixel of "safety margin" */
303
 
sp_globals.x_band.band_max = sp_globals.xmax /* - 1 + 1 */; /* Add one pixel of "safety margin" */
304
 
#endif
305
 
}
306
 
 
307
305
 
308
306
 
309
307