~ubuntu-branches/ubuntu/oneiric/ghostscript/oneiric

« back to all changes in this revision

Viewing changes to base/gxdtfill.h

  • Committer: Bazaar Package Importer
  • Author(s): Till Kamppeter
  • Date: 2011-07-15 16:49:55 UTC
  • mfrom: (1.1.23 upstream)
  • Revision ID: james.westby@ubuntu.com-20110715164955-uga6qibao6kez05c
Tags: 9.04~dfsg~20110715-0ubuntu1
* New upstream release
   - GIT snapshot from Jult, 12 2011.
* debian/patches/020110406~a54df2d.patch,
  debian/patches/020110408~0791cc8.patch,
  debian/patches/020110408~507cbee.patch,
  debian/patches/020110411~4509a49.patch,
  debian/patches/020110412~78bb9a6.patch,
  debian/patches/020110418~a05ab8a.patch,
  debian/patches/020110420~20b6c78.patch,
  debian/patches/020110420~4ddefa2.patch: Removed upstream patches.
* debian/rules: Generate ABI version number (variable "abi") correctly,
  cutting off repackaging and pre-release parts.
* debian/rules: Added ./lcms2/ directory to DEB_UPSTREAM_REPACKAGE_EXCLUDES.
* debian/copyright: Added lcms2/* to the list of excluded files.
* debian/symbols.common: Updated for new upstream source. Applied patch
  which dpkg-gensymbols generated for debian/libgs9.symbols to this file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/* Copyright (C) 2001-2006 Artifex Software, Inc.
2
2
   All Rights Reserved.
3
 
  
 
3
 
4
4
   This software is provided AS-IS with no warranty, either express or
5
5
   implied.
6
6
 
11
11
   San Rafael, CA  94903, U.S.A., +1(415)492-9861, for further information.
12
12
*/
13
13
 
14
 
/* $Id: gxdtfill.h 8022 2007-06-05 22:23:38Z giles $ */
 
14
/* $Id$ */
15
15
/* Configurable algorithm for filling a trapezoid */
16
16
 
17
17
/*
18
18
 * Since we need several statically defined variants of this agorithm,
19
 
 * we store it in .h file and include several times into gdevddrw.c and 
 
19
 * we store it in .h file and include several times into gdevddrw.c and
20
20
 * into gxfill.h . Configuration flags (macros) are :
21
 
 * 
 
21
 *
22
22
 *   GX_FILL_TRAPEZOID - a name of method
23
23
 *   CONTIGUOUS_FILL   - prevent dropouts in narrow trapezoids
24
24
 *   SWAP_AXES         - assume swapped axes
25
25
 *   FILL_DIRECT       - See LOOP_FILL_RECTANGLE_DIRECT.
26
26
 *   LINEAR_COLOR      - Fill with a linear color.
27
27
 *   EDGE_TYPE         - a type of edge structure.
28
 
 *   FILL_ATTRS        - operation attributes. 
 
28
 *   FILL_ATTRS        - operation attributes.
29
29
 */
30
30
 
31
31
/*
37
37
 */
38
38
 
39
39
/*
40
 
 * With CONTIGUOUS_FILL is off, 
 
40
 * With CONTIGUOUS_FILL is off,
41
41
 * this algorithm paints pixels, which centers fall between
42
 
 * the left and the right side of the trapezoid, excluding the 
43
 
 * right side (see PLRM3, 7.5. Scan conversion details). 
 
42
 * the left and the right side of the trapezoid, excluding the
 
43
 * right side (see PLRM3, 7.5. Scan conversion details).
44
44
 * Particularly 0-width trapezoids are not painted.
45
45
 *
46
46
 * Similarly, it paints pixels, which centers
52
52
 * Particularly it may paint pixels on the right and on the top sides,
53
53
 * if they are necessary for the contiguity.
54
54
 *
55
 
 * With LINEAR_COLOR returns 1 if the gradient arithmetics overflows.. 
 
55
 * With LINEAR_COLOR returns 1 if the gradient arithmetics overflows..
56
56
 */
