Code

Patch from codedread. Prevents rendering of title/desc/metadata elements in text...
[inkscape.git] / src / display / nr-filter-component-transfer.cpp
index 1edb3ac98fcca609f2bed031d64e1e4d441bc013..f4749de825f25b9a05c91c3ad0190c070f8174a7 100644 (file)
@@ -47,6 +47,7 @@ int FilterComponentTransfer::render(FilterSlot &slot, FilterUnits const &/*units
 
     // this primitive is defined for non-premultiplied RGBA values,
     // thus convert them to that format before blending
+    bool free_in_on_exit = false;
     if (in->mode != NR_PIXBLOCK_MODE_R8G8B8A8N) {
         NRPixBlock *original_in = in;
         in = new NRPixBlock;
@@ -55,6 +56,7 @@ int FilterComponentTransfer::render(FilterSlot &slot, FilterUnits const &/*units
                                original_in->area.x1, original_in->area.y1,
                                false);
         nr_blit_pixblock_pixblock(in, original_in);
+        free_in_on_exit = true;
     }
 
     unsigned char *in_data = NR_PIXBLOCK_PX(in);
@@ -114,9 +116,17 @@ int FilterComponentTransfer::render(FilterSlot &slot, FilterUnits const &/*units
                     out_data[i] = CLAMP_D_TO_U8(256 * (_amplitude * pow((double)in_data[i]/256, _exponent) + _offset));
                 }
                 break;
+            case COMPONENTTRANSFER_TYPE_ERROR:
+                //TODO: report an error here
+                break;
         }
     }
 
+    if (free_in_on_exit) {
+        nr_pixblock_release(in);
+        delete in;
+    }
+
     out->empty = FALSE;
     slot.set(_output, out);
     return 0;