From baeb92c8b275ada9a09187772e11f8b32b7ae6ef Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Thu, 5 Mar 2015 11:00:36 +0100 Subject: Fix for Bug #918319 (Printing offsets page). Fix for a dead assignment in the printing code (Jenkins warning: http://jenkins.inkscape.org/job/Inkscape_trunk_scan-build/42/clangScanBuildBugs/browse/report-a94344.html#EndPath). Fixed bugs: - https://launchpad.net/bugs/918319 (bzr r13965) --- src/ui/dialog/print.cpp | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) (limited to 'src') diff --git a/src/ui/dialog/print.cpp b/src/ui/dialog/print.cpp index a015d28f9..ad979b570 100644 --- a/src/ui/dialog/print.cpp +++ b/src/ui/dialog/print.cpp @@ -126,30 +126,13 @@ static void draw_page( cairo_surface_t *surface = cairo_get_target(cr); cairo_matrix_t ctm; cairo_get_matrix(cr, &ctm); -#ifdef WIN32 - //Gtk+ does not take the non printable area into account - //http://bugzilla.gnome.org/show_bug.cgi?id=381371 - // - // This workaround translates the origin from the top left of the - // printable area to the top left of the page. - GtkPrintSettings *settings = gtk_print_operation_get_print_settings(operation); - const gchar *printerName = gtk_print_settings_get_printer(settings); - HDC hdc = CreateDC("WINSPOOL", printerName, NULL, NULL); - if (hdc) { - cairo_matrix_t mat; - int x_off = GetDeviceCaps (hdc, PHYSICALOFFSETX); - int y_off = GetDeviceCaps (hdc, PHYSICALOFFSETY); - cairo_matrix_init_translate(&mat, -x_off, -y_off); - cairo_matrix_multiply (&ctm, &ctm, &mat); - DeleteDC(hdc); - } -#endif + bool ret = ctx->setSurfaceTarget (surface, true, &ctm); if (ret) { ret = renderer.setupDocument (ctx, junk->_doc, TRUE, 0., NULL); if (ret) { renderer.renderItem(ctx, junk->_base); - ret = ctx->finish(); + ctx->finish(); } else { g_warning("%s", _("Could not set up Document")); -- cgit v1.2.3 From 24f4d9249267f8b93fd2b9075ffe7aead079afd9 Mon Sep 17 00:00:00 2001 From: "Liam P. White" Date: Thu, 5 Mar 2015 07:41:18 -0500 Subject: Fix out-of-control render cache from dominating all available memory (bzr r13966) --- src/display/drawing.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/display/drawing.cpp b/src/display/drawing.cpp index 6e728b03d..eadd7e528 100644 --- a/src/display/drawing.cpp +++ b/src/display/drawing.cpp @@ -210,9 +210,9 @@ Drawing::_pickItemsForCaching() } std::set to_cache; - for (i = _candidate_items.begin(); i != _candidate_items.end(); ++i) { - i->item->setCached(true); - to_cache.insert(i->item); + for (CandidateList::iterator j = _candidate_items.begin(); j != i; ++j) { + j->item->setCached(true); + to_cache.insert(j->item); } // Everything which is now in _cached_items but not in to_cache must be uncached // Note that calling setCached on an item modifies _cached_items -- cgit v1.2.3 From 957c647a8a0a567fef4f1940be43134d749830d4 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Fri, 6 Mar 2015 09:51:53 +0100 Subject: Fix for Bug #1428967 (Inkscape0.91 crashes under interface using Chinese/Taiwan(zh-tw)). Fixed bugs: - https://launchpad.net/bugs/1428967 (bzr r13968) --- src/selection-describer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/selection-describer.cpp b/src/selection-describer.cpp index f7814fd57..2386a731e 100644 --- a/src/selection-describer.cpp +++ b/src/selection-describer.cpp @@ -233,8 +233,8 @@ void SelectionDescriber::_updateMessageFromSelection(Inkscape::Selection *select int n_terms = count_terms((GSList *)items); gchar *objects_str = g_strdup_printf(ngettext( - "%i objects selected of type %s", - "%i objects selected of types %s", n_terms), + "%1$i objects selected of type %2$s", + "%1$i objects selected of types %2$s", n_terms), objcount, terms); g_free(terms); -- cgit v1.2.3 From 77ef2ed0b37ba73bae12a602207499931a9edf13 Mon Sep 17 00:00:00 2001 From: Tavmjong Bah Date: Fri, 6 Mar 2015 15:11:29 +0100 Subject: Fix filter primitives using 'type' attribute. (Broken when 'type' attribute introduced on meshes.) (bzr r13969) --- src/attributes.cpp | 2 +- src/attributes.h | 2 +- src/sp-mesh.cpp | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/attributes.cpp b/src/attributes.cpp index 3cf13d3f2..568f0528a 100644 --- a/src/attributes.cpp +++ b/src/attributes.cpp @@ -291,7 +291,7 @@ static SPStyleProp const props[] = { {SP_ATTR_FY, "fy"}, /* SPMeshPatch */ {SP_ATTR_TENSOR, "tensor"}, - {SP_ATTR_MESH_TYPE, "type"}, + //{SP_ATTR_TYPE, "type"}, /* SPPattern */ {SP_ATTR_PATTERNUNITS, "patternUnits"}, {SP_ATTR_PATTERNCONTENTUNITS, "patternContentUnits"}, diff --git a/src/attributes.h b/src/attributes.h index 817819b69..91c8868f9 100644 --- a/src/attributes.h +++ b/src/attributes.h @@ -293,7 +293,7 @@ enum SPAttributeEnum { SP_ATTR_FY, /* SPMeshPatch */ SP_ATTR_TENSOR, - SP_ATTR_MESH_TYPE, + //SP_ATTR_TYPE, /* SPPattern */ SP_ATTR_PATTERNUNITS, SP_ATTR_PATTERNCONTENTUNITS, diff --git a/src/sp-mesh.cpp b/src/sp-mesh.cpp index 0b1eb4509..e04c29e8e 100644 --- a/src/sp-mesh.cpp +++ b/src/sp-mesh.cpp @@ -48,14 +48,14 @@ void SPMesh::set(unsigned key, gchar const *value) { this->requestModified(SP_OBJECT_MODIFIED_FLAG); break; - case SP_ATTR_MESH_TYPE: + case SP_ATTR_TYPE: if (value) { if (!strcmp(value, "coons")) { this->type = SP_MESH_TYPE_COONS; } else if (!strcmp(value, "bicubic")) { this->type = SP_MESH_TYPE_BICUBIC; } else { - std::cout << "SPMesh::set(): invalid value " << value << std::endl; + std::cerr << "SPMesh::set(): invalid value " << value << std::endl; } this->type_set = TRUE; } else { -- cgit v1.2.3 From f30550286f21085f0494910c32685f07d14ec978 Mon Sep 17 00:00:00 2001 From: Alvin Penner Date: Fri, 6 Mar 2015 12:58:06 -0500 Subject: avoid 0/0 problem in get_scale_transform_for_uniform_stroke. (Bug 1428789) Fixed bugs: - https://launchpad.net/bugs/1428789 (bzr r13970) --- src/sp-item-transform.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/sp-item-transform.cpp b/src/sp-item-transform.cpp index 86beee907..767f0ed91 100644 --- a/src/sp-item-transform.cpp +++ b/src/sp-item-transform.cpp @@ -181,7 +181,9 @@ Geom::Affine get_scale_transform_for_uniform_stroke(Geom::Rect const &bbox_visua if (B*B - 4*A*C < 0) { g_message("stroke scaling error : %d, %f, %f, %f, %f, %f", preserve, r0, w0, h0, w1, h1); } else { - r1 = fabs((-B - sqrt(B*B - 4*A*C))/(2*A)); + r1 = -C/B; + if (!Geom::are_near(A*C/B/B, 0.0, Geom::EPSILON)) + r1 = fabs((-B - sqrt(B*B - 4*A*C))/(2*A)); // If w1 < 0 then the scale will be wrong if we just assume that scale_x = (w1 - r1)/(w0 - r0); // Therefore we here need the absolute values of w0, w1, h0, h1, and r0, as taken care of earlier scale_x = (w1 - r1)/(w0 - r0); @@ -339,7 +341,9 @@ Geom::Affine get_scale_transform_for_variable_stroke(Geom::Rect const &bbox_visu if (B*B - 4*A*C < 0) { g_message("variable stroke scaling error : %d, %d, %f, %f, %f, %f, %f, %f", transform_stroke, preserve, r0w, r0h, w0, h0, w1, h1); } else { - gdouble det = (-B + sqrt(B*B - 4*A*C))/(2*A); + gdouble det = -C/B; + if (!Geom::are_near(A*C/B/B, 0.0, Geom::EPSILON)) + det = (-B + sqrt(B*B - 4*A*C))/(2*A); r1w = r0w*det; r1h = r0h*det; // If w1 < 0 then the scale will be wrong if we just assume that scale_x = (w1 - r1)/(w0 - r0); -- cgit v1.2.3 From 578d8e35fb697fc574a677a1301ceab34f4b79ba Mon Sep 17 00:00:00 2001 From: Adrian Johnson Date: Sat, 7 Mar 2015 08:05:30 +0100 Subject: Enable PDF/PS/EPS export for gradient mesh (bug #1363369) (bzr r13971) --- src/extension/internal/cairo-render-context.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') diff --git a/src/extension/internal/cairo-render-context.cpp b/src/extension/internal/cairo-render-context.cpp index d76c187a2..2d6619e1e 100644 --- a/src/extension/internal/cairo-render-context.cpp +++ b/src/extension/internal/cairo-render-context.cpp @@ -42,6 +42,7 @@ #include "sp-hatch.h" #include "sp-linear-gradient.h" #include "sp-radial-gradient.h" +#include "sp-mesh.h" #include "sp-pattern.h" #include "sp-mask.h" #include "sp-clippath.h" @@ -1259,6 +1260,10 @@ CairoRenderContext::_createPatternForPaintServer(SPPaintServer const *const pain sp_color_get_rgb_floatv(&rg->vector.stops[i].color, rgb); cairo_pattern_add_color_stop_rgba(pattern, rg->vector.stops[i].offset, rgb[0], rgb[1], rgb[2], rg->vector.stops[i].opacity * alpha); } + } else if (SP_IS_MESH (paintserver)) { + SPMesh *mg = SP_MESH(paintserver); + + pattern = mg->pattern_new(_cr, pbox, 1.0); } else if (SP_IS_PATTERN (paintserver)) { pattern = _createPatternPainter(paintserver, pbox); } else if ( dynamic_cast(paintserver) ) { -- cgit v1.2.3