Simplify PostScript code generated by wxPostScriptDC to draw elliptic contour

Optimize procedure 'ellipse' (to draw elliptic contour) by doing all operations on the operand stack instead of creating local dictionary and temporary variables.
This commit is contained in:
Artur Wieczorek
2017-02-22 21:15:21 +01:00
parent f49528cc2f
commit 8a45881e44

View File

@@ -75,25 +75,18 @@ static const char *wxPostScriptHeaderConicTo = "\
} bind def\n\ } bind def\n\
"; ";
static const char *wxPostScriptHeaderEllipse = "\ static const char *wxPostScriptHeaderEllipse =
/ellipsedict 8 dict def\n\ "/ellipse {\n" // x y xrad yrad startangle endangle
ellipsedict /mtrx matrix put\n\ " matrix currentmatrix\n" // x y xrad yrad startangle endangle CTM
/ellipse {\n\ " 0 0 1\n" // x y xrad yrad startangle endangle CTM 0 0 1
ellipsedict begin\n\ " 10 4 roll\n" // CTM 0 0 1 x y xrad yrad startangle endangle
/endangle exch def\n\ " 6 2 roll\n" // CTM 0 0 1 startangle endangle x y xrad yrad
/startangle exch def\n\ " 4 2 roll\n" // CTM 0 0 1 startangle endangle xrad yrad x y
/yrad exch def\n\ " translate\n" // CTM 0 0 1 startangle endangle xrad yrad
/xrad exch def\n\ " scale\n" // CTM 0 0 1 startangle endangle
/y exch def\n\ " arc\n" // CTM
/x exch def\n\ " setmatrix\n" // -> restore transformation matrix
/savematrix mtrx currentmatrix def\n\ "} def\n";
x y translate\n\
xrad yrad scale\n\
0 0 1 startangle endangle arc\n\
savematrix setmatrix\n\
end\n\
} def\n\
";
static const char *wxPostScriptHeaderEllipticArc= "\ static const char *wxPostScriptHeaderEllipticArc= "\
/ellipticarcdict 8 dict def\n\ /ellipticarcdict 8 dict def\n\