diff options
| author | Niko Kiirala <niko@kiirala.com> | 2007-05-21 09:39:52 +0000 |
|---|---|---|
| committer | kiirala <kiirala@users.sourceforge.net> | 2007-05-21 09:39:52 +0000 |
| commit | 2ac98237319c51ceb2a25d5a4821ef6afc0beb6e (patch) | |
| tree | 8ff0e8ad21cae00d3ff85127285f6279d2872dfe /src/display/nr-arena-group.cpp | |
| parent | committed patch 1629798 (diff) | |
| download | inkscape-2ac98237319c51ceb2a25d5a4821ef6afc0beb6e.tar.gz inkscape-2ac98237319c51ceb2a25d5a4821ef6afc0beb6e.zip | |
Refactoring work for filter effects renderer initialization
(bzr r3035)
Diffstat (limited to 'src/display/nr-arena-group.cpp')
| -rw-r--r-- | src/display/nr-arena-group.cpp | 80 |
1 files changed, 30 insertions, 50 deletions
diff --git a/src/display/nr-arena-group.cpp b/src/display/nr-arena-group.cpp index 697ef6a05..da3a240a6 100644 --- a/src/display/nr-arena-group.cpp +++ b/src/display/nr-arena-group.cpp @@ -187,59 +187,30 @@ nr_arena_group_update (NRArenaItem *item, NRRectL *area, NRGC *gc, unsigned int void nr_arena_group_set_style (NRArenaGroup *group, SPStyle *style) { - g_return_if_fail(group != NULL); - g_return_if_fail(NR_IS_ARENA_GROUP(group)); - - if (style) sp_style_ref(style); - if (group->style) sp_style_unref(group->style); - group->style = style; - - //if there is a filter set for this group - if (style && style->filter.set && style->filter.filter) { - - group->filter = new NR::Filter(); - group->filter->set_x(style->filter.filter->x); - group->filter->set_y(style->filter.filter->y); - group->filter->set_width(style->filter.filter->width); - group->filter->set_height(style->filter.filter->height); - - //go through all SP filter primitives - for(int i=0; i<style->filter.filter->_primitive_count; i++) - { - SPFilterPrimitive *primitive = style->filter.filter->_primitives[i]; - //if primitive is gaussianblur - if(SP_IS_GAUSSIANBLUR(primitive)) - { - NR::FilterGaussian * gaussian = (NR::FilterGaussian *) group->filter->add_primitive(NR::NR_FILTER_GAUSSIANBLUR); - SPGaussianBlur * spblur = SP_GAUSSIANBLUR(primitive); - float num = spblur->stdDeviation.getNumber(); - if( num>=0.0 ) - { - float optnum = spblur->stdDeviation.getOptNumber(); - if( optnum>=0.0 ) - gaussian->set_deviation((double) num, (double) optnum); - else - gaussian->set_deviation((double) num); - } - } else if(SP_IS_FEBLEND(primitive)) { - // TODO: this is just a test. Besides this whole filter - // creation needs to be redone - NR::FilterBlend *nrblend = (NR::FilterBlend *) group->filter->add_primitive(NR::NR_FILTER_BLEND); - SPFeBlend *spblend = SP_FEBLEND(primitive); - nrblend->set_mode(spblend->blend_mode); - } + g_return_if_fail(group != NULL); + g_return_if_fail(NR_IS_ARENA_GROUP(group)); + + if (style) sp_style_ref(style); + if (group->style) sp_style_unref(group->style); + group->style = style; + + //if group has a filter + if (style->filter.set && style->filter.filter) { + if (!group->filter) { + int primitives = sp_filter_primitive_count(style->filter.filter); + group->filter = new NR::Filter(primitives); } - } - else - { + sp_filter_build_renderer(style->filter.filter, group->filter); + } else { //no filter set for this group + delete group->filter; group->filter = NULL; } - - if (style && style->enable_background.set - && style->enable_background.value == SP_CSS_BACKGROUND_NEW) { - group->background_new = true; - } + + if (style && style->enable_background.set + && style->enable_background.value == SP_CSS_BACKGROUND_NEW) { + group->background_new = true; + } } static unsigned int @@ -314,4 +285,13 @@ void nr_arena_group_set_child_transform(NRArenaGroup *group, NRMatrix const *t) } } - +/* + Local Variables: + mode:c++ + c-file-style:"stroustrup" + c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +)) + indent-tabs-mode:nil + fill-column:99 + End: +*/ +// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 : |
