204 |
|
register COLOR *sl0, *sl1, *mysl; |
205 |
|
register int i; |
206 |
|
|
207 |
< |
if (y < sb->nread - sb->nscans) { |
208 |
< |
fprintf(stderr, "%s: internal - cannot backspace in getascan\n", |
209 |
< |
progname); |
210 |
< |
exit(1); |
211 |
< |
} |
207 |
> |
if (y < sb->nread - sb->nscans) /* too far back? */ |
208 |
> |
return(NULL); |
209 |
|
for ( ; y >= sb->nread; sb->nread++) { /* read as necessary */ |
210 |
|
mysl = bscan(sb, sb->nread); |
211 |
|
if (sb->sampr == 1) { |
216 |
|
} |
217 |
|
} else { |
218 |
|
sl0 = getascan(sb->next, 2*y); |
219 |
+ |
if (sl0 == NULL) |
220 |
+ |
return(NULL); |
221 |
|
sl1 = getascan(sb->next, 2*y+1); |
222 |
|
for (i = 0; i < sb->len; i++) { |
223 |
|
copycolor(mysl[i], sl0[2*i]); |
290 |
|
double dx, dy; |
291 |
|
int ix, iy; |
292 |
|
|
293 |
+ |
if (sb->sampr == 1) { /* no need to interpolate */ |
294 |
+ |
sl0 = getascan(sb, y); |
295 |
+ |
copycolor(col, sl0[x]); |
296 |
+ |
return; |
297 |
+ |
} |
298 |
+ |
/* compute coordinates for sb */ |
299 |
|
ix = dx = (x+.5)/sb->sampr - .5; |
300 |
|
if (ix >= sb->len-1) ix--; |
301 |
|
dx -= (double)ix; |
304 |
|
dy -= (double)iy; |
305 |
|
/* get scanlines */ |
306 |
|
sl0 = getascan(sb, iy); |
307 |
+ |
if (sl0 == NULL) { |
308 |
+ |
fprintf(stderr, "%s: internal - cannot backspace in ascanval\n", |
309 |
+ |
progname); |
310 |
+ |
exit(1); |
311 |
+ |
} |
312 |
|
sl1 = getascan(sb, iy+1); |
313 |
|
/* 2D linear interpolation */ |
314 |
|
copycolor(col, sl0[ix]); |