396 | 9.49M | } Unexecuted instantiation: gx_fill_trapezoid_cf_fd Unexecuted instantiation: gx_fill_trapezoid_cf_nd gdevddrw.c:gx_fill_trapezoid_as_fd Line | Count | Source | 137 | 105k | { | 138 | 105k | const fixed ymin = fixed_pixround(ybot) + fixed_half; | 139 | 105k | const fixed ymax = fixed_pixround(ytop); | 140 | | | 141 | 105k | if (ymin >= ymax) | 142 | 8.61k | return 0; /* no scan lines to sample */ | 143 | 96.9k | { | 144 | 96.9k | int iy = fixed2int_var(ymin); | 145 | 96.9k | const int iy1 = fixed2int_var(ymax); | 146 | 96.9k | trap_line l, r; | 147 | 96.9k | register int rxl, rxr; | 148 | 96.9k | #if !LINEAR_COLOR | 149 | 96.9k | int ry; | 150 | 96.9k | #endif | 151 | 96.9k | const fixed | 152 | 96.9k | x0l = left->start.x, x1l = left->end.x, x0r = right->start.x, | 153 | 96.9k | x1r = right->end.x, dxl = x1l - x0l, dxr = x1r - x0r; | 154 | 96.9k | const fixed /* partial pixel offset to first line to sample */ | 155 | 96.9k | ysl = ymin - left->start.y, ysr = ymin - right->start.y; | 156 | 96.9k | fixed fxl; | 157 | 96.9k | int code; | 158 | | # if CONTIGUOUS_FILL | 159 | | const bool peak0 = ((flags & 1) != 0); | 160 | | const bool peak1 = ((flags & 2) != 0); | 161 | | int peak_y0 = ybot + fixed_half; | 162 | | int peak_y1 = ytop - fixed_half; | 163 | | # endif | 164 | | # if LINEAR_COLOR | 165 | | int num_components = dev->color_info.num_components; | 166 | | frac31 lgc[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 167 | | int32_t lgf[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 168 | | int32_t lgnum[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 169 | | frac31 rgc[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 170 | | int32_t rgf[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 171 | | int32_t rgnum[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 172 | | frac31 xgc[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 173 | | int32_t xgf[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 174 | | int32_t xgnum[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 175 | | trap_gradient lg, rg, xg; | 176 | | # else | 177 | 96.9k | gx_color_index cindex = pdevc->colors.pure; | 178 | 96.9k | dev_proc_fill_rectangle((*fill_rect)) = | 179 | 96.9k | dev_proc(dev, fill_rectangle); | 180 | 96.9k | # endif | 181 | | | 182 | 96.9k | if_debug2m('z', dev->memory, "[z]y=[%d,%d]\n", iy, iy1); | 183 | | | 184 | 96.9k | l.h = left->end.y - left->start.y; | 185 | 96.9k | if (l.h == 0) | 186 | 0 | return 0; | 187 | 96.9k | r.h = right->end.y - right->start.y; | 188 | 96.9k | if (r.h == 0) | 189 | 0 | return 0; | 190 | 96.9k | l.x = x0l + (fixed_half - fixed_epsilon); | 191 | 96.9k | r.x = x0r + (fixed_half - fixed_epsilon); | 192 | 96.9k | #if !LINEAR_COLOR | 193 | 96.9k | ry = iy; | 194 | 96.9k | #endif | 195 | | | 196 | | /* | 197 | | * Free variables of FILL_TRAP_RECT: | 198 | | * SWAP_AXES, pdevc, dev, fa | 199 | | * Free variables of FILL_TRAP_RECT_DIRECT: | 200 | | * SWAP_AXES, fill_rect, dev, cindex | 201 | | */ | 202 | 96.9k | #define FILL_TRAP_RECT_INDIRECT(x,y,w,h)\ | 203 | 96.9k | (SWAP_AXES ? gx_fill_rectangle_device_rop(y, x, h, w, pdevc, dev, fa) :\ | 204 | 96.9k | gx_fill_rectangle_device_rop(x, y, w, h, pdevc, dev, fa)) | 205 | 96.9k | #define FILL_TRAP_RECT_DIRECT(x,y,w,h)\ | 206 | 96.9k | (SWAP_AXES ? (*fill_rect)(dev, y, x, h, w, cindex) :\ | 207 | 96.9k | (*fill_rect)(dev, x, y, w, h, cindex)) | 208 | | | 209 | | #if LINEAR_COLOR | 210 | | # define FILL_TRAP_RECT(x,y,w,h)\ | 211 | | (!(w) ? 0 : dev_proc(dev, fill_linear_color_scanline)(dev, fa, x, y, w, xg.c, xg.f, xg.num, xg.den)) | 212 | | #else | 213 | 96.9k | # define FILL_TRAP_RECT(x,y,w,h)\ | 214 | 96.9k | (FILL_DIRECT ? FILL_TRAP_RECT_DIRECT(x,y,w,h) : FILL_TRAP_RECT_INDIRECT(x,y,w,h)) | 215 | 96.9k | #endif | 216 | | | 217 | | /* Compute the dx/dy ratios. */ | 218 | | | 219 | | /* | 220 | | * Compute the x offsets at the first scan line to sample. We need | 221 | | * to be careful in computing ys# * dx#f {/,%} h# because the | 222 | | * multiplication may overflow. We know that all the quantities | 223 | | * involved are non-negative, and that ys# is usually less than 1 (as | 224 | | * a fixed, of course); this gives us a cheap conservative check for | 225 | | * overflow in the multiplication. | 226 | | */ | 227 | 96.9k | #define YMULT_QUO(ys, tl)\ | 228 | 96.9k | (ys < fixed_1 && tl.df < YMULT_LIMIT ? ys * tl.df / tl.h :\ | 229 | 96.9k | fixed_mult_quo(ys, tl.df, tl.h)) | 230 | | | 231 | | #if CONTIGUOUS_FILL | 232 | | /* | 233 | | * If left and right boundary round to same pixel index, | 234 | | * we would not paing the scan and would get a dropout. | 235 | | * Check for this case and choose one of two pixels | 236 | | * which is closer to the "axis". We need to exclude | 237 | | * 'peak' because it would paint an excessive pixel. | 238 | | */ | 239 | | #define SET_MINIMAL_WIDTH(ixl, ixr, l, r) \ | 240 | | if (ixl == ixr) \ | 241 | | if ((!peak0 || iy >= peak_y0) && (!peak1 || iy <= peak_y1)) {\ | 242 | | fixed x = int2fixed(ixl) + fixed_half;\ | 243 | | if (x - l.x < r.x - x)\ | 244 | | ++ixr;\ | 245 | | else\ | 246 | | --ixl;\ | 247 | | } | 248 | | | 249 | | #define CONNECT_RECTANGLES(ixl, ixr, rxl, rxr, iy, ry, adj1, adj2, fill)\ | 250 | | if (adj1 < adj2) {\ | 251 | | if (iy - ry > 1) {\ | 252 | | code = fill(rxl, ry, rxr - rxl, iy - ry - 1);\ | 253 | | if (code < 0)\ | 254 | | goto xit;\ | 255 | | ry = iy - 1;\ | 256 | | }\ | 257 | | adj1 = adj2 = (adj2 + adj2) / 2;\ | 258 | | } | 259 | | | 260 | | #else | 261 | 96.9k | #define SET_MINIMAL_WIDTH(ixl, ixr, l, r) DO_NOTHING | 262 | 96.9k | #define CONNECT_RECTANGLES(ixl, ixr, rxl, rxr, iy, ry, adj1, adj2, fill) DO_NOTHING | 263 | 96.9k | #endif | 264 | 96.9k | if (fixed_floor(l.x) == fixed_pixround(x1l)) { | 265 | | /* Left edge is vertical, we don't need to increment. */ | 266 | 23.0k | l.di = 0, l.df = 0; | 267 | 23.0k | fxl = 0; | 268 | 73.9k | } else { | 269 | 73.9k | compute_dx(&l, dxl, ysl); | 270 | 73.9k | fxl = YMULT_QUO(ysl, l); | 271 | 73.9k | l.x += fxl; | 272 | 73.9k | } | 273 | 96.9k | if (fixed_floor(r.x) == fixed_pixround(x1r)) { | 274 | | /* Right edge is vertical. If both are vertical, */ | 275 | | /* we have a rectangle. */ | 276 | 22.8k | # if !LINEAR_COLOR | 277 | 22.8k | if (l.di == 0 && l.df == 0) { | 278 | 20.1k | rxl = fixed2int_var(l.x); | 279 | 20.1k | rxr = fixed2int_var(r.x); | 280 | 20.1k | SET_MINIMAL_WIDTH(rxl, rxr, l, r); | 281 | 20.1k | code = FILL_TRAP_RECT(rxl, ry, rxr - rxl, iy1 - ry); | 282 | 20.1k | goto xit; | 283 | 20.1k | } | 284 | 2.64k | # endif | 285 | 2.64k | r.di = 0, r.df = 0; | 286 | 2.64k | } | 287 | | /* | 288 | | * The test for fxl != 0 is required because the right edge might | 289 | | * cross some pixel centers even if the left edge doesn't. | 290 | | */ | 291 | 74.1k | else if (dxr == dxl && fxl != 0) { | 292 | 59.7k | if (l.di == 0) | 293 | 29.9k | r.di = 0, r.df = l.df; | 294 | 29.8k | else | 295 | 29.8k | compute_dx(&r, dxr, ysr); | 296 | 59.7k | if (ysr == ysl && r.h == l.h) | 297 | 59.7k | r.x += fxl; | 298 | 8 | else | 299 | 8 | r.x += YMULT_QUO(ysr, r); | 300 | 59.7k | } else { | 301 | 14.3k | compute_dx(&r, dxr, ysr); | 302 | 14.3k | r.x += YMULT_QUO(ysr, r); | 303 | 14.3k | } | 304 | | /* Compute one line's worth of dx/dy. */ | 305 | 76.7k | compute_ldx(&l, ysl); | 306 | 76.7k | compute_ldx(&r, ysr); | 307 | | /* We subtracted fixed_epsilon from l.x, r.x to simplify rounding | 308 | | when the rational part is zero. Now add it back to get xl', xr' */ | 309 | 76.7k | l.x += fixed_epsilon; | 310 | 76.7k | r.x += fixed_epsilon; | 311 | | # if LINEAR_COLOR | 312 | | # ifdef DEBUG | 313 | | if (check_gradient_overflow(left, right)) { | 314 | | /* The caller must care of. | 315 | | Checking it here looses some performance with triangles. */ | 316 | | return_error(gs_error_unregistered); | 317 | | } | 318 | | # endif | 319 | | lg.c = lgc; | 320 | | lg.f = lgf; | 321 | | lg.num = lgnum; | 322 | | rg.c = rgc; | 323 | | rg.f = rgf; | 324 | | rg.num = rgnum; | 325 | | xg.c = xgc; | 326 | | xg.f = xgf; | 327 | | xg.num = xgnum; | 328 | | code = init_gradient(&lg, fa, left, right, &l, ymin, num_components); | 329 | | if (code < 0) | 330 | | return code; | 331 | | code = init_gradient(&rg, fa, right, left, &r, ymin, num_components); | 332 | | if (code < 0) | 333 | | return code; | 334 | | | 335 | | # endif | 336 | | | 337 | 76.7k | #define rational_floor(tl)\ | 338 | 76.7k | fixed2int_var(fixed_is_int(tl.x) && tl.xf == -tl.h ? tl.x - fixed_1 : tl.x) | 339 | 76.7k | #define STEP_LINE(ix, tl)\ | 340 | 76.7k | tl.x += tl.ldi;\ | 341 | 76.7k | if ( (tl.xf += tl.ldf) >= 0 ) tl.xf -= tl.h, tl.x++;\ | 342 | 76.7k | ix = rational_floor(tl) | 343 | | | 344 | 76.7k | rxl = rational_floor(l); | 345 | 76.7k | rxr = rational_floor(r); | 346 | 76.7k | SET_MINIMAL_WIDTH(rxl, rxr, l, r); | 347 | 3.97M | while (LINEAR_COLOR ? 1 : ++iy != iy1) { | 348 | | # if LINEAR_COLOR | 349 | | if (rxl != rxr) { | 350 | | code = set_x_gradient(&xg, &lg, &rg, &l, &r, rxl, rxr, num_components); | 351 | | if (code < 0) | 352 | | goto xit; | 353 | | code = FILL_TRAP_RECT(rxl, iy, rxr - rxl, 1); | 354 | | if (code < 0) | 355 | | goto xit; | 356 | | } | 357 | | if (++iy == iy1) | 358 | | break; | 359 | | STEP_LINE(rxl, l); | 360 | | STEP_LINE(rxr, r); | 361 | | step_gradient(&lg, num_components); | 362 | | step_gradient(&rg, num_components); | 363 | | # else | 364 | 3.89M | register int ixl, ixr; | 365 | | | 366 | 3.89M | STEP_LINE(ixl, l); | 367 | 3.89M | STEP_LINE(ixr, r); | 368 | 3.89M | SET_MINIMAL_WIDTH(ixl, ixr, l, r); | 369 | 3.89M | if (ixl != rxl || ixr != rxr) { | 370 | 386k | CONNECT_RECTANGLES(ixl, ixr, rxl, rxr, iy, ry, rxr, ixl, FILL_TRAP_RECT); | 371 | 386k | CONNECT_RECTANGLES(ixl, ixr, rxl, rxr, iy, ry, ixr, rxl, FILL_TRAP_RECT); | 372 | 386k | code = FILL_TRAP_RECT(rxl, ry, rxr - rxl, iy - ry); | 373 | 386k | if (code < 0) | 374 | 0 | goto xit; | 375 | 386k | rxl = ixl, rxr = ixr, ry = iy; | 376 | 386k | } | 377 | 3.89M | # endif | 378 | 3.89M | } | 379 | 76.7k | # if !LINEAR_COLOR | 380 | 76.7k | code = FILL_TRAP_RECT(rxl, ry, rxr - rxl, iy - ry); | 381 | | # else | 382 | | code = 0; | 383 | | # endif | 384 | 76.7k | #undef STEP_LINE | 385 | 76.7k | #undef SET_MINIMAL_WIDTH | 386 | 76.7k | #undef CONNECT_RECTANGLES | 387 | 76.7k | #undef FILL_TRAP_RECT | 388 | 76.7k | #undef FILL_TRAP_RECT_DIRECT | 389 | 76.7k | #undef FILL_TRAP_RECT_INRECT | 390 | 76.7k | #undef YMULT_QUO | 391 | 96.9k | xit: if (code < 0 && FILL_DIRECT) | 392 | 0 | return_error(code); | 393 | 96.9k | return_if_interrupt(dev->memory); | 394 | 96.9k | return code; | 395 | 96.9k | } | 396 | 96.9k | } |
Unexecuted instantiation: gdevddrw.c:gx_fill_trapezoid_as_nd gdevddrw.c:gx_fill_trapezoid_ns_fd Line | Count | Source | 137 | 3.34M | { | 138 | 3.34M | const fixed ymin = fixed_pixround(ybot) + fixed_half; | 139 | 3.34M | const fixed ymax = fixed_pixround(ytop); | 140 | | | 141 | 3.34M | if (ymin >= ymax) | 142 | 114k | return 0; /* no scan lines to sample */ | 143 | 3.23M | { | 144 | 3.23M | int iy = fixed2int_var(ymin); | 145 | 3.23M | const int iy1 = fixed2int_var(ymax); | 146 | 3.23M | trap_line l, r; | 147 | 3.23M | register int rxl, rxr; | 148 | 3.23M | #if !LINEAR_COLOR | 149 | 3.23M | int ry; | 150 | 3.23M | #endif | 151 | 3.23M | const fixed | 152 | 3.23M | x0l = left->start.x, x1l = left->end.x, x0r = right->start.x, | 153 | 3.23M | x1r = right->end.x, dxl = x1l - x0l, dxr = x1r - x0r; | 154 | 3.23M | const fixed /* partial pixel offset to first line to sample */ | 155 | 3.23M | ysl = ymin - left->start.y, ysr = ymin - right->start.y; | 156 | 3.23M | fixed fxl; | 157 | 3.23M | int code; | 158 | | # if CONTIGUOUS_FILL | 159 | | const bool peak0 = ((flags & 1) != 0); | 160 | | const bool peak1 = ((flags & 2) != 0); | 161 | | int peak_y0 = ybot + fixed_half; | 162 | | int peak_y1 = ytop - fixed_half; | 163 | | # endif | 164 | | # if LINEAR_COLOR | 165 | | int num_components = dev->color_info.num_components; | 166 | | frac31 lgc[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 167 | | int32_t lgf[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 168 | | int32_t lgnum[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 169 | | frac31 rgc[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 170 | | int32_t rgf[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 171 | | int32_t rgnum[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 172 | | frac31 xgc[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 173 | | int32_t xgf[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 174 | | int32_t xgnum[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 175 | | trap_gradient lg, rg, xg; | 176 | | # else | 177 | 3.23M | gx_color_index cindex = pdevc->colors.pure; | 178 | 3.23M | dev_proc_fill_rectangle((*fill_rect)) = | 179 | 3.23M | dev_proc(dev, fill_rectangle); | 180 | 3.23M | # endif | 181 | | | 182 | 3.23M | if_debug2m('z', dev->memory, "[z]y=[%d,%d]\n", iy, iy1); | 183 | | | 184 | 3.23M | l.h = left->end.y - left->start.y; | 185 | 3.23M | if (l.h == 0) | 186 | 0 | return 0; | 187 | 3.23M | r.h = right->end.y - right->start.y; | 188 | 3.23M | if (r.h == 0) | 189 | 0 | return 0; | 190 | 3.23M | l.x = x0l + (fixed_half - fixed_epsilon); | 191 | 3.23M | r.x = x0r + (fixed_half - fixed_epsilon); | 192 | 3.23M | #if !LINEAR_COLOR | 193 | 3.23M | ry = iy; | 194 | 3.23M | #endif | 195 | | | 196 | | /* | 197 | | * Free variables of FILL_TRAP_RECT: | 198 | | * SWAP_AXES, pdevc, dev, fa | 199 | | * Free variables of FILL_TRAP_RECT_DIRECT: | 200 | | * SWAP_AXES, fill_rect, dev, cindex | 201 | | */ | 202 | 3.23M | #define FILL_TRAP_RECT_INDIRECT(x,y,w,h)\ | 203 | 3.23M | (SWAP_AXES ? gx_fill_rectangle_device_rop(y, x, h, w, pdevc, dev, fa) :\ | 204 | 3.23M | gx_fill_rectangle_device_rop(x, y, w, h, pdevc, dev, fa)) | 205 | 3.23M | #define FILL_TRAP_RECT_DIRECT(x,y,w,h)\ | 206 | 3.23M | (SWAP_AXES ? (*fill_rect)(dev, y, x, h, w, cindex) :\ | 207 | 3.23M | (*fill_rect)(dev, x, y, w, h, cindex)) | 208 | | | 209 | | #if LINEAR_COLOR | 210 | | # define FILL_TRAP_RECT(x,y,w,h)\ | 211 | | (!(w) ? 0 : dev_proc(dev, fill_linear_color_scanline)(dev, fa, x, y, w, xg.c, xg.f, xg.num, xg.den)) | 212 | | #else | 213 | 3.23M | # define FILL_TRAP_RECT(x,y,w,h)\ | 214 | 3.23M | (FILL_DIRECT ? FILL_TRAP_RECT_DIRECT(x,y,w,h) : FILL_TRAP_RECT_INDIRECT(x,y,w,h)) | 215 | 3.23M | #endif | 216 | | | 217 | | /* Compute the dx/dy ratios. */ | 218 | | | 219 | | /* | 220 | | * Compute the x offsets at the first scan line to sample. We need | 221 | | * to be careful in computing ys# * dx#f {/,%} h# because the | 222 | | * multiplication may overflow. We know that all the quantities | 223 | | * involved are non-negative, and that ys# is usually less than 1 (as | 224 | | * a fixed, of course); this gives us a cheap conservative check for | 225 | | * overflow in the multiplication. | 226 | | */ | 227 | 3.23M | #define YMULT_QUO(ys, tl)\ | 228 | 3.23M | (ys < fixed_1 && tl.df < YMULT_LIMIT ? ys * tl.df / tl.h :\ | 229 | 3.23M | fixed_mult_quo(ys, tl.df, tl.h)) | 230 | | | 231 | | #if CONTIGUOUS_FILL | 232 | | /* | 233 | | * If left and right boundary round to same pixel index, | 234 | | * we would not paing the scan and would get a dropout. | 235 | | * Check for this case and choose one of two pixels | 236 | | * which is closer to the "axis". We need to exclude | 237 | | * 'peak' because it would paint an excessive pixel. | 238 | | */ | 239 | | #define SET_MINIMAL_WIDTH(ixl, ixr, l, r) \ | 240 | | if (ixl == ixr) \ | 241 | | if ((!peak0 || iy >= peak_y0) && (!peak1 || iy <= peak_y1)) {\ | 242 | | fixed x = int2fixed(ixl) + fixed_half;\ | 243 | | if (x - l.x < r.x - x)\ | 244 | | ++ixr;\ | 245 | | else\ | 246 | | --ixl;\ | 247 | | } | 248 | | | 249 | | #define CONNECT_RECTANGLES(ixl, ixr, rxl, rxr, iy, ry, adj1, adj2, fill)\ | 250 | | if (adj1 < adj2) {\ | 251 | | if (iy - ry > 1) {\ | 252 | | code = fill(rxl, ry, rxr - rxl, iy - ry - 1);\ | 253 | | if (code < 0)\ | 254 | | goto xit;\ | 255 | | ry = iy - 1;\ | 256 | | }\ | 257 | | adj1 = adj2 = (adj2 + adj2) / 2;\ | 258 | | } | 259 | | | 260 | | #else | 261 | 3.23M | #define SET_MINIMAL_WIDTH(ixl, ixr, l, r) DO_NOTHING | 262 | 3.23M | #define CONNECT_RECTANGLES(ixl, ixr, rxl, rxr, iy, ry, adj1, adj2, fill) DO_NOTHING | 263 | 3.23M | #endif | 264 | 3.23M | if (fixed_floor(l.x) == fixed_pixround(x1l)) { | 265 | | /* Left edge is vertical, we don't need to increment. */ | 266 | 1.67M | l.di = 0, l.df = 0; | 267 | 1.67M | fxl = 0; | 268 | 1.67M | } else { | 269 | 1.56M | compute_dx(&l, dxl, ysl); | 270 | 1.56M | fxl = YMULT_QUO(ysl, l); | 271 | 1.56M | l.x += fxl; | 272 | 1.56M | } | 273 | 3.23M | if (fixed_floor(r.x) == fixed_pixround(x1r)) { | 274 | | /* Right edge is vertical. If both are vertical, */ | 275 | | /* we have a rectangle. */ | 276 | 1.67M | # if !LINEAR_COLOR | 277 | 1.67M | if (l.di == 0 && l.df == 0) { | 278 | 563k | rxl = fixed2int_var(l.x); | 279 | 563k | rxr = fixed2int_var(r.x); | 280 | 563k | SET_MINIMAL_WIDTH(rxl, rxr, l, r); | 281 | 563k | code = FILL_TRAP_RECT(rxl, ry, rxr - rxl, iy1 - ry); | 282 | 563k | goto xit; | 283 | 563k | } | 284 | 1.10M | # endif | 285 | 1.10M | r.di = 0, r.df = 0; | 286 | 1.10M | } | 287 | | /* | 288 | | * The test for fxl != 0 is required because the right edge might | 289 | | * cross some pixel centers even if the left edge doesn't. | 290 | | */ | 291 | 1.56M | else if (dxr == dxl && fxl != 0) { | 292 | 251k | if (l.di == 0) | 293 | 107k | r.di = 0, r.df = l.df; | 294 | 144k | else | 295 | 144k | compute_dx(&r, dxr, ysr); | 296 | 251k | if (ysr == ysl && r.h == l.h) | 297 | 152k | r.x += fxl; | 298 | 99.1k | else | 299 | 99.1k | r.x += YMULT_QUO(ysr, r); | 300 | 1.31M | } else { | 301 | 1.31M | compute_dx(&r, dxr, ysr); | 302 | 1.31M | r.x += YMULT_QUO(ysr, r); | 303 | 1.31M | } | 304 | | /* Compute one line's worth of dx/dy. */ | 305 | 2.66M | compute_ldx(&l, ysl); | 306 | 2.66M | compute_ldx(&r, ysr); | 307 | | /* We subtracted fixed_epsilon from l.x, r.x to simplify rounding | 308 | | when the rational part is zero. Now add it back to get xl', xr' */ | 309 | 2.66M | l.x += fixed_epsilon; | 310 | 2.66M | r.x += fixed_epsilon; | 311 | | # if LINEAR_COLOR | 312 | | # ifdef DEBUG | 313 | | if (check_gradient_overflow(left, right)) { | 314 | | /* The caller must care of. | 315 | | Checking it here looses some performance with triangles. */ | 316 | | return_error(gs_error_unregistered); | 317 | | } | 318 | | # endif | 319 | | lg.c = lgc; | 320 | | lg.f = lgf; | 321 | | lg.num = lgnum; | 322 | | rg.c = rgc; | 323 | | rg.f = rgf; | 324 | | rg.num = rgnum; | 325 | | xg.c = xgc; | 326 | | xg.f = xgf; | 327 | | xg.num = xgnum; | 328 | | code = init_gradient(&lg, fa, left, right, &l, ymin, num_components); | 329 | | if (code < 0) | 330 | | return code; | 331 | | code = init_gradient(&rg, fa, right, left, &r, ymin, num_components); | 332 | | if (code < 0) | 333 | | return code; | 334 | | | 335 | | # endif | 336 | | | 337 | 2.66M | #define rational_floor(tl)\ | 338 | 2.66M | fixed2int_var(fixed_is_int(tl.x) && tl.xf == -tl.h ? tl.x - fixed_1 : tl.x) | 339 | 2.66M | #define STEP_LINE(ix, tl)\ | 340 | 2.66M | tl.x += tl.ldi;\ | 341 | 2.66M | if ( (tl.xf += tl.ldf) >= 0 ) tl.xf -= tl.h, tl.x++;\ | 342 | 2.66M | ix = rational_floor(tl) | 343 | | | 344 | 2.66M | rxl = rational_floor(l); | 345 | 2.66M | rxr = rational_floor(r); | 346 | 2.66M | SET_MINIMAL_WIDTH(rxl, rxr, l, r); | 347 | 120M | while (LINEAR_COLOR ? 1 : ++iy != iy1) { | 348 | | # if LINEAR_COLOR | 349 | | if (rxl != rxr) { | 350 | | code = set_x_gradient(&xg, &lg, &rg, &l, &r, rxl, rxr, num_components); | 351 | | if (code < 0) | 352 | | goto xit; | 353 | | code = FILL_TRAP_RECT(rxl, iy, rxr - rxl, 1); | 354 | | if (code < 0) | 355 | | goto xit; | 356 | | } | 357 | | if (++iy == iy1) | 358 | | break; | 359 | | STEP_LINE(rxl, l); | 360 | | STEP_LINE(rxr, r); | 361 | | step_gradient(&lg, num_components); | 362 | | step_gradient(&rg, num_components); | 363 | | # else | 364 | 117M | register int ixl, ixr; | 365 | | | 366 | 117M | STEP_LINE(ixl, l); | 367 | 117M | STEP_LINE(ixr, r); | 368 | 117M | SET_MINIMAL_WIDTH(ixl, ixr, l, r); | 369 | 117M | if (ixl != rxl || ixr != rxr) { | 370 | 111M | CONNECT_RECTANGLES(ixl, ixr, rxl, rxr, iy, ry, rxr, ixl, FILL_TRAP_RECT); | 371 | 111M | CONNECT_RECTANGLES(ixl, ixr, rxl, rxr, iy, ry, ixr, rxl, FILL_TRAP_RECT); | 372 | 111M | code = FILL_TRAP_RECT(rxl, ry, rxr - rxl, iy - ry); | 373 | 111M | if (code < 0) | 374 | 0 | goto xit; | 375 | 111M | rxl = ixl, rxr = ixr, ry = iy; | 376 | 111M | } | 377 | 117M | # endif | 378 | 117M | } | 379 | 2.66M | # if !LINEAR_COLOR | 380 | 2.66M | code = FILL_TRAP_RECT(rxl, ry, rxr - rxl, iy - ry); | 381 | | # else | 382 | | code = 0; | 383 | | # endif | 384 | 2.66M | #undef STEP_LINE | 385 | 2.66M | #undef SET_MINIMAL_WIDTH | 386 | 2.66M | #undef CONNECT_RECTANGLES | 387 | 2.66M | #undef FILL_TRAP_RECT | 388 | 2.66M | #undef FILL_TRAP_RECT_DIRECT | 389 | 2.66M | #undef FILL_TRAP_RECT_INRECT | 390 | 2.66M | #undef YMULT_QUO | 391 | 3.23M | xit: if (code < 0 && FILL_DIRECT) | 392 | 0 | return_error(code); | 393 | 3.23M | return_if_interrupt(dev->memory); | 394 | 3.23M | return code; | 395 | 3.23M | } | 396 | 3.23M | } |
gdevddrw.c:gx_fill_trapezoid_ns_nd Line | Count | Source | 137 | 63.9k | { | 138 | 63.9k | const fixed ymin = fixed_pixround(ybot) + fixed_half; | 139 | 63.9k | const fixed ymax = fixed_pixround(ytop); | 140 | | | 141 | 63.9k | if (ymin >= ymax) | 142 | 0 | return 0; /* no scan lines to sample */ | 143 | 63.9k | { | 144 | 63.9k | int iy = fixed2int_var(ymin); | 145 | 63.9k | const int iy1 = fixed2int_var(ymax); | 146 | 63.9k | trap_line l, r; | 147 | 63.9k | register int rxl, rxr; | 148 | 63.9k | #if !LINEAR_COLOR | 149 | 63.9k | int ry; | 150 | 63.9k | #endif | 151 | 63.9k | const fixed | 152 | 63.9k | x0l = left->start.x, x1l = left->end.x, x0r = right->start.x, | 153 | 63.9k | x1r = right->end.x, dxl = x1l - x0l, dxr = x1r - x0r; | 154 | 63.9k | const fixed /* partial pixel offset to first line to sample */ | 155 | 63.9k | ysl = ymin - left->start.y, ysr = ymin - right->start.y; | 156 | 63.9k | fixed fxl; | 157 | 63.9k | int code; | 158 | | # if CONTIGUOUS_FILL | 159 | | const bool peak0 = ((flags & 1) != 0); | 160 | | const bool peak1 = ((flags & 2) != 0); | 161 | | int peak_y0 = ybot + fixed_half; | 162 | | int peak_y1 = ytop - fixed_half; | 163 | | # endif | 164 | | # if LINEAR_COLOR | 165 | | int num_components = dev->color_info.num_components; | 166 | | frac31 lgc[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 167 | | int32_t lgf[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 168 | | int32_t lgnum[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 169 | | frac31 rgc[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 170 | | int32_t rgf[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 171 | | int32_t rgnum[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 172 | | frac31 xgc[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 173 | | int32_t xgf[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 174 | | int32_t xgnum[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 175 | | trap_gradient lg, rg, xg; | 176 | | # else | 177 | 63.9k | gx_color_index cindex = pdevc->colors.pure; | 178 | 63.9k | dev_proc_fill_rectangle((*fill_rect)) = | 179 | 63.9k | dev_proc(dev, fill_rectangle); | 180 | 63.9k | # endif | 181 | | | 182 | 63.9k | if_debug2m('z', dev->memory, "[z]y=[%d,%d]\n", iy, iy1); | 183 | | | 184 | 63.9k | l.h = left->end.y - left->start.y; | 185 | 63.9k | if (l.h == 0) | 186 | 0 | return 0; | 187 | 63.9k | r.h = right->end.y - right->start.y; | 188 | 63.9k | if (r.h == 0) | 189 | 0 | return 0; | 190 | 63.9k | l.x = x0l + (fixed_half - fixed_epsilon); | 191 | 63.9k | r.x = x0r + (fixed_half - fixed_epsilon); | 192 | 63.9k | #if !LINEAR_COLOR | 193 | 63.9k | ry = iy; | 194 | 63.9k | #endif | 195 | | | 196 | | /* | 197 | | * Free variables of FILL_TRAP_RECT: | 198 | | * SWAP_AXES, pdevc, dev, fa | 199 | | * Free variables of FILL_TRAP_RECT_DIRECT: | 200 | | * SWAP_AXES, fill_rect, dev, cindex | 201 | | */ | 202 | 63.9k | #define FILL_TRAP_RECT_INDIRECT(x,y,w,h)\ | 203 | 63.9k | (SWAP_AXES ? gx_fill_rectangle_device_rop(y, x, h, w, pdevc, dev, fa) :\ | 204 | 63.9k | gx_fill_rectangle_device_rop(x, y, w, h, pdevc, dev, fa)) | 205 | 63.9k | #define FILL_TRAP_RECT_DIRECT(x,y,w,h)\ | 206 | 63.9k | (SWAP_AXES ? (*fill_rect)(dev, y, x, h, w, cindex) :\ | 207 | 63.9k | (*fill_rect)(dev, x, y, w, h, cindex)) | 208 | | | 209 | | #if LINEAR_COLOR | 210 | | # define FILL_TRAP_RECT(x,y,w,h)\ | 211 | | (!(w) ? 0 : dev_proc(dev, fill_linear_color_scanline)(dev, fa, x, y, w, xg.c, xg.f, xg.num, xg.den)) | 212 | | #else | 213 | 63.9k | # define FILL_TRAP_RECT(x,y,w,h)\ | 214 | 63.9k | (FILL_DIRECT ? FILL_TRAP_RECT_DIRECT(x,y,w,h) : FILL_TRAP_RECT_INDIRECT(x,y,w,h)) | 215 | 63.9k | #endif | 216 | | | 217 | | /* Compute the dx/dy ratios. */ | 218 | | | 219 | | /* | 220 | | * Compute the x offsets at the first scan line to sample. We need | 221 | | * to be careful in computing ys# * dx#f {/,%} h# because the | 222 | | * multiplication may overflow. We know that all the quantities | 223 | | * involved are non-negative, and that ys# is usually less than 1 (as | 224 | | * a fixed, of course); this gives us a cheap conservative check for | 225 | | * overflow in the multiplication. | 226 | | */ | 227 | 63.9k | #define YMULT_QUO(ys, tl)\ | 228 | 63.9k | (ys < fixed_1 && tl.df < YMULT_LIMIT ? ys * tl.df / tl.h :\ | 229 | 63.9k | fixed_mult_quo(ys, tl.df, tl.h)) | 230 | | | 231 | | #if CONTIGUOUS_FILL | 232 | | /* | 233 | | * If left and right boundary round to same pixel index, | 234 | | * we would not paing the scan and would get a dropout. | 235 | | * Check for this case and choose one of two pixels | 236 | | * which is closer to the "axis". We need to exclude | 237 | | * 'peak' because it would paint an excessive pixel. | 238 | | */ | 239 | | #define SET_MINIMAL_WIDTH(ixl, ixr, l, r) \ | 240 | | if (ixl == ixr) \ | 241 | | if ((!peak0 || iy >= peak_y0) && (!peak1 || iy <= peak_y1)) {\ | 242 | | fixed x = int2fixed(ixl) + fixed_half;\ | 243 | | if (x - l.x < r.x - x)\ | 244 | | ++ixr;\ | 245 | | else\ | 246 | | --ixl;\ | 247 | | } | 248 | | | 249 | | #define CONNECT_RECTANGLES(ixl, ixr, rxl, rxr, iy, ry, adj1, adj2, fill)\ | 250 | | if (adj1 < adj2) {\ | 251 | | if (iy - ry > 1) {\ | 252 | | code = fill(rxl, ry, rxr - rxl, iy - ry - 1);\ | 253 | | if (code < 0)\ | 254 | | goto xit;\ | 255 | | ry = iy - 1;\ | 256 | | }\ | 257 | | adj1 = adj2 = (adj2 + adj2) / 2;\ | 258 | | } | 259 | | | 260 | | #else | 261 | 63.9k | #define SET_MINIMAL_WIDTH(ixl, ixr, l, r) DO_NOTHING | 262 | 63.9k | #define CONNECT_RECTANGLES(ixl, ixr, rxl, rxr, iy, ry, adj1, adj2, fill) DO_NOTHING | 263 | 63.9k | #endif | 264 | 63.9k | if (fixed_floor(l.x) == fixed_pixround(x1l)) { | 265 | | /* Left edge is vertical, we don't need to increment. */ | 266 | 30.8k | l.di = 0, l.df = 0; | 267 | 30.8k | fxl = 0; | 268 | 33.0k | } else { | 269 | 33.0k | compute_dx(&l, dxl, ysl); | 270 | 33.0k | fxl = YMULT_QUO(ysl, l); | 271 | 33.0k | l.x += fxl; | 272 | 33.0k | } | 273 | 63.9k | if (fixed_floor(r.x) == fixed_pixround(x1r)) { | 274 | | /* Right edge is vertical. If both are vertical, */ | 275 | | /* we have a rectangle. */ | 276 | 27.4k | # if !LINEAR_COLOR | 277 | 27.4k | if (l.di == 0 && l.df == 0) { | 278 | 21.9k | rxl = fixed2int_var(l.x); | 279 | 21.9k | rxr = fixed2int_var(r.x); | 280 | 21.9k | SET_MINIMAL_WIDTH(rxl, rxr, l, r); | 281 | 21.9k | code = FILL_TRAP_RECT(rxl, ry, rxr - rxl, iy1 - ry); | 282 | 21.9k | goto xit; | 283 | 21.9k | } | 284 | 5.51k | # endif | 285 | 5.51k | r.di = 0, r.df = 0; | 286 | 5.51k | } | 287 | | /* | 288 | | * The test for fxl != 0 is required because the right edge might | 289 | | * cross some pixel centers even if the left edge doesn't. | 290 | | */ | 291 | 36.4k | else if (dxr == dxl && fxl != 0) { | 292 | 8 | if (l.di == 0) | 293 | 0 | r.di = 0, r.df = l.df; | 294 | 8 | else | 295 | 8 | compute_dx(&r, dxr, ysr); | 296 | 8 | if (ysr == ysl && r.h == l.h) | 297 | 0 | r.x += fxl; | 298 | 8 | else | 299 | 8 | r.x += YMULT_QUO(ysr, r); | 300 | 36.4k | } else { | 301 | 36.4k | compute_dx(&r, dxr, ysr); | 302 | 36.4k | r.x += YMULT_QUO(ysr, r); | 303 | 36.4k | } | 304 | | /* Compute one line's worth of dx/dy. */ | 305 | 41.9k | compute_ldx(&l, ysl); | 306 | 41.9k | compute_ldx(&r, ysr); | 307 | | /* We subtracted fixed_epsilon from l.x, r.x to simplify rounding | 308 | | when the rational part is zero. Now add it back to get xl', xr' */ | 309 | 41.9k | l.x += fixed_epsilon; | 310 | 41.9k | r.x += fixed_epsilon; | 311 | | # if LINEAR_COLOR | 312 | | # ifdef DEBUG | 313 | | if (check_gradient_overflow(left, right)) { | 314 | | /* The caller must care of. | 315 | | Checking it here looses some performance with triangles. */ | 316 | | return_error(gs_error_unregistered); | 317 | | } | 318 | | # endif | 319 | | lg.c = lgc; | 320 | | lg.f = lgf; | 321 | | lg.num = lgnum; | 322 | | rg.c = rgc; | 323 | | rg.f = rgf; | 324 | | rg.num = rgnum; | 325 | | xg.c = xgc; | 326 | | xg.f = xgf; | 327 | | xg.num = xgnum; | 328 | | code = init_gradient(&lg, fa, left, right, &l, ymin, num_components); | 329 | | if (code < 0) | 330 | | return code; | 331 | | code = init_gradient(&rg, fa, right, left, &r, ymin, num_components); | 332 | | if (code < 0) | 333 | | return code; | 334 | | | 335 | | # endif | 336 | | | 337 | 41.9k | #define rational_floor(tl)\ | 338 | 41.9k | fixed2int_var(fixed_is_int(tl.x) && tl.xf == -tl.h ? tl.x - fixed_1 : tl.x) | 339 | 41.9k | #define STEP_LINE(ix, tl)\ | 340 | 41.9k | tl.x += tl.ldi;\ | 341 | 41.9k | if ( (tl.xf += tl.ldf) >= 0 ) tl.xf -= tl.h, tl.x++;\ | 342 | 41.9k | ix = rational_floor(tl) | 343 | | | 344 | 41.9k | rxl = rational_floor(l); | 345 | 41.9k | rxr = rational_floor(r); | 346 | 41.9k | SET_MINIMAL_WIDTH(rxl, rxr, l, r); | 347 | 1.46M | while (LINEAR_COLOR ? 1 : ++iy != iy1) { | 348 | | # if LINEAR_COLOR | 349 | | if (rxl != rxr) { | 350 | | code = set_x_gradient(&xg, &lg, &rg, &l, &r, rxl, rxr, num_components); | 351 | | if (code < 0) | 352 | | goto xit; | 353 | | code = FILL_TRAP_RECT(rxl, iy, rxr - rxl, 1); | 354 | | if (code < 0) | 355 | | goto xit; | 356 | | } | 357 | | if (++iy == iy1) | 358 | | break; | 359 | | STEP_LINE(rxl, l); | 360 | | STEP_LINE(rxr, r); | 361 | | step_gradient(&lg, num_components); | 362 | | step_gradient(&rg, num_components); | 363 | | # else | 364 | 1.42M | register int ixl, ixr; | 365 | | | 366 | 1.42M | STEP_LINE(ixl, l); | 367 | 1.42M | STEP_LINE(ixr, r); | 368 | 1.42M | SET_MINIMAL_WIDTH(ixl, ixr, l, r); | 369 | 1.42M | if (ixl != rxl || ixr != rxr) { | 370 | 918k | CONNECT_RECTANGLES(ixl, ixr, rxl, rxr, iy, ry, rxr, ixl, FILL_TRAP_RECT); | 371 | 918k | CONNECT_RECTANGLES(ixl, ixr, rxl, rxr, iy, ry, ixr, rxl, FILL_TRAP_RECT); | 372 | 918k | code = FILL_TRAP_RECT(rxl, ry, rxr - rxl, iy - ry); | 373 | 918k | if (code < 0) | 374 | 0 | goto xit; | 375 | 918k | rxl = ixl, rxr = ixr, ry = iy; | 376 | 918k | } | 377 | 1.42M | # endif | 378 | 1.42M | } | 379 | 41.9k | # if !LINEAR_COLOR | 380 | 41.9k | code = FILL_TRAP_RECT(rxl, ry, rxr - rxl, iy - ry); | 381 | | # else | 382 | | code = 0; | 383 | | # endif | 384 | 41.9k | #undef STEP_LINE | 385 | 41.9k | #undef SET_MINIMAL_WIDTH | 386 | 41.9k | #undef CONNECT_RECTANGLES | 387 | 41.9k | #undef FILL_TRAP_RECT | 388 | 41.9k | #undef FILL_TRAP_RECT_DIRECT | 389 | 41.9k | #undef FILL_TRAP_RECT_INRECT | 390 | 41.9k | #undef YMULT_QUO | 391 | 63.9k | xit: if (code < 0 && FILL_DIRECT) | 392 | 0 | return_error(code); | 393 | 63.9k | return_if_interrupt(dev->memory); | 394 | 63.9k | return code; | 395 | 63.9k | } | 396 | 63.9k | } |
gdevddrw.c:gx_fill_trapezoid_as_lc Line | Count | Source | 137 | 291k | { | 138 | 291k | const fixed ymin = fixed_pixround(ybot) + fixed_half; | 139 | 291k | const fixed ymax = fixed_pixround(ytop); | 140 | | | 141 | 291k | if (ymin >= ymax) | 142 | 69.2k | return 0; /* no scan lines to sample */ | 143 | 221k | { | 144 | 221k | int iy = fixed2int_var(ymin); | 145 | 221k | const int iy1 = fixed2int_var(ymax); | 146 | 221k | trap_line l, r; | 147 | 221k | register int rxl, rxr; | 148 | | #if !LINEAR_COLOR | 149 | | int ry; | 150 | | #endif | 151 | 221k | const fixed | 152 | 221k | x0l = left->start.x, x1l = left->end.x, x0r = right->start.x, | 153 | 221k | x1r = right->end.x, dxl = x1l - x0l, dxr = x1r - x0r; | 154 | 221k | const fixed /* partial pixel offset to first line to sample */ | 155 | 221k | ysl = ymin - left->start.y, ysr = ymin - right->start.y; | 156 | 221k | fixed fxl; | 157 | 221k | int code; | 158 | | # if CONTIGUOUS_FILL | 159 | | const bool peak0 = ((flags & 1) != 0); | 160 | | const bool peak1 = ((flags & 2) != 0); | 161 | | int peak_y0 = ybot + fixed_half; | 162 | | int peak_y1 = ytop - fixed_half; | 163 | | # endif | 164 | 221k | # if LINEAR_COLOR | 165 | 221k | int num_components = dev->color_info.num_components; | 166 | 221k | frac31 lgc[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 167 | 221k | int32_t lgf[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 168 | 221k | int32_t lgnum[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 169 | 221k | frac31 rgc[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 170 | 221k | int32_t rgf[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 171 | 221k | int32_t rgnum[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 172 | 221k | frac31 xgc[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 173 | 221k | int32_t xgf[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 174 | 221k | int32_t xgnum[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 175 | 221k | trap_gradient lg, rg, xg; | 176 | | # else | 177 | | gx_color_index cindex = pdevc->colors.pure; | 178 | | dev_proc_fill_rectangle((*fill_rect)) = | 179 | | dev_proc(dev, fill_rectangle); | 180 | | # endif | 181 | | | 182 | 221k | if_debug2m('z', dev->memory, "[z]y=[%d,%d]\n", iy, iy1); | 183 | | | 184 | 221k | l.h = left->end.y - left->start.y; | 185 | 221k | if (l.h == 0) | 186 | 0 | return 0; | 187 | 221k | r.h = right->end.y - right->start.y; | 188 | 221k | if (r.h == 0) | 189 | 0 | return 0; | 190 | 221k | l.x = x0l + (fixed_half - fixed_epsilon); | 191 | 221k | r.x = x0r + (fixed_half - fixed_epsilon); | 192 | | #if !LINEAR_COLOR | 193 | | ry = iy; | 194 | | #endif | 195 | | | 196 | | /* | 197 | | * Free variables of FILL_TRAP_RECT: | 198 | | * SWAP_AXES, pdevc, dev, fa | 199 | | * Free variables of FILL_TRAP_RECT_DIRECT: | 200 | | * SWAP_AXES, fill_rect, dev, cindex | 201 | | */ | 202 | 221k | #define FILL_TRAP_RECT_INDIRECT(x,y,w,h)\ | 203 | 221k | (SWAP_AXES ? gx_fill_rectangle_device_rop(y, x, h, w, pdevc, dev, fa) :\ | 204 | 221k | gx_fill_rectangle_device_rop(x, y, w, h, pdevc, dev, fa)) | 205 | 221k | #define FILL_TRAP_RECT_DIRECT(x,y,w,h)\ | 206 | 221k | (SWAP_AXES ? (*fill_rect)(dev, y, x, h, w, cindex) :\ | 207 | 221k | (*fill_rect)(dev, x, y, w, h, cindex)) | 208 | | | 209 | 221k | #if LINEAR_COLOR | 210 | 221k | # define FILL_TRAP_RECT(x,y,w,h)\ | 211 | 221k | (!(w) ? 0 : dev_proc(dev, fill_linear_color_scanline)(dev, fa, x, y, w, xg.c, xg.f, xg.num, xg.den)) | 212 | | #else | 213 | | # define FILL_TRAP_RECT(x,y,w,h)\ | 214 | | (FILL_DIRECT ? FILL_TRAP_RECT_DIRECT(x,y,w,h) : FILL_TRAP_RECT_INDIRECT(x,y,w,h)) | 215 | | #endif | 216 | | | 217 | | /* Compute the dx/dy ratios. */ | 218 | | | 219 | | /* | 220 | | * Compute the x offsets at the first scan line to sample. We need | 221 | | * to be careful in computing ys# * dx#f {/,%} h# because the | 222 | | * multiplication may overflow. We know that all the quantities | 223 | | * involved are non-negative, and that ys# is usually less than 1 (as | 224 | | * a fixed, of course); this gives us a cheap conservative check for | 225 | | * overflow in the multiplication. | 226 | | */ | 227 | 221k | #define YMULT_QUO(ys, tl)\ | 228 | 221k | (ys < fixed_1 && tl.df < YMULT_LIMIT ? ys * tl.df / tl.h :\ | 229 | 221k | fixed_mult_quo(ys, tl.df, tl.h)) | 230 | | | 231 | | #if CONTIGUOUS_FILL | 232 | | /* | 233 | | * If left and right boundary round to same pixel index, | 234 | | * we would not paing the scan and would get a dropout. | 235 | | * Check for this case and choose one of two pixels | 236 | | * which is closer to the "axis". We need to exclude | 237 | | * 'peak' because it would paint an excessive pixel. | 238 | | */ | 239 | | #define SET_MINIMAL_WIDTH(ixl, ixr, l, r) \ | 240 | | if (ixl == ixr) \ | 241 | | if ((!peak0 || iy >= peak_y0) && (!peak1 || iy <= peak_y1)) {\ | 242 | | fixed x = int2fixed(ixl) + fixed_half;\ | 243 | | if (x - l.x < r.x - x)\ | 244 | | ++ixr;\ | 245 | | else\ | 246 | | --ixl;\ | 247 | | } | 248 | | | 249 | | #define CONNECT_RECTANGLES(ixl, ixr, rxl, rxr, iy, ry, adj1, adj2, fill)\ | 250 | | if (adj1 < adj2) {\ | 251 | | if (iy - ry > 1) {\ | 252 | | code = fill(rxl, ry, rxr - rxl, iy - ry - 1);\ | 253 | | if (code < 0)\ | 254 | | goto xit;\ | 255 | | ry = iy - 1;\ | 256 | | }\ | 257 | | adj1 = adj2 = (adj2 + adj2) / 2;\ | 258 | | } | 259 | | | 260 | | #else | 261 | 221k | #define SET_MINIMAL_WIDTH(ixl, ixr, l, r) DO_NOTHING | 262 | 221k | #define CONNECT_RECTANGLES(ixl, ixr, rxl, rxr, iy, ry, adj1, adj2, fill) DO_NOTHING | 263 | 221k | #endif | 264 | 221k | if (fixed_floor(l.x) == fixed_pixround(x1l)) { | 265 | | /* Left edge is vertical, we don't need to increment. */ | 266 | 128k | l.di = 0, l.df = 0; | 267 | 128k | fxl = 0; | 268 | 128k | } else { | 269 | 93.8k | compute_dx(&l, dxl, ysl); | 270 | 93.8k | fxl = YMULT_QUO(ysl, l); | 271 | 93.8k | l.x += fxl; | 272 | 93.8k | } | 273 | 221k | if (fixed_floor(r.x) == fixed_pixround(x1r)) { | 274 | | /* Right edge is vertical. If both are vertical, */ | 275 | | /* we have a rectangle. */ | 276 | | # if !LINEAR_COLOR | 277 | | if (l.di == 0 && l.df == 0) { | 278 | | rxl = fixed2int_var(l.x); | 279 | | rxr = fixed2int_var(r.x); | 280 | | SET_MINIMAL_WIDTH(rxl, rxr, l, r); | 281 | | code = FILL_TRAP_RECT(rxl, ry, rxr - rxl, iy1 - ry); | 282 | | goto xit; | 283 | | } | 284 | | # endif | 285 | 126k | r.di = 0, r.df = 0; | 286 | 126k | } | 287 | | /* | 288 | | * The test for fxl != 0 is required because the right edge might | 289 | | * cross some pixel centers even if the left edge doesn't. | 290 | | */ | 291 | 94.9k | else if (dxr == dxl && fxl != 0) { | 292 | 48.7k | if (l.di == 0) | 293 | 25.0k | r.di = 0, r.df = l.df; | 294 | 23.6k | else | 295 | 23.6k | compute_dx(&r, dxr, ysr); | 296 | 48.7k | if (ysr == ysl && r.h == l.h) | 297 | 48.7k | r.x += fxl; | 298 | 1 | else | 299 | 1 | r.x += YMULT_QUO(ysr, r); | 300 | 48.7k | } else { | 301 | 46.1k | compute_dx(&r, dxr, ysr); | 302 | 46.1k | r.x += YMULT_QUO(ysr, r); | 303 | 46.1k | } | 304 | | /* Compute one line's worth of dx/dy. */ | 305 | 221k | compute_ldx(&l, ysl); | 306 | 221k | compute_ldx(&r, ysr); | 307 | | /* We subtracted fixed_epsilon from l.x, r.x to simplify rounding | 308 | | when the rational part is zero. Now add it back to get xl', xr' */ | 309 | 221k | l.x += fixed_epsilon; | 310 | 221k | r.x += fixed_epsilon; | 311 | 221k | # if LINEAR_COLOR | 312 | | # ifdef DEBUG | 313 | | if (check_gradient_overflow(left, right)) { | 314 | | /* The caller must care of. | 315 | | Checking it here looses some performance with triangles. */ | 316 | | return_error(gs_error_unregistered); | 317 | | } | 318 | | # endif | 319 | 221k | lg.c = lgc; | 320 | 221k | lg.f = lgf; | 321 | 221k | lg.num = lgnum; | 322 | 221k | rg.c = rgc; | 323 | 221k | rg.f = rgf; | 324 | 221k | rg.num = rgnum; | 325 | 221k | xg.c = xgc; | 326 | 221k | xg.f = xgf; | 327 | 221k | xg.num = xgnum; | 328 | 221k | code = init_gradient(&lg, fa, left, right, &l, ymin, num_components); | 329 | 221k | if (code < 0) | 330 | 0 | return code; | 331 | 221k | code = init_gradient(&rg, fa, right, left, &r, ymin, num_components); | 332 | 221k | if (code < 0) | 333 | 0 | return code; | 334 | | | 335 | 221k | # endif | 336 | | | 337 | 221k | #define rational_floor(tl)\ | 338 | 221k | fixed2int_var(fixed_is_int(tl.x) && tl.xf == -tl.h ? tl.x - fixed_1 : tl.x) | 339 | 221k | #define STEP_LINE(ix, tl)\ | 340 | 221k | tl.x += tl.ldi;\ | 341 | 221k | if ( (tl.xf += tl.ldf) >= 0 ) tl.xf -= tl.h, tl.x++;\ | 342 | 221k | ix = rational_floor(tl) | 343 | | | 344 | 221k | rxl = rational_floor(l); | 345 | 221k | rxr = rational_floor(r); | 346 | 221k | SET_MINIMAL_WIDTH(rxl, rxr, l, r); | 347 | 4.86M | while (LINEAR_COLOR ? 1 : ++iy != iy1) { | 348 | 4.86M | # if LINEAR_COLOR | 349 | 4.86M | if (rxl != rxr) { | 350 | 3.46M | code = set_x_gradient(&xg, &lg, &rg, &l, &r, rxl, rxr, num_components); | 351 | 3.46M | if (code < 0) | 352 | 0 | goto xit; | 353 | 3.46M | code = FILL_TRAP_RECT(rxl, iy, rxr - rxl, 1); | 354 | 3.46M | if (code < 0) | 355 | 0 | goto xit; | 356 | 3.46M | } | 357 | 4.86M | if (++iy == iy1) | 358 | 221k | break; | 359 | 4.63M | STEP_LINE(rxl, l); | 360 | 4.63M | STEP_LINE(rxr, r); | 361 | 4.63M | step_gradient(&lg, num_components); | 362 | 4.63M | step_gradient(&rg, num_components); | 363 | | # else | 364 | | register int ixl, ixr; | 365 | | | 366 | | STEP_LINE(ixl, l); | 367 | | STEP_LINE(ixr, r); | 368 | | SET_MINIMAL_WIDTH(ixl, ixr, l, r); | 369 | | if (ixl != rxl || ixr != rxr) { | 370 | | CONNECT_RECTANGLES(ixl, ixr, rxl, rxr, iy, ry, rxr, ixl, FILL_TRAP_RECT); | 371 | | CONNECT_RECTANGLES(ixl, ixr, rxl, rxr, iy, ry, ixr, rxl, FILL_TRAP_RECT); | 372 | | code = FILL_TRAP_RECT(rxl, ry, rxr - rxl, iy - ry); | 373 | | if (code < 0) | 374 | | goto xit; | 375 | | rxl = ixl, rxr = ixr, ry = iy; | 376 | | } | 377 | | # endif | 378 | 4.63M | } | 379 | | # if !LINEAR_COLOR | 380 | | code = FILL_TRAP_RECT(rxl, ry, rxr - rxl, iy - ry); | 381 | | # else | 382 | 221k | code = 0; | 383 | 221k | # endif | 384 | 221k | #undef STEP_LINE | 385 | 221k | #undef SET_MINIMAL_WIDTH | 386 | 221k | #undef CONNECT_RECTANGLES | 387 | 221k | #undef FILL_TRAP_RECT | 388 | 221k | #undef FILL_TRAP_RECT_DIRECT | 389 | 221k | #undef FILL_TRAP_RECT_INRECT | 390 | 221k | #undef YMULT_QUO | 391 | 221k | xit: if (code < 0 && FILL_DIRECT) | 392 | 0 | return_error(code); | 393 | 221k | return_if_interrupt(dev->memory); | 394 | 221k | return code; | 395 | 221k | } | 396 | 221k | } |
gdevddrw.c:gx_fill_trapezoid_ns_lc Line | Count | Source | 137 | 9.22M | { | 138 | 9.22M | const fixed ymin = fixed_pixround(ybot) + fixed_half; | 139 | 9.22M | const fixed ymax = fixed_pixround(ytop); | 140 | | | 141 | 9.22M | if (ymin >= ymax) | 142 | 3.34M | return 0; /* no scan lines to sample */ | 143 | 5.87M | { | 144 | 5.87M | int iy = fixed2int_var(ymin); | 145 | 5.87M | const int iy1 = fixed2int_var(ymax); | 146 | 5.87M | trap_line l, r; | 147 | 5.87M | register int rxl, rxr; | 148 | | #if !LINEAR_COLOR | 149 | | int ry; | 150 | | #endif | 151 | 5.87M | const fixed | 152 | 5.87M | x0l = left->start.x, x1l = left->end.x, x0r = right->start.x, | 153 | 5.87M | x1r = right->end.x, dxl = x1l - x0l, dxr = x1r - x0r; | 154 | 5.87M | const fixed /* partial pixel offset to first line to sample */ | 155 | 5.87M | ysl = ymin - left->start.y, ysr = ymin - right->start.y; | 156 | 5.87M | fixed fxl; | 157 | 5.87M | int code; | 158 | | # if CONTIGUOUS_FILL | 159 | | const bool peak0 = ((flags & 1) != 0); | 160 | | const bool peak1 = ((flags & 2) != 0); | 161 | | int peak_y0 = ybot + fixed_half; | 162 | | int peak_y1 = ytop - fixed_half; | 163 | | # endif | 164 | 5.87M | # if LINEAR_COLOR | 165 | 5.87M | int num_components = dev->color_info.num_components; | 166 | 5.87M | frac31 lgc[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 167 | 5.87M | int32_t lgf[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 168 | 5.87M | int32_t lgnum[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 169 | 5.87M | frac31 rgc[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 170 | 5.87M | int32_t rgf[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 171 | 5.87M | int32_t rgnum[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 172 | 5.87M | frac31 xgc[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 173 | 5.87M | int32_t xgf[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 174 | 5.87M | int32_t xgnum[GX_DEVICE_COLOR_MAX_COMPONENTS]; | 175 | 5.87M | trap_gradient lg, rg, xg; | 176 | | # else | 177 | | gx_color_index cindex = pdevc->colors.pure; | 178 | | dev_proc_fill_rectangle((*fill_rect)) = | 179 | | dev_proc(dev, fill_rectangle); | 180 | | # endif | 181 | | | 182 | 5.87M | if_debug2m('z', dev->memory, "[z]y=[%d,%d]\n", iy, iy1); | 183 | | | 184 | 5.87M | l.h = left->end.y - left->start.y; | 185 | 5.87M | if (l.h == 0) | 186 | 0 | return 0; | 187 | 5.87M | r.h = right->end.y - right->start.y; | 188 | 5.87M | if (r.h == 0) | 189 | 0 | return 0; | 190 | 5.87M | l.x = x0l + (fixed_half - fixed_epsilon); | 191 | 5.87M | r.x = x0r + (fixed_half - fixed_epsilon); | 192 | | #if !LINEAR_COLOR | 193 | | ry = iy; | 194 | | #endif | 195 | | | 196 | | /* | 197 | | * Free variables of FILL_TRAP_RECT: | 198 | | * SWAP_AXES, pdevc, dev, fa | 199 | | * Free variables of FILL_TRAP_RECT_DIRECT: | 200 | | * SWAP_AXES, fill_rect, dev, cindex | 201 | | */ | 202 | 5.87M | #define FILL_TRAP_RECT_INDIRECT(x,y,w,h)\ | 203 | 5.87M | (SWAP_AXES ? gx_fill_rectangle_device_rop(y, x, h, w, pdevc, dev, fa) :\ | 204 | 5.87M | gx_fill_rectangle_device_rop(x, y, w, h, pdevc, dev, fa)) | 205 | 5.87M | #define FILL_TRAP_RECT_DIRECT(x,y,w,h)\ | 206 | 5.87M | (SWAP_AXES ? (*fill_rect)(dev, y, x, h, w, cindex) :\ | 207 | 5.87M | (*fill_rect)(dev, x, y, w, h, cindex)) | 208 | | | 209 | 5.87M | #if LINEAR_COLOR | 210 | 5.87M | # define FILL_TRAP_RECT(x,y,w,h)\ | 211 | 5.87M | (!(w) ? 0 : dev_proc(dev, fill_linear_color_scanline)(dev, fa, x, y, w, xg.c, xg.f, xg.num, xg.den)) | 212 | | #else | 213 | | # define FILL_TRAP_RECT(x,y,w,h)\ | 214 | | (FILL_DIRECT ? FILL_TRAP_RECT_DIRECT(x,y,w,h) : FILL_TRAP_RECT_INDIRECT(x,y,w,h)) | 215 | | #endif | 216 | | | 217 | | /* Compute the dx/dy ratios. */ | 218 | | | 219 | | /* | 220 | | * Compute the x offsets at the first scan line to sample. We need | 221 | | * to be careful in computing ys# * dx#f {/,%} h# because the | 222 | | * multiplication may overflow. We know that all the quantities | 223 | | * involved are non-negative, and that ys# is usually less than 1 (as | 224 | | * a fixed, of course); this gives us a cheap conservative check for | 225 | | * overflow in the multiplication. | 226 | | */ | 227 | 5.87M | #define YMULT_QUO(ys, tl)\ | 228 | 5.87M | (ys < fixed_1 && tl.df < YMULT_LIMIT ? ys * tl.df / tl.h :\ | 229 | 5.87M | fixed_mult_quo(ys, tl.df, tl.h)) | 230 | | | 231 | | #if CONTIGUOUS_FILL | 232 | | /* | 233 | | * If left and right boundary round to same pixel index, | 234 | | * we would not paing the scan and would get a dropout. | 235 | | * Check for this case and choose one of two pixels | 236 | | * which is closer to the "axis". We need to exclude | 237 | | * 'peak' because it would paint an excessive pixel. | 238 | | */ | 239 | | #define SET_MINIMAL_WIDTH(ixl, ixr, l, r) \ | 240 | | if (ixl == ixr) \ | 241 | | if ((!peak0 || iy >= peak_y0) && (!peak1 || iy <= peak_y1)) {\ | 242 | | fixed x = int2fixed(ixl) + fixed_half;\ | 243 | | if (x - l.x < r.x - x)\ | 244 | | ++ixr;\ | 245 | | else\ | 246 | | --ixl;\ | 247 | | } | 248 | | | 249 | | #define CONNECT_RECTANGLES(ixl, ixr, rxl, rxr, iy, ry, adj1, adj2, fill)\ | 250 | | if (adj1 < adj2) {\ | 251 | | if (iy - ry > 1) {\ | 252 | | code = fill(rxl, ry, rxr - rxl, iy - ry - 1);\ | 253 | | if (code < 0)\ | 254 | | goto xit;\ | 255 | | ry = iy - 1;\ | 256 | | }\ | 257 | | adj1 = adj2 = (adj2 + adj2) / 2;\ | 258 | | } | 259 | | | 260 | | #else | 261 | 5.87M | #define SET_MINIMAL_WIDTH(ixl, ixr, l, r) DO_NOTHING | 262 | 5.87M | #define CONNECT_RECTANGLES(ixl, ixr, rxl, rxr, iy, ry, adj1, adj2, fill) DO_NOTHING | 263 | 5.87M | #endif | 264 | 5.87M | if (fixed_floor(l.x) == fixed_pixround(x1l)) { | 265 | | /* Left edge is vertical, we don't need to increment. */ | 266 | 1.85M | l.di = 0, l.df = 0; | 267 | 1.85M | fxl = 0; | 268 | 4.02M | } else { | 269 | 4.02M | compute_dx(&l, dxl, ysl); | 270 | 4.02M | fxl = YMULT_QUO(ysl, l); | 271 | 4.02M | l.x += fxl; | 272 | 4.02M | } | 273 | 5.87M | if (fixed_floor(r.x) == fixed_pixround(x1r)) { | 274 | | /* Right edge is vertical. If both are vertical, */ | 275 | | /* we have a rectangle. */ | 276 | | # if !LINEAR_COLOR | 277 | | if (l.di == 0 && l.df == 0) { | 278 | | rxl = fixed2int_var(l.x); | 279 | | rxr = fixed2int_var(r.x); | 280 | | SET_MINIMAL_WIDTH(rxl, rxr, l, r); | 281 | | code = FILL_TRAP_RECT(rxl, ry, rxr - rxl, iy1 - ry); | 282 | | goto xit; | 283 | | } | 284 | | # endif | 285 | 1.84M | r.di = 0, r.df = 0; | 286 | 1.84M | } | 287 | | /* | 288 | | * The test for fxl != 0 is required because the right edge might | 289 | | * cross some pixel centers even if the left edge doesn't. | 290 | | */ | 291 | 4.03M | else if (dxr == dxl && fxl != 0) { | 292 | 343k | if (l.di == 0) | 293 | 116k | r.di = 0, r.df = l.df; | 294 | 226k | else | 295 | 226k | compute_dx(&r, dxr, ysr); | 296 | 343k | if (ysr == ysl && r.h == l.h) | 297 | 199k | r.x += fxl; | 298 | 143k | else | 299 | 143k | r.x += YMULT_QUO(ysr, r); | 300 | 3.69M | } else { | 301 | 3.69M | compute_dx(&r, dxr, ysr); | 302 | 3.69M | r.x += YMULT_QUO(ysr, r); | 303 | 3.69M | } | 304 | | /* Compute one line's worth of dx/dy. */ | 305 | 5.87M | compute_ldx(&l, ysl); | 306 | 5.87M | compute_ldx(&r, ysr); | 307 | | /* We subtracted fixed_epsilon from l.x, r.x to simplify rounding | 308 | | when the rational part is zero. Now add it back to get xl', xr' */ | 309 | 5.87M | l.x += fixed_epsilon; | 310 | 5.87M | r.x += fixed_epsilon; | 311 | 5.87M | # if LINEAR_COLOR | 312 | | # ifdef DEBUG | 313 | | if (check_gradient_overflow(left, right)) { | 314 | | /* The caller must care of. | 315 | | Checking it here looses some performance with triangles. */ | 316 | | return_error(gs_error_unregistered); | 317 | | } | 318 | | # endif | 319 | 5.87M | lg.c = lgc; | 320 | 5.87M | lg.f = lgf; | 321 | 5.87M | lg.num = lgnum; | 322 | 5.87M | rg.c = rgc; | 323 | 5.87M | rg.f = rgf; | 324 | 5.87M | rg.num = rgnum; | 325 | 5.87M | xg.c = xgc; | 326 | 5.87M | xg.f = xgf; | 327 | 5.87M | xg.num = xgnum; | 328 | 5.87M | code = init_gradient(&lg, fa, left, right, &l, ymin, num_components); | 329 | 5.87M | if (code < 0) | 330 | 0 | return code; | 331 | 5.87M | code = init_gradient(&rg, fa, right, left, &r, ymin, num_components); | 332 | 5.87M | if (code < 0) | 333 | 0 | return code; | 334 | | | 335 | 5.87M | # endif | 336 | | | 337 | 5.87M | #define rational_floor(tl)\ | 338 | 5.87M | fixed2int_var(fixed_is_int(tl.x) && tl.xf == -tl.h ? tl.x - fixed_1 : tl.x) | 339 | 5.87M | #define STEP_LINE(ix, tl)\ | 340 | 5.87M | tl.x += tl.ldi;\ | 341 | 5.87M | if ( (tl.xf += tl.ldf) >= 0 ) tl.xf -= tl.h, tl.x++;\ | 342 | 5.87M | ix = rational_floor(tl) | 343 | | | 344 | 5.87M | rxl = rational_floor(l); | 345 | 5.87M | rxr = rational_floor(r); | 346 | 5.87M | SET_MINIMAL_WIDTH(rxl, rxr, l, r); | 347 | 52.6M | while (LINEAR_COLOR ? 1 : ++iy != iy1) { | 348 | 52.6M | # if LINEAR_COLOR | 349 | 52.6M | if (rxl != rxr) { | 350 | 9.19M | code = set_x_gradient(&xg, &lg, &rg, &l, &r, rxl, rxr, num_components); | 351 | 9.19M | if (code < 0) | 352 | 0 | goto xit; | 353 | 9.19M | code = FILL_TRAP_RECT(rxl, iy, rxr - rxl, 1); | 354 | 9.19M | if (code < 0) | 355 | 0 | goto xit; | 356 | 9.19M | } | 357 | 52.6M | if (++iy == iy1) | 358 | 5.87M | break; | 359 | 46.7M | STEP_LINE(rxl, l); | 360 | 46.7M | STEP_LINE(rxr, r); | 361 | 46.7M | step_gradient(&lg, num_components); | 362 | 46.7M | step_gradient(&rg, num_components); | 363 | | # else | 364 | | register int ixl, ixr; | 365 | | | 366 | | STEP_LINE(ixl, l); | 367 | | STEP_LINE(ixr, r); | 368 | | SET_MINIMAL_WIDTH(ixl, ixr, l, r); | 369 | | if (ixl != rxl || ixr != rxr) { | 370 | | CONNECT_RECTANGLES(ixl, ixr, rxl, rxr, iy, ry, rxr, ixl, FILL_TRAP_RECT); | 371 | | CONNECT_RECTANGLES(ixl, ixr, rxl, rxr, iy, ry, ixr, rxl, FILL_TRAP_RECT); | 372 | | code = FILL_TRAP_RECT(rxl, ry, rxr - rxl, iy - ry); | 373 | | if (code < 0) | 374 | | goto xit; | 375 | | rxl = ixl, rxr = ixr, ry = iy; | 376 | | } | 377 | | # endif | 378 | 46.7M | } | 379 | | # if !LINEAR_COLOR | 380 | | code = FILL_TRAP_RECT(rxl, ry, rxr - rxl, iy - ry); | 381 | | # else | 382 | 5.87M | code = 0; | 383 | 5.87M | # endif | 384 | 5.87M | #undef STEP_LINE | 385 | 5.87M | #undef SET_MINIMAL_WIDTH | 386 | 5.87M | #undef CONNECT_RECTANGLES | 387 | 5.87M | #undef FILL_TRAP_RECT | 388 | 5.87M | #undef FILL_TRAP_RECT_DIRECT | 389 | 5.87M | #undef FILL_TRAP_RECT_INRECT | 390 | 5.87M | #undef YMULT_QUO | 391 | 5.87M | xit: if (code < 0 && FILL_DIRECT) | 392 | 0 | return_error(code); | 393 | 5.87M | return_if_interrupt(dev->memory); | 394 | 5.87M | return code; | 395 | 5.87M | } | 396 | 5.87M | } |
|