57
57
 
58
58
/*
81
81
 
82
82
Where 'e' is 'fixed_epsilon', 0.5 is 'fixed_half', and fl == l.fx / l.h, fr == - r.fx / r.h,
83
83
e <= fl < 0, e <= fr < 0.
84
 
Let 
 
84
Let
85
85
 
86
86
    xl' := xl + 0.5
87
87
    xr' := xr + 0.5
88
88
 
89
 
Then 
 
89
Then
90
90
 
91
91
    xl = xl' - 0.5
92
92
    xr = xr' - 0.5
95
95
    Xr = xr' - 0.5 + e - fr
96
96
 
97
97
    ceil(xl' - 0.5 + e - fl - 0.5) <= i < ceil(xr' - 0.5 + e - fr - 0.5)
98
 
    
 
98
 
99
99
which is equivalent to
100
100
 
101
101
    ceil(xl' + e - fl) - 1 <= i < ceil(xr' + e - fr) - 1
135
135
    const fixed ymax = fixed_pixround(ytop);
136
136
 
137
137
    if (ymin >= ymax)
138
 
        return 0;               /* no scan lines to sample */
 
138
        return 0;               /* no scan lines to sample */
139
139
    {
140
 
        int iy = fixed2int_var(ymin);
141
 
        const int iy1 = fixed2int_var(ymax);
142
 
        trap_line l, r;
143
 
        register int rxl, rxr;
144
 
        int ry;
145
 
        const fixed
146
 
            x0l = left->start.x, x1l = left->end.x, x0r = right->start.x,
147
 
            x1r = right->end.x, dxl = x1l - x0l, dxr = x1r - x0r;
148
 
        const fixed     /* partial pixel offset to first line to sample */
149
 
            ysl = ymin - left->start.y, ysr = ymin - right->start.y;
150
 
        fixed fxl;
151
 
        int code;
 
140
        int iy = fixed2int_var(ymin);
 
141
        const int iy1 = fixed2int_var(ymax);
 
142
        trap_line l, r;
 
143
        register int rxl, rxr;
 
144
        int ry;
 
145
        const fixed
 
146
            x0l = left->start.x, x1l = left->end.x, x0r = right->start.x,
 
147
            x1r = right->end.x, dxl = x1l - x0l, dxr = x1r - x0r;
 
148
        const fixed     /* partial pixel offset to first line to sample */
 
149
            ysl = ymin - left->start.y, ysr = ymin - right->start.y;
 
150
        fixed fxl;
 
151
        int code;
152
152
#       if CONTIGUOUS_FILL
153
 
            const bool peak0 = ((flags & 1) != 0);
154
 
            const bool peak1 = ((flags & 2) != 0);
155
 
            int peak_y0 = ybot + fixed_half;
156
 
            int peak_y1 = ytop - fixed_half;
 
153
            const bool peak0 = ((flags & 1) != 0);
 
154
            const bool peak1 = ((flags & 2) != 0);
 
155
            int peak_y0 = ybot + fixed_half;
 
156
            int peak_y1 = ytop - fixed_half;
157
157
#       endif
158
158
#       if LINEAR_COLOR
159
 
            int num_components = dev->color_info.num_components;
160
 
            frac31 lgc[GX_DEVICE_COLOR_MAX_COMPONENTS];
161
 
            int32_t lgf[GX_DEVICE_COLOR_MAX_COMPONENTS];
162
 
            int32_t lgnum[GX_DEVICE_COLOR_MAX_COMPONENTS];
163
 
            frac31 rgc[GX_DEVICE_COLOR_MAX_COMPONENTS];
164
 
            int32_t rgf[GX_DEVICE_COLOR_MAX_COMPONENTS];
165
 
            int32_t rgnum[GX_DEVICE_COLOR_MAX_COMPONENTS];
166
 
            frac31 xgc[GX_DEVICE_COLOR_MAX_COMPONENTS];
167
 
            int32_t xgf[GX_DEVICE_COLOR_MAX_COMPONENTS];
168
 
            int32_t xgnum[GX_DEVICE_COLOR_MAX_COMPONENTS];
169
 
            trap_gradient lg, rg, xg;
 
159
            int num_components = dev->color_info.num_components;
 
160
            frac31 lgc[GX_DEVICE_COLOR_MAX_COMPONENTS];
 
161
            int32_t lgf[GX_DEVICE_COLOR_MAX_COMPONENTS];
 
162
            int32_t lgnum[GX_DEVICE_COLOR_MAX_COMPONENTS];
 
163
            frac31 rgc[GX_DEVICE_COLOR_MAX_COMPONENTS];
 
164
            int32_t rgf[GX_DEVICE_COLOR_MAX_COMPONENTS];
 
165
            int32_t rgnum[GX_DEVICE_COLOR_MAX_COMPONENTS];
 
166
            frac31 xgc[GX_DEVICE_COLOR_MAX_COMPONENTS];
 
167
            int32_t xgf[GX_DEVICE_COLOR_MAX_COMPONENTS];
 
168
            int32_t xgnum[GX_DEVICE_COLOR_MAX_COMPONENTS];
 
169
            trap_gradient lg, rg, xg;
170
170
#       else
171
 
            gx_color_index cindex = pdevc->colors.pure;
172
 
            dev_proc_fill_rectangle((*fill_rect)) =
173
 
                dev_proc(dev, fill_rectangle);
 
171
            gx_color_index cindex = pdevc->colors.pure;
 
172
            dev_proc_fill_rectangle((*fill_rect)) =
 
173
                dev_proc(dev, fill_rectangle);
174
174
#       endif
175
175
 
176
 
        if_debug2('z', "[z]y=[%d,%d]\n", iy, iy1);
 
176
        if_debug2('z', "[z]y=[%d,%d]\n", iy, iy1);
177
177
 
178
 
        l.h = left->end.y - left->start.y;
179
 
        r.h = right->end.y - right->start.y;
180
 
        l.x = x0l + (fixed_half - fixed_epsilon);
181
 
        r.x = x0r + (fixed_half - fixed_epsilon);
182
 
        ry = iy;
 
178
        l.h = left->end.y - left->start.y;
 
179
        r.h = right->end.y - right->start.y;
 
180
        l.x = x0l + (fixed_half - fixed_epsilon);
 
181
        r.x = x0r + (fixed_half - fixed_epsilon);
 
182
        ry = iy;
183
183
 
184
184
/*
185
185
 * Free variables of FILL_TRAP_RECT:
196
196
 
197
197
#if LINEAR_COLOR
198
198
#   define FILL_TRAP_RECT(x,y,w,h)\
199
 
        (!(w) ? 0 : dev_proc(dev, fill_linear_color_scanline)(dev, fa, x, y, w, xg.c, xg.f, xg.num, xg.den))
 
199
        (!(w) ? 0 : dev_proc(dev, fill_linear_color_scanline)(dev, fa, x, y, w, xg.c, xg.f, xg.num, xg.den))
200
200
#else
201
201
#   define FILL_TRAP_RECT(x,y,w,h)\
202
 
        (FILL_DIRECT ? FILL_TRAP_RECT_DIRECT(x,y,w,h) : FILL_TRAP_RECT_INDIRECT(x,y,w,h))
 
202
        (FILL_DIRECT ? FILL_TRAP_RECT_DIRECT(x,y,w,h) : FILL_TRAP_RECT_INDIRECT(x,y,w,h))
203
203
#endif
204
204
 
205
205
#define VD_RECT_SWAPPED(rxl, ry, rxr, iy)\
206
206
    vd_rect(int2fixed(SWAP_AXES ? ry : rxl), int2fixed(SWAP_AXES ? rxl : ry),\
207
207
            int2fixed(SWAP_AXES ? iy : rxr), int2fixed(SWAP_AXES ? rxr : iy),\
208
 
            1, VD_RECT_COLOR);
209
 
 
210
 
        /* Compute the dx/dy ratios. */
211
 
 
212
 
        /*
213
 
         * Compute the x offsets at the first scan line to sample.  We need
214
 
         * to be careful in computing ys# * dx#f {/,%} h# because the
215
 
         * multiplication may overflow.  We know that all the quantities
216
 
         * involved are non-negative, and that ys# is usually less than 1 (as
217
 
         * a fixed, of course); this gives us a cheap conservative check for
218
 
         * overflow in the multiplication.
219
 
         */
 
208
            1, VD_RECT_COLOR);
 
