| 236 |
|
|
| 237 |
|
// Check if neighbor differences are below pixel sampling threshold |
| 238 |
|
bool |
| 239 |
< |
RpictSimulManager::BelowSampThresh(int x, int y, const int noff[4][2]) const |
| 239 |
> |
RpictSimulManager::BelowSampThresh(const int x, const int y, const int noff[4][2]) const |
| 240 |
|
{ |
| 241 |
|
SCOLOR pval[4]; |
| 242 |
|
float dist[4]; |
| 243 |
|
int i, j; |
| 244 |
|
|
| 245 |
|
for (i = 4; i--; ) { // get pixels from tile store |
| 246 |
< |
int px = x + noff[i][0]; |
| 247 |
< |
int py = y + noff[i][1]; |
| 246 |
> |
const int px = x + noff[i][0]; |
| 247 |
> |
const int py = y + noff[i][1]; |
| 248 |
|
if (!doneMap.Check(px, py) || |
| 249 |
|
!pacc.GetPixel(px, py, pval[i], &dist[i])) |
| 250 |
|
return false; |
| 251 |
|
} |
| 252 |
< |
const bool spectr = (pacc.NC() > 3); |
| 253 |
< |
for (i = 4; --i; ) // do pairwise comparisons |
| 254 |
< |
for (j = i; j--; ) { |
| 255 |
< |
if (pacc.DepthType() && |
| 256 |
< |
(dist[i] - dist[j] > maxdiff*dist[j]) | |
| 252 |
> |
// do pairwise comparisons |
| 253 |
> |
for (i = (pacc.DepthType() != RDTnone)*4; --i > 0; ) |
| 254 |
> |
for (j = i; j--; ) |
| 255 |
> |
if ((dist[i] - dist[j] > maxdiff*dist[j]) | |
| 256 |
|
(dist[j] - dist[i] > maxdiff*dist[i])) |
| 257 |
|
return false; |
| 258 |
< |
if (spectr ? sbigsdiff(pval[i], pval[j], maxdiff) : |
| 259 |
< |
bigdiff(pval[i], pval[j], maxdiff)) |
| 258 |
> |
if (pacc.NC() > 3) { |
| 259 |
> |
for (i = 4; --i; ) |
| 260 |
> |
for (j = i; j--; ) |
| 261 |
> |
if (sbigsdiff(pval[i], pval[j], maxdiff)) |
| 262 |
|
return false; |
| 263 |
< |
} |
| 264 |
< |
return true; // linear interpolation OK |
| 263 |
> |
} else { |
| 264 |
> |
for (i = 4; --i; ) |
| 265 |
> |
for (j = i; j--; ) |
| 266 |
> |
if (bigdiff(pval[i], pval[j], maxdiff)) |
| 267 |
> |
return false; |
| 268 |
> |
} |
| 269 |
> |
return true; |
| 270 |
|
} |
| 271 |
|
|
| 272 |
|
// Fill an interior square patch with interpolated values |
| 397 |
|
for (x = y = 0; sampMap.Find(&x, &y); x++) |
| 398 |
|
if (BelowSampThresh(x, y, noff)) |
| 399 |
|
sampMap.Reset(x, y); |
| 394 |
– |
#if 0 |
| 395 |
– |
XXX Need to fix directions for spreading!! |
| 400 |
|
// spread sampling to neighbors... |
| 401 |
|
const ABitMap2 origSampMap = sampMap; |
| 402 |
|
for (x = 4; x--; ) { |
| 403 |
|
ABitMap2 stamp = origSampMap; |
| 404 |
< |
stamp.Shift(noff[x][0], noff[x][1]); |
| 404 |
> |
stamp.Shift(noff[x][0] + noff[(x+1)&3][0], |
| 405 |
> |
noff[x][1] + noff[(x+1)&3][1]); |
| 406 |
|
sampMap |= stamp; |
| 407 |
|
} // ...but don't resample what's done |
| 408 |
|
sampMap -= doneSamples; |
| 404 |
– |
#endif |
| 409 |
|
// interpolate smooth regions |
| 410 |
|
fillMap -= sampMap; |
| 411 |
+ |
fillMap -= doneSamples; |
| 412 |
|
for (x = y = 0; fillMap.Find(&x, &y); x++) |
| 413 |
|
FillSquare(x, y, noff); |
| 414 |
|
doneSamples |= doneMap; |
| 423 |
|
return false; |
| 424 |
|
x = y = 0; |
| 425 |
|
if (doneMap.Find(&x, &y, false)) { |
| 426 |
< |
sprintf(errmsg, "missed %ld tile pixels, e.g. (%d,%d)", |
| 427 |
< |
(long)doneMap.Width()*doneMap.Height() - |
| 428 |
< |
doneMap.SumTotal(), x, y); |
| 426 |
> |
sprintf(errmsg, "missed %.4f%% of pixels in rectangle\n", |
| 427 |
> |
100. - 100.*doneMap.SumTotal() / |
| 428 |
> |
doneMap.Width() / doneMap.Height()); |
| 429 |
|
error(WARNING, errmsg); |
| 430 |
|
} |
| 431 |
|
if ((prCB != NULL) & (barPix == NULL)) |
| 452 |
|
else if (prims) |
| 453 |
|
pacc.SetColorSpace(RDTrgb, prims); |
| 454 |
|
|
| 455 |
< |
int x0=0, y0=0; |
| 451 |
< |
if (tile) { |
| 452 |
< |
x0 = -tile[0]*TWidth(); |
| 453 |
< |
y0 = -tile[1]*THeight(); |
| 454 |
< |
} |
| 455 |
< |
return SetTile(tile) && RenderRect(x0, y0); |
| 455 |
> |
return SetTile(tile) && RenderRect(); |
| 456 |
|
} |
| 457 |
|
|
| 458 |
|
// Same but store as common-exponent COLR or SCOLR |
| 469 |
|
else if (prims) |
| 470 |
|
pacc.SetColorSpace(RDTrgbe, prims); |
| 471 |
|
|
| 472 |
< |
int x0=0, y0=0; |
| 473 |
< |
if (tile) { |
| 474 |
< |
x0 = -tile[0]*TWidth(); |
| 475 |
< |
y0 = -tile[1]*THeight(); |
| 476 |
< |
} |
| 477 |
< |
return SetTile(tile) && RenderRect(x0, y0); |
| 472 |
> |
return SetTile(tile) && RenderRect(); |
| 473 |
|
} |
| 474 |
|
|
| 475 |
|
// Same but also use 16-bit encoded depth buffer |
| 486 |
|
else if (prims) |
| 487 |
|
pacc.SetColorSpace(RDTrgbe, prims); |
| 488 |
|
|
| 489 |
< |
int x0=0, y0=0; |
| 495 |
< |
if (tile) { |
| 496 |
< |
x0 = -tile[0]*TWidth(); |
| 497 |
< |
y0 = -tile[1]*THeight(); |
| 498 |
< |
} |
| 499 |
< |
return SetTile(tile) && RenderRect(x0, y0); |
| 489 |
> |
return SetTile(tile) && RenderRect(); |
| 490 |
|
} |
| 491 |
|
|
| 492 |
|
// Back to float color with 16-bit depth |
| 503 |
|
else if (prims) |
| 504 |
|
pacc.SetColorSpace(RDTrgb, prims); |
| 505 |
|
|
| 506 |
< |
int x0=0, y0=0; |
| 517 |
< |
if (tile) { |
| 518 |
< |
x0 = -tile[0]*TWidth(); |
| 519 |
< |
y0 = -tile[1]*THeight(); |
| 520 |
< |
} |
| 521 |
< |
return SetTile(tile) && RenderRect(x0, y0); |
| 506 |
> |
return SetTile(tile) && RenderRect(); |
| 507 |
|
} |
| 508 |
|
|
| 509 |
|
// Allocate a new render bar |
| 805 |
|
if (RDTdepthT(dt) == RDTdshort) |
| 806 |
|
fprtresolu(GetWidth(), GetHeight(), pdfp[1]); |
| 807 |
|
|
| 808 |
< |
const int bheight = (psample > 1) ? int(4*psample+.99) : 8; |
| 808 |
> |
const int bheight = (psample > 1) ? int(8*psample+.99) : 16; |
| 809 |
|
const int vstep = bheight >> (psample > 1); |
| 810 |
|
|
| 811 |
|
NewBar(bheight); // render frame if we can |
| 1168 |
|
fclose(pdfp[0]); fclose(pdfp[1]); |
| 1169 |
|
return RDTnone; |
| 1170 |
|
} |
| 1171 |
< |
int bheight = (psample > 1) ? int(4*psample+.99) : 8; |
| 1171 |
> |
int bheight = (psample > 1) ? int(8*psample+.99) : 16; |
| 1172 |
|
if (bheight > GetHeight()-doneScans) |
| 1173 |
|
bheight = GetHeight()-doneScans; |
| 1174 |
|
int vstep = bheight >> (psample > 1); |