summaryrefslogtreecommitdiff
path: root/Build/source/utils/asymptote/base/palette.asy
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2012-05-31 00:02:26 +0000
committerKarl Berry <karl@freefriends.org>2012-05-31 00:02:26 +0000
commit19fc9fd9a26973d87fad437ce549ffaba479df54 (patch)
treef40a9d2592b3cf827970c8bf54a1eebf9cc8f9c0 /Build/source/utils/asymptote/base/palette.asy
parent24b3bac312553b2cc61e94fda581aba311967f5c (diff)
asy 2.16 sources
git-svn-id: svn://tug.org/texlive/trunk@26734 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/base/palette.asy')
-rw-r--r--Build/source/utils/asymptote/base/palette.asy12
1 files changed, 5 insertions, 7 deletions
diff --git a/Build/source/utils/asymptote/base/palette.asy b/Build/source/utils/asymptote/base/palette.asy
index 9a2d1845604..b1d1985a323 100644
--- a/Build/source/utils/asymptote/base/palette.asy
+++ b/Build/source/utils/asymptote/base/palette.asy
@@ -54,14 +54,10 @@ pen[] adjust(picture pic, real min, real max, real rmin, real rmax,
real factor=palette.length/delta;
int minindex=floor(factor*(dmin-rmin));
if(minindex < 0) minindex=0;
- int maxindex=floor(factor*(dmax-rmin));
+ int maxindex=ceil(factor*(dmax-rmin));
if(maxindex > palette.length) maxindex=palette.length;
- if(minindex > 0 || maxindex < palette.length) {
- pen[] newpalette;
- for(int i=minindex; i < maxindex; ++i)
- newpalette.push(palette[i]);
- return newpalette;
- }
+ if(minindex > 0 || maxindex < palette.length)
+ return palette[minindex:maxindex];
}
return palette;
}
@@ -170,6 +166,8 @@ bounds image(picture pic=currentpicture, pair[] z, real[] f,
real rmax=pic.scale.z.T(bounds.max);
palette=adjust(pic,m,M,rmin,rmax,palette);
+ rmin=max(rmin,m);
+ rmax=min(rmax,M);
// Crop data to allowed range and scale
if(range != Full || pic.scale.z.scale.T != identity ||