diff options
| author | Tavmjong Bah <tavmjong@free.fr> | 2012-12-23 09:55:50 +0000 |
|---|---|---|
| committer | tavmjong-free <tavmjong@free.fr> | 2012-12-23 09:55:50 +0000 |
| commit | d1e043d27a35b00c9e49a2deef1c2ee5bc8b2cc5 (patch) | |
| tree | 1e38179576836ab002e2824a9438c3de3718e130 /src | |
| parent | ruler: Use border widths for Gtk+ 3 rendering (diff) | |
| download | inkscape-d1e043d27a35b00c9e49a2deef1c2ee5bc8b2cc5.tar.gz inkscape-d1e043d27a35b00c9e49a2deef1c2ee5bc8b2cc5.zip | |
Move some code from filter primitives to cairo-utils.cpp. Fix bug in lighting primitives.
(bzr r11976)
Diffstat (limited to 'src')
| -rw-r--r-- | src/display/cairo-utils.cpp | 21 | ||||
| -rw-r--r-- | src/display/cairo-utils.h | 1 | ||||
| -rw-r--r-- | src/display/nr-filter-blend.cpp | 36 | ||||
| -rw-r--r-- | src/display/nr-filter-colormatrix.cpp | 19 | ||||
| -rw-r--r-- | src/display/nr-filter-component-transfer.cpp | 18 | ||||
| -rw-r--r-- | src/display/nr-filter-composite.cpp | 36 | ||||
| -rw-r--r-- | src/display/nr-filter-convolve-matrix.cpp | 18 | ||||
| -rw-r--r-- | src/display/nr-filter-diffuselighting.cpp | 9 | ||||
| -rw-r--r-- | src/display/nr-filter-displacement-map.cpp | 19 | ||||
| -rw-r--r-- | src/display/nr-filter-flood.cpp | 3 | ||||
| -rw-r--r-- | src/display/nr-filter-gaussian.cpp | 31 | ||||
| -rw-r--r-- | src/display/nr-filter-image.cpp | 4 | ||||
| -rw-r--r-- | src/display/nr-filter-merge.cpp | 13 | ||||
| -rw-r--r-- | src/display/nr-filter-morphology.cpp | 2 | ||||
| -rw-r--r-- | src/display/nr-filter-offset.cpp | 3 | ||||
| -rw-r--r-- | src/display/nr-filter-slot.cpp | 2 | ||||
| -rw-r--r-- | src/display/nr-filter-specularlighting.cpp | 9 | ||||
| -rw-r--r-- | src/display/nr-filter-turbulence.cpp | 2 | ||||
| -rw-r--r-- | src/display/nr-filter.cpp | 8 |
19 files changed, 40 insertions, 214 deletions
diff --git a/src/display/cairo-utils.cpp b/src/display/cairo-utils.cpp index 92303fed8..692e31837 100644 --- a/src/display/cairo-utils.cpp +++ b/src/display/cairo-utils.cpp @@ -287,9 +287,26 @@ get_cairo_surface_ci(cairo_surface_t *surface) { } } +/** Set the color_interpolation_value for a Cairo surface. + * Transform the surface between sRGB and linearRGB if necessary. */ void set_cairo_surface_ci(cairo_surface_t *surface, SPColorInterpolation ci) { - cairo_surface_set_user_data(surface, &ci_key, GINT_TO_POINTER (ci), NULL); + + if( cairo_surface_get_content( surface ) != CAIRO_CONTENT_ALPHA ) { + + SPColorInterpolation ci_in = get_cairo_surface_ci( surface ); + + if( ci_in == SP_CSS_COLOR_INTERPOLATION_SRGB && + ci == SP_CSS_COLOR_INTERPOLATION_LINEARRGB ) { + ink_cairo_surface_srgb_to_linear( surface ); + } + if( ci_in == SP_CSS_COLOR_INTERPOLATION_LINEARRGB && + ci == SP_CSS_COLOR_INTERPOLATION_SRGB ) { + ink_cairo_surface_linear_to_srgb( surface ); + } + + cairo_surface_set_user_data(surface, &ci_key, GINT_TO_POINTER (ci), NULL); + } } void @@ -627,7 +644,6 @@ int ink_cairo_surface_srgb_to_linear(cairo_surface_t *surface) *reinterpret_cast<guint32*>(data + 4*x) = px2; } } - set_cairo_surface_ci( surface, SP_CSS_COLOR_INTERPOLATION_LINEARRGB ); return width * height; } @@ -653,7 +669,6 @@ int ink_cairo_surface_linear_to_srgb(cairo_surface_t *surface) *reinterpret_cast<guint32*>(data + 4*x) = px2; } } - set_cairo_surface_ci( surface, SP_CSS_COLOR_INTERPOLATION_SRGB ); return width * height; } diff --git a/src/display/cairo-utils.h b/src/display/cairo-utils.h index edaf5ebaa..d240545eb 100644 --- a/src/display/cairo-utils.h +++ b/src/display/cairo-utils.h @@ -91,6 +91,7 @@ static cairo_user_data_key_t ci_key; SPColorInterpolation get_cairo_surface_ci(cairo_surface_t *surface); void set_cairo_surface_ci(cairo_surface_t *surface, SPColorInterpolation cif); void copy_cairo_surface_ci(cairo_surface_t *in, cairo_surface_t *out); +void convert_cairo_surface_ci(cairo_surface_t *surface, SPColorInterpolation cif); void ink_cairo_set_source_color(cairo_t *ct, SPColor const &color, double opacity); void ink_cairo_set_source_rgba32(cairo_t *ct, guint32 rgba); diff --git a/src/display/nr-filter-blend.cpp b/src/display/nr-filter-blend.cpp index 2ada36949..a08191f67 100644 --- a/src/display/nr-filter-blend.cpp +++ b/src/display/nr-filter-blend.cpp @@ -149,47 +149,17 @@ void FilterBlend::render_cairo(FilterSlot &slot) // We may need to transform input surface to correct color interpolation space. The input surface // might be used as input to another primitive but it is likely that all the primitives in a given // filter use the same color interpolation space so we don't copy the input before converting. - // The converting function tags surface with the proper ci value. - // Note: an alpha only surface should not have ci set. - SPColorInterpolation ci_in1 = get_cairo_surface_ci(input1); - SPColorInterpolation ci_in2 = get_cairo_surface_ci(input2); SPColorInterpolation ci_fp = SP_CSS_COLOR_INTERPOLATION_AUTO; if( _style ) { ci_fp = (SPColorInterpolation)_style->color_interpolation_filters.computed; } - if( ci_in1 == SP_CSS_COLOR_INTERPOLATION_SRGB && - ci_fp == SP_CSS_COLOR_INTERPOLATION_LINEARRGB ) { - //std::cout << "FilterColorBlend: srgb -> linear" << std::endl; - ink_cairo_surface_srgb_to_linear( input1 ); - } - if( ci_in1 == SP_CSS_COLOR_INTERPOLATION_LINEARRGB && - ci_fp == SP_CSS_COLOR_INTERPOLATION_SRGB ) { - //std::cout << "FilterColorBlend: linear -> srgb" << std::endl; - ink_cairo_surface_linear_to_srgb( input1 ); - } - if( ci_in2 == SP_CSS_COLOR_INTERPOLATION_SRGB && - ci_fp == SP_CSS_COLOR_INTERPOLATION_LINEARRGB ) { - //std::cout << "FilterColorBlend: srgb -> linear" << std::endl; - ink_cairo_surface_srgb_to_linear( input2 ); - } - if( ci_in2 == SP_CSS_COLOR_INTERPOLATION_LINEARRGB && - ci_fp == SP_CSS_COLOR_INTERPOLATION_SRGB ) { - //std::cout << "FilterColorBlend: linear -> srgb" << std::endl; - ink_cairo_surface_linear_to_srgb( input2 ); - } + set_cairo_surface_ci( input1, ci_fp ); + set_cairo_surface_ci( input2, ci_fp ); // input2 is the "background" image // out should be ARGB32 if any of the inputs is ARGB32 cairo_surface_t *out = ink_cairo_surface_create_output(input1, input2); - if( cairo_surface_get_content( out ) == CAIRO_CONTENT_COLOR_ALPHA ) { - set_cairo_surface_ci(out, ci_fp ); - } - - // std::cout << "FilterBlend: ci data: " - // << " in1: " << get_cairo_surface_ci(input1) - // << " in2: " << get_cairo_surface_ci(input2) - // << " out: " << get_cairo_surface_ci(out) - // << std::endl; + set_cairo_surface_ci( out, ci_fp ); cairo_content_t ct1 = cairo_surface_get_content(input1); cairo_content_t ct2 = cairo_surface_get_content(input2); diff --git a/src/display/nr-filter-colormatrix.cpp b/src/display/nr-filter-colormatrix.cpp index 5d3cf6a9e..77873d523 100644 --- a/src/display/nr-filter-colormatrix.cpp +++ b/src/display/nr-filter-colormatrix.cpp @@ -156,23 +156,11 @@ void FilterColorMatrix::render_cairo(FilterSlot &slot) // We may need to transform input surface to correct color interpolation space. The input surface // might be used as input to another primitive but it is likely that all the primitives in a given // filter use the same color interpolation space so we don't copy the input before converting. - // The converting function tags surface with the proper ci value. - // Note: an alpha only surface should not have ci set. - SPColorInterpolation ci_in = get_cairo_surface_ci(input); SPColorInterpolation ci_fp = SP_CSS_COLOR_INTERPOLATION_AUTO; if( _style ) { ci_fp = (SPColorInterpolation)_style->color_interpolation_filters.computed; } - if( ci_in == SP_CSS_COLOR_INTERPOLATION_SRGB && - ci_fp == SP_CSS_COLOR_INTERPOLATION_LINEARRGB ) { - //std::cout << "FilterColorMatrix: srgb -> linear" << std::endl; - ink_cairo_surface_srgb_to_linear( input ); - } - if( ci_in == SP_CSS_COLOR_INTERPOLATION_LINEARRGB && - ci_fp == SP_CSS_COLOR_INTERPOLATION_SRGB ) { - //std::cout << "FilterColorMatrix: linear -> srgb" << std::endl; - ink_cairo_surface_linear_to_srgb( input ); - } + set_cairo_surface_ci( input, ci_fp ); if (type == COLORMATRIX_LUMINANCETOALPHA) { out = ink_cairo_surface_create_same_size(input, CAIRO_CONTENT_ALPHA); @@ -182,11 +170,6 @@ void FilterColorMatrix::render_cairo(FilterSlot &slot) set_cairo_surface_ci(out, ci_fp); } - // std::cout << "FilterColorMatrix: ci data: " - // << " in1: " << get_cairo_surface_ci(input) - // << " out: " << get_cairo_surface_ci(out) - // << std::endl; - switch (type) { case COLORMATRIX_MATRIX: ink_cairo_surface_filter(input, out, FilterColorMatrix::ColorMatrixMatrix(values)); diff --git a/src/display/nr-filter-component-transfer.cpp b/src/display/nr-filter-component-transfer.cpp index 8efcc9c4d..3bc00d2d7 100644 --- a/src/display/nr-filter-component-transfer.cpp +++ b/src/display/nr-filter-component-transfer.cpp @@ -242,28 +242,12 @@ void FilterComponentTransfer::render_cairo(FilterSlot &slot) // We may need to transform input surface to correct color interpolation space. The input surface // might be used as input to another primitive but it is likely that all the primitives in a given // filter use the same color interpolation space so we don't copy the input before converting. - // The converting function tags surface with the proper ci value. - SPColorInterpolation ci_in = get_cairo_surface_ci(input); SPColorInterpolation ci_fp = SP_CSS_COLOR_INTERPOLATION_AUTO; if( _style ) { ci_fp = (SPColorInterpolation)_style->color_interpolation_filters.computed; set_cairo_surface_ci(out, ci_fp ); } - if( ci_in == SP_CSS_COLOR_INTERPOLATION_SRGB && - ci_fp == SP_CSS_COLOR_INTERPOLATION_LINEARRGB ) { - //std::cout << "FilterComponentTransfer: srgb -> linear" << std::endl; - ink_cairo_surface_srgb_to_linear( input ); - } - if( ci_in == SP_CSS_COLOR_INTERPOLATION_LINEARRGB && - ci_fp == SP_CSS_COLOR_INTERPOLATION_SRGB ) { - //std::cout << "FilterComponentTransfer: linear -> srgb" << std::endl; - ink_cairo_surface_linear_to_srgb( input ); - } - - // std::cout << "FilterComponentTransfer: ci data: " - // << " in1: " << get_cairo_surface_ci(input) - // << " out: " << get_cairo_surface_ci(out) - // << std::endl; + set_cairo_surface_ci( input, ci_fp ); //cairo_surface_t *outtemp = ink_cairo_surface_create_identical(out); ink_cairo_surface_blit(input, out); diff --git a/src/display/nr-filter-composite.cpp b/src/display/nr-filter-composite.cpp index f5ec94a46..f6decad0d 100644 --- a/src/display/nr-filter-composite.cpp +++ b/src/display/nr-filter-composite.cpp @@ -69,45 +69,15 @@ void FilterComposite::render_cairo(FilterSlot &slot) // We may need to transform input surface to correct color interpolation space. The input surface // might be used as input to another primitive but it is likely that all the primitives in a given // filter use the same color interpolation space so we don't copy the input before converting. - // The converting function tags surface with the proper ci value. - // Note: an alpha only surface should not have ci set. - SPColorInterpolation ci_in1 = get_cairo_surface_ci(input1); - SPColorInterpolation ci_in2 = get_cairo_surface_ci(input2); SPColorInterpolation ci_fp = SP_CSS_COLOR_INTERPOLATION_AUTO; if( _style ) { ci_fp = (SPColorInterpolation)_style->color_interpolation_filters.computed; } - if( ci_in1 == SP_CSS_COLOR_INTERPOLATION_SRGB && - ci_fp == SP_CSS_COLOR_INTERPOLATION_LINEARRGB ) { - //std::cout << "FilterColorComposite: srgb -> linear" << std::endl; - ink_cairo_surface_srgb_to_linear( input1 ); - } - if( ci_in1 == SP_CSS_COLOR_INTERPOLATION_LINEARRGB && - ci_fp == SP_CSS_COLOR_INTERPOLATION_SRGB ) { - //std::cout << "FilterColorComposite: linear -> srgb" << std::endl; - ink_cairo_surface_linear_to_srgb( input1 ); - } - if( ci_in2 == SP_CSS_COLOR_INTERPOLATION_SRGB && - ci_fp == SP_CSS_COLOR_INTERPOLATION_LINEARRGB ) { - std::cout << "FilterColorComposite: srgb -> linear" << std::endl; - //ink_cairo_surface_srgb_to_linear( input2 ); - } - if( ci_in2 == SP_CSS_COLOR_INTERPOLATION_LINEARRGB && - ci_fp == SP_CSS_COLOR_INTERPOLATION_SRGB ) { - //std::cout << "FilterColorComposite: linear -> srgb" << std::endl; - ink_cairo_surface_linear_to_srgb( input2 ); - } + set_cairo_surface_ci( input1, ci_fp ); + set_cairo_surface_ci( input2, ci_fp ); cairo_surface_t *out = ink_cairo_surface_create_output(input1, input2); - if( cairo_surface_get_content( out ) == CAIRO_CONTENT_COLOR_ALPHA ) { - set_cairo_surface_ci(out, ci_fp ); - } - - // std::cout << "FilterComposite: ci data: " - // << " in1: " << get_cairo_surface_ci(input1) - // << " in2: " << get_cairo_surface_ci(input2) - // << " out: " << get_cairo_surface_ci(out) - // << std::endl; + set_cairo_surface_ci(out, ci_fp ); if (op == COMPOSITE_ARITHMETIC) { ink_cairo_surface_blend(input1, input2, out, ComposeArithmetic(k1, k2, k3, k4)); diff --git a/src/display/nr-filter-convolve-matrix.cpp b/src/display/nr-filter-convolve-matrix.cpp index 6ee67d126..2aad528a6 100644 --- a/src/display/nr-filter-convolve-matrix.cpp +++ b/src/display/nr-filter-convolve-matrix.cpp @@ -123,28 +123,12 @@ void FilterConvolveMatrix::render_cairo(FilterSlot &slot) // We may need to transform input surface to correct color interpolation space. The input surface // might be used as input to another primitive but it is likely that all the primitives in a given // filter use the same color interpolation space so we don't copy the input before converting. - // The converting function tags surface with the proper ci value. - SPColorInterpolation ci_in = get_cairo_surface_ci(input); SPColorInterpolation ci_fp = SP_CSS_COLOR_INTERPOLATION_AUTO; if( _style ) { ci_fp = (SPColorInterpolation)_style->color_interpolation_filters.computed; set_cairo_surface_ci(out, ci_fp); } - if( ci_in == SP_CSS_COLOR_INTERPOLATION_SRGB && - ci_fp == SP_CSS_COLOR_INTERPOLATION_LINEARRGB ) { - //std::cout << "FilterConvolveMatrix: srgb -> linear" << std::endl; - ink_cairo_surface_srgb_to_linear( input ); - } - if( ci_in == SP_CSS_COLOR_INTERPOLATION_LINEARRGB && - ci_fp == SP_CSS_COLOR_INTERPOLATION_SRGB ) { - //std::cout << "FilterConvolveMatrix: linear -> srgb" << std::endl; - ink_cairo_surface_linear_to_srgb( input ); - } - - // std::cout << "FilterConvolveMatrix: ci data: " - // << " in1: " << get_cairo_surface_ci(input) - // << " out: " << get_cairo_surface_ci(out) - // << std::endl; + set_cairo_surface_ci( input, ci_fp ); if (bias!=0 && !bias_warning) { g_warning("It is unknown whether Inkscape's implementation of bias in feConvolveMatrix " diff --git a/src/display/nr-filter-diffuselighting.cpp b/src/display/nr-filter-diffuselighting.cpp index bd473eb76..faf56a4ca 100644 --- a/src/display/nr-filter-diffuselighting.cpp +++ b/src/display/nr-filter-diffuselighting.cpp @@ -129,14 +129,9 @@ void FilterDiffuseLighting::render_cairo(FilterSlot &slot) // Only alpha channel of input is used, no need to check input color_interpolation_filter value. SPColorInterpolation ci_fp = SP_CSS_COLOR_INTERPOLATION_AUTO; if( _style ) { - set_cairo_surface_ci(out, (SPColorInterpolation)_style->color_interpolation_filters.computed ); - set_cairo_surface_ci(out, ci_fp ); + ci_fp = (SPColorInterpolation)_style->color_interpolation_filters.computed; } - - // std::cout << "FilterDiffuseLighting: ci data: " - // << " in1: " << get_cairo_surface_ci(input) - // << " out: " << get_cairo_surface_ci(out) - // << std::endl; + set_cairo_surface_ci(out, ci_fp ); Geom::Rect slot_area = slot.get_slot_area(); Geom::Point p = slot_area.min(); diff --git a/src/display/nr-filter-displacement-map.cpp b/src/display/nr-filter-displacement-map.cpp index 909e11f50..1b979fa6c 100644 --- a/src/display/nr-filter-displacement-map.cpp +++ b/src/display/nr-filter-displacement-map.cpp @@ -80,28 +80,11 @@ void FilterDisplacementMap::render_cairo(FilterSlot &slot) // We may need to transform map surface to correct color interpolation space. The map surface // might be used as input to another primitive but it is likely that all the primitives in a given // filter use the same color interpolation space so we don't copy the map before converting. - // The converting function tags surface with the proper ci value. - SPColorInterpolation ci_map = get_cairo_surface_ci(map); SPColorInterpolation ci_fp = SP_CSS_COLOR_INTERPOLATION_AUTO; if( _style ) { ci_fp = (SPColorInterpolation)_style->color_interpolation_filters.computed; } - if( ci_map == SP_CSS_COLOR_INTERPOLATION_SRGB && - ci_fp == SP_CSS_COLOR_INTERPOLATION_LINEARRGB ) { - //std::cout << "FilterDisplacementMap: srgb -> linear" << std::endl; - ink_cairo_surface_srgb_to_linear( map ); - } - if( ci_map == SP_CSS_COLOR_INTERPOLATION_LINEARRGB && - ci_fp == SP_CSS_COLOR_INTERPOLATION_SRGB ) { - //std::cout << "FilterDisplacementMap: linear -> srgb" << std::endl; - ink_cairo_surface_linear_to_srgb( map ); - } - - // std::cout << "FilterDisplacementMap: ci data: " - // << " texture: " << get_cairo_surface_ci(texture) - // << " map: " << get_cairo_surface_ci(map) - // << " out: " << get_cairo_surface_ci(out) - // << std::endl; + set_cairo_surface_ci( map, ci_fp ); Geom::Affine trans = slot.get_units().get_matrix_primitiveunits2pb(); double scalex = scale * trans.expansionX(); diff --git a/src/display/nr-filter-flood.cpp b/src/display/nr-filter-flood.cpp index 649d4609f..7117e0343 100644 --- a/src/display/nr-filter-flood.cpp +++ b/src/display/nr-filter-flood.cpp @@ -62,9 +62,6 @@ void FilterFlood::render_cairo(FilterSlot &slot) set_cairo_surface_ci(out, (SPColorInterpolation)_style->color_interpolation_filters.computed ); } - // std::cout << "FilterFlood: ci data: out: " - // << get_cairo_surface_ci(out) << std::endl; - // Get filter primitive area in user units Geom::Rect fp = filter_primitive_area( slot.get_units() ); diff --git a/src/display/nr-filter-gaussian.cpp b/src/display/nr-filter-gaussian.cpp index 3b29e825d..9d7c32585 100644 --- a/src/display/nr-filter-gaussian.cpp +++ b/src/display/nr-filter-gaussian.cpp @@ -556,26 +556,11 @@ void FilterGaussian::render_cairo(FilterSlot &slot) // We may need to transform input surface to correct color interpolation space. The input surface // might be used as input to another primitive but it is likely that all the primitives in a given // filter use the same color interpolation space so we don't copy the input before converting. - // The converting function tags surface with the proper ci value. - // Note: an alpha only surface should not have ci set. - SPColorInterpolation ci_in = get_cairo_surface_ci(in); SPColorInterpolation ci_fp = SP_CSS_COLOR_INTERPOLATION_AUTO; if( _style ) { ci_fp = (SPColorInterpolation)_style->color_interpolation_filters.computed; } - if( ci_in == SP_CSS_COLOR_INTERPOLATION_SRGB && - ci_fp == SP_CSS_COLOR_INTERPOLATION_LINEARRGB ) { - //std::cout << "FilterGaussian: srgb -> linear" << std::endl; - ink_cairo_surface_srgb_to_linear( in ); - } - if( ci_in == SP_CSS_COLOR_INTERPOLATION_LINEARRGB && - ci_fp == SP_CSS_COLOR_INTERPOLATION_SRGB ) { - //std::cout << "FilterGaussian: linear -> srgb" << std::endl; - ink_cairo_surface_linear_to_srgb( in ); - } - - // std::cout << "FilterGaussian: ci data: in: " - // << get_cairo_surface_ci( in ) << std::endl; + set_cairo_surface_ci( in, ci_fp ); // zero deviation = no change in output if (_deviation_x <= 0 && _deviation_y <= 0) { @@ -684,20 +669,14 @@ void FilterGaussian::render_cairo(FilterSlot &slot) cairo_paint(ct); cairo_destroy(ct); - if( cairo_surface_get_content( upsampled ) == CAIRO_CONTENT_COLOR_ALPHA ) { - set_cairo_surface_ci( upsampled, ci_fp ); - } - // std::cout << "FilterGaussian: ci data: resampled: " - // << get_cairo_surface_ci(upsampled) << std::endl; + set_cairo_surface_ci( upsampled, ci_fp ); + slot.set(_output, upsampled); cairo_surface_destroy(upsampled); cairo_surface_destroy(downsampled); } else { - if( cairo_surface_get_content( downsampled ) == CAIRO_CONTENT_COLOR_ALPHA ) { - set_cairo_surface_ci( downsampled, ci_fp ); - } - // std::cout << "FilterGaussian: ci data: downsampled: " - // << get_cairo_surface_ci(downsampled) << std::endl; + set_cairo_surface_ci( downsampled, ci_fp ); + slot.set(_output, downsampled); cairo_surface_destroy(downsampled); } diff --git a/src/display/nr-filter-image.cpp b/src/display/nr-filter-image.cpp index 8aae29cbe..fca8fdba3 100644 --- a/src/display/nr-filter-image.cpp +++ b/src/display/nr-filter-image.cpp @@ -122,8 +122,6 @@ void FilterImage::render_cairo(FilterSlot &slot) // For the moment, we'll assume that any image is in sRGB color space set_cairo_surface_ci(out, SP_CSS_COLOR_INTERPOLATION_SRGB); - // std::cout << "FilterImage: ci set to: " - // << get_cairo_surface_ci(out) << std::endl; slot.set(_output, out); cairo_surface_destroy(out); @@ -192,8 +190,6 @@ void FilterImage::render_cairo(FilterSlot &slot) // For the moment, we'll assume that any image is in sRGB color space set_cairo_surface_ci(out, SP_CSS_COLOR_INTERPOLATION_SRGB); - // std::cout << "FilterImage: ci set to: " - // << get_cairo_surface_ci(out) << std::endl; cairo_t *ct = cairo_create(out); cairo_translate(ct, -sa.min()[Geom::X], -sa.min()[Geom::Y]); diff --git a/src/display/nr-filter-merge.cpp b/src/display/nr-filter-merge.cpp index 4d3862a33..2b9a24f25 100644 --- a/src/display/nr-filter-merge.cpp +++ b/src/display/nr-filter-merge.cpp @@ -59,18 +59,7 @@ void FilterMerge::render_cairo(FilterSlot &slot) for (std::vector<int>::iterator i = _input_image.begin(); i != _input_image.end(); ++i) { cairo_surface_t *in = slot.getcairo(*i); - SPColorInterpolation ci_in = get_cairo_surface_ci(in); - //std::cout << "FilterMerge: slot: ci: " << ci_in << std::endl; - if( ci_in == SP_CSS_COLOR_INTERPOLATION_SRGB && - ci_fp == SP_CSS_COLOR_INTERPOLATION_LINEARRGB ) { - //std::cout << "FilterMerge: srgb -> linear" << std::endl; - ink_cairo_surface_srgb_to_linear( in ); - } - if( ci_in == SP_CSS_COLOR_INTERPOLATION_LINEARRGB && - ci_fp == SP_CSS_COLOR_INTERPOLATION_SRGB ) { - //std::cout << "FilterMerge: linear -> srgb" << std::endl; - ink_cairo_surface_linear_to_srgb( in ); - } + set_cairo_surface_ci( in, ci_fp ); cairo_set_source_surface(out_ct, in, 0, 0); cairo_paint(out_ct); } diff --git a/src/display/nr-filter-morphology.cpp b/src/display/nr-filter-morphology.cpp index 7447b76fe..b058307cf 100644 --- a/src/display/nr-filter-morphology.cpp +++ b/src/display/nr-filter-morphology.cpp @@ -195,8 +195,6 @@ void FilterMorphology::render_cairo(FilterSlot &slot) // color_interpolation_filters for out same as input. See spec (DisplacementMap). copy_cairo_surface_ci(input, out); - // std::cout << "FilterMorphology: ci set to: " - // << get_cairo_surface_ci(out) << std::endl; if (Operator == MORPHOLOGY_OPERATOR_DILATE) { if (bpp == 1) { diff --git a/src/display/nr-filter-offset.cpp b/src/display/nr-filter-offset.cpp index 3543de6df..01d6ffe56 100644 --- a/src/display/nr-filter-offset.cpp +++ b/src/display/nr-filter-offset.cpp @@ -38,9 +38,6 @@ void FilterOffset::render_cairo(FilterSlot &slot) // color_interpolation_filters for out same as in. See spec (DisplacementMap). copy_cairo_surface_ci(in, out); - // std::cout << "FilterOffset: ci data: out: " - // << get_cairo_surface_ci(out) << std::endl; - cairo_t *ct = cairo_create(out); Geom::Affine trans = slot.get_units().get_matrix_primitiveunits2pb(); diff --git a/src/display/nr-filter-slot.cpp b/src/display/nr-filter-slot.cpp index 64c5143ff..fe67972d6 100644 --- a/src/display/nr-filter-slot.cpp +++ b/src/display/nr-filter-slot.cpp @@ -84,13 +84,11 @@ cairo_surface_t *FilterSlot::getcairo(int slot_nr) case NR_FILTER_SOURCEGRAPHIC: { cairo_surface_t *tr = _get_transformed_source_graphic(); _set_internal(NR_FILTER_SOURCEGRAPHIC, tr); - //std::cout << "Source Graphic: ci data: " << get_cairo_surface_ci( tr ) << std::endl; cairo_surface_destroy(tr); } break; case NR_FILTER_BACKGROUNDIMAGE: { cairo_surface_t *bg = _get_transformed_background(); _set_internal(NR_FILTER_BACKGROUNDIMAGE, bg); - //std::cout << "Background Image: ci data: " << get_cairo_surface_ci( bg ) << std::endl; cairo_surface_destroy(bg); } break; case NR_FILTER_SOURCEALPHA: { diff --git a/src/display/nr-filter-specularlighting.cpp b/src/display/nr-filter-specularlighting.cpp index 4cf8f319d..50f1b48c5 100644 --- a/src/display/nr-filter-specularlighting.cpp +++ b/src/display/nr-filter-specularlighting.cpp @@ -142,14 +142,9 @@ void FilterSpecularLighting::render_cairo(FilterSlot &slot) // Only alpha channel of input is used, no need to check input color_interpolation_filter value. SPColorInterpolation ci_fp = SP_CSS_COLOR_INTERPOLATION_AUTO; if( _style ) { - set_cairo_surface_ci(out, (SPColorInterpolation)_style->color_interpolation_filters.computed ); - set_cairo_surface_ci(out, ci_fp ); + ci_fp = (SPColorInterpolation)_style->color_interpolation_filters.computed; } - - // std::cout << "FilterSpecularLighting: ci data: " - // << " in1: " << get_cairo_surface_ci(input) - // << " out: " << get_cairo_surface_ci(out) - // << std::endl; + set_cairo_surface_ci(out, ci_fp ); Geom::Affine trans = slot.get_units().get_matrix_primitiveunits2pb(); Geom::Point p = slot.get_slot_area().min(); diff --git a/src/display/nr-filter-turbulence.cpp b/src/display/nr-filter-turbulence.cpp index e2b52a1d4..76b877fbc 100644 --- a/src/display/nr-filter-turbulence.cpp +++ b/src/display/nr-filter-turbulence.cpp @@ -379,8 +379,6 @@ void FilterTurbulence::render_cairo(FilterSlot &slot) if( _style ) { set_cairo_surface_ci(out, (SPColorInterpolation)_style->color_interpolation_filters.computed ); } - // std::cout << "FilterTurbulance: ci data: out: " - // << get_cairo_surface_ci(out) << std::endl; if (!gen->ready()) { Geom::Point ta(fTileX, fTileY); diff --git a/src/display/nr-filter.cpp b/src/display/nr-filter.cpp index a29ac551a..eeba94d7c 100644 --- a/src/display/nr-filter.cpp +++ b/src/display/nr-filter.cpp @@ -161,14 +161,8 @@ int Filter::render(Inkscape::DrawingItem const *item, DrawingContext &graphic, D Geom::Point origin = graphic.targetLogicalBounds().min(); cairo_surface_t *result = slot.get_result(_output_slot); - // std::cout << "Filter: result: ci data: " - // << get_cairo_surface_ci(result) << std::endl; - // Assume for the moment that we paint the filter in sRGB - if( get_cairo_surface_ci(result) == SP_CSS_COLOR_INTERPOLATION_LINEARRGB ) { - //std::cout << "Filter: result: linear -> sRGB" << std::endl; - ink_cairo_surface_linear_to_srgb( result ); - } + set_cairo_surface_ci( result, SP_CSS_COLOR_INTERPOLATION_SRGB ); graphic.setSource(result, origin[Geom::X], origin[Geom::Y]); graphic.setOperator(CAIRO_OPERATOR_SOURCE); |
