summaryrefslogtreecommitdiff
path: root/graphics/asymptote/pen.h
diff options
context:
space:
mode:
authorNorbert Preining <norbert@preining.info>2019-09-30 03:00:43 +0000
committerNorbert Preining <norbert@preining.info>2019-09-30 03:00:43 +0000
commitbbbe8128e7ae9d816a221377dbf5ff3969bb203b (patch)
tree0283a521760b879b30e61872f14f235645745675 /graphics/asymptote/pen.h
parent14ce8b68fe7df49e8a8891bb94c63b9a846da232 (diff)
CTAN sync 201909300300
Diffstat (limited to 'graphics/asymptote/pen.h')
-rw-r--r--graphics/asymptote/pen.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/graphics/asymptote/pen.h b/graphics/asymptote/pen.h
index 1208f4a60c..d9572eee5c 100644
--- a/graphics/asymptote/pen.h
+++ b/graphics/asymptote/pen.h
@@ -136,14 +136,14 @@ inline bool operator == (const Transparency& a, const Transparency& b) {
extern const char* BlendMode[];
extern const Int nBlendMode;
+const double bytescale=256.0*(1.0-DBL_EPSILON);
+
// Map [0,1] to [0,255]
inline unsigned int byte(double r)
{
if(r < 0.0) r=0.0;
else if(r > 1.0) r=1.0;
- int a=(int)(256.0*r);
- if(a == 256) a=255;
- return a;
+ return (int)(bytescale*r);
}
class pen;