209
 
 
210
        /* Compute the dx/dy ratios. */
 
211
 
 
212
        /*
 
213
         * Compute the x offsets at the first scan line to sample.  We need
 
214
         * to be careful in computing ys# * dx#f {/,%} h# because the
 
215
         * multiplication may overflow.  We know that all the quantities
 
216
         * involved are non-negative, and that ys# is usually less than 1 (as
 
217
         * a fixed, of course); this gives us a cheap conservative check for
 
218
         * overflow in the multiplication.
 
219
         */
220
220
#define YMULT_QUO(ys, tl)\
221
221
  (ys < fixed_1 && tl.df < YMULT_LIMIT ? ys * tl.df / tl.h :\
222
222
   fixed_mult_quo(ys, tl.df, tl.h))
231
231
 */
232
232
#define SET_MINIMAL_WIDTH(ixl, ixr, l, r) \
233
233
    if (ixl == ixr) \
234
 
        if ((!peak0 || iy >= peak_y0) && (!peak1 || iy <= peak_y1)) {\
235
 
            fixed x = int2fixed(ixl) + fixed_half;\
236
 
            if (x - l.x < r.x - x)\
237
 
                ++ixr;\
238
 
            else\
239
 
                --ixl;\
240
 
        }
 
234
        if ((!peak0 || iy >= peak_y0) && (!peak1 || iy <= peak_y1)) {\
 
235
            fixed x = int2fixed(ixl) + fixed_half;\
 
236
            if (x - l.x < r.x - x)\
 
237
                ++ixr;\
 
238
            else\
 
239
                --ixl;\
 
240
        }
