diff options
Diffstat (limited to 'graphics/asymptote/runpicture.in')
-rw-r--r-- | graphics/asymptote/runpicture.in | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/graphics/asymptote/runpicture.in b/graphics/asymptote/runpicture.in index 2fa501f22a..d5c94badc3 100644 --- a/graphics/asymptote/runpicture.in +++ b/graphics/asymptote/runpicture.in @@ -233,13 +233,14 @@ void tensorshade(picture *f, patharray *g, bool stroke=false, { array *(*copyarray)(array *a)=copy ? copyArray : nop; array *(*copyarray2)(array *a)=copy ? copyArray2 : nop; - if(b == NULL) b=g; - size_t n=checkArrays(p,b); + size_t n=checkArrays(p,b ? b : g); + array& G=*copyarray(g); + array& B=b ? *copyarray(b) : G; size_t nz=checkArray(z); if(nz != 0) checkEqual(nz,n); - f->append(new drawTensorShade(*copyarray(g),stroke,fillrule,*copyarray2(p), - *copyarray(b),*copyarray2(z))); + f->append(new drawTensorShade(G,stroke,fillrule,*copyarray2(p),B, + *copyarray2(z))); } void functionshade(picture *f, patharray *g, bool stroke=false, @@ -564,14 +565,14 @@ void deconstruct(picture *f, picture *preamble=NULL, transform T=identity) if(!Delete) { drawElement *e=t.isIdentity() ? *p : (*p)->transformed(t); group->append(e); - if((*p)->endclip()) clip=true; - ostringstream buf; - buf << prefix << "_" << arg; - string outname=buildname(buf.str(),xformat); - group->shipout(preamble,outname,xformat,false,false); bbox b=group->bounds(); - if(!b.empty) { - fprintf(pipeout,"KEY=%s%d\n",e->KEY.c_str(),clip); + if(!b.empty && b.right > b.left && b.top > b.bottom) { + if((*p)->endclip()) clip=true; + ostringstream buf; + buf << prefix << "_" << arg; + string outname=buildname(buf.str(),xformat); + group->shipout(preamble,outname,xformat,false,false); + fprintf(pipeout,"KEY=%s%d\n",e->KEY.c_str(),clip || f->havepng()); const char *oldlocale=setlocale(LC_NUMERIC,NULL); bool override=oldlocale && strcmp(oldlocale,"C") != 0; @@ -607,33 +608,36 @@ void _draw(picture *f, path3 g, triple center=Zero, penarray *p, real opacity, real shininess, real metallic, real fresnel0, Int interaction=0) { - if(g.size() > 0) - f->append(new drawPath3(g,center,*p,opacity,shininess,metallic,fresnel0, + size_t n=g.size(); + for(unsigned int i=0; i < n; ++i) + f->append(new drawPath3(g.subpath((Int) i,Int(i+1)),center,*p,opacity, + shininess,metallic,fresnel0, (Interaction) intcast(interaction))); } // Bezier patch void draw(picture *f, triplearray2 *P, triple center, bool straight, penarray *p, real opacity, real shininess, real metallic, - real fresnel0, penarray *colors, Int interaction, + real fresnel0, penarray *colors, Int interaction, Int digits, bool primitive=false) { f->append(new drawBezierPatch(*P,center,straight,*p,opacity,shininess, metallic,fresnel0,*colors, - (Interaction) intcast(interaction),primitive)); + (Interaction) intcast(interaction), + digits,primitive)); } // Bezier triangle void drawbeziertriangle(picture *f, triplearray2 *P, triple center, bool straight, penarray *p, real opacity, real shininess, real metallic, real fresnel0, - penarray *colors, Int interaction, + penarray *colors, Int interaction, Int digits, bool primitive=false) { f->append(new drawBezierTriangle(*P,center,straight,*p,opacity,shininess, metallic,fresnel0,*colors, (Interaction) intcast(interaction), - primitive)); + digits,primitive)); } // General NURBS curve |