Subversion Repositories filter_foundry

Compare Revisions

Regard whitespace Rev 501 → Rev 502

/trunk/CHANGELOG.md
3,7 → 3,8
## 1.7.0.17 [Work-In-Progress]
- Fixed theoretical bug that can crash a Photoshop application if PLUGIN.DLL exists but is not loaded.
- Added translation for German systems (*)
- map(i,n) now works like in Filter Factory and not like GIMP User Filter v0.8
- `map(i,n)` now works like in Filter Factory and not like GIMP User Filter v0.8.
- `val(i,a,b)` now returns the same value like Filter Factory for illegal values of i.
 
(*) This bug/solution was tested on Windows but needs to be verified and/or implemented on Mac.
 
/trunk/ff.h
74,7 → 74,12
} plugin_dll_slider_info;
#endif
 
// size: 0x2090 (8336 Bytes)
// The "gdata" structure contains all values which MUST be kept between filter invocations.
// All other working-data (which automatically gets calculated etc.) are NOT part of this structure.
// To increase performance, the lookup tables *tantab and *costab have been included here, so that
// they only need to be calculated one.
// size: 0x2098 (8344 Bytes) for 32-bit
// size: 0x20AC (8364 Bytes) for 64-bit
typedef struct globals_t_ {
PARM_T parm;
Boolean standalone;
/trunk/funcs.c
336,6 → 336,7
#ifdef PARSERTEST
return 0;
#else
if (z < 0 || z >= var['Z']) return 0;
if (x < 0)
x = 0;
else if (x >= var['X'])
344,8 → 345,7
y = 0;
else if (y >= var['Y'])
y = var['Y'] - 1;
return z >= 0 && z < var['Z'] ?
image_ptr[(long)gpb->inRowBytes * y + (long)nplanes * x + z] : 0;
return image_ptr[(long)gpb->inRowBytes * y + (long)nplanes * x + z];
#endif
}
 
494,14 → 494,33
// -------------------------------------------------------------------------------------------
 
/* val(i,a,b) Value of slider i, mapped onto the range a to b */
value_type ff_val(value_type i, value_type a, value_type b) {
 
value_type val_factory(value_type i, value_type a, value_type b) {
#ifdef PARSERTEST
return 0;
#else
if (i < 0 || i > 7) return 0;
return ((long)slider[i] * (b - a)) / 255 + a;
#endif
}
 
value_type val_foundry(value_type i, value_type a, value_type b) {
#ifdef PARSERTEST
return 0;
#else
return ((long)ff_ctl(i) * (b - a)) / 255 + a;
#endif
}
 
value_type ff_val(value_type i, value_type a, value_type b) {
// The only difference is the handling of invalid values of "i"
#ifdef use_filterfactory_implementation_val
return val_factory(i, a, b);
#else
return val_foundry(i, a, b);
#endif
}
 
// -------------------------------------------------------------------------------------------
 
/* map(i,n) Item n from mapping table i, where i is an integer between
825,7 → 844,8
#ifdef PARSERTEST
return 0;
#else
return d ? ((long)a * n) / d + ((long)b * (d - n)) / d : 0;
if (d == 0) return 0;
return ((long)a * n) / d + ((long)b * (d - n)) / d;
#endif
}
 
1100,7 → 1120,7
if (eax != 0) {
eax = (eax & 0xFFFF0000) | (FACTORY_C2D_LOOKUP[eax - 1] & 0xFFFF);
eax = eax << 9;
ebx = 205888; // 205888/65536 == pi
ebx = 205888; // 205888/65536 == pi == 3.14159265358979323846264338327
eax /= ebx;
}
}
1151,7 → 1171,7
ebx = y < 0 ? -y : y;
eax = x < 0 ? -x : x;
if (eax == ebx) {
eax = 27146; // 27146/65536 == sqrt(2)-1
eax = 27146; // 27146/65536 == sqrt(2)-1 == 0.41421356237
}
else {
if (eax > ebx) {
1225,7 → 1245,7
if (eax != 0) { // C2D_LOOKUP[-1] will never be called. Good!
eax = (eax & 0xFFFF0000) + (FACTORY_C2D_LOOKUP[eax - 1] & 0xFFFF);
eax = eax << 9;
ebx = 205888; // 205888/65536 == pi
ebx = 205888; // 205888/65536 == pi == 3.14159265358979323846264338327
eax /= ebx;
}
}
1290,7 → 1310,7
eax = (var['X'] - xmin) >> 1;
ebx = (var['Y'] - ymin) >> 1;
if (eax == ebx) {
eax = 27146; // 27146/65536 == sqrt(2)-1
eax = 27146; // 27146/65536 == sqrt(2)-1 == 0.41421356237
}
else {
if (eax > ebx) {
1343,7 → 1363,7
ebx = ebx < 0 ? -ebx : ebx;
 
if (eax == ebx) {
eax = 27146; // 27146/65536 == sqrt(2)-1
eax = 27146; // 27146/65536 == sqrt(2)-1 == 0.41421356237
}
else {
if (eax > ebx) {
1483,6 → 1503,7
}
 
value_type ff_get(value_type i) {
// The only difference is the handling of invalid values of "i"
#ifdef use_filterfactory_implementation_get
return factory_get(i);
#else
1516,6 → 1537,9
#else
long total;
int x, y, z;
 
if (d == 0) return 0;
 
// shift x,y from selection-relative to image relative required by rawsrc()
if (HAS_BIG_DOC(gpb)) {
x = var['x'] + BIGDOC_FILTER_RECT(gpb).left;
1534,7 → 1558,7
else
total = 0; // ... can this happen at all ?!
 
return d ? total / d : 0;
return total / d;
#endif
}
 
/trunk/funcs.h
57,6 → 57,7
#define use_filterfactory_implementation_d
#define use_filterfactory_implementation_m
#define use_filterfactory_implementation_M
#define use_filterfactory_implementation_val
#endif