summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNiko Kiirala <niko@kiirala.com>2008-01-12 18:38:39 +0000
committerkiirala <kiirala@users.sourceforge.net>2008-01-12 18:38:39 +0000
commit259e0b9ca691078b156287f6845a0a27e1565826 (patch)
treec976fb6b88368a9be37b4a133a15bc1e83bf7a05 /src
parentfix vector, power, and fidelity for paths in transformed groups, also normali... (diff)
downloadinkscape-259e0b9ca691078b156287f6845a0a27e1565826.tar.gz
inkscape-259e0b9ca691078b156287f6845a0a27e1565826.zip
Fixed erroneous overwriting of temporary images inside filter effects
(bzr r4470)
Diffstat (limited to 'src')
-rw-r--r--src/display/nr-filter-slot.cpp15
-rw-r--r--src/display/nr-filter-types.h5
2 files changed, 17 insertions, 3 deletions
diff --git a/src/display/nr-filter-slot.cpp b/src/display/nr-filter-slot.cpp
index e6a78c8c7..0cbf88e02 100644
--- a/src/display/nr-filter-slot.cpp
+++ b/src/display/nr-filter-slot.cpp
@@ -172,8 +172,18 @@ void FilterSlot::get_final(int slot_nr, NRPixBlock *result) {
void FilterSlot::set(int slot_nr, NRPixBlock *pb)
{
- int index = _get_index(slot_nr);
+ /* Unnamed slot is for saving filter primitive results, when parameter
+ * 'result' is not set. Only the filter immediately after this one
+ * can access unnamed results, so we don't have to worry about overwriting
+ * previous results in filter chain. On the other hand, we may not
+ * overwrite any other image with this one, because they might be
+ * accessed later on. */
+ int index = ((slot_nr != NR_FILTER_SLOT_NOT_SET)
+ ? _get_index(slot_nr)
+ : _get_index(NR_FILTER_UNNAMED_SLOT));
assert(index >= 0);
+ // Unnamed slot is only for NR::FilterSlot internal use.
+ assert(slot_nr != NR_FILTER_UNNAMED_SLOT);
assert(slot_nr == NR_FILTER_SLOT_NOT_SET ||_slot_number[index] == slot_nr);
if (slot_nr == NR_FILTER_SOURCEGRAPHIC || slot_nr == NR_FILTER_BACKGROUNDIMAGE) {
@@ -277,7 +287,8 @@ int FilterSlot::_get_index(int slot_nr)
slot_nr == NR_FILTER_BACKGROUNDIMAGE ||
slot_nr == NR_FILTER_BACKGROUNDALPHA ||
slot_nr == NR_FILTER_FILLPAINT ||
- slot_nr == NR_FILTER_STROKEPAINT);
+ slot_nr == NR_FILTER_STROKEPAINT ||
+ slot_nr == NR_FILTER_UNNAMED_SLOT);
int index = -1;
if (slot_nr == NR_FILTER_SLOT_NOT_SET) {
diff --git a/src/display/nr-filter-types.h b/src/display/nr-filter-types.h
index 0997d36f4..ee24840cf 100644
--- a/src/display/nr-filter-types.h
+++ b/src/display/nr-filter-types.h
@@ -31,8 +31,11 @@ enum FilterSlotType {
NR_FILTER_BACKGROUNDIMAGE = -4,
NR_FILTER_BACKGROUNDALPHA = -5,
NR_FILTER_FILLPAINT = -6,
- NR_FILTER_STROKEPAINT = -7
+ NR_FILTER_STROKEPAINT = -7,
+ NR_FILTER_UNNAMED_SLOT = -8
};
+/* Unnamed slot is for NR::FilterSlot internal use. Passing it as
+ * parameter to NR::FilterSlot accessors may have unforeseen consequences. */
} /* namespace NR */