241
241
 
242
242
#define CONNECT_RECTANGLES(ixl, ixr, rxl, rxr, iy, ry, adj1, adj2, fill)\
243
243
    if (adj1 < adj2) {\
244
 
        if (iy - ry > 1) {\
245
 
            VD_RECT_SWAPPED(rxl, ry, rxr, iy - 1);\
246
 
            code = fill(rxl, ry, rxr - rxl, iy - ry - 1);\
247
 
            if (code < 0)\
248
 
                goto xit;\
249
 
            ry = iy - 1;\
250
 
        }\
251
 
        adj1 = adj2 = (adj2 + adj2) / 2;\
 
244
        if (iy - ry > 1) {\
 
245
            VD_RECT_SWAPPED(rxl, ry, rxr, iy - 1);\
 
246
            code = fill(rxl, ry, rxr - rxl, iy - ry - 1);\
 
247
            if (code < 0)\
 
248
                goto xit;\
 
249
            ry = iy - 1;\
 
250
        }\
 
251
        adj1 = adj2 = (adj2 + adj2) / 2;\
252
252
    }
253
253
 
254
254
#else
255
255
#define SET_MINIMAL_WIDTH(ixl, ixr, l, r) DO_NOTHING
256
256
#define CONNECT_RECTANGLES(ixl, ixr, rxl, rxr, iy, ry, adj1, adj2, fill) DO_NOTHING
257
257
#endif
258
 
        if (fixed_floor(l.x) == fixed_pixround(x1l)) {
259
 
            /* Left edge is vertical, we don't need to increment. */
260
 
            l.di = 0, l.df = 0;
261
 
            fxl = 0;
262
 
        } else {
263
 
            compute_dx(&l, dxl, ysl);
264
 
            fxl = YMULT_QUO(ysl, l);
265
 
            l.x += fxl;
266
 
        }
267
 
        if (fixed_floor(r.x) == fixed_pixround(x1r)) {
268
 
            /* Right edge is vertical.  If both are vertical, */
269
 
            /* we have a rectangle. */
 
258
        if (fixed_floor(l.x) == fixed_pixround(x1l)) {
 
259
            /* Left edge is vertical, we don't need to increment. */
 
260
            l.di = 0, l.df = 0;
 
261
            fxl = 0;
 
262
        } else {
 
263
            compute_dx(&l, dxl, ysl);
 
264
            fxl = YMULT_QUO(ysl, l);
 
265
            l.x += fxl;
 
266
        }
 
267
        if (fixed_floor(r.x) == fixed_pixround(x1r)) {
 
268
            /* Right edge is vertical.  If both are vertical, */
 
269
            /* we have a rectangle. */
270
270
#           if !LINEAR_COLOR
271
 
                if (l.di == 0 && l.df == 0) {
272
 
                    rxl = fixed2int_var(l.x);
273
 
                    rxr = fixed2int_var(r.x);
274
 
                    SET_MINIMAL_WIDTH(rxl, rxr, l, r);
275
 
                    VD_RECT_SWAPPED(rxl, ry, rxr, iy1);
276
 
                    code = FILL_TRAP_RECT(rxl, ry, rxr - rxl, iy1 - ry);
277
 
                    goto xit;
278
 
                }
 
271
                if (l.di == 0 && l.df == 0) {
 
272
                    rxl = fixed2int_var(l.x);
 
273
                    rxr = fixed2int_var(r.x);
 
274
                    SET_MINIMAL_WIDTH(rxl, rxr, l, r);
 
275
                    VD_RECT_SWAPPED(rxl, ry, rxr, iy1);
 
276
                    code = FILL_TRAP_RECT(rxl, ry, rxr - rxl, iy1 - ry);
 
277
                    goto xit;
 
278
                }
279
279
#           endif
280
 
            r.di = 0, r.df = 0;
281
 
        }
282
 
        /*
283
 
         * The test for fxl != 0 is required because the right edge might
284
 
         * cross some pixel centers even if the left edge doesn't.
285
 
         */
286
 
        else if (dxr == dxl && fxl != 0) {
287
 
            if (l.di == 0)
288
 
                r.di = 0, r.df = l.df;
289
 
            else
290
 
                compute_dx(&r, dxr, ysr);
291
 
            if (ysr == ysl && r.h == l.h)
292
 
                r.x += fxl;
293
 
            else
294
 
                r.x += YMULT_QUO(ysr, r);
295
 
        } else {
296
 
            compute_dx(&r, dxr, ysr);
297
 
            r.x += YMULT_QUO(ysr, r);
298
 
        }
299
 
        /* Compute one line's worth of dx/dy. */
300
 
        compute_ldx(&l, ysl);
301
 
        compute_ldx(&r, ysr);
302
 
        /* We subtracted fixed_epsilon from l.x, r.x to simplify rounding
303
 
           when the rational part is zero. Now add it back to get xl', xr' */
304
 
        l.x += fixed_epsilon;
305
 
        r.x += fixed_epsilon;
 
280
            r.di = 0, r.df = 0;
 
281
        }
 
282
        /*
 
283
         * The test for fxl != 0 is required because the right edge might
 
284
         * cross some pixel centers even if the left edge doesn't.
 
285
         */
 
286
        else if (dxr == dxl && fxl != 0) {
 
287
            if (l.di == 0)
 
288
                r.di = 0, r.df = l.df;
 
289
            else
 
290
                compute_dx(&r, dxr, ysr);
 
291
            if (ysr == ysl && r.h == l.h)
 
292
                r.x += fxl;
 
293
            else
 
294
                r.x += YMULT_QUO(ysr, r);
 
295
        } else {
 
296
            compute_dx(&r, dxr, ysr);
 
297
            r.x += YMULT_QUO(ysr, r);
 
298
        }
 
