diff options
| author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2018-06-20 10:34:30 +0000 |
|---|---|---|
| committer | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> | 2018-06-21 11:02:56 +0000 |
| commit | 50b3c18850a43b962ed15855abdb337c846550a8 (patch) | |
| tree | 147a86fc1d123f44bfd9927448ab2ecf4bfd1bdc /src | |
| parent | Merge branch 'select-page' of gitlab.com:bobqwatson/inkscape (diff) | |
| download | inkscape-50b3c18850a43b962ed15855abdb337c846550a8.tar.gz inkscape-50b3c18850a43b962ed15855abdb337c846550a8.zip | |
Move global functions into SPPrintContext methods.
Diffstat (limited to 'src')
| -rw-r--r-- | src/libnrtype/Layout-TNG-Output.cpp | 10 | ||||
| -rw-r--r-- | src/object/sp-image.cpp | 2 | ||||
| -rw-r--r-- | src/object/sp-item.cpp | 4 | ||||
| -rw-r--r-- | src/object/sp-root.cpp | 4 | ||||
| -rw-r--r-- | src/object/sp-shape.cpp | 8 | ||||
| -rw-r--r-- | src/object/sp-symbol.cpp | 4 | ||||
| -rw-r--r-- | src/object/sp-use.cpp | 4 | ||||
| -rw-r--r-- | src/print.cpp | 35 | ||||
| -rw-r--r-- | src/print.h | 27 |
9 files changed, 48 insertions, 50 deletions
diff --git a/src/libnrtype/Layout-TNG-Output.cpp b/src/libnrtype/Layout-TNG-Output.cpp index dc69934b1..7f9ee69a9 100644 --- a/src/libnrtype/Layout-TNG-Output.cpp +++ b/src/libnrtype/Layout-TNG-Output.cpp @@ -270,9 +270,9 @@ Geom::Affine glyph_matrix; _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, text_source->style, pbox, dbox, bbox); + ctx->fill(temp_pv, ctm, text_source->style, pbox, dbox, bbox); if (!text_source->style->stroke.isNone()) - sp_print_stroke(ctx, temp_pv, ctm, text_source->style, pbox, dbox, bbox); + ctx->stroke(temp_pv, ctm, text_source->style, pbox, dbox, bbox); } } } @@ -401,16 +401,16 @@ std:: cout << "DEBUG Layout::print in while --- " } // write it - sp_print_bind(ctx, glyph_matrix, 1.0); + ctx->bind(glyph_matrix, 1.0); // the dx array is smuggled through to the EMF driver (ignored by others) as: // text<nul>w1 w2 w3 ...wn<nul><nul> // where the widths are floats 7 characters wide, including the space char *smuggle_string=smuggle_adxkyrtl_in(text_string.c_str(),ndx, &hold_dx[0], ky, rtl); - sp_print_text(ctx, smuggle_string, g_pos, text_source->style); + ctx->text(smuggle_string, g_pos, text_source->style); free(smuggle_string); - sp_print_release(ctx); + ctx->release(); ndx = 0; char_index = lc_index; } diff --git a/src/object/sp-image.cpp b/src/object/sp-image.cpp index cdbe0ef4a..2b38995df 100644 --- a/src/object/sp-image.cpp +++ b/src/object/sp-image.cpp @@ -479,7 +479,7 @@ void SPImage::print(SPPrintContext *ctx) { Geom::Translate tp(vx, vy); Geom::Scale s(this->sx, this->sy); t = s * tp; - sp_print_image_R8G8B8A8_N(ctx, px, w, h, rs, t, this->style); + ctx->image_R8G8B8A8_N(px, w, h, rs, t, this->style); delete pb; } } diff --git a/src/object/sp-item.cpp b/src/object/sp-item.cpp index 286886a1a..ec92c655f 100644 --- a/src/object/sp-item.cpp +++ b/src/object/sp-item.cpp @@ -1023,9 +1023,9 @@ void SPItem::invoke_print(SPPrintContext *ctx) { if ( !isHidden() ) { if (!transform.isIdentity() || style->opacity.value != SP_SCALE24_MAX) { - sp_print_bind(ctx, transform, SP_SCALE24_TO_FLOAT(style->opacity.value)); + ctx->bind(transform, SP_SCALE24_TO_FLOAT(style->opacity.value)); this->print(ctx); - sp_print_release(ctx); + ctx->release(); } else { this->print(ctx); } diff --git a/src/object/sp-root.cpp b/src/object/sp-root.cpp index 592aae443..6ebccef3c 100644 --- a/src/object/sp-root.cpp +++ b/src/object/sp-root.cpp @@ -369,11 +369,11 @@ Inkscape::DrawingItem *SPRoot::show(Inkscape::Drawing &drawing, unsigned int key void SPRoot::print(SPPrintContext *ctx) { - sp_print_bind(ctx, this->c2p, 1.0); + ctx->bind(this->c2p, 1.0); SPGroup::print(ctx); - sp_print_release(ctx); + ctx->release(); } const char *SPRoot::displayName() const { diff --git a/src/object/sp-shape.cpp b/src/object/sp-shape.cpp index 1f4572428..d3fce702e 100644 --- a/src/object/sp-shape.cpp +++ b/src/object/sp-shape.cpp @@ -641,7 +641,7 @@ void SPShape::print(SPPrintContext* ctx) { if (add_comments) { gchar * comment = g_strdup_printf("begin '%s'", this->defaultLabel()); - sp_print_comment(ctx, comment); + ctx->comment(comment); g_free(comment); } @@ -656,11 +656,11 @@ void SPShape::print(SPPrintContext* ctx) { SPStyle* style = this->style; if (!style->fill.isNone()) { - sp_print_fill (ctx, pathv, i2dt, style, pbox, dbox, bbox); + ctx->fill (pathv, i2dt, style, pbox, dbox, bbox); } if (!style->stroke.isNone()) { - sp_print_stroke (ctx, pathv, i2dt, style, pbox, dbox, bbox); + ctx->stroke (pathv, i2dt, style, pbox, dbox, bbox); } /** \todo make code prettier */ @@ -737,7 +737,7 @@ void SPShape::print(SPPrintContext* ctx) { if (add_comments) { gchar * comment = g_strdup_printf("end '%s'", this->defaultLabel()); - sp_print_comment(ctx, comment); + ctx->comment(comment); g_free(comment); } } diff --git a/src/object/sp-symbol.cpp b/src/object/sp-symbol.cpp index d3a06a60b..feb3ed097 100644 --- a/src/object/sp-symbol.cpp +++ b/src/object/sp-symbol.cpp @@ -148,11 +148,11 @@ void SPSymbol::print(SPPrintContext* ctx) { if (this->cloned) { // Cloned <symbol> is actually renderable - sp_print_bind(ctx, this->c2p, 1.0); + ctx->bind(this->c2p, 1.0); SPGroup::print(ctx); - sp_print_release (ctx); + ctx->release (); } } diff --git a/src/object/sp-use.cpp b/src/object/sp-use.cpp index 6ee4be4b2..a73a731f8 100644 --- a/src/object/sp-use.cpp +++ b/src/object/sp-use.cpp @@ -216,7 +216,7 @@ void SPUse::print(SPPrintContext* ctx) { if ((this->x._set && this->x.computed != 0) || (this->y._set && this->y.computed != 0)) { Geom::Affine tp(Geom::Translate(this->x.computed, this->y.computed)); - sp_print_bind(ctx, tp, 1.0); + ctx->bind(tp, 1.0); translated = true; } @@ -225,7 +225,7 @@ void SPUse::print(SPPrintContext* ctx) { } if (translated) { - sp_print_release(ctx); + ctx->release(); } } diff --git a/src/print.cpp b/src/print.cpp index efdfe392b..f455623ae 100644 --- a/src/print.cpp +++ b/src/print.cpp @@ -34,49 +34,48 @@ unsigned int -sp_print_bind(SPPrintContext *ctx, Geom::Affine const &transform, float opacity) +SPPrintContext::bind(Geom::Affine const &transform, float opacity) { - return ctx->module->bind(transform, opacity); + return module->bind(transform, opacity); } unsigned int -sp_print_release(SPPrintContext *ctx) +SPPrintContext::release() { - return ctx->module->release(); + return module->release(); } unsigned int -sp_print_comment(SPPrintContext *ctx, char const *comment) +SPPrintContext::comment(char const *comment) { - return ctx->module->comment(comment); + return module->comment(comment); } 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) +SPPrintContext::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 ctx->module->fill(pathv, ctm, style, pbox, dbox, bbox); + return 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, - Geom::OptRect const &pbox, Geom::OptRect const &dbox, Geom::OptRect const &bbox) +SPPrintContext::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 ctx->module->stroke(pathv, ctm, style, pbox, dbox, bbox); + return 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) +SPPrintContext::image_R8G8B8A8_N(guchar *px, unsigned int w, unsigned int h, unsigned int rs, + Geom::Affine const &transform, SPStyle const *style) { - return ctx->module->image(px, w, h, rs, transform, style); + return module->image(px, w, h, rs, transform, style); } -unsigned int sp_print_text(SPPrintContext *ctx, char const *text, Geom::Point p, +unsigned int SPPrintContext::text(char const *text, Geom::Point p, SPStyle const *style) { - return ctx->module->text(text, p, style); + return module->text(text, p, style); } /* UI */ diff --git a/src/print.h b/src/print.h index ab2bcc0a7..a952672b7 100644 --- a/src/print.h +++ b/src/print.h @@ -30,24 +30,23 @@ class Print; struct SPPrintContext { Inkscape::Extension::Print *module; -}; -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, - 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 &ctm, SPStyle const *style, - Geom::OptRect const &pbox, Geom::OptRect const &dbox, Geom::OptRect const &bbox); + unsigned int bind(Geom::Affine const &transform, float opacity); + unsigned int release(); + unsigned int comment(char const *comment); + unsigned int fill(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 stroke(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, - unsigned char *px, unsigned int w, unsigned int h, unsigned int rs, - Geom::Affine const &transform, SPStyle const *style); + unsigned int image_R8G8B8A8_N(unsigned char *px, unsigned int w, unsigned int h, unsigned int rs, + Geom::Affine const &transform, SPStyle const *style); -unsigned int sp_print_text(SPPrintContext *ctx, char const *text, Geom::Point p, - SPStyle const *style); + unsigned int text(char const *text, Geom::Point p, + SPStyle const *style); -void sp_print_get_param(SPPrintContext *ctx, char *name, bool *value); + void get_param(char *name, bool *value); +}; /* UI */ |
