diff options
| author | Jabier Arraiza Cenoz <jabier.arraiza@marker.es> | 2015-03-07 12:55:42 +0000 |
|---|---|---|
| committer | Jabiertxof <jtx@jtx.marker.es> | 2015-03-07 12:55:42 +0000 |
| commit | c04b394168c108cb7053d7395244b72b30430d24 (patch) | |
| tree | c99d89d9a81c812f37e3119e2fc4260379f29f30 /src | |
| parent | finish helper paths and beter handle of fillet/chamfer overflow. Also make th... (diff) | |
| parent | Enable PDF/PS/EPS export for gradient mesh (bug #1363369) (diff) | |
| download | inkscape-c04b394168c108cb7053d7395244b72b30430d24.tar.gz inkscape-c04b394168c108cb7053d7395244b72b30430d24.zip | |
update to trunk
(bzr r13645.1.36)
Diffstat (limited to 'src')
| -rw-r--r-- | src/attributes.cpp | 2 | ||||
| -rw-r--r-- | src/attributes.h | 2 | ||||
| -rw-r--r-- | src/display/drawing.cpp | 6 | ||||
| -rw-r--r-- | src/extension/internal/cairo-render-context.cpp | 5 | ||||
| -rw-r--r-- | src/selection-describer.cpp | 4 | ||||
| -rw-r--r-- | src/sp-item-transform.cpp | 8 | ||||
| -rw-r--r-- | src/sp-mesh.cpp | 4 | ||||
| -rw-r--r-- | src/ui/dialog/print.cpp | 21 |
8 files changed, 22 insertions, 30 deletions
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/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<DrawingItem*> 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 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<SPHatch const *>(paintserver) ) { 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( - "<b>%i</b> objects selected of type %s", - "<b>%i</b> objects selected of types %s", n_terms), + "<b>%1$i</b> objects selected of type %2$s", + "<b>%1$i</b> objects selected of types %2$s", n_terms), objcount, terms); g_free(terms); 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); 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 { 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")); |
