diff options
| author | Krzysztof Kosi??ski <tweenk.pl@gmail.com> | 2011-08-27 10:20:13 +0000 |
|---|---|---|
| committer | Krzysztof Kosinski <tweenk.pl@gmail.com> | 2011-08-27 10:20:13 +0000 |
| commit | 84194ec2d0b9830437a5470320422265d5dd8c35 (patch) | |
| tree | 120f0d8dca7933dad09e455dbc4ec91f33f75029 /src | |
| parent | Refactor SPItem bounding box methods: remove NRRect usage and make code (diff) | |
| download | inkscape-84194ec2d0b9830437a5470320422265d5dd8c35.tar.gz inkscape-84194ec2d0b9830437a5470320422265d5dd8c35.zip | |
Remove NRRect use from the extension system
(bzr r10582.1.2)
Diffstat (limited to 'src')
| -rw-r--r-- | src/extension/implementation/implementation.cpp | 174 | ||||
| -rw-r--r-- | src/extension/implementation/implementation.h | 93 | ||||
| -rw-r--r-- | src/extension/internal/emf-win32-print.cpp | 20 | ||||
| -rw-r--r-- | src/extension/internal/emf-win32-print.h | 18 | ||||
| -rw-r--r-- | src/extension/internal/latex-pstricks.cpp | 28 | ||||
| -rw-r--r-- | src/extension/internal/latex-pstricks.h | 16 | ||||
| -rw-r--r-- | src/extension/print.cpp | 38 | ||||
| -rw-r--r-- | src/extension/print.h | 22 | ||||
| -rw-r--r-- | src/libnrtype/Layout-TNG-Output.cpp | 5 | ||||
| -rw-r--r-- | src/print.cpp | 23 | ||||
| -rw-r--r-- | src/print.h | 7 | ||||
| -rw-r--r-- | src/sp-image.cpp | 4 | ||||
| -rw-r--r-- | src/sp-shape.cpp | 7 | ||||
| -rw-r--r-- | src/sp-symbol.cpp | 2 |
14 files changed, 149 insertions, 308 deletions
diff --git a/src/extension/implementation/implementation.cpp b/src/extension/implementation/implementation.cpp index 63181d0c4..6f6bddb93 100644 --- a/src/extension/implementation/implementation.cpp +++ b/src/extension/implementation/implementation.cpp @@ -29,72 +29,15 @@ namespace Inkscape { namespace Extension { namespace Implementation { -/** - * \return Was the load sucessful? - * \brief This function is the stub load. It just returns success. - * \param module The Extension that should be loaded. - */ -bool -Implementation::load(Inkscape::Extension::Extension */*module*/) { - return TRUE; -} /* Implementation::load */ - -void -Implementation::unload(Inkscape::Extension::Extension */*module*/) { - return; -} /* Implementation::unload */ - -/** \brief Create a new document cache object - \param ext The extension that is referencing us - \param doc The document to create the cache of - \return A new document cache that is valid as long as the document - is not changed. - - This function just returns \c NULL. Subclasses are likely - to reimplement it to do something useful. -*/ -ImplementationDocumentCache * -Implementation::newDocCache( Inkscape::Extension::Extension * /*ext*/, Inkscape::UI::View::View * /*view*/ ) { - return NULL; -} - -bool -Implementation::check(Inkscape::Extension::Extension */*module*/) { - /* If there are no checks, they all pass */ - return TRUE; -} /* Implemenation::check */ - -bool -Implementation::cancelProcessing (void) { - return true; -} - -void -Implementation::commitDocument (void) { - return; -} - Gtk::Widget * Implementation::prefs_input(Inkscape::Extension::Input *module, gchar const */*filename*/) { return module->autogui(NULL, NULL); -} /* Implementation::prefs_input */ - -SPDocument * -Implementation::open(Inkscape::Extension::Input */*module*/, gchar const */*filename*/) { - /* throw open_failed(); */ - return NULL; -} /* Implementation::open */ +} Gtk::Widget * Implementation::prefs_output(Inkscape::Extension::Output *module) { return module->autogui(NULL, NULL); -} /* Implementation::prefs_output */ - -void -Implementation::save(Inkscape::Extension::Output */*module*/, SPDocument */*doc*/, gchar const */*filename*/) { - /* throw save_fail */ - return; -} /* Implementation::save */ +} Gtk::Widget *Implementation::prefs_effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View * view, sigc::signal<void> * changeSignal, ImplementationDocumentCache * /*docCache*/) { @@ -117,119 +60,6 @@ Gtk::Widget *Implementation::prefs_effect(Inkscape::Extension::Effect *module, I return module->autogui(current_document, const_cast<Inkscape::XML::Node *>(first_select), changeSignal); } // Implementation::prefs_effect -void -Implementation::effect(Inkscape::Extension::Effect */*module*/, Inkscape::UI::View::View */*document*/, ImplementationDocumentCache * /*docCache*/) { - /* throw filter_fail */ - return; -} /* Implementation::filter */ - -unsigned int -Implementation::setup(Inkscape::Extension::Print */*module*/) -{ - return 0; -} - -unsigned int -Implementation::set_preview(Inkscape::Extension::Print */*module*/) -{ - return 0; -} - - -unsigned int -Implementation::begin(Inkscape::Extension::Print */*module*/, SPDocument */*doc*/) -{ - return 0; -} - -unsigned int -Implementation::finish(Inkscape::Extension::Print */*module*/) -{ - return 0; -} - - -/* Rendering methods */ -unsigned int -Implementation::bind(Inkscape::Extension::Print */*module*/, Geom::Affine const */*transform*/, float /*opacity*/) -{ - return 0; -} - -unsigned int -Implementation::release(Inkscape::Extension::Print */*module*/) -{ - return 0; -} - -unsigned int -Implementation::comment(Inkscape::Extension::Print */*module*/, char const */*comment*/) -{ - return 0; -} - -unsigned int -Implementation::fill(Inkscape::Extension::Print */*module*/, Geom::PathVector const &/*pathv*/, Geom::Affine const */*ctm*/, SPStyle const */*style*/, - NRRect const */*pbox*/, NRRect const */*dbox*/, NRRect const */*bbox*/) -{ - return 0; -} - -unsigned int -Implementation::stroke(Inkscape::Extension::Print */*module*/, Geom::PathVector const &/*pathv*/, Geom::Affine const */*transform*/, SPStyle const */*style*/, - NRRect const */*pbox*/, NRRect const */*dbox*/, NRRect const */*bbox*/) -{ - return 0; -} - -unsigned int -Implementation::image(Inkscape::Extension::Print */*module*/, unsigned char */*px*/, unsigned int /*w*/, unsigned int /*h*/, unsigned int /*rs*/, - Geom::Affine const */*transform*/, SPStyle const */*style*/) -{ - return 0; -} - -unsigned int -Implementation::text(Inkscape::Extension::Print */*module*/, char const */*text*/, - Geom::Point /*p*/, SPStyle const */*style*/) -{ - return 0; -} - -void -Implementation::processPath(Inkscape::XML::Node * /*node*/) -{ - return; -} - -/** - \brief Tell the printing engine whether text should be text or path - \retval true Render the text as a path - \retval false Render text using the text function (above) - - Default value is false because most printing engines will support - paths more than they'll support text. (at least they do today) -*/ -bool -Implementation::textToPath(Inkscape::Extension::Print */*ext*/) -{ - return false; -} - -/** - \brief Get "fontEmbedded" param, i.e. tell the printing engine whether fonts should be embedded - \retval TRUE Fonts have to be embedded in the output so that the user might not need to install fonts to have the interpreter read the document correctly - \retval FALSE Not embed fonts - - Only available for Adobe Type 1 fonts in EPS output as of now -*/ - -bool -Implementation::fontEmbedded(Inkscape::Extension::Print * /*ext*/) -{ - return false; -} - } /* namespace Implementation */ } /* namespace Extension */ } /* namespace Inkscape */ diff --git a/src/extension/implementation/implementation.h b/src/extension/implementation/implementation.h index bd3edb43b..4a01a3e84 100644 --- a/src/extension/implementation/implementation.h +++ b/src/extension/implementation/implementation.h @@ -9,8 +9,8 @@ important for implementing the extensions themselves. This file contains the base class for all of that. */ -#ifndef __INKSCAPE_EXTENSION_IMPLEMENTATION_H__ -#define __INKSCAPE_EXTENSION_IMPLEMENTATION_H__ +#ifndef SEEN_INKSCAPE_EXTENSION_IMPLEMENTATION_H +#define SEEN_INKSCAPE_EXTENSION_IMPLEMENTATION_H #include <gtk/gtk.h> #include <gdkmm/types.h> @@ -54,16 +54,23 @@ public: virtual ~Implementation() {} /* ----- Basic functions for all Extension ----- */ - virtual bool load(Inkscape::Extension::Extension *module); - - virtual void unload(Inkscape::Extension::Extension *module); - virtual ImplementationDocumentCache * newDocCache (Inkscape::Extension::Extension * ext, Inkscape::UI::View::View * doc); + virtual bool load(Inkscape::Extension::Extension *module) { return true; } + + virtual void unload(Inkscape::Extension::Extension *module) {} + /** \brief Create a new document cache object + * This function just returns \c NULL. Subclasses are likely + * to reimplement it to do something useful. + * \param ext The extension that is referencing us + * \param doc The document to create the cache of + * \return A new document cache that is valid as long as the document + * is not changed. */ + virtual ImplementationDocumentCache * newDocCache (Inkscape::Extension::Extension * ext, Inkscape::UI::View::View * doc) { return NULL; } /** Verify any dependencies. */ - virtual bool check(Inkscape::Extension::Extension *module); + virtual bool check(Inkscape::Extension::Extension *module) { return true; } - virtual bool cancelProcessing (void); - virtual void commitDocument (void); + virtual bool cancelProcessing () { return true; } + virtual void commitDocument () {} /* ----- Input functions ----- */ /** Find out information about the file. */ @@ -71,65 +78,75 @@ public: gchar const *filename); virtual SPDocument *open(Inkscape::Extension::Input *module, - gchar const *filename); + gchar const *filename) { return NULL; } /* ----- Output functions ----- */ /** Find out information about the file. */ virtual Gtk::Widget *prefs_output(Inkscape::Extension::Output *module); - virtual void save(Inkscape::Extension::Output *module, SPDocument *doc, gchar const *filename); + virtual void save(Inkscape::Extension::Output *module, SPDocument *doc, gchar const *filename) {} /* ----- Effect functions ----- */ /** Find out information about the file. */ virtual Gtk::Widget * prefs_effect(Inkscape::Extension::Effect *module, - Inkscape::UI::View::View * view, - sigc::signal<void> * changeSignal, - ImplementationDocumentCache * docCache); + Inkscape::UI::View::View *view, + sigc::signal<void> *changeSignal, + ImplementationDocumentCache *docCache); virtual void effect(Inkscape::Extension::Effect *module, Inkscape::UI::View::View *document, - ImplementationDocumentCache * docCache); + ImplementationDocumentCache *docCache) {} /* ----- Print functions ----- */ - virtual unsigned setup(Inkscape::Extension::Print *module); - virtual unsigned set_preview(Inkscape::Extension::Print *module); + virtual unsigned setup(Inkscape::Extension::Print *module) { return 0; } + virtual unsigned set_preview(Inkscape::Extension::Print *module) { return 0; } virtual unsigned begin(Inkscape::Extension::Print *module, - SPDocument *doc); - virtual unsigned finish(Inkscape::Extension::Print *module); - virtual bool textToPath(Inkscape::Extension::Print *ext); - virtual bool fontEmbedded(Inkscape::Extension::Print * ext); + SPDocument *doc) { return 0; } + virtual unsigned finish(Inkscape::Extension::Print *module) { return 0; } + /** \brief Tell the printing engine whether text should be text or path + * Default value is false because most printing engines will support + * paths more than they'll support text. (at least they do today) + * \retval true Render the text as a path + * \retval false Render text using the text function (above) */ + virtual bool textToPath(Inkscape::Extension::Print *ext) { return false; } + /** \brief Get "fontEmbedded" param, i.e. tell the printing engine whether fonts should be embedded + * Only available for Adobe Type 1 fonts in EPS output as of now + * \retval true Fonts have to be embedded in the output so that the user might not need + * to install fonts to have the interpreter read the document correctly + * \retval false Do not embed fonts */ + virtual bool fontEmbedded(Inkscape::Extension::Print * ext) { return false; } /* ----- Rendering methods ----- */ virtual unsigned bind(Inkscape::Extension::Print *module, - Geom::Affine const *transform, - float opacity); - virtual unsigned release(Inkscape::Extension::Print *module); - virtual unsigned comment(Inkscape::Extension::Print *module, const char * comment); + Geom::Affine const &transform, + float opacity) { return 0; } + virtual unsigned release(Inkscape::Extension::Print *module) { return 0; } + virtual unsigned comment(Inkscape::Extension::Print *module, char const *comment) { return 0; } virtual unsigned fill(Inkscape::Extension::Print *module, Geom::PathVector const &pathv, - Geom::Affine const *ctm, + Geom::Affine const &ctm, SPStyle const *style, - NRRect const *pbox, - NRRect const *dbox, - NRRect const *bbox); + Geom::OptRect const &pbox, + Geom::OptRect const &dbox, + Geom::OptRect const &bbox) { return 0; } virtual unsigned stroke(Inkscape::Extension::Print *module, Geom::PathVector const &pathv, - Geom::Affine const *transform, + Geom::Affine const &transform, SPStyle const *style, - NRRect const *pbox, - NRRect const *dbox, - NRRect const *bbox); + Geom::OptRect const &pbox, + Geom::OptRect const &dbox, + Geom::OptRect const &bbox) { return 0; } virtual unsigned image(Inkscape::Extension::Print *module, unsigned char *px, unsigned int w, unsigned int h, unsigned int rs, - Geom::Affine const *transform, - SPStyle const *style); + Geom::Affine const &transform, + SPStyle const *style) { return 0; } virtual unsigned text(Inkscape::Extension::Print *module, char const *text, - Geom::Point p, - SPStyle const *style); - virtual void processPath(Inkscape::XML::Node * node); + Geom::Point const &p, + SPStyle const *style) { return 0; } + virtual void processPath(Inkscape::XML::Node * node) {} }; diff --git a/src/extension/internal/emf-win32-print.cpp b/src/extension/internal/emf-win32-print.cpp index be5bf96c3..d08304a00 100644 --- a/src/extension/internal/emf-win32-print.cpp +++ b/src/extension/internal/emf-win32-print.cpp @@ -448,15 +448,13 @@ PrintEmfWin32::flush_fill() } unsigned int -PrintEmfWin32::bind(Inkscape::Extension::Print * /*mod*/, Geom::Affine const *transform, float /*opacity*/) -{ - Geom::Affine tr = *transform; - +PrintEmfWin32::bind(Inkscape::Extension::Print * /*mod*/, Geom::Affine const &transform, float /*opacity*/) +{ if (m_tr_stack.size()) { Geom::Affine tr_top = m_tr_stack.top(); - m_tr_stack.push(tr * tr_top); + m_tr_stack.push(transform * tr_top); } else { - m_tr_stack.push(tr); + m_tr_stack.push(transform); } return 1; @@ -471,8 +469,8 @@ PrintEmfWin32::release(Inkscape::Extension::Print * /*mod*/) unsigned int PrintEmfWin32::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 (!hdc) return 0; @@ -500,8 +498,8 @@ PrintEmfWin32::fill(Inkscape::Extension::Print * /*mod*/, unsigned int PrintEmfWin32::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*/) + Geom::PathVector const &pathv, const Geom::Affine &/*transform*/, const SPStyle *style, + Geom::OptRect const &/*pbox*/, Geom::OptRect const &/*dbox*/, Geom::OptRect const &/*bbox*/) { if (!hdc) return 0; @@ -846,7 +844,7 @@ PrintEmfWin32::textToPath(Inkscape::Extension::Print * ext) } unsigned int -PrintEmfWin32::text(Inkscape::Extension::Print * /*mod*/, char const *text, Geom::Point p, +PrintEmfWin32::text(Inkscape::Extension::Print * /*mod*/, char const *text, Geom::Point const &p, SPStyle const *const style) { if (!hdc) return 0; diff --git a/src/extension/internal/emf-win32-print.h b/src/extension/internal/emf-win32-print.h index 44327d35e..71ce5d6d0 100644 --- a/src/extension/internal/emf-win32-print.h +++ b/src/extension/internal/emf-win32-print.h @@ -62,17 +62,21 @@ public: virtual unsigned int finish (Inkscape::Extension::Print * module); /* Rendering methods */ - virtual unsigned int bind(Inkscape::Extension::Print *module, Geom::Affine const *transform, float opacity); + virtual unsigned int bind(Inkscape::Extension::Print *module, Geom::Affine const &transform, float opacity); virtual unsigned int release(Inkscape::Extension::Print *module); - virtual unsigned int fill (Inkscape::Extension::Print * module, - Geom::PathVector const &pathv, const Geom::Affine *ctm, const SPStyle *style, - const NRRect *pbox, const NRRect *dbox, const NRRect *bbox); + virtual unsigned int fill (Inkscape::Extension::Print *module, + Geom::PathVector const &pathv, + Geom::Affine const &ctm, SPStyle const *style, + Geom::OptRect const &pbox, Geom::OptRect const &dbox, + Geom::OptRect const &bbox); virtual unsigned int stroke (Inkscape::Extension::Print * module, - Geom::PathVector const &pathv, const Geom::Affine *transform, const SPStyle *style, - const NRRect *pbox, const NRRect *dbox, const NRRect *bbox); + Geom::PathVector const &pathv, + Geom::Affine const &ctm, SPStyle const *style, + Geom::OptRect const &pbox, Geom::OptRect const &dbox, + Geom::OptRect const &bbox); virtual unsigned int comment(Inkscape::Extension::Print *module, const char * comment); virtual unsigned int text(Inkscape::Extension::Print *module, char const *text, - Geom::Point p, SPStyle const *style); + Geom::Point const &p, SPStyle const *style); bool textToPath (Inkscape::Extension::Print * ext); static void init (void); 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; diff --git a/src/extension/internal/latex-pstricks.h b/src/extension/internal/latex-pstricks.h index 64b0de474..5bc6eeb22 100644 --- a/src/extension/internal/latex-pstricks.h +++ b/src/extension/internal/latex-pstricks.h @@ -33,7 +33,7 @@ class PrintLatex : public Inkscape::Extension::Implementation::Implementation { std::stack<Geom::Affine> m_tr_stack; - void print_pathvector(SVGOStringStream &os, Geom::PathVector const &pathv_in, const Geom::Affine * /*transform*/); + void print_pathvector(SVGOStringStream &os, Geom::PathVector const &pathv_in, const Geom::Affine & /*transform*/); void print_2geomcurve(SVGOStringStream &os, Geom::Curve const & c ); public: @@ -47,13 +47,17 @@ public: virtual unsigned int finish (Inkscape::Extension::Print * module); /* Rendering methods */ - virtual unsigned int bind(Inkscape::Extension::Print *module, Geom::Affine const *transform, float opacity); + virtual unsigned int bind(Inkscape::Extension::Print *module, Geom::Affine const &transform, float opacity); virtual unsigned int release(Inkscape::Extension::Print *module); - virtual unsigned int fill (Inkscape::Extension::Print * module, Geom::PathVector const &pathv, const Geom::Affine *ctm, const SPStyle *style, - const NRRect *pbox, const NRRect *dbox, const NRRect *bbox); - virtual unsigned int stroke (Inkscape::Extension::Print * module, Geom::PathVector const &pathv, const Geom::Affine *transform, const SPStyle *style, - const NRRect *pbox, const NRRect *dbox, const NRRect *bbox); + virtual unsigned int fill (Inkscape::Extension::Print *module, Geom::PathVector const &pathv, + Geom::Affine const &ctm, SPStyle const *style, + Geom::OptRect const &pbox, Geom::OptRect const &dbox, + Geom::OptRect const &bbox); + virtual unsigned int stroke (Inkscape::Extension::Print *module, Geom::PathVector const &pathv, + Geom::Affine const &ctm, SPStyle const *style, + Geom::OptRect const &pbox, Geom::OptRect const &dbox, + Geom::OptRect const &bbox); virtual unsigned int comment(Inkscape::Extension::Print *module, const char * comment); bool textToPath (Inkscape::Extension::Print * ext); diff --git a/src/extension/print.cpp b/src/extension/print.cpp index f2dbb0b9b..c37e9425c 100644 --- a/src/extension/print.cpp +++ b/src/extension/print.cpp @@ -15,7 +15,7 @@ namespace Inkscape { namespace Extension { -Print::Print (Inkscape::XML::Node * in_repr, Implementation::Implementation * in_imp) +Print::Print (Inkscape::XML::Node *in_repr, Implementation::Implementation *in_imp) : Extension(in_repr, in_imp) , base(NULL) , drawing(NULL) @@ -24,23 +24,23 @@ Print::Print (Inkscape::XML::Node * in_repr, Implementation::Implementation * in { } -Print::~Print (void) +Print::~Print () {} bool -Print::check (void) +Print::check () { return Extension::check(); } unsigned int -Print::setup (void) +Print::setup () { return imp->setup(this); } unsigned int -Print::set_preview (void) +Print::set_preview () { return imp->set_preview(this); } @@ -52,65 +52,65 @@ Print::begin (SPDocument *doc) } unsigned int -Print::finish (void) +Print::finish () { return imp->finish(this); } unsigned int -Print::bind (const Geom::Affine *transform, float opacity) +Print::bind (const Geom::Affine &transform, float opacity) { return imp->bind (this, transform, opacity); } unsigned int -Print::release (void) +Print::release () { return imp->release(this); } unsigned int -Print::comment (const char * comment) +Print::comment (char const *comment) { - return imp->comment(this,comment); + return imp->comment(this, comment); } unsigned int -Print::fill (Geom::PathVector const &pathv, const Geom::Affine *ctm, const SPStyle *style, - const NRRect *pbox, const NRRect *dbox, const NRRect *bbox) +Print::fill (Geom::PathVector const &pathv, Geom::Affine const &ctm, SPStyle const *style, + Geom::OptRect const &pbox, Geom::OptRect const &dbox, Geom::OptRect const &bbox) { return imp->fill (this, pathv, ctm, style, pbox, dbox, bbox); } unsigned int -Print::stroke (Geom::PathVector const &pathv, const Geom::Affine *transform, const SPStyle *style, - const NRRect *pbox, const NRRect *dbox, const NRRect *bbox) +Print::stroke (Geom::PathVector const &pathv, Geom::Affine const &ctm, SPStyle const *style, + Geom::OptRect const &pbox, Geom::OptRect const &dbox, Geom::OptRect const &bbox) { - return imp->stroke (this, pathv, transform, style, pbox, dbox, bbox); + return imp->stroke (this, pathv, ctm, style, pbox, dbox, bbox); } unsigned int Print::image (unsigned char *px, unsigned int w, unsigned int h, unsigned int rs, - const Geom::Affine *transform, const SPStyle *style) + const Geom::Affine &transform, const SPStyle *style) { return imp->image (this, px, w, h, rs, transform, style); } unsigned int -Print::text (const char* text, Geom::Point p, const SPStyle* style) +Print::text (char const *text, Geom::Point const &p, SPStyle const *style) { return imp->text (this, text, p, style); } bool -Print::textToPath (void) +Print::textToPath () { return imp->textToPath(this); } //whether embed font in print output (EPS especially) bool -Print::fontEmbedded (void) +Print::fontEmbedded () { return imp->fontEmbedded(this); } diff --git a/src/extension/print.h b/src/extension/print.h index c2276126b..9c0920499 100644 --- a/src/extension/print.h +++ b/src/extension/print.h @@ -41,30 +41,30 @@ public: unsigned int finish (void); /* Rendering methods */ - unsigned int bind (Geom::Affine const *transform, + unsigned int bind (Geom::Affine const &transform, float opacity); unsigned int release (void); unsigned int comment (const char * comment); unsigned int fill (Geom::PathVector const &pathv, - Geom::Affine const *ctm, + Geom::Affine const &ctm, SPStyle const *style, - NRRect const *pbox, - NRRect const *dbox, - NRRect const *bbox); + Geom::OptRect const &pbox, + Geom::OptRect const &dbox, + Geom::OptRect const &bbox); unsigned int stroke (Geom::PathVector const &pathv, - Geom::Affine const *transform, + Geom::Affine const &transform, SPStyle const *style, - NRRect const *pbox, - NRRect const *dbox, - NRRect const *bbox); + Geom::OptRect const &pbox, + Geom::OptRect const &dbox, + Geom::OptRect const &bbox); unsigned int image (unsigned char *px, unsigned int w, unsigned int h, unsigned int rs, - Geom::Affine const *transform, + Geom::Affine const &transform, SPStyle const *style); unsigned int text (char const *text, - Geom::Point p, + Geom::Point const &p, SPStyle const *style); bool textToPath (void); bool fontEmbedded (void); diff --git a/src/libnrtype/Layout-TNG-Output.cpp b/src/libnrtype/Layout-TNG-Output.cpp index fa1a07414..7e54a00e2 100644 --- a/src/libnrtype/Layout-TNG-Output.cpp +++ b/src/libnrtype/Layout-TNG-Output.cpp @@ -136,7 +136,6 @@ void Layout::print(SPPrintContext *ctx, { if (_input_stream.empty()) return; - Geom::Affine ctm_2geom(ctm); Direction block_progression = _blockProgression(); bool text_to_path = ctx->module->textToPath(); for (unsigned glyph_index = 0 ; glyph_index < _glyphs.size() ; ) { @@ -156,9 +155,9 @@ void Layout::print(SPPrintContext *ctx, _getGlyphTransformMatrix(glyph_index, &glyph_matrix); Geom::PathVector temp_pv = (*pv) * glyph_matrix; if (!text_source->style->fill.isNone()) - sp_print_fill(ctx, temp_pv, &ctm_2geom, text_source->style, pbox, dbox, bbox); + sp_print_fill(ctx, temp_pv, ctm, text_source->style, pbox, dbox, bbox); if (!text_source->style->stroke.isNone()) - sp_print_stroke(ctx, temp_pv, &ctm_2geom, text_source->style, pbox, dbox, bbox); + sp_print_stroke(ctx, temp_pv, ctm, text_source->style, pbox, dbox, bbox); } glyph_index++; } else { diff --git a/src/print.cpp b/src/print.cpp index 3e477c976..d2fc72175 100644 --- a/src/print.cpp +++ b/src/print.cpp @@ -27,17 +27,8 @@ #include "ui/dialog/print.h" - -/* Identity typedef */ - -unsigned int sp_print_bind(SPPrintContext *ctx, Geom::Affine const &transform, float opacity) -{ - Geom::Affine const ntransform(transform); - return sp_print_bind(ctx, &ntransform, opacity); -} - unsigned int -sp_print_bind(SPPrintContext *ctx, Geom::Affine const *transform, float opacity) +sp_print_bind(SPPrintContext *ctx, Geom::Affine const &transform, float opacity) { return ctx->module->bind(transform, opacity); } @@ -55,25 +46,23 @@ sp_print_comment(SPPrintContext *ctx, char const *comment) } unsigned int -sp_print_fill(SPPrintContext *ctx, Geom::PathVector const &pathv, Geom::Affine const *ctm, SPStyle const *style, +sp_print_fill(SPPrintContext *ctx, Geom::PathVector const &pathv, Geom::Affine const &ctm, SPStyle const *style, Geom::OptRect const &pbox, Geom::OptRect const &dbox, Geom::OptRect const &bbox) { - NRRect nrpbox(pbox), nrdbox(dbox), nrbbox(bbox); - return ctx->module->fill(pathv, ctm, style, &nrpbox, &nrdbox, &nrbbox); + return ctx->module->fill(pathv, ctm, style, pbox, dbox, bbox); } unsigned int -sp_print_stroke(SPPrintContext *ctx, Geom::PathVector const &pathv, Geom::Affine const *ctm, SPStyle const *style, +sp_print_stroke(SPPrintContext *ctx, Geom::PathVector const &pathv, Geom::Affine const &ctm, SPStyle const *style, Geom::OptRect const &pbox, Geom::OptRect const &dbox, Geom::OptRect const &bbox) { - NRRect nrpbox(pbox), nrdbox(dbox), nrbbox(bbox); - return ctx->module->stroke(pathv, ctm, style, &nrpbox, &nrdbox, &nrbbox); + return ctx->module->stroke(pathv, ctm, style, pbox, dbox, bbox); } unsigned int sp_print_image_R8G8B8A8_N(SPPrintContext *ctx, guchar *px, unsigned int w, unsigned int h, unsigned int rs, - Geom::Affine const *transform, SPStyle const *style) + Geom::Affine const &transform, SPStyle const *style) { return ctx->module->image(px, w, h, rs, transform, style); } diff --git a/src/print.h b/src/print.h index 34c85d901..d584245e5 100644 --- a/src/print.h +++ b/src/print.h @@ -23,17 +23,16 @@ struct SPPrintContext { }; unsigned int sp_print_bind(SPPrintContext *ctx, Geom::Affine const &transform, float opacity); -unsigned int sp_print_bind(SPPrintContext *ctx, Geom::Affine const *transform, float opacity); unsigned int sp_print_release(SPPrintContext *ctx); unsigned int sp_print_comment(SPPrintContext *ctx, char const *comment); -unsigned int sp_print_fill(SPPrintContext *ctx, Geom::PathVector const &pathv, Geom::Affine const *ctm, SPStyle const *style, +unsigned int sp_print_fill(SPPrintContext *ctx, Geom::PathVector const &pathv, Geom::Affine const &ctm, SPStyle const *style, Geom::OptRect const &pbox, Geom::OptRect const &dbox, Geom::OptRect const &bbox); -unsigned int sp_print_stroke(SPPrintContext *ctx, Geom::PathVector const &pathv, Geom::Affine const *transform, SPStyle const *style, +unsigned int sp_print_stroke(SPPrintContext *ctx, Geom::PathVector const &pathv, Geom::Affine const &ctm, SPStyle const *style, Geom::OptRect const &pbox, Geom::OptRect const &dbox, Geom::OptRect const &bbox); unsigned int sp_print_image_R8G8B8A8_N(SPPrintContext *ctx, guchar *px, unsigned int w, unsigned int h, unsigned int rs, - Geom::Affine const *transform, SPStyle const *style); + Geom::Affine const &transform, SPStyle const *style); unsigned int sp_print_text(SPPrintContext *ctx, char const *text, Geom::Point p, SPStyle const *style); diff --git a/src/sp-image.cpp b/src/sp-image.cpp index 3ae2b6e63..1bfcc90e5 100644 --- a/src/sp-image.cpp +++ b/src/sp-image.cpp @@ -1095,7 +1095,7 @@ static void sp_image_print( SPItem *item, SPPrintContext *ctx ) Geom::Translate ti(0.0, -1.0); t = s * tp; t = ti * t; - sp_print_image_R8G8B8A8_N(ctx, px, w, h, rs, &t, item->style); + sp_print_image_R8G8B8A8_N(ctx, px, w, h, rs, t, item->style); } else { // preserveAspectRatio double vw = image->width.computed / image->sx; double vh = image->height.computed / image->sy; @@ -1116,7 +1116,7 @@ static void sp_image_print( SPItem *item, SPPrintContext *ctx ) Geom::Translate ti(0.0, -1.0); t = s * tp; t = ti * t; - sp_print_image_R8G8B8A8_N(ctx, px + trimx*pixskip + trimy*rs, trimwidth, trimheight, rs, &t, item->style); + sp_print_image_R8G8B8A8_N(ctx, px + trimx*pixskip + trimy*rs, trimwidth, trimheight, rs, t, item->style); } } } diff --git a/src/sp-shape.cpp b/src/sp-shape.cpp index 15fa76d65..8bfa99392 100644 --- a/src/sp-shape.cpp +++ b/src/sp-shape.cpp @@ -657,7 +657,8 @@ Geom::OptRect SPShape::sp_shape_bbox(SPItem const *item, Geom::Affine const &tra } static void -sp_shape_print_invoke_marker_printing(SPObject* obj, Geom::Affine tr, SPStyle* style, SPPrintContext *ctx) { +sp_shape_print_invoke_marker_printing(SPObject *obj, Geom::Affine tr, SPStyle const *style, SPPrintContext *ctx) +{ SPMarker *marker = SP_MARKER(obj); if (marker->markerUnits == SP_MARKER_UNITS_STROKEWIDTH) { tr = Geom::Scale(style->stroke_width.computed) * tr; @@ -709,11 +710,11 @@ sp_shape_print (SPItem *item, SPPrintContext *ctx) SPStyle* style = item->style; if (!style->fill.isNone()) { - sp_print_fill (ctx, pathv, &i2dt, style, pbox, dbox, bbox); + sp_print_fill (ctx, pathv, i2dt, style, pbox, dbox, bbox); } if (!style->stroke.isNone()) { - sp_print_stroke (ctx, pathv, &i2dt, style, pbox, dbox, bbox); + sp_print_stroke (ctx, pathv, i2dt, style, pbox, dbox, bbox); } /** \todo make code prettier */ diff --git a/src/sp-symbol.cpp b/src/sp-symbol.cpp index 71de619c1..0a1ebdb06 100644 --- a/src/sp-symbol.cpp +++ b/src/sp-symbol.cpp @@ -421,7 +421,7 @@ static void sp_symbol_print(SPItem *item, SPPrintContext *ctx) if (symbol->cloned) { // Cloned <symbol> is actually renderable - sp_print_bind(ctx, &symbol->c2p, 1.0); + sp_print_bind(ctx, symbol->c2p, 1.0); if (((SPItemClass *) (parent_class))->print) { ((SPItemClass *) (parent_class))->print (item, ctx); |
