From eed6e9c2c229b10911a23976c47da79fc70a5b87 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 17 Jul 2011 21:47:09 +0200 Subject: - rename SPItem::i2d_affine to i2dt_affine, to clarify that it is item-to-desktop, not item-to-document. This should make it easier to spot bugs. - tag some instances where the document-to-desktop transform has been hardcoded (bzr r10466) --- src/extension/internal/latex-pstricks.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/extension/internal/latex-pstricks.cpp') diff --git a/src/extension/internal/latex-pstricks.cpp b/src/extension/internal/latex-pstricks.cpp index e09e7c024..18950295c 100644 --- a/src/extension/internal/latex-pstricks.cpp +++ b/src/extension/internal/latex-pstricks.cpp @@ -141,7 +141,7 @@ 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()); } -- cgit v1.2.3 From 84194ec2d0b9830437a5470320422265d5dd8c35 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Sat, 27 Aug 2011 12:20:13 +0200 Subject: Remove NRRect use from the extension system (bzr r10582.1.2) --- src/extension/internal/latex-pstricks.cpp | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) (limited to 'src/extension/internal/latex-pstricks.cpp') diff --git a/src/extension/internal/latex-pstricks.cpp b/src/extension/internal/latex-pstricks.cpp index 18950295c..49304de96 100644 --- a/src/extension/internal/latex-pstricks.cpp +++ b/src/extension/internal/latex-pstricks.cpp @@ -164,15 +164,14 @@ PrintLatex::finish (Inkscape::Extension::Print *mod) } unsigned int -PrintLatex::bind(Inkscape::Extension::Print *mod, Geom::Affine const *transform, float opacity) +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.size()) { 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; } @@ -194,8 +193,8 @@ unsigned int PrintLatex::comment (Inkscape::Extension::Print * module, 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) + 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. @@ -227,8 +226,9 @@ PrintLatex::fill(Inkscape::Extension::Print *mod, } 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) +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. @@ -277,12 +277,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 +304,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; -- cgit v1.2.3 From 4012b2b37ebabcbdf8a695b418ebc05b897ad0cd Mon Sep 17 00:00:00 2001 From: Kris De Gussem Date: Thu, 20 Oct 2011 21:12:09 +0200 Subject: cppcheck (bzr r10686) --- src/extension/internal/latex-pstricks.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/extension/internal/latex-pstricks.cpp') diff --git a/src/extension/internal/latex-pstricks.cpp b/src/extension/internal/latex-pstricks.cpp index 49304de96..72df53377 100644 --- a/src/extension/internal/latex-pstricks.cpp +++ b/src/extension/internal/latex-pstricks.cpp @@ -166,7 +166,7 @@ PrintLatex::finish (Inkscape::Extension::Print *mod) unsigned int PrintLatex::bind(Inkscape::Extension::Print *mod, Geom::Affine const &transform, float opacity) { - if (m_tr_stack.size()) { + if (!m_tr_stack.empty()) { Geom::Affine tr_top = m_tr_stack.top(); m_tr_stack.push(transform * tr_top); } else { -- cgit v1.2.3 From 72d63966662421b4316e74ff1fb0799c4629f146 Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Sun, 23 Oct 2011 01:00:27 -0700 Subject: Warning cleanup. (bzr r10691) --- src/extension/internal/latex-pstricks.cpp | 58 +++++++++++++++---------------- 1 file changed, 28 insertions(+), 30 deletions(-) (limited to 'src/extension/internal/latex-pstricks.cpp') diff --git a/src/extension/internal/latex-pstricks.cpp b/src/extension/internal/latex-pstricks.cpp index 72df53377..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; } @@ -146,25 +145,21 @@ PrintLatex::begin (Inkscape::Extension::Print *mod, SPDocument *doc) 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*/) { if (!m_tr_stack.empty()) { Geom::Affine tr_top = m_tr_stack.top(); @@ -176,27 +171,29 @@ PrintLatex::bind(Inkscape::Extension::Print *mod, Geom::Affine const &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, - Geom::OptRect const &pbox, Geom::OptRect const &dbox, Geom::OptRect 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; @@ -225,12 +222,13 @@ PrintLatex::fill(Inkscape::Extension::Print *mod, return 0; } -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) +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; -- cgit v1.2.3