mirror of
https://github.com/gnustep/libs-back.git
synced 2025-02-23 11:51:27 +00:00
Clamp to range when getting samples. Use -doubleValue instead of -intValue where values may be real numbers.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/back/trunk@16748 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
1707acd988
commit
3d01a03dd5
2 changed files with 16 additions and 4 deletions
|
@ -1,3 +1,9 @@
|
|||
2003-05-19 15:56 Alexander Malmberg <alexander@malmberg.org>
|
||||
|
||||
* Source/art/shfill.m (function_getsample): Clamp to range.
|
||||
(function_setup): Use -doubleValue, not -intValue, for values that
|
||||
are allowed to be real numbers.
|
||||
|
||||
2003-05-18 Benhur Stein
|
||||
|
||||
* Source/xlib/XGGState.m (-copyBits:fromRect:toPoint:): Draw
|
||||
|
|
|
@ -20,6 +20,10 @@
|
|||
Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
/*
|
||||
this code is rather experimental
|
||||
*/
|
||||
|
||||
#include <math.h>
|
||||
|
||||
#include "ARTGState.h"
|
||||
|
@ -264,6 +268,8 @@ static double function_getsample(function_t *f,int sample,int i)
|
|||
}
|
||||
|
||||
v=f->decode[i*2]+v*(f->decode[i*2+1]-f->decode[i*2]);
|
||||
if (v<f->range[i*2]) v=f->range[i*2];
|
||||
if (v>f->range[i*2+1]) v=f->range[i*2+1];
|
||||
return v;
|
||||
}
|
||||
|
||||
|
@ -481,24 +487,24 @@ static BOOL function_setup(NSDictionary *d,function_t *f)
|
|||
|
||||
a=[d objectForKey: @"Domain"];
|
||||
for (i=0;i<f->num_in*2;i++)
|
||||
f->domain[i]=[[a objectAtIndex: i] intValue];
|
||||
f->domain[i]=[[a objectAtIndex: i] doubleValue];
|
||||
|
||||
a=[d objectForKey: @"Range"];
|
||||
for (i=0;i<f->num_out*2;i++)
|
||||
f->decode[i]=f->range[i]=[[a objectAtIndex: i] intValue];
|
||||
f->decode[i]=f->range[i]=[[a objectAtIndex: i] doubleValue];
|
||||
|
||||
a=[d objectForKey: @"Decode"];
|
||||
if (a)
|
||||
{
|
||||
for (i=0;i<f->num_out*2;i++)
|
||||
f->decode[i]=[[a objectAtIndex: i] intValue];
|
||||
f->decode[i]=[[a objectAtIndex: i] doubleValue];
|
||||
}
|
||||
|
||||
a=[d objectForKey: @"Encode"];
|
||||
if (a)
|
||||
{
|
||||
for (i=0;i<f->num_in*2;i++)
|
||||
f->encode[i]=[[a objectAtIndex: i] intValue];
|
||||
f->encode[i]=[[a objectAtIndex: i] doubleValue];
|
||||
}
|
||||
|
||||
f->eval=function_eval;
|
||||
|
|
Loading…
Reference in a new issue