Simplify PostScript code generated by wxPostScriptDC to draw elliptic arc

Optimize procedure 'ellipticarc' 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:18:45 +01:00
parent 8a45881e44
commit 74ab36c125
2 changed files with 17 additions and 21 deletions

View File

@@ -128,6 +128,7 @@ All (GUI):
- Deprecate wxEVT_STC_KEY and wxEVT_STC_URIDROPPED events (NewPagodi). - Deprecate wxEVT_STC_KEY and wxEVT_STC_URIDROPPED events (NewPagodi).
- Optimize font registration in PostScript code emitted by wxPostScriptDC. - Optimize font registration in PostScript code emitted by wxPostScriptDC.
- Fix drawing filled arc with wxPostScriptDC::DrawArc(). - Fix drawing filled arc with wxPostScriptDC::DrawArc().
- Optimize PostScript code emitted by wxPostScriptDC to draw elliptic arcs.
wxGTK: wxGTK:

View File

@@ -88,27 +88,22 @@ static const char *wxPostScriptHeaderEllipse =
" setmatrix\n" // -> restore transformation matrix " setmatrix\n" // -> restore transformation matrix
"} def\n"; "} def\n";
static const char *wxPostScriptHeaderEllipticArc= "\ static const char *wxPostScriptHeaderEllipticArc=
/ellipticarcdict 8 dict def\n\ "/ellipticarc {\n" // x y xrad yrad startangle endangle do_fill
ellipticarcdict /mtrx matrix put\n\ " dup\n" // x y xrad yrad startangle endangle do_fill do_fill
/ellipticarc\n\ " 8 1 roll\n" // do_fill x y xrad yrad startangle endangle do_fill
{ ellipticarcdict begin\n\ " matrix currentmatrix\n" // do_fill x y xrad yrad startangle endangle do_fill CTM
/do_fill exch def\n\ " 0 0 1\n" // do_fill x y xrad yrad startangle endangle do_fill CTM 0 0 1
/endangle exch def\n\ " 11 4 roll\n" // do_fill CTM 0 0 1 x y xrad yrad startangle endangle do_fill
/startangle exch def\n\ " 7 3 roll\n" // do_fill CTM 0 0 1 startangle endangle do_fill x y xrad yrad
/yrad exch def\n\ " 4 2 roll\n" // do_fill CTM 0 0 1 startangle endangle do_fill xrad yrad x y
/xrad exch def \n\ " translate\n" // do_fill CTM 0 0 1 startangle endangle do_fill xrad yrad
/y exch def\n\ " scale\n" // do_fill CTM 0 0 1 startangle endangle do_fill
/x exch def\n\ " { 0 0 moveto } if\n" // do_fill CTM 0 0 1 startangle endangle
/savematrix mtrx currentmatrix def\n\ " arc\n" // do_fill CTM -> draw arc
x y translate\n\ " setmatrix\n" // do_fill -> restore transformation matrix
xrad yrad scale\n\ " { fill }{ stroke } ifelse\n" // -> fill or stroke
do_fill { 0 0 moveto } if\n\ "} def\n";
0 0 1 startangle endangle arc\n\
savematrix setmatrix\n\
do_fill { fill }{ stroke } ifelse\n\
end\n\
} def\n";
static const char *wxPostScriptHeaderSpline = "\ static const char *wxPostScriptHeaderSpline = "\
/DrawSplineSection {\n\ /DrawSplineSection {\n\