diff options
Diffstat (limited to 'src/extension/internal/latex-pstricks.cpp')
| -rw-r--r-- | src/extension/internal/latex-pstricks.cpp | 76 |
1 files changed, 37 insertions, 39 deletions
diff --git a/src/extension/internal/latex-pstricks.cpp b/src/extension/internal/latex-pstricks.cpp index e09e7c024..dd5419ee4 100644 --- a/src/extension/internal/latex-pstricks.cpp +++ b/src/extension/internal/latex-pstricks.cpp @@ -56,8 +56,7 @@ PrintLatex::~PrintLatex (void) return; } -unsigned int -PrintLatex::setup (Inkscape::Extension::Print *mod) +unsigned int PrintLatex::setup(Inkscape::Extension::Print * /*mod*/) { return TRUE; } @@ -141,63 +140,60 @@ PrintLatex::begin (Inkscape::Extension::Print *mod, SPDocument *doc) os << "\\begin{pspicture}(" << doc->getWidth() << "," << doc->getHeight() << ")\n"; } - m_tr_stack.push( Geom::Scale(1, -1) * Geom::Translate(0, doc->getHeight())); + m_tr_stack.push( Geom::Scale(1, -1) * Geom::Translate(0, doc->getHeight())); /// @fixme hardcoded doc2dt transform return fprintf(_stream, "%s", os.str().c_str()); } -unsigned int -PrintLatex::finish (Inkscape::Extension::Print *mod) +unsigned int PrintLatex::finish(Inkscape::Extension::Print * /*mod*/) { - int res; - - if (!_stream) return 0; - - res = fprintf(_stream, "\\end{pspicture}\n"); + if (_stream) { + fprintf(_stream, "\\end{pspicture}\n"); - /* Flush stream to be sure. */ - (void) fflush(_stream); + // Flush stream to be sure. + fflush(_stream); - fclose(_stream); - _stream = NULL; + fclose(_stream); + _stream = NULL; + } return 0; } -unsigned int -PrintLatex::bind(Inkscape::Extension::Print *mod, Geom::Affine const *transform, float opacity) +unsigned int PrintLatex::bind(Inkscape::Extension::Print * /*mod*/, Geom::Affine const &transform, float /*opacity*/) { - Geom::Affine tr = *transform; - - if(m_tr_stack.size()){ + if (!m_tr_stack.empty()) { Geom::Affine tr_top = m_tr_stack.top(); - m_tr_stack.push(tr * tr_top); - }else - m_tr_stack.push(tr); + m_tr_stack.push(transform * tr_top); + } else { + m_tr_stack.push(transform); + } return 1; } -unsigned int -PrintLatex::release(Inkscape::Extension::Print *mod) +unsigned int PrintLatex::release(Inkscape::Extension::Print * /*mod*/) { m_tr_stack.pop(); return 1; } -unsigned int PrintLatex::comment (Inkscape::Extension::Print * module, - const char * comment) +unsigned int PrintLatex::comment(Inkscape::Extension::Print * /*mod*/, + const char * comment) { - if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned. + if (!_stream) { + return 0; // XXX: fixme, returning -1 as unsigned. + } return fprintf(_stream, "%%! %s\n",comment); } -unsigned int -PrintLatex::fill(Inkscape::Extension::Print *mod, - Geom::PathVector const &pathv, Geom::Affine const *transform, SPStyle const *style, - NRRect const *pbox, NRRect const *dbox, NRRect const *bbox) +unsigned int PrintLatex::fill(Inkscape::Extension::Print * /*mod*/, + Geom::PathVector const &pathv, Geom::Affine const &transform, SPStyle const *style, + Geom::OptRect const & /*pbox*/, Geom::OptRect const & /*dbox*/, Geom::OptRect const & /*bbox*/) { - if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned. + if (!_stream) { + return 0; // XXX: fixme, returning -1 as unsigned. + } if (style->fill.isColor()) { Inkscape::SVGOStringStream os; @@ -226,11 +222,13 @@ PrintLatex::fill(Inkscape::Extension::Print *mod, return 0; } -unsigned int -PrintLatex::stroke (Inkscape::Extension::Print *mod, Geom::PathVector const &pathv, const Geom::Affine *transform, const SPStyle *style, - const NRRect *pbox, const NRRect *dbox, const NRRect *bbox) +unsigned int PrintLatex::stroke(Inkscape::Extension::Print * /*mod*/, + Geom::PathVector const &pathv, Geom::Affine const &transform, SPStyle const *style, + Geom::OptRect const & /*pbox*/, Geom::OptRect const & /*dbox*/, Geom::OptRect const & /*bbox*/) { - if (!_stream) return 0; // XXX: fixme, returning -1 as unsigned. + if (!_stream) { + return 0; // XXX: fixme, returning -1 as unsigned. + } if (style->stroke.isColor()) { Inkscape::SVGOStringStream os; @@ -277,12 +275,12 @@ PrintLatex::stroke (Inkscape::Extension::Print *mod, Geom::PathVector const &pat // FIXME: why is 'transform' argument not used? void -PrintLatex::print_pathvector(SVGOStringStream &os, Geom::PathVector const &pathv_in, const Geom::Affine * /*transform*/) +PrintLatex::print_pathvector(SVGOStringStream &os, Geom::PathVector const &pathv_in, const Geom::Affine & /*transform*/) { if (pathv_in.empty()) return; -// Geom::Affine tf=*transform; // why was this here? +// Geom::Affine tf=transform; // why was this here? Geom::Affine tf_stack=m_tr_stack.top(); // and why is transform argument not used? Geom::PathVector pathv = pathv_in * tf_stack; // generates new path, which is a bit slow, but this doesn't have to be performance optimized @@ -304,7 +302,7 @@ PrintLatex::print_pathvector(SVGOStringStream &os, Geom::PathVector const &pathv } void -PrintLatex::print_2geomcurve(SVGOStringStream &os, Geom::Curve const & c ) +PrintLatex::print_2geomcurve(SVGOStringStream &os, Geom::Curve const &c) { using Geom::X; using Geom::Y; |