299
        /* Compute one line's worth of dx/dy. */
 
300
        compute_ldx(&l, ysl);
 
301
        compute_ldx(&r, ysr);
 
302
        /* We subtracted fixed_epsilon from l.x, r.x to simplify rounding
 
303
           when the rational part is zero. Now add it back to get xl', xr' */
 
304
        l.x += fixed_epsilon;
 
305
        r.x += fixed_epsilon;
306
306
#       if LINEAR_COLOR
307
307
#           ifdef DEBUG
308
 
                if (check_gradient_overflow(left, right, num_components)) {
309
 
                    /* The caller must care of. 
310
 
                       Checking it here looses some performance with triangles. */
311
 
                    return_error(gs_error_unregistered);
312
 
                }
 
308
                if (check_gradient_overflow(left, right, num_components)) {
 
309
                    /* The caller must care of.
 
310
                       Checking it here looses some performance with triangles. */
 
311
                    return_error(gs_error_unregistered);
 
312
                }
313
313
#           endif
314
 
            lg.c = lgc;
315
 
            lg.f = lgf;
316
 
            lg.num = lgnum;
317
 
            rg.c = rgc;
318
 
            rg.f = rgf;
319
 
            rg.num = rgnum;
320
 
            xg.c = xgc;
321
 
            xg.f = xgf;
322
 
            xg.num = xgnum;
323
 
            code = init_gradient(&lg, fa, left, right, &l, ymin, num_components);
324
 
            if (code < 0)
325
 
                return code;
326
 
            code = init_gradient(&rg, fa, right, left, &r, ymin, num_components);
327
 
            if (code < 0)
328
 
                return code;
 
314
            lg.c = lgc;
 
315
            lg.f = lgf;
 
316
            lg.num = lgnum;
 
317
            rg.c = rgc;
 
318
            rg.f = rgf;
 
319
            rg.num = rgnum;
 
320
            xg.c = xgc;
 
321
            xg.f = xgf;
 
322
            xg.num = xgnum;
 
323
            code = init_gradient(&lg, fa, left, right, &l, ymin, num_components);
 
324
            if (code < 0)
 
325
                return code;
 
326
            code = init_gradient(&rg, fa, right, left, &r, ymin, num_components);
 
327
            if (code < 0)
 
328
                return code;
329
329
 
330
330
#       endif
331
331
 
336
336
  if ( (tl.xf += tl.ldf) >= 0 ) tl.xf -= tl.h, tl.x++;\
337
337
  ix = rational_floor(tl)
338
338
 
339
 
        rxl = rational_floor(l);
340
 
        rxr = rational_floor(r);
341
 
        SET_MINIMAL_WIDTH(rxl, rxr, l, r);
342
 
        while (LINEAR_COLOR ? 1 : ++iy != iy1) {
 
339
        rxl = rational_floor(l);
 
340
        rxr = rational_floor(r);
 
341
        SET_MINIMAL_WIDTH(rxl, rxr, l, r);
 
342
        while (LINEAR_COLOR ? 1 : ++iy != iy1) {
343
343
#           if LINEAR_COLOR
344
 
                if (rxl != rxr) {
345
 
                    code = set_x_gradient(&xg, &lg, &rg, &l, &r, rxl, rxr, num_components);
346
 
                    if (code < 0)
347
 
                        goto xit;
348
 
                    /*VD_RECT_SWAPPED(rxl, iy, rxr, iy + 1);*/
349
 
                    code = FILL_TRAP_RECT(rxl, iy, rxr - rxl, 1);
350
 
                    if (code < 0)
351
 
                        goto xit;
352
 
                }
353
 
                if (++iy == iy1)
354
 
                    break;
355
 
                STEP_LINE(rxl, l);
356
 
                STEP_LINE(rxr, r);
357
 
                step_gradient(&lg, num_components);
358
 
                step_gradient(&rg, num_components);
 
344
                if (rxl != rxr) {
 
345
                    code = set_x_gradient(&xg, &lg, &rg, &l, &r, rxl, rxr, num_components);
 
346
                    if (code < 0)
 
347
                        goto xit;
 
348
                    /*VD_RECT_SWAPPED(rxl, iy, rxr, iy + 1);*/
 
349
                    code = FILL_TRAP_RECT(rxl, iy, rxr - rxl, 1);
 
350
                    if (code < 0)
 
351
                        goto xit;
 
352
                }
 
353
                if (++iy == iy1)
 
354
                    break;
 
355
                STEP_LINE(rxl, l);
 
356
                STEP_LINE(rxr, r);
 
357
                step_gradient(&lg, num_components);
 
358
                step_gradient(&rg, num_components);
359
359
#           else
360
 
                register int ixl, ixr;
 
360
                register int ixl, ixr;
361
361
 
362
 
                STEP_LINE(ixl, l);
363
 
                STEP_LINE(ixr, r);
364
 
                SET_MINIMAL_WIDTH(ixl, ixr, l, r);
365
 
                if (ixl != rxl || ixr != rxr) {
366
 
                    CONNECT_RECTANGLES(ixl, ixr, rxl, rxr, iy, ry, rxr, ixl, FILL_TRAP_RECT);
367
 
                    CONNECT_RECTANGLES(ixl, ixr, rxl, rxr, iy, ry, ixr, rxl, FILL_TRAP_RECT);
368
 
                    VD_RECT_SWAPPED(rxl, ry, rxr, iy);
369
 
                    code = FILL_TRAP_RECT(rxl, ry, rxr - rxl, iy - ry);
370
 
                    if (code < 0)
371
 
                        goto xit;
372
 
                    rxl = ixl, rxr = ixr, ry = iy;
373
 
                }
 
362
                STEP_LINE(ixl, l);
 
363
                STEP_LINE(ixr, r);
 
364
                SET_MINIMAL_WIDTH(ixl, ixr, l, r);
 
365
                if (ixl != rxl || ixr != rxr) {
 
366
                    CONNECT_RECTANGLES(ixl, ixr, rxl, rxr, iy, ry, rxr, ixl, FILL_TRAP_RECT);
 
367
                    CONNECT_RECTANGLES(ixl, ixr, rxl, rxr, iy, ry, ixr, rxl, FILL_TRAP_RECT);
 
368
                    VD_RECT_SWAPPED(rxl, ry, rxr, iy);
 
369
                    code = FILL_TRAP_RECT(rxl, ry, rxr - rxl, iy - ry);
 
370
                    if (code < 0)
 
371
                        goto xit;
 
372
                    rxl = ixl, rxr = ixr, ry = iy;
 
373
                }
374
374
#           endif
375
 
        }
 
375
        }
376
376
#       if !LINEAR_COLOR
377
 
            VD_RECT_SWAPPED(rxl, ry, rxr, iy);
378
 
            code = FILL_TRAP_RECT(rxl, ry, rxr - rxl, iy - ry);
 
377
            VD_RECT_SWAPPED(rxl, ry, rxr, iy);
 
378
            code = FILL_TRAP_RECT(rxl, ry, rxr - rxl, iy - ry);
379
379
#       else
380
 
            code = 0;
 
380
            code = 0;
381
381
#       endif
382
382
#undef STEP_LINE
383
383
#undef SET_MINIMAL_WIDTH
388
388
#undef YMULT_QUO
389
389
#undef VD_RECT_SWAPPED
390
390
xit:    if (code < 0 && FILL_DIRECT)
391
 
            return_error(code);
392
 
        return_if_interrupt(dev->memory);
393
 
        return code;
 
391
            return_error(code);
 
392
        return_if_interrupt(dev->memory);
 
393
        return code;
394
394
    }
395
395
}
396
396