From bb8404b19557519bd828113fa93604b10e9e7fe3 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Wed, 14 Jul 2010 04:32:10 +0200 Subject: Merge redundant *-fns.h into respective filter headers. Move gaussian blur to filters directory. Blend filter effect. (bzr r9508.1.16) --- src/desktop-style.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/desktop-style.cpp') diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index 26f29d172..1b277a381 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -28,7 +28,7 @@ #include "filters/blend.h" #include "sp-filter.h" #include "sp-filter-reference.h" -#include "sp-gaussian-blur.h" +#include "filters/gaussian-blur.h" #include "sp-flowtext.h" #include "sp-flowregion.h" #include "sp-flowdiv.h" -- cgit v1.2.3 From 77dc5f1acd4a6b66b2d6fc5c81f7e5c61ef95785 Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Thu, 5 Aug 2010 02:49:51 +0200 Subject: Wholesale cruft removal part 4; fix crash when rendering guides (bzr r9508.1.48) --- src/desktop-style.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/desktop-style.cpp') diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index 1b277a381..f68797d80 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -406,7 +406,7 @@ gdouble stroke_average_width (GSList const *objects) { if (g_slist_length ((GSList *) objects) == 0) - return NR_HUGE; + return Geom::infinity(); gdouble avgwidth = 0.0; bool notstroked = true; @@ -431,7 +431,7 @@ stroke_average_width (GSList const *objects) } if (notstroked) - return NR_HUGE; + return Geom::infinity(); return avgwidth / (g_slist_length ((GSList *) objects) - n_notstroked); } -- cgit v1.2.3 From 0ff79849c34ee1a5120b70968ccc4b418877f8e1 Mon Sep 17 00:00:00 2001 From: Nicolas Dufour Date: Fri, 1 Apr 2011 14:52:41 +0200 Subject: Tweak and spray: * Fix for Bug #745652 (Gradient handles persistence with Tweak and Spray). * Fix for Bug #490225 (Tweak Tool : Opacity doesn't change in Paint/Jitter modes). * Tweak tool code consistency fix. * Spray tool default status message modified. (bzr r10139) --- src/desktop-style.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/desktop-style.cpp') diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index d2ec093fc..2c20964aa 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -288,7 +288,7 @@ sp_desktop_get_master_opacity_tool(SPDesktop *desktop, Glib::ustring const &tool value = 1.0; // things failed. set back to the default } else { if (has_opacity) - *has_opacity = false; + *has_opacity = true; } } -- cgit v1.2.3 From eed6e9c2c229b10911a23976c47da79fc70a5b87 Mon Sep 17 00:00:00 2001 From: "Johan B. C. Engelen" Date: Sun, 17 Jul 2011 21:47:09 +0200 Subject: - rename SPItem::i2d_affine to i2dt_affine, to clarify that it is item-to-desktop, not item-to-document. This should make it easier to spot bugs. - tag some instances where the document-to-desktop transform has been hardcoded (bzr r10466) --- src/desktop-style.cpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/desktop-style.cpp') diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index 88ad9ca57..1cad282b3 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -420,7 +420,7 @@ stroke_average_width (GSList const *objects) if (!SP_IS_ITEM (l->data)) continue; - Geom::Affine i2d = SP_ITEM(l->data)->i2d_affine(); + Geom::Affine i2dt = SP_ITEM(l->data)->i2dt_affine(); SPObject *object = SP_OBJECT(l->data); @@ -431,7 +431,7 @@ stroke_average_width (GSList const *objects) notstroked = false; } - avgwidth += object->style->stroke_width.computed * i2d.descrim(); + avgwidth += object->style->stroke_width.computed * i2dt.descrim(); } if (notstroked) @@ -725,7 +725,7 @@ objects_query_strokewidth (GSList *objects, SPStyle *style_res) noneSet &= style->stroke.isNone(); - Geom::Affine i2d = SP_ITEM(obj)->i2d_affine(); + Geom::Affine i2d = SP_ITEM(obj)->i2dt_affine(); double sw = style->stroke_width.computed * i2d.descrim(); if (prev_sw != -1 && fabs(sw - prev_sw) > 1e-3) @@ -961,7 +961,7 @@ objects_query_fontnumbers (GSList *objects, SPStyle *style_res) } texts ++; - size += style->font_size.computed * Geom::Affine(SP_ITEM(obj)->i2d_affine()).descrim(); /// \todo FIXME: we assume non-% units here + size += style->font_size.computed * Geom::Affine(SP_ITEM(obj)->i2dt_affine()).descrim(); /// \todo FIXME: we assume non-% units here if (style->letter_spacing.normal) { if (!different && (letterspacing_prev == 0 || letterspacing_prev == letterspacing)) { @@ -1428,7 +1428,7 @@ objects_query_blur (GSList *objects, SPStyle *style_res) continue; } - Geom::Affine i2d = SP_ITEM(obj)->i2d_affine(); + Geom::Affine i2d = SP_ITEM(obj)->i2dt_affine(); items ++; -- cgit v1.2.3 From 45125f4504bd611ab43d9c6529b45fca81e98948 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Mon, 5 Sep 2011 23:32:08 +0200 Subject: When scaling a diagonal line to a horizontal line, the strokewidth becomes NaN. This commit allows to change the strokewidth back to a more useful value (as reported by ~suv in lp:825840) (bzr r10621) --- src/desktop-style.cpp | 46 ++++++++++++++++++++++++++++++---------------- 1 file changed, 30 insertions(+), 16 deletions(-) (limited to 'src/desktop-style.cpp') diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index 1cad282b3..c08ee8677 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -424,14 +424,16 @@ stroke_average_width (GSList const *objects) SPObject *object = SP_OBJECT(l->data); - if ( object->style->stroke.isNone() ) { + double width = object->style->stroke_width.computed * i2dt.descrim(); + + if ( object->style->stroke.isNone() || isnan(width)) { ++n_notstroked; // do not count nonstroked objects continue; } else { notstroked = false; } - avgwidth += object->style->stroke_width.computed * i2dt.descrim(); + avgwidth += width; } if (notstroked) @@ -721,18 +723,19 @@ objects_query_strokewidth (GSList *objects, SPStyle *style_res) continue; } - n_stroked ++; - noneSet &= style->stroke.isNone(); Geom::Affine i2d = SP_ITEM(obj)->i2dt_affine(); double sw = style->stroke_width.computed * i2d.descrim(); - if (prev_sw != -1 && fabs(sw - prev_sw) > 1e-3) - same_sw = false; - prev_sw = sw; + if (!isnan(sw)) { + if (prev_sw != -1 && fabs(sw - prev_sw) > 1e-3) + same_sw = false; + prev_sw = sw; - avgwidth += sw; + avgwidth += sw; + n_stroked ++; + } } if (n_stroked > 1) @@ -945,6 +948,7 @@ objects_query_fontnumbers (GSList *objects, SPStyle *style_res) double linespacing_prev = 0; int texts = 0; + int no_size = 0; for (GSList const *i = objects; i != NULL; i = i->next) { SPObject *obj = SP_OBJECT (i->data); @@ -961,7 +965,12 @@ objects_query_fontnumbers (GSList *objects, SPStyle *style_res) } texts ++; - size += style->font_size.computed * Geom::Affine(SP_ITEM(obj)->i2dt_affine()).descrim(); /// \todo FIXME: we assume non-% units here + double dummy = style->font_size.computed * Geom::Affine(SP_ITEM(obj)->i2dt_affine()).descrim(); + if (!isnan(dummy)) { + size += dummy; /// \todo FIXME: we assume non-% units here + } else { + no_size++; + } if (style->letter_spacing.normal) { if (!different && (letterspacing_prev == 0 || letterspacing_prev == letterspacing)) { @@ -1016,7 +1025,9 @@ objects_query_fontnumbers (GSList *objects, SPStyle *style_res) return QUERY_STYLE_NOTHING; if (texts > 1) { - size /= texts; + if (texts - no_size > 0) { + size /= (texts - no_size); + } letterspacing /= texts; wordspacing /= texts; linespacing /= texts; @@ -1444,12 +1455,15 @@ objects_query_blur (GSList *objects, SPStyle *style_res) if(SP_IS_GAUSSIANBLUR(primitive)) { SPGaussianBlur * spblur = SP_GAUSSIANBLUR(primitive); float num = spblur->stdDeviation.getNumber(); - blur_sum += num * i2d.descrim(); - if (blur_prev != -1 && fabs (num - blur_prev) > 1e-2) // rather low tolerance because difference in blur radii is much harder to notice than e.g. difference in sizes - same_blur = false; - blur_prev = num; - //TODO: deal with opt number, for the moment it's not necessary to the ui. - blur_items ++; + float dummy = num * i2d.descrim(); + if (!isnan(dummy)) { + blur_sum += dummy; + if (blur_prev != -1 && fabs (num - blur_prev) > 1e-2) // rather low tolerance because difference in blur radii is much harder to notice than e.g. difference in sizes + same_blur = false; + blur_prev = num; + //TODO: deal with opt number, for the moment it's not necessary to the ui. + blur_items ++; + } } } primitive_obj = primitive_obj->next; -- cgit v1.2.3 From 8ceb1a926aaacf57ebfe1c244ac1a73b6866fda4 Mon Sep 17 00:00:00 2001 From: Diederik van Lierop Date: Tue, 6 Sep 2011 19:56:21 +0200 Subject: Fix isnan() compilation issues (bzr r10623) --- src/desktop-style.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/desktop-style.cpp') diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index c08ee8677..074e7bf67 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -46,6 +46,7 @@ #include "desktop-style.h" #include "svg/svg-icc-color.h" #include "box3d-side.h" +#include <2geom/math-utils.h> /** * Set color on selection on desktop. @@ -426,7 +427,7 @@ stroke_average_width (GSList const *objects) double width = object->style->stroke_width.computed * i2dt.descrim(); - if ( object->style->stroke.isNone() || isnan(width)) { + if ( object->style->stroke.isNone() || IS_NAN(width)) { ++n_notstroked; // do not count nonstroked objects continue; } else { @@ -728,7 +729,7 @@ objects_query_strokewidth (GSList *objects, SPStyle *style_res) Geom::Affine i2d = SP_ITEM(obj)->i2dt_affine(); double sw = style->stroke_width.computed * i2d.descrim(); - if (!isnan(sw)) { + if (!IS_NAN(sw)) { if (prev_sw != -1 && fabs(sw - prev_sw) > 1e-3) same_sw = false; prev_sw = sw; @@ -966,7 +967,7 @@ objects_query_fontnumbers (GSList *objects, SPStyle *style_res) texts ++; double dummy = style->font_size.computed * Geom::Affine(SP_ITEM(obj)->i2dt_affine()).descrim(); - if (!isnan(dummy)) { + if (!IS_NAN(dummy)) { size += dummy; /// \todo FIXME: we assume non-% units here } else { no_size++; @@ -1456,7 +1457,7 @@ objects_query_blur (GSList *objects, SPStyle *style_res) SPGaussianBlur * spblur = SP_GAUSSIANBLUR(primitive); float num = spblur->stdDeviation.getNumber(); float dummy = num * i2d.descrim(); - if (!isnan(dummy)) { + if (!IS_NAN(dummy)) { blur_sum += dummy; if (blur_prev != -1 && fabs (num - blur_prev) > 1e-2) // rather low tolerance because difference in blur radii is much harder to notice than e.g. difference in sizes same_blur = false; -- cgit v1.2.3 From 2633767789e4264b13ef91a684accf734fb4e94f Mon Sep 17 00:00:00 2001 From: "Jon A. Cruz" Date: Wed, 26 Oct 2011 21:55:51 -0700 Subject: Fixing more broken and split doc comments. (bzr r10697) --- src/desktop-style.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/desktop-style.cpp') diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp index 074e7bf67..b29799bb3 100644 --- a/src/desktop-style.cpp +++ b/src/desktop-style.cpp @@ -1,4 +1,4 @@ -/** \file +/* * Desktop style management * * Authors: -- cgit v1.2.3