diff options
author | Karl Berry <karl@freefriends.org> | 2019-03-27 22:27:57 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2019-03-27 22:27:57 +0000 |
commit | 9121faed0cf54a08882acf41120cf28fc3a32998 (patch) | |
tree | fe7f0c5e9ed02fe4a1fc389c27c88750c2807e43 /Build/source/utils/asymptote/picture.cc | |
parent | b8e24fbf964b4030f68a8484a53d405869693266 (diff) |
asy 2.48 sources
git-svn-id: svn://tug.org/texlive/trunk@50622 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/utils/asymptote/picture.cc')
-rw-r--r-- | Build/source/utils/asymptote/picture.cc | 50 |
1 files changed, 33 insertions, 17 deletions
diff --git a/Build/source/utils/asymptote/picture.cc b/Build/source/utils/asymptote/picture.cc index 7580ec727a9..f7582a7dca7 100644 --- a/Build/source/utils/asymptote/picture.cc +++ b/Build/source/utils/asymptote/picture.cc @@ -15,6 +15,7 @@ #include "drawlabel.h" #include "drawlayer.h" #include "drawsurface.h" +#include "drawpath3.h" using std::ifstream; using std::ofstream; @@ -323,7 +324,7 @@ pair picture::ratio(double (*m)(double, double)) bool first=true; pair b; bounds3(); - double fuzz=sqrtFuzz*(b3.Max()-b3.Min()).length(); + double fuzz=Fuzz*(b3.Max()-b3.Min()).length(); matrixstack ms; for(nodelist::const_iterator p=nodes.begin(); p != nodes.end(); ++p) { assert(*p); @@ -457,8 +458,18 @@ bool picture::texprocess(const string& texname, const string& outname, push_split(cmd,getSetting<string>("dvisvgmOptions")); cmd.push_back("-o"+outname); ostringstream buf; + bbox B=svgbbox(b,bboxshift); + /* + double height=b.top-b.bottom; + double threshold=12.0*tex2ps; + if(height < threshold) { + double offset=threshold-height; + b.top += offset; + b.bottom += offset; + } bbox B=b; B.shift(bboxshift+pair(1.99*cm,1.9*cm)); + */ buf << "--bbox=" << B.left << "bp " << B.bottom << "bp " @@ -595,8 +606,10 @@ int picture::epstopdf(const string& epsname, const string& pdfname) cmd.push_back("-dNOPAUSE"); cmd.push_back("-dBATCH"); cmd.push_back("-P"); - if(safe) + if(safe) { cmd.push_back("-dSAFER"); + cmd.push_back("-dDELAYSAFER"); // Support transparency extensions. + } cmd.push_back("-sDEVICE=pdfwrite"); cmd.push_back("-dEPSCrop"); cmd.push_back("-dSubsetFonts=true"); @@ -612,6 +625,11 @@ int picture::epstopdf(const string& epsname, const string& pdfname) cmd.push_back("-dDEVICEHEIGHTPOINTS="+String(max(b.top-b.bottom,3.0))); push_split(cmd,getSetting<string>("gsOptions")); cmd.push_back("-sOutputFile="+stripDir(pdfname)); + if(safe) { + cmd.push_back("-c"); + cmd.push_back(".setsafe"); + cmd.push_back("-f"); + } cmd.push_back(stripDir(epsname)); char *oldPath=NULL; @@ -963,7 +981,7 @@ bool picture::shipout(picture *preamble, const string& Prefix, bbox bshift=b; - transparency=false; +// transparency=false; int svgcount=0; typedef mem::list<drawElement *> clipstack; @@ -1088,8 +1106,8 @@ bool picture::shipout(picture *preamble, const string& Prefix, out.epilogue(); out.close(); - if(out.Transparency()) - transparency=true; +// if(out.Transparency()) +// transparency=true; if(Labels) { tex->resetpen(); @@ -1157,16 +1175,18 @@ bool picture::shipout(picture *preamble, const string& Prefix, } // render viewport with width x height pixels. -void picture::render(GLUnurbs *nurb, double size2, - const triple& Min, const triple& Max, - double perspective, bool lighton, bool transparent) const +void picture::render(double size2, const triple& Min, const triple& Max, + double perspective, bool transparent) const { for(nodelist::const_iterator p=nodes.begin(); p != nodes.end(); ++p) { assert(*p); - (*p)->render(nurb,size2,Min,Max,perspective,lighton,transparent); + (*p)->render(size2,Min,Max,perspective,transparent); } #ifdef HAVE_GL - drawBezierPatch::S.draw(); + if(transparent) + drawBezierPatch::S.drawTransparent(); + else + drawBezierPatch::S.drawOpaque(); #endif } @@ -1188,7 +1208,6 @@ struct Communicate : public gc { double *diffuse; double *ambient; double *specular; - bool viewportlighting; bool view; }; @@ -1203,8 +1222,7 @@ void glrenderWrapper() #endif glrender(com.prefix,com.pic,com.format,com.width,com.height,com.angle, com.zoom,com.m,com.M,com.shift,com.t,com.background,com.nlights, - com.lights,com.diffuse,com.ambient,com.specular,com.viewportlighting, - com.view); + com.lights,com.diffuse,com.ambient,com.specular,com.view); #endif } @@ -1213,7 +1231,7 @@ bool picture::shipout3(const string& prefix, const string& format, const triple& m, const triple& M, const pair& shift, double *t, double *background, size_t nlights, triple *lights, double *diffuse, double *ambient, - double *specular, bool viewportlighting, bool view) + double *specular, bool view) { if(getSetting<bool>("interrupt")) return true; @@ -1288,7 +1306,6 @@ bool picture::shipout3(const string& prefix, const string& format, com.diffuse=diffuse; com.ambient=ambient; com.specular=specular; - com.viewportlighting=viewportlighting; com.view=View; if(Wait) pthread_mutex_lock(&readyLock); @@ -1322,8 +1339,7 @@ bool picture::shipout3(const string& prefix, const string& format, #endif #ifdef HAVE_GL glrender(prefix,pic,outputformat,width,height,angle,zoom,m,M,shift,t, - background,nlights,lights,diffuse,ambient,specular,viewportlighting, - View,oldpid); + background,nlights,lights,diffuse,ambient,specular,View,oldpid); #ifdef HAVE_PTHREAD if(glthread && !offscreen && Wait) { pthread_cond_wait(&readySignal,&readyLock); |