diff options
| author | Patrick Storz <eduard.braun2@gmx.de> | 2019-07-06 19:50:57 +0000 |
|---|---|---|
| committer | Patrick Storz <eduard.braun2@gmx.de> | 2019-07-10 18:15:54 +0000 |
| commit | 2185fad3b6170529ad07aaa0d05874e4c80befa8 (patch) | |
| tree | 696a302b3602aaf5ba70af09ef16623c005be6c5 /src/extension | |
| parent | Enhancements for --export-type command line option (diff) | |
| download | inkscape-2185fad3b6170529ad07aaa0d05874e4c80befa8.tar.gz inkscape-2185fad3b6170529ad07aaa0d05874e4c80befa8.zip | |
cairo-renderer: / cairo-render-context: whitespace fixes
Diffstat (limited to 'src/extension')
| -rw-r--r-- | src/extension/internal/cairo-render-context.cpp | 12 | ||||
| -rw-r--r-- | src/extension/internal/cairo-renderer-pdf-out.cpp | 8 | ||||
| -rw-r--r-- | src/extension/internal/cairo-renderer.cpp | 22 | ||||
| -rw-r--r-- | src/extension/internal/cairo-renderer.h | 2 |
4 files changed, 21 insertions, 23 deletions
diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index c801821c8..ab9f9e82f 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -196,7 +196,7 @@ void CairoRenderContext::setStateForStyle(SPStyle const *style) * \param width width of the surface to be created * \param height height of the surface to be created */ -CairoRenderContext* +CairoRenderContext* CairoRenderContext::cloneMe(double width, double height) const { g_assert( _is_valid ); @@ -948,7 +948,7 @@ CairoRenderContext::finish(bool finish_surface) cairo_destroy(_cr); _cr = nullptr; - + if (finish_surface) cairo_surface_finish(_surface); status = cairo_surface_status(_surface); @@ -1509,7 +1509,7 @@ CairoRenderContext::_prepareRenderGraphic() // and apply clipping / masking to layers on the way (this is done in popLayer) // - then emit the page using cairo_show_page() // - finally restore the previous state with proper transforms and appropriate layers again - // + // // TODO: While this appears to be an ugly hack it seems to work // Somebody with a more intimate understanding of cairo and the renderer implementation might // be able to implement this in a cleaner way, though. @@ -1666,7 +1666,7 @@ bool CairoRenderContext::renderImage(Inkscape::Pixbuf *pb, cairo_rectangle(_cr, 0, 0, w, h); cairo_clip(_cr); } - + // Cairo filter method will be mapped to PS/PDF 'interpolate' true/false). // See cairo-pdf-surface.c if (style) { @@ -1742,7 +1742,7 @@ unsigned int CairoRenderContext::_showGlyphs(cairo_t *cr, PangoFont * /*font*/, bool CairoRenderContext::renderGlyphtext(PangoFont *font, Geom::Affine const &font_matrix, std::vector<CairoGlyphInfo> const &glyphtext, SPStyle const *style) -{ +{ _prepareRenderText(); if (_is_omittext) @@ -1871,7 +1871,7 @@ CairoRenderContext::renderGlyphtext(PangoFont *font, Geom::Affine const &font_ma _showGlyphs(_cr, font, glyphtext, false); } } - + } cairo_restore(_cr); diff --git a/src/extension/internal/cairo-renderer-pdf-out.cpp b/src/extension/internal/cairo-renderer-pdf-out.cpp index a48025c1a..ecdea2005 100644 --- a/src/extension/internal/cairo-renderer-pdf-out.cpp +++ b/src/extension/internal/cairo-renderer-pdf-out.cpp @@ -229,11 +229,11 @@ CairoRendererPdfOutput::save(Inkscape::Extension::Output *mod, SPDocument *doc, #include "clear-n_.h" /** - \brief A function allocate a copy of this function. + \brief A function allocate a copy of this function. - This is the definition of Cairo PDF out. This function just - calls the extension system with the memory allocated XML that - describes the data. + This is the definition of Cairo PDF out. This function just + calls the extension system with the memory allocated XML that + describes the data. */ void CairoRendererPdfOutput::init () diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index c5477e3c2..be8155991 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -215,7 +215,7 @@ static void sp_shape_render(SPShape *shape, CairoRenderContext *ctx) SPMarker* marker = shape->_marker[i]; for(Geom::PathVector::const_iterator path_it = pathv.begin(); path_it != pathv.end(); ++path_it) { // START position - if ( path_it != pathv.begin() + if ( path_it != pathv.begin() && ! ((path_it == (pathv.end()-1)) && (path_it->size_default() == 0)) ) // if this is the last path and it is a moveto-only, there is no mid marker there { Geom::Affine tr; @@ -305,7 +305,6 @@ static void sp_shape_render(SPShape *shape, CairoRenderContext *ctx) static void sp_group_render(SPGroup *group, CairoRenderContext *ctx) { CairoRenderer *renderer = ctx->getRenderer(); - //TRACE(("sp_group_render opacity: %f\n", SP_SCALE24_TO_FLOAT(item->style->opacity.value))); std::vector<SPObject*> l(group->childList(false)); for(std::vector<SPObject*>::const_iterator x = l.begin(); x!= l.end(); ++x){ @@ -377,13 +376,12 @@ static void sp_image_render(SPImage *image, CairoRenderContext *ctx) Geom::Scale s(width / (double)w, height / (double)h); Geom::Affine t(s * tp); - ctx->renderImage(image->pixbuf, t, image->style); + ctx->renderImage(image->pixbuf, t, image->style); } static void sp_anchor_render(SPAnchor *a, CairoRenderContext *ctx) { CairoRenderer *renderer = ctx->getRenderer(); - //TRACE(("sp_group_render opacity: %f\n", SP_SCALE24_TO_FLOAT(item->style->opacity.value))); std::vector<SPObject*> l(a->childList(false)); if (a->href) @@ -502,7 +500,7 @@ static void sp_asbitmap_render(SPItem *item, CairoRenderContext *ctx) double shift_y = bbox->top(); // For default 96 dpi, snap bitmap to pixel grid - if (res == Inkscape::Util::Quantity::convert(1, "in", "px")) { + if (res == Inkscape::Util::Quantity::convert(1, "in", "px")) { shift_x = round (shift_x); shift_y = round (shift_y); } @@ -522,7 +520,7 @@ static void sp_asbitmap_render(SPItem *item, CairoRenderContext *ctx) std::unique_ptr<Inkscape::Pixbuf> pb( sp_generate_internal_bitmap(document, nullptr, - bbox->min()[Geom::X], bbox->min()[Geom::Y], bbox->max()[Geom::X], bbox->max()[Geom::Y], + bbox->min()[Geom::X], bbox->min()[Geom::Y], bbox->max()[Geom::X], bbox->max()[Geom::Y], width, height, res, res, (guint32) 0xffffff00, item )); if (pb) { @@ -585,12 +583,12 @@ static void sp_item_invoke_render(SPItem *item, CairoRenderContext *ctx) TRACE(("image\n")); sp_image_render(image, ctx); } else { - SPGroup *group = dynamic_cast<SPGroup *>(item); - if (group) { - TRACE(("<g>\n")); - sp_group_render(group, ctx); - } - } + SPGroup *group = dynamic_cast<SPGroup *>(item); + if (group) { + TRACE(("<g>\n")); + sp_group_render(group, ctx); + } + } } } } diff --git a/src/extension/internal/cairo-renderer.h b/src/extension/internal/cairo-renderer.h index d70f8f551..a8eab52a8 100644 --- a/src/extension/internal/cairo-renderer.h +++ b/src/extension/internal/cairo-renderer.h @@ -38,7 +38,7 @@ class CairoRenderer { public: CairoRenderer(); virtual ~CairoRenderer(); - + CairoRenderContext *createContext(); void destroyContext(CairoRenderContext *ctx); |
