diff options
| author | Jabiertxo Arraiza Cenoz <jtx@jtx-desktop.markerlab.es> | 2017-11-10 18:57:54 +0000 |
|---|---|---|
| committer | Jabiertxo Arraiza Cenoz <jtx@jtx-desktop.markerlab.es> | 2017-11-10 18:57:54 +0000 |
| commit | dc6c4dc337aa2ad766cada2eb06fe4c186a89d14 (patch) | |
| tree | 3fc8d3fd109b7c89751183b8be880e856be5ff34 /src/display | |
| parent | Merge branch 'master' into powerpencil (diff) | |
| parent | Removing regects (diff) | |
| download | inkscape-dc6c4dc337aa2ad766cada2eb06fe4c186a89d14.tar.gz inkscape-dc6c4dc337aa2ad766cada2eb06fe4c186a89d14.zip | |
Merge branch 'master' into powerpencil
Diffstat (limited to 'src/display')
34 files changed, 76 insertions, 55 deletions
diff --git a/src/display/drawing-context.cpp b/src/display/drawing-context.cpp index 319136e06..1a1f20425 100644 --- a/src/display/drawing-context.cpp +++ b/src/display/drawing-context.cpp @@ -41,7 +41,7 @@ DrawingContext::Save::~Save() void DrawingContext::Save::save(DrawingContext &dc) { if (_dc) { - // TODO: it might be better to treat this occurence as a bug + // TODO: it might be better to treat this occurrence as a bug _dc->restore(); } _dc = &dc; diff --git a/src/display/drawing-item.cpp b/src/display/drawing-item.cpp index c4af81efc..43db4f259 100644 --- a/src/display/drawing-item.cpp +++ b/src/display/drawing-item.cpp @@ -99,7 +99,7 @@ void set_cairo_blend_operator( DrawingContext &dc, unsigned blend_mode ) { * you always need to delete the item views of children before deleting * the view of the parent. Do not call delete on things returned from show() * - this will cause dangling pointers inside the SPItem and lead to a crash. - * Use the corresponing hide() method. + * Use the corresponding hide() method. * * Outside of the SP tree, you should not use any references after the root node * has been deleted. diff --git a/src/display/drawing-pattern.h b/src/display/drawing-pattern.h index dc1f93ed1..43e0e97e1 100644 --- a/src/display/drawing-pattern.h +++ b/src/display/drawing-pattern.h @@ -39,7 +39,7 @@ public: */ void setPatternToUserTransform(Geom::Affine const &new_trans); /** - * Set the tile rect position and dimentions in content coordinate system + * Set the tile rect position and dimensions in content coordinate system */ void setTileRect(Geom::Rect const &tile_rect); /** diff --git a/src/display/nr-filter-blend.h b/src/display/nr-filter-blend.h index 5b1295c88..cdabb469b 100644 --- a/src/display/nr-filter-blend.h +++ b/src/display/nr-filter-blend.h @@ -59,6 +59,8 @@ public: virtual void set_input(int input, int slot); void set_mode(FilterBlendMode mode); + virtual Glib::ustring name() { return Glib::ustring("Blend"); } + private: static const std::set<FilterBlendMode> _valid_modes; FilterBlendMode _blend_mode; diff --git a/src/display/nr-filter-colormatrix.h b/src/display/nr-filter-colormatrix.h index cc43f4914..a6ba3693e 100644 --- a/src/display/nr-filter-colormatrix.h +++ b/src/display/nr-filter-colormatrix.h @@ -46,6 +46,8 @@ public: virtual void set_value(double value); virtual void set_values(std::vector<double> const &values); + virtual Glib::ustring name() { return Glib::ustring("Color Matrix"); } + public: struct ColorMatrixMatrix { ColorMatrixMatrix(std::vector<double> const &values); diff --git a/src/display/nr-filter-component-transfer.h b/src/display/nr-filter-component-transfer.h index 7019dde37..dae230f24 100644 --- a/src/display/nr-filter-component-transfer.h +++ b/src/display/nr-filter-component-transfer.h @@ -46,6 +46,8 @@ public: double amplitude[4]; double exponent[4]; double offset[4]; + + virtual Glib::ustring name() { return Glib::ustring("Component Transfer"); } }; } /* namespace Filters */ diff --git a/src/display/nr-filter-composite.cpp b/src/display/nr-filter-composite.cpp index dc5e4278f..04f81f857 100644 --- a/src/display/nr-filter-composite.cpp +++ b/src/display/nr-filter-composite.cpp @@ -79,6 +79,9 @@ void FilterComposite::render_cairo(FilterSlot &slot) cairo_surface_t *out = ink_cairo_surface_create_output(input1, input2); set_cairo_surface_ci(out, ci_fp ); + Geom::Rect vp = filter_primitive_area( slot.get_units() ); + slot.set_primitive_area(_output, vp); // Needed for tiling + if (op == COMPOSITE_ARITHMETIC) { ink_cairo_surface_blend(input1, input2, out, ComposeArithmetic(k1, k2, k3, k4)); } else { diff --git a/src/display/nr-filter-composite.h b/src/display/nr-filter-composite.h index 35756383b..74806ad5e 100644 --- a/src/display/nr-filter-composite.h +++ b/src/display/nr-filter-composite.h @@ -36,6 +36,8 @@ public: void set_operator(FeCompositeOperator op); void set_arithmetic(double k1, double k2, double k3, double k4); + virtual Glib::ustring name() { return Glib::ustring("Composite"); } + private: FeCompositeOperator op; double k1, k2, k3, k4; diff --git a/src/display/nr-filter-convolve-matrix.h b/src/display/nr-filter-convolve-matrix.h index d2e38eb95..3d86129ba 100644 --- a/src/display/nr-filter-convolve-matrix.h +++ b/src/display/nr-filter-convolve-matrix.h @@ -47,6 +47,8 @@ public: void set_edgeMode(FilterConvolveMatrixEdgeMode mode); void set_preserveAlpha(bool pa); + virtual Glib::ustring name() { return Glib::ustring("Convolve Matrix"); } + private: std::vector<double> kernelMatrix; int targetX, targetY; diff --git a/src/display/nr-filter-diffuselighting.h b/src/display/nr-filter-diffuselighting.h index 5ce505979..ef7a3011b 100644 --- a/src/display/nr-filter-diffuselighting.h +++ b/src/display/nr-filter-diffuselighting.h @@ -47,6 +47,8 @@ public: double surfaceScale; guint32 lighting_color; + virtual Glib::ustring name() { return Glib::ustring("Diffuse Lighting"); } + private: SVGICCColor *icc; }; diff --git a/src/display/nr-filter-displacement-map.cpp b/src/display/nr-filter-displacement-map.cpp index 1b979fa6c..c0d1ae411 100644 --- a/src/display/nr-filter-displacement-map.cpp +++ b/src/display/nr-filter-displacement-map.cpp @@ -145,7 +145,7 @@ void FilterDisplacementMap::area_enlarge(Geom::IntRect &area, Geom::Affine const double scalex = scale/2.*(std::fabs(trans[0])+std::fabs(trans[1])); double scaley = scale/2.*(std::fabs(trans[2])+std::fabs(trans[3])); - //FIXME: no +2 should be there!... (noticable only for big scales at big zoom factor) + //FIXME: no +2 should be there!... (noticeable only for big scales at big zoom factor) area.expandBy(scalex+2, scaley+2); } diff --git a/src/display/nr-filter-displacement-map.h b/src/display/nr-filter-displacement-map.h index c4e2400fe..c469f4ced 100644 --- a/src/display/nr-filter-displacement-map.h +++ b/src/display/nr-filter-displacement-map.h @@ -35,6 +35,8 @@ public: virtual void set_scale(double s); virtual void set_channel_selector(int s, FilterDisplacementMapChannelSelector channel); + virtual Glib::ustring name() { return Glib::ustring("Displacement Map"); } + private: double scale; int _input2; diff --git a/src/display/nr-filter-flood.h b/src/display/nr-filter-flood.h index 826aa981a..1752a4ca4 100644 --- a/src/display/nr-filter-flood.h +++ b/src/display/nr-filter-flood.h @@ -35,6 +35,8 @@ public: virtual void set_color(guint32 c); virtual void set_icc(SVGICCColor *icc_color); + virtual Glib::ustring name() { return Glib::ustring("Flood"); } + private: double opacity; guint32 color; diff --git a/src/display/nr-filter-gaussian.cpp b/src/display/nr-filter-gaussian.cpp index 24960af78..cdd01e75e 100644 --- a/src/display/nr-filter-gaussian.cpp +++ b/src/display/nr-filter-gaussian.cpp @@ -616,7 +616,7 @@ void FilterGaussian::render_cairo(FilterSlot &slot) // Decide which filter to use for X and Y // This threshold was determined by trial-and-error for one specific machine, // so there's a good chance that it's not optimal. - // Whatever you do, don't go below 1 (and preferrably not even below 2), as + // Whatever you do, don't go below 1 (and preferably not even below 2), as // the IIR filter gets unstable there. bool use_IIR_x = deviation_x > 3; bool use_IIR_y = deviation_y > 3; diff --git a/src/display/nr-filter-gaussian.h b/src/display/nr-filter-gaussian.h index 88c38247f..c8314b633 100644 --- a/src/display/nr-filter-gaussian.h +++ b/src/display/nr-filter-gaussian.h @@ -56,6 +56,8 @@ public: */ void set_deviation(double x, double y); + virtual Glib::ustring name() { return Glib::ustring("Gaussian Blur"); } + private: double _deviation_x; double _deviation_y; diff --git a/src/display/nr-filter-image.cpp b/src/display/nr-filter-image.cpp index af89d98e0..7e859314a 100644 --- a/src/display/nr-filter-image.cpp +++ b/src/display/nr-filter-image.cpp @@ -144,7 +144,7 @@ void FilterImage::render_cairo(FilterSlot &slot) * (See http://www.w3.org/TR/xmlbase/#resolution .) */ gchar *fullname = feImageHref; if ( !g_file_test( fullname, G_FILE_TEST_EXISTS ) ) { - // Try to load from relative postion combined with document base + // Try to load from relative position combined with document base if( document ) { fullname = g_build_filename( document->getBase(), feImageHref, NULL ); } diff --git a/src/display/nr-filter-image.h b/src/display/nr-filter-image.h index 147a8ba6c..0ae6ac6ce 100644 --- a/src/display/nr-filter-image.h +++ b/src/display/nr-filter-image.h @@ -40,6 +40,8 @@ public: bool from_element; SPItem* SVGElem; + virtual Glib::ustring name() { return Glib::ustring("Image"); } + private: SPDocument *document; char *feImageHref; diff --git a/src/display/nr-filter-merge.cpp b/src/display/nr-filter-merge.cpp index 2b9a24f25..fc2ce408f 100644 --- a/src/display/nr-filter-merge.cpp +++ b/src/display/nr-filter-merge.cpp @@ -38,6 +38,9 @@ void FilterMerge::render_cairo(FilterSlot &slot) ci_fp = (SPColorInterpolation)_style->color_interpolation_filters.computed; } + Geom::Rect vp = filter_primitive_area( slot.get_units() ); + slot.set_primitive_area(_output, vp); // Needed for tiling + // output is RGBA if at least one input is RGBA bool rgba32 = false; cairo_surface_t *out = NULL; diff --git a/src/display/nr-filter-merge.h b/src/display/nr-filter-merge.h index b20d663ab..26ef42e4d 100644 --- a/src/display/nr-filter-merge.h +++ b/src/display/nr-filter-merge.h @@ -32,6 +32,8 @@ public: virtual void set_input(int input); virtual void set_input(int input, int slot); + virtual Glib::ustring name() { return Glib::ustring("Merge"); } + private: std::vector<int> _input_image; }; diff --git a/src/display/nr-filter-morphology.h b/src/display/nr-filter-morphology.h index cd7dfe775..97d91b1a6 100644 --- a/src/display/nr-filter-morphology.h +++ b/src/display/nr-filter-morphology.h @@ -39,6 +39,8 @@ public: void set_xradius(double x); void set_yradius(double y); + virtual Glib::ustring name() { return Glib::ustring("Morphology"); } + private: FilterMorphologyOperator Operator; double xradius; diff --git a/src/display/nr-filter-offset.cpp b/src/display/nr-filter-offset.cpp index 93bab7d39..718dc4e2c 100644 --- a/src/display/nr-filter-offset.cpp +++ b/src/display/nr-filter-offset.cpp @@ -42,25 +42,11 @@ void FilterOffset::render_cairo(FilterSlot &slot) Geom::Rect vp = filter_primitive_area( slot.get_units() ); slot.set_primitive_area(_output, vp); // Needed for tiling - // Handle bounding box case - double x = dx; - double y = dy; - if( slot.get_units().get_primitive_units() == SP_FILTER_UNITS_OBJECTBOUNDINGBOX ) { - Geom::OptRect bbox = slot.get_units().get_item_bbox(); - if( bbox ) { - x *= (*bbox).width(); - y *= (*bbox).height(); - } - } - - Geom::Affine trans = slot.get_units().get_matrix_user2pb(); - - Geom::Point offset(x, y); - offset *= trans; - offset[X] -= trans[4]; - offset[Y] -= trans[5]; + Geom::Affine p2pb = slot.get_units().get_matrix_primitiveunits2pb(); + double x = dx * p2pb.expansionX(); + double y = dy * p2pb.expansionY(); - cairo_set_source_surface(ct, in, offset[X], offset[Y]); + cairo_set_source_surface(ct, in, x, y); cairo_paint(ct); cairo_destroy(ct); diff --git a/src/display/nr-filter-offset.h b/src/display/nr-filter-offset.h index c1ee1d82a..6e02bc1d7 100644 --- a/src/display/nr-filter-offset.h +++ b/src/display/nr-filter-offset.h @@ -33,6 +33,8 @@ public: void set_dx(double amount); void set_dy(double amount); + virtual Glib::ustring name() { return Glib::ustring("Offset"); } + private: double dx, dy; }; diff --git a/src/display/nr-filter-primitive.h b/src/display/nr-filter-primitive.h index a1339cc6c..cba1fdf20 100644 --- a/src/display/nr-filter-primitive.h +++ b/src/display/nr-filter-primitive.h @@ -14,6 +14,8 @@ #include <2geom/forward.h> #include <2geom/rect.h> +#include <glibmm/ustring.h> + #include "display/nr-filter-types.h" #include "svg/svg-length.h" @@ -121,6 +123,9 @@ public: */ void setStyle(SPStyle *style); + // Useful for debugging + virtual Glib::ustring name() { return Glib::ustring("No name"); } + protected: int _input; int _output; diff --git a/src/display/nr-filter-skeleton.cpp b/src/display/nr-filter-skeleton.cpp index 86ab8141e..491c7f52a 100644 --- a/src/display/nr-filter-skeleton.cpp +++ b/src/display/nr-filter-skeleton.cpp @@ -1,14 +1,14 @@ /* * Filter primitive renderer skeleton class * You can create your new filter primitive renderer by replacing - * all occurences of Skeleton, skeleton and SKELETON with your filter + * all occurrences of Skeleton, skeleton and SKELETON with your filter * type, like gaussian or blend in respective case. * * This can be accomplished with the following sed command: * sed -e "s/Skeleton/Name/g" -e "s/skeleton/name/" -e "s/SKELETON/NAME/" * nr-filter-skeleton.cpp >nr-filter-name.cpp * - * (on one line, replace occurences of 'name' with your filter name) + * (on one line, replace occurrences of 'name' with your filter name) * * Remember to convert the .h file too. The sed command is same for both * files. diff --git a/src/display/nr-filter-skeleton.h b/src/display/nr-filter-skeleton.h index e17c244c1..6c92a4a09 100644 --- a/src/display/nr-filter-skeleton.h +++ b/src/display/nr-filter-skeleton.h @@ -4,14 +4,14 @@ /* * Filter primitive renderer skeleton class * You can create your new filter primitive renderer by replacing - * all occurences of Skeleton, skeleton and SKELETON with your filter + * all occurrences of Skeleton, skeleton and SKELETON with your filter * type, like gaussian or blend in respective case. * * This can be accomplished with the following sed command: * sed -e "s/Skeleton/Name/g" -e "s/skeleton/name/" -e "s/SKELETON/NAME/" * nr-filter-skeleton.h >nr-filter-name.h * - * (on one line, replace occurences of 'name' with your filter name) + * (on one line, replace occurrences of 'name' with your filter name) * * Remember to convert the .cpp file too. The sed command is same for both * files. diff --git a/src/display/nr-filter-specularlighting.h b/src/display/nr-filter-specularlighting.h index ff9cda450..833b2ac3d 100644 --- a/src/display/nr-filter-specularlighting.h +++ b/src/display/nr-filter-specularlighting.h @@ -49,6 +49,8 @@ public: double specularExponent; guint32 lighting_color; + virtual Glib::ustring name() { return Glib::ustring("Specular Lighting"); } + private: SVGICCColor *icc; }; diff --git a/src/display/nr-filter-tile.cpp b/src/display/nr-filter-tile.cpp index c151c8537..ad4e64768 100644 --- a/src/display/nr-filter-tile.cpp +++ b/src/display/nr-filter-tile.cpp @@ -114,8 +114,11 @@ void FilterTile::render_cairo(FilterSlot &slot) void FilterTile::area_enlarge(Geom::IntRect &area, Geom::Affine const &trans) { - // Set to infinite rectangle so we get tile source. It will be clipped later. - area = Geom::IntRect::infinite(); + // Set to very large rectangle so we get tile source. It will be clipped later. + + // Note, setting to infinite using Geom::IntRect::infinite() causes overflow/underflow problems. + Geom::IntCoord max = std::numeric_limits<Geom::IntCoord>::max()/4; + area = Geom::IntRect(-max,-max,max,max); } double FilterTile::complexity(Geom::Affine const &) diff --git a/src/display/nr-filter-tile.h b/src/display/nr-filter-tile.h index 239ecff4b..c76302033 100644 --- a/src/display/nr-filter-tile.h +++ b/src/display/nr-filter-tile.h @@ -28,6 +28,8 @@ public: virtual void render_cairo(FilterSlot &slot); virtual void area_enlarge(Geom::IntRect &area, Geom::Affine const &trans); virtual double complexity(Geom::Affine const &ctm); + + virtual Glib::ustring name() { return Glib::ustring("Tile"); } }; } /* namespace Filters */ diff --git a/src/display/nr-filter-turbulence.h b/src/display/nr-filter-turbulence.h index ee8079133..3960c2f8e 100644 --- a/src/display/nr-filter-turbulence.h +++ b/src/display/nr-filter-turbulence.h @@ -54,6 +54,9 @@ public: void set_stitchTiles(bool st); void set_type(FilterTurbulenceType t); void set_updated(bool u); + + virtual Glib::ustring name() { return Glib::ustring("Turbulence"); } + private: TurbulenceGenerator *gen; diff --git a/src/display/nr-filter-units.cpp b/src/display/nr-filter-units.cpp index 369deeb00..e242e3963 100644 --- a/src/display/nr-filter-units.cpp +++ b/src/display/nr-filter-units.cpp @@ -83,24 +83,15 @@ Geom::Affine FilterUnits::get_matrix_user2pb() const { Geom::Affine FilterUnits::get_matrix_units2pb(SPFilterUnits units) const { if ( item_bbox && (units == SP_FILTER_UNITS_OBJECTBOUNDINGBOX) ) { + Geom::Affine u2pb = get_matrix_user2pb(); - Geom::Point origo(item_bbox->min()); - origo *= u2pb; - Geom::Point i_end(item_bbox->max()[X], item_bbox->min()[Y]); - i_end *= u2pb; - Geom::Point j_end(item_bbox->min()[X], item_bbox->max()[Y]); - j_end *= u2pb; - - double len_i = sqrt((origo[X] - i_end[X]) * (origo[X] - i_end[X]) - + (origo[Y] - i_end[Y]) * (origo[Y] - i_end[Y])); - double len_j = sqrt((origo[X] - j_end[X]) * (origo[X] - j_end[X]) - + (origo[Y] - j_end[Y]) * (origo[Y] - j_end[Y])); /* TODO: make sure that user coordinate system (0,0) is in correct * place in pixblock coordinates */ - Geom::Scale scaling(1.0 / len_i, 1.0 / len_j); + Geom::Scale scaling(item_bbox->width(), item_bbox->height()); u2pb *= scaling; return u2pb; + } else if (units == SP_FILTER_UNITS_USERSPACEONUSE) { return get_matrix_user2pb(); } else { diff --git a/src/display/nr-filter.h b/src/display/nr-filter.h index 211d8ddd9..7028f2e81 100644 --- a/src/display/nr-filter.h +++ b/src/display/nr-filter.h @@ -40,7 +40,7 @@ public: * New primitive is placed so that it will be executed after all filter * primitives defined beforehand for this filter object. * Should this filter not have enough space for a new primitive, the filter - * is enlarged to accomodate the new filter element. It may be enlarged by + * is enlarged to accommodate the new filter element. It may be enlarged by * more that one element. * Returns a handle (non-negative integer) to the filter primitive created. * Returns -1, if type is not valid filter primitive type or filter diff --git a/src/display/nr-light.h b/src/display/nr-light.h index 94b573761..57c421f4a 100644 --- a/src/display/nr-light.h +++ b/src/display/nr-light.h @@ -42,14 +42,14 @@ class DistantLight { /** * Computes the light vector of the distant light * - * \param v a Fvector referece where we store the result + * \param v a Fvector reference where we store the result */ void light_vector(NR::Fvector &v); /** * Computes the light components of the distant light * - * \param lc a Fvector referece where we store the result, X=R, Y=G, Z=B + * \param lc a Fvector reference where we store the result, X=R, Y=G, Z=B */ void light_components(NR::Fvector &lc); @@ -77,7 +77,7 @@ class PointLight { * x, y and z are given in the arena_item coordinate, they are used as * is * - * \param v a Fvector referece where we store the result + * \param v a Fvector reference where we store the result * \param x x coordinate of the current point * \param y y coordinate of the current point * \param z z coordinate of the current point @@ -87,7 +87,7 @@ class PointLight { /** * Computes the light components of the distant light * - * \param lc a Fvector referece where we store the result, X=R, Y=G, Z=B + * \param lc a Fvector reference where we store the result, X=R, Y=G, Z=B */ void light_components(NR::Fvector &lc); @@ -118,7 +118,7 @@ class SpotLight { * x, y and z are given in the arena_item coordinate, they are used as * is * - * \param v a Fvector referece where we store the result + * \param v a Fvector reference where we store the result * \param x x coordinate of the current point * \param y y coordinate of the current point * \param z z coordinate of the current point @@ -129,7 +129,7 @@ class SpotLight { * Computes the light components of the distant light at the current * point. We only need the light vector to compute theses * - * \param lc a Fvector referece where we store the result, X=R, Y=G, Z=B + * \param lc a Fvector reference where we store the result, X=R, Y=G, Z=B * \param L the light vector of the current point */ void light_components(NR::Fvector &lc, const NR::Fvector &L); diff --git a/src/display/sodipodi-ctrlrect.cpp b/src/display/sodipodi-ctrlrect.cpp index 075e04e6d..a35f07c3d 100644 --- a/src/display/sodipodi-ctrlrect.cpp +++ b/src/display/sodipodi-ctrlrect.cpp @@ -212,7 +212,7 @@ void CtrlRect::render(SPCanvasBuf *buf) cairo_stroke_preserve(buf->ct); } - cairo_new_path( buf->ct ); // Clear path or get wierd artifacts. + cairo_new_path( buf->ct ); // Clear path or get weird artifacts. cairo_restore(buf->ct); } } diff --git a/src/display/sp-canvas.cpp b/src/display/sp-canvas.cpp index 17c4cc0d5..7acd645c8 100644 --- a/src/display/sp-canvas.cpp +++ b/src/display/sp-canvas.cpp @@ -1755,11 +1755,8 @@ bool SPCanvas::paintRect(int xx0, int yy0, int xx1, int yy1) setup.mouse_loc = sp_canvas_window_to_world(this, Geom::Point(x,y)); - static unsigned tile_multiplier = 0; - if (tile_multiplier == 0) { - Inkscape::Preferences *prefs = Inkscape::Preferences::get(); - tile_multiplier = prefs->getIntLimited("/options/rendering/tile-multiplier", 1, 1, 64); - } + Inkscape::Preferences *prefs = Inkscape::Preferences::get(); + unsigned tile_multiplier = prefs->getIntLimited("/options/rendering/tile-multiplier", 16, 1, 512); if (_rendermode != Inkscape::RENDERMODE_OUTLINE) { // use 256K as a compromise to not slow down gradients |
