summaryrefslogtreecommitdiffstats
path: root/src/desktop-style.cpp
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2010-08-08 17:27:51 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2010-08-08 17:27:51 +0000
commit60d3113d1f022a3de7cf04c7979d4751b3fe21f6 (patch)
treeca33e2a9a1af6b5911598fa1c6a1d77087b71dd2 /src/desktop-style.cpp
parentMinor cleanups (diff)
parentAdd a constrained snap method that takes multiple constraints. This reduces t... (diff)
downloadinkscape-60d3113d1f022a3de7cf04c7979d4751b3fe21f6.tar.gz
inkscape-60d3113d1f022a3de7cf04c7979d4751b3fe21f6.zip
merge from trunk
(bzr r9508.1.52)
Diffstat (limited to 'src/desktop-style.cpp')
-rw-r--r--src/desktop-style.cpp52
1 files changed, 22 insertions, 30 deletions
diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp
index f68797d80..55345ee8a 100644
--- a/src/desktop-style.cpp
+++ b/src/desktop-style.cpp
@@ -44,7 +44,6 @@
#include "desktop-style.h"
#include "svg/svg-icc-color.h"
-#include "svg/svg-device-color.h"
#include "box3d-side.h"
/**
@@ -436,6 +435,20 @@ stroke_average_width (GSList const *objects)
return avgwidth / (g_slist_length ((GSList *) objects) - n_notstroked);
}
+static bool vectorsClose( std::vector<double> const &lhs, std::vector<double> const &rhs )
+{
+ static double epsilon = 1e-6;
+ bool isClose = false;
+ if ( lhs.size() == rhs.size() ) {
+ isClose = true;
+ for ( size_t i = 0; (i < lhs.size()) && isClose; ++i ) {
+ isClose = fabs(lhs[i] - rhs[i]) < epsilon;
+ }
+ }
+ return isClose;
+}
+
+
/**
* Write to style_res the average fill or stroke of list of objects, if applicable.
*/
@@ -452,7 +465,6 @@ objects_query_fillstroke (GSList *objects, SPStyle *style_res, bool const isfill
paint_res->set = TRUE;
SVGICCColor* iccColor = 0;
- SVGDeviceColor* devColor = 0;
bool iccSeen = false;
gfloat c[4];
@@ -536,11 +548,15 @@ objects_query_fillstroke (GSList *objects, SPStyle *style_res, bool const isfill
iccColor = paint->value.color.icc;
iccSeen = true;
} else {
- if (same_color && (prev[0] != d[0] || prev[1] != d[1] || prev[2] != d[2]))
+ if (same_color && (prev[0] != d[0] || prev[1] != d[1] || prev[2] != d[2])) {
same_color = false;
- if ( iccSeen ) {
- if(paint->value.color.icc) {
- // TODO fix this
+ iccColor = 0;
+ }
+ if ( iccSeen && iccColor ) {
+ if ( !paint->value.color.icc
+ || (iccColor->colorProfile != paint->value.color.icc->colorProfile)
+ || !vectorsClose(iccColor->colors, paint->value.color.icc->colors) ) {
+ same_color = false;
iccColor = 0;
}
}
@@ -552,22 +568,6 @@ objects_query_fillstroke (GSList *objects, SPStyle *style_res, bool const isfill
c[2] += d[2];
c[3] += SP_SCALE24_TO_FLOAT (isfill? style->fill_opacity.value : style->stroke_opacity.value);
- // average device color
- unsigned int it;
- if (i==objects /*if this is the first object in the GList*/
- && paint->value.color.device){
- devColor = new SVGDeviceColor(*paint->value.color.device);
- for (it=0; it < paint->value.color.device->colors.size(); it++){
- devColor->colors[it] = 0;
- }
- }
-
- if (devColor && paint->value.color.device && paint->value.color.device->type == devColor->type){
- for (it=0; it < paint->value.color.device->colors.size(); it++){
- devColor->colors[it] += paint->value.color.device->colors[it];
- }
- }
-
num ++;
}
@@ -607,14 +607,6 @@ objects_query_fillstroke (GSList *objects, SPStyle *style_res, bool const isfill
paint_res->value.color.icc = tmp;
}
- // divide and store the device-color
- if (devColor){
- for (unsigned int it=0; it < devColor->colors.size(); it++){
- devColor->colors[it] /= num;
- }
- paint_res->value.color.device = devColor;
- }
-
if (num > 1) {
if (same_color)
return QUERY_STYLE_MULTIPLE_SAME;