summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorkamalpreetgrewal <grewalkamal005@gmail.com>2016-06-15 13:44:45 +0000
committerkamalpreetgrewal <grewalkamal005@gmail.com>2016-06-15 13:44:45 +0000
commita3791c80377428f14bc4729c11d1538ba14fa7c3 (patch)
tree499cd4d98350d0aa48124f82c21c1c91a49ca770 /src
parentSet style and class attribute of object approprialtely when adding new style ... (diff)
parent[Bug #1300865] lcms2: crash in Fill and Stroke if linked color profile is mis... (diff)
downloadinkscape-a3791c80377428f14bc4729c11d1538ba14fa7c3.tar.gz
inkscape-a3791c80377428f14bc4729c11d1538ba14fa7c3.zip
Merge changes from trunk
(bzr r14949.1.17)
Diffstat (limited to 'src')
-rw-r--r--src/color-profile.cpp6
-rw-r--r--src/document.cpp22
-rw-r--r--src/document.h2
-rw-r--r--src/sp-object.cpp15
-rw-r--r--src/ui/widget/color-icc-selector.cpp3
5 files changed, 44 insertions, 4 deletions
diff --git a/src/color-profile.cpp b/src/color-profile.cpp
index 9e545df03..aea9ccab0 100644
--- a/src/color-profile.cpp
+++ b/src/color-profile.cpp
@@ -588,7 +588,11 @@ bool ColorProfile::GamutCheck(SPColor color)
static_cast<guchar>(SP_RGBA32_G_U(val)),
static_cast<guchar>(SP_RGBA32_B_U(val)),
255};
- cmsDoTransform(ColorProfile::getTransfGamutCheck(), &check_color, &outofgamut, 1);
+
+ cmsHTRANSFORM gamutCheck = ColorProfile::getTransfGamutCheck();
+ if (gamutCheck) {
+ cmsDoTransform(gamutCheck, &check_color, &outofgamut, 1);
+ }
#if HAVE_LIBLCMS1
cmsSetAlarmCodes(alarm_r, alarm_g, alarm_b);
diff --git a/src/document.cpp b/src/document.cpp
index d8c3f1269..902dabbc3 100644
--- a/src/document.cpp
+++ b/src/document.cpp
@@ -1602,11 +1602,22 @@ static unsigned int count_objects_recursive(SPObject *obj, unsigned int count)
return count;
}
+/**
+ * Count the number of objects in a given document recursively using the count_objects_recursive helper function
+ *
+ * @param[in] document Pointer to the document for counting objects
+ * @return Numer of objects in the document
+ */
static unsigned int objects_in_document(SPDocument *document)
{
return count_objects_recursive(document->getRoot(), 0);
}
+/**
+ * Remove unused definitions etc. recursively from an object and its siblings
+ *
+ * @param[inout] obj Object which shall be "cleaned"
+ */
static void vacuum_document_recursive(SPObject *obj)
{
if (SP_IS_DEFS(obj)) {
@@ -1621,6 +1632,11 @@ static void vacuum_document_recursive(SPObject *obj)
}
}
+/**
+ * Remove unused definitions etc. recursively from an entire document.
+ *
+ * @return Number of removed objects
+ */
unsigned int SPDocument::vacuumDocument()
{
unsigned int start = objects_in_document(this);
@@ -1639,6 +1655,7 @@ unsigned int SPDocument::vacuumDocument()
newend = objects_in_document(this);
} while (iterations < 100 && newend < end);
+ // We stop if vacuum_document_recursive doesn't remove any more objects or after 100 iterations, whichever occurs first.
return start - newend;
}
@@ -1647,6 +1664,11 @@ bool SPDocument::isSeeking() const {
return priv->seeking;
}
+/**
+ * Indicate to the user if the document has been modified since the last save by displaying a "*" in front of the name of the file in the window title.
+ *
+ * @param[in] modified True if the document has been modified.
+ */
void SPDocument::setModifiedSinceSave(bool modified) {
this->modified_since_save = modified;
if (SP_ACTIVE_DESKTOP) {
diff --git a/src/document.h b/src/document.h
index e95042155..813d4ae49 100644
--- a/src/document.h
+++ b/src/document.h
@@ -198,7 +198,7 @@ public:
bool isSeeking() const;
bool isModifiedSinceSave() const { return modified_since_save; }
- void setModifiedSinceSave(bool modified = true);
+ void setModifiedSinceSave(bool const modified = true);
private:
SPDocument(SPDocument const &); // no copy
diff --git a/src/sp-object.cpp b/src/sp-object.cpp
index db66eb3e6..d1659eedc 100644
--- a/src/sp-object.cpp
+++ b/src/sp-object.cpp
@@ -71,13 +71,17 @@ Inkscape::XML::NodeEventVector object_event_vector = {
SPObject::repr_order_changed
};
-// A friend class used to set internal members on SPObject so as to not expose settors in SPObject's public API
+/**
+ * A friend class used to set internal members on SPObject so as to not expose settors in SPObject's public API
+ */
class SPObjectImpl
{
public:
/**
* Null's the id member of an SPObject without attempting to free prior contents.
+ *
+ * @param[inout] obj Pointer to the object which's id shall be nulled.
*/
static void setIdNull( SPObject* obj ) {
if (obj) {
@@ -87,6 +91,9 @@ public:
/**
* Sets the id member of an object, freeing any prior content.
+ *
+ * @param[inout] obj Pointer to the object which's id shall be set.
+ * @param[in] id New id
*/
static void setId( SPObject* obj, gchar const* id ) {
if (obj && (id != obj->id) ) {
@@ -104,6 +111,9 @@ public:
static gchar *sp_object_get_unique_id(SPObject *object,
gchar const *defid);
+/**
+ * Constructor, sets all attributes to default values.
+ */
SPObject::SPObject()
: cloned(0), uflags(0), mflags(0), hrefcount(0), _total_hrefcount(0),
document(NULL), parent(NULL), children(NULL), _last_child(NULL),
@@ -126,6 +136,9 @@ SPObject::SPObject()
this->context_style = NULL;
}
+/**
+ * Destructor, frees the used memory and unreferences a potential successor of the object.
+ */
SPObject::~SPObject() {
g_free(this->_label);
g_free(this->_default_label);
diff --git a/src/ui/widget/color-icc-selector.cpp b/src/ui/widget/color-icc-selector.cpp
index b422892fe..e4f58fe8a 100644
--- a/src/ui/widget/color-icc-selector.cpp
+++ b/src/ui/widget/color-icc-selector.cpp
@@ -633,9 +633,10 @@ void ColorICCSelectorImpl::_switchToProfile(gchar const *name)
#endif // DEBUG_LCMS
tmp.set(SP_RGBA32_U_COMPOSE(pre[0], pre[1], pre[2], 0xff));
}
+
+ dirty = true;
}
}
- dirty = true;
}
}
else {