From 79483ba14ddfcd2a9befc251c88233d6495d8436 Mon Sep 17 00:00:00 2001 From: jaspervdg Date: Sat, 20 Dec 2008 14:00:41 +0000 Subject: [PATCH] Fixes "disappearing gradients" problem discussed on mailing list and adds a few g_warnings to component transfer type checks. --- src/display/nr-filter-component-transfer.cpp | 3 +++ src/filters/componenttransfer.cpp | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/display/nr-filter-component-transfer.cpp b/src/display/nr-filter-component-transfer.cpp index 4004d6e8d..5c4fd4598 100644 --- a/src/display/nr-filter-component-transfer.cpp +++ b/src/display/nr-filter-component-transfer.cpp @@ -118,7 +118,10 @@ int FilterComponentTransfer::render(FilterSlot &slot, FilterUnits const &/*units break; case COMPONENTTRANSFER_TYPE_ERROR: //TODO: report an error here + g_warning("Component tranfer type \"error\"."); break; + default: + g_warning("Invalid tranfer type %d.", type[color]); } } diff --git a/src/filters/componenttransfer.cpp b/src/filters/componenttransfer.cpp index 09ea48bc6..603e1f4e5 100644 --- a/src/filters/componenttransfer.cpp +++ b/src/filters/componenttransfer.cpp @@ -25,7 +25,7 @@ #include "componenttransfer.h" #include "componenttransfer-funcnode.h" #include "xml/repr.h" -//#include "display/nr-filter-component-transfer.h" +#include "display/nr-filter-component-transfer.h" /* FeComponentTransfer base class */ @@ -106,6 +106,7 @@ sp_feComponentTransfer_build(SPObject *object, SPDocument *document, Inkscape::X static void sp_feComponentTransfer_children_modified(SPFeComponentTransfer *sp_componenttransfer) { if (sp_componenttransfer->renderer) { + bool set[4] = {false, false, false, false}; SPObject* node = sp_componenttransfer->children; for(;node;node=node->next){ int i=4; @@ -113,7 +114,10 @@ static void sp_feComponentTransfer_children_modified(SPFeComponentTransfer *sp_c if (SP_IS_FEFUNCG(node)) i=1; if (SP_IS_FEFUNCB(node)) i=2; if (SP_IS_FEFUNCA(node)) i=3; - if (i==4) break; + if (i==4) { + g_warning("Unrecognized channel for component transfer."); + break; + } sp_componenttransfer->renderer->type[i] = ((SPFeFuncNode *) node)->type; sp_componenttransfer->renderer->tableValues[i] = ((SPFeFuncNode *) node)->tableValues; sp_componenttransfer->renderer->slope[i] = ((SPFeFuncNode *) node)->slope; @@ -121,6 +125,13 @@ static void sp_feComponentTransfer_children_modified(SPFeComponentTransfer *sp_c sp_componenttransfer->renderer->amplitude[i] = ((SPFeFuncNode *) node)->amplitude; sp_componenttransfer->renderer->exponent[i] = ((SPFeFuncNode *) node)->exponent; sp_componenttransfer->renderer->offset[i] = ((SPFeFuncNode *) node)->offset; + set[i] = true; + } + // Set any types not explicitly set to the identity transform + for(int i=0;i<4;i++) { + if (!set[i]) { + sp_componenttransfer->renderer->type[i] = NR::COMPONENTTRANSFER_TYPE_IDENTITY; + } } } } -- 2.30.2