9 |
|
|
10 |
|
#include "copyright.h" |
11 |
|
|
12 |
– |
#include <stdio.h> |
12 |
|
#include <stdlib.h> |
14 |
– |
#include <string.h> |
13 |
|
#include <math.h> |
16 |
– |
#include <time.h> |
14 |
|
|
15 |
|
#ifdef PCOND |
16 |
< |
#include "rtprocess.h" |
16 |
> |
#include "paths.h" |
17 |
|
#endif |
18 |
|
#include "tmprivat.h" |
19 |
+ |
#include "rtio.h" |
20 |
|
#include "resolu.h" |
21 |
|
|
22 |
|
#define GAMTSZ 4096 |
71 |
|
returnErr(TM_E_NOMEM); |
72 |
|
for (i = len; i--; ) { |
73 |
|
if (tmNeedMatrix(tms)) { /* apply color xform */ |
74 |
+ |
bi = 0; |
75 |
|
for (j = 3; j--; ) { |
76 |
|
vl = cd->cmatb[j][RED]*(int32)scan[i][RED] + |
77 |
|
cd->cmatb[j][GRN]*(int32)scan[i][GRN] + |
78 |
|
cd->cmatb[j][BLU]*(int32)scan[i][BLU] ; |
79 |
< |
if (vl < 0) cmon[j] = vl/0x10000; |
80 |
< |
else cmon[j] = vl>>16; |
79 |
> |
if (vl < 0) |
80 |
> |
cmon[j] = vl/(int32)0x10000; |
81 |
> |
else if ((cmon[j] = vl>>16) > bi) |
82 |
> |
bi = cmon[j]; |
83 |
|
} |
84 |
|
cmon[EXP] = scan[i][EXP]; |
85 |
+ |
while (bi >= 256) { /* handle overflow */ |
86 |
+ |
cmon[EXP]++; |
87 |
+ |
for (j = 3; j--; ) cmon[j] >>= 1; |
88 |
+ |
bi >>= 1; |
89 |
+ |
} |
90 |
|
} else |
91 |
|
copycolr(cmon, scan[i]); |
92 |
|
/* world luminance */ |
125 |
|
cmon[RED] = cmon[GRN] = cmon[BLU] = li; |
126 |
|
} else { |
127 |
|
for (j = 3; j--; ) |
128 |
< |
if (cmon[j] < 0) cmon[j] = 0; |
128 |
> |
cmon[j] *= (cmon[j] > 0); |
129 |
|
} |
130 |
|
bi = ( (uint32)GAMTSZ*cd->clfb[RED]*cmon[RED]/li ) >> 12; |
131 |
|
cs[3*i ] = bi>=GAMTSZ ? 255 : cd->gamb[bi]; |
157 |
|
void *vrh |
158 |
|
) |
159 |
|
{ |
160 |
< |
char fmt[32]; |
160 |
> |
char fmt[MAXFMTLEN]; |
161 |
|
struct radhead *rh = vrh; |
162 |
|
|
163 |
|
if (formatval(fmt, s)) { |
363 |
|
FILE *fp; |
364 |
|
{ |
365 |
|
char *funcName = fname==NULL ? "tmMapPicture" : fname; |
366 |
< |
TMstruct *tms; |
366 |
> |
TMstruct *tms = NULL; |
367 |
|
uby8 *cp; |
368 |
|
TMbright *lp; |
369 |
|
int err; |