summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d5f28ef)
raw | patch | inline | side by side (parent: d5f28ef)
author | buliabyak <buliabyak@users.sourceforge.net> | |
Wed, 27 Jun 2007 06:34:35 +0000 (06:34 +0000) | ||
committer | buliabyak <buliabyak@users.sourceforge.net> | |
Wed, 27 Jun 2007 06:34:35 +0000 (06:34 +0000) |
diff --git a/src/desktop-style.cpp b/src/desktop-style.cpp
index c6344da5cc54e4e9f485f1fb52a1c17975f5eb4c..94221ba546fb4eb0c2d42dddb5ac7fcbd8ee938b 100644 (file)
--- a/src/desktop-style.cpp
+++ b/src/desktop-style.cpp
items++;
//if object has a filter
- if (style->filter.set && style->filter.href->getObject()) {
+ if (style->filter.set && style->getFilter()) {
int blurcount = 0;
int blendcount = 0;
// determine whether filter is simple (blend and/or blur) or complex
- for(SPObject *primitive_obj = style->filter.href->getObject()->children;
+ for(SPObject *primitive_obj = style->getFilter()->children;
primitive_obj && SP_IS_FILTER_PRIMITIVE(primitive_obj);
primitive_obj = primitive_obj->next) {
SPFilterPrimitive *primitive = SP_FILTER_PRIMITIVE(primitive_obj);
// simple filter
if(blurcount == 1 || blendcount == 1) {
- for(SPObject *primitive_obj = style->filter.href->getObject()->children;
+ for(SPObject *primitive_obj = style->getFilter()->children;
primitive_obj && SP_IS_FILTER_PRIMITIVE(primitive_obj);
primitive_obj = primitive_obj->next) {
if(SP_IS_FEBLEND(primitive_obj)) {
items ++;
//if object has a filter
- if (style->filter.set && style->filter.href->getObject()) {
+ if (style->filter.set && style->getFilter()) {
//cycle through filter primitives
- SPObject *primitive_obj = style->filter.href->getObject()->children;
+ SPObject *primitive_obj = style->getFilter()->children;
while (primitive_obj) {
if (SP_IS_FILTER_PRIMITIVE(primitive_obj)) {
SPFilterPrimitive *primitive = SP_FILTER_PRIMITIVE(primitive_obj);
index 3f08f42f4393bd5d8cb8e23be6a0082fe3372719..912992a6e38bc88633a32e13d13d5f4b9138b7d0 100644 (file)
group->style = style;
//if group has a filter
- if (style->filter.set && style->filter.href->getObject()) {
+ if (style->filter.set && style->getFilter()) {
if (!group->filter) {
- int primitives = sp_filter_primitive_count(style->filter.href->getObject());
+ int primitives = sp_filter_primitive_count(SP_FILTER(style->getFilter()));
group->filter = new NR::Filter(primitives);
}
- sp_filter_build_renderer(style->filter.href->getObject(), group->filter);
+ sp_filter_build_renderer(SP_FILTER(style->getFilter()), group->filter);
} else {
//no filter set for this group
delete group->filter;
index 87cc94e1b72e115af6193805d34c45d8172e2860..e388fca1d0e84d013fe422cb7be45a8144dd9cce 100644 (file)
image->style = style;
//if image has a filter
- if (style->filter.set && style->filter.href->getObject()) {
+ if (style->filter.set && style->getFilter()) {
if (!image->filter) {
- int primitives = sp_filter_primitive_count(style->filter.href->getObject());
+ int primitives = sp_filter_primitive_count(SP_FILTER(style->getFilter()));
image->filter = new NR::Filter(primitives);
}
- sp_filter_build_renderer(style->filter.href->getObject(), image->filter);
+ sp_filter_build_renderer(SP_FILTER(style->getFilter()), image->filter);
} else {
//no filter set for this image
delete image->filter;
index 0e7dd27985614581aa397c02251d3549958e7302..a31363f9a8abd327cce446caa2fd22a7f31e3856 100644 (file)
shape->setMitreLimit(style->stroke_miterlimit.value);
//if shape has a filter
- if (style->filter.set && style->filter.href->getObject()) {
+ if (style->filter.set && style->getFilter()) {
if (!shape->filter) {
- int primitives = sp_filter_primitive_count(style->filter.href->getObject());
+ int primitives = sp_filter_primitive_count(SP_FILTER(style->getFilter()));
shape->filter = new NR::Filter(primitives);
}
- sp_filter_build_renderer(style->filter.href->getObject(), shape->filter);
+ sp_filter_build_renderer(SP_FILTER(style->getFilter()), shape->filter);
} else {
//no filter set for this shape
delete shape->filter;
index 5515d0a049d69cca18b7174c8b9f6ecf63f94504..e59036362bdff71760bbcce65d09e65af7e97b02 100644 (file)
--- a/src/filter-chemistry.cpp
+++ b/src/filter-chemistry.cpp
SPStyle *style = SP_OBJECT_STYLE(o);
if (style
&& style->filter.set
- && style->filter.href->getObject() == filter)
+ && style->getFilter() == filter)
{
i ++;
}
//return new_filter_gaussian_blur_from_item(document, item, radius);
}
- SPFilter *filter = SP_FILTER(item->style->filter.href->getObject());
+ SPFilter *filter = SP_FILTER(item->style->getFilter());
Inkscape::XML::Document *xml_doc = sp_document_repr_doc(document);
// If there are more users for this filter, duplicate it
if (SP_OBJECT_HREFCOUNT(filter) > count_filter_hrefs(item, filter)) {
Inkscape::XML::Node *repr;
- repr = SP_OBJECT_REPR(item->style->filter.href->getObject())->duplicate(xml_doc);
+ repr = SP_OBJECT_REPR(item->style->getFilter())->duplicate(xml_doc);
SPDefs *defs = (SPDefs *) SP_DOCUMENT_DEFS(document);
SP_OBJECT_REPR(defs)->appendChild(repr);
}
// Set the filter effects area
- Inkscape::XML::Node *repr = SP_OBJECT_REPR(item->style->filter.href->getObject());
+ Inkscape::XML::Node *repr = SP_OBJECT_REPR(item->style->getFilter());
set_filter_area(repr, radius, expansion, i2d.expansionX(),
i2d.expansionY(), width, height);
* be handled gracefully */
void remove_filter_gaussian_blur (SPObject *item)
{
- if (item->style && item->style->filter.set && item->style->filter.href->getObject()) {
+ if (item->style && item->style->filter.set && item->style->getFilter()) {
// Search for the first blur primitive and remove it. (if found)
- Inkscape::XML::Node *repr = SP_OBJECT_REPR(item->style->filter.href->getObject());
+ Inkscape::XML::Node *repr = SP_OBJECT_REPR(item->style->getFilter());
Inkscape::XML::Node *primitive = repr->firstChild();
while (primitive) {
if (strcmp("svg:feGaussianBlur", primitive->name()) == 0) {
index 27c04f1ddd4e9f10b9015edb930873335b852f63..ce66243ccef8fe5a6dc46f3c7d9967d0eb8dced2 100644 (file)
}
}
- if (style->filter.href->getObject()) {
- SPObject *filter = style->filter.href->getObject();
+ if (style->getFilter()) {
+ SPObject *filter = style->getFilter();
if (SP_IS_FILTER(filter)) {
sp_copy_single (defs_clip, filter, xml_doc);
}
diff --git a/src/sp-item.cpp b/src/sp-item.cpp
index 7c1a464479684a86e8f4e50feae2520891e62fa7..8b101896f71bb93bc8b425acb0eac33528390f8a 100644 (file)
--- a/src/sp-item.cpp
+++ b/src/sp-item.cpp
@@ -1201,7 +1201,7 @@ sp_item_write_transform(SPItem *item, Inkscape::XML::Node *repr, NR::Matrix cons
!preserve && // user did not chose to preserve all transforms
!item->clip_ref->getObject() && // the object does not have a clippath
!item->mask_ref->getObject() && // the object does not have a mask
- !(!transform.is_translation() && SP_OBJECT_STYLE(item) && SP_OBJECT_STYLE(item)->filter.href->getObject())
+ !(!transform.is_translation() && SP_OBJECT_STYLE(item) && SP_OBJECT_STYLE(item)->getFilter())
// the object does not have a filter, or the transform is translation (which is supposed to not affect filters)
) {
transform_attr = ((SPItemClass *) G_OBJECT_GET_CLASS(item))->set_transform(item, transform);
diff --git a/src/style.cpp b/src/style.cpp
index 46b544382a751c3ad8335747e4dd9ac96ea42dbd..699d950541e723858dc4d5cfc0f44c2e5da1b3ef 100644 (file)
--- a/src/style.cpp
+++ b/src/style.cpp
sp_style_filter_ref_modified(SPObject *obj, guint flags, SPStyle *style)
{
SPFilter *filter=static_cast<SPFilter *>(obj);
- if (style->filter.href->getObject() == filter)
+ if (style->getFilter() == filter)
{
if (style->object) {
style->object->requestModified(SP_OBJECT_MODIFIED_FLAG | SP_OBJECT_STYLE_MODIFIED_FLAG);
diff --git a/src/style.h b/src/style.h
index df2ba127f6b374ccdb401fb4155afcfe10a0ffd4..0aec2151dd4101377ef116c6c1d759e37be2c973 100644 (file)
--- a/src/style.h
+++ b/src/style.h
#include "forward.h"
#include "sp-marker-loc.h"
#include "sp-filter.h"
+#include "sp-filter-reference.h"
#include <sigc++/connection.h>
} value;
};
-struct SPFilterReference;
-
/// Filter type internal to SPStyle
struct SPIFilter {
unsigned set : 1;
sigc::connection stroke_release_connection;
sigc::connection stroke_modified_connection;
+
+ SPObject *getFilter() {if (filter.href) return filter.href->getObject(); else return NULL;}
};
SPStyle *sp_style_new(SPDocument *document);