diff options
| author | Patrick Storz <eduard.braun2@gmx.de> | 2019-09-22 18:15:47 +0000 |
|---|---|---|
| committer | Patrick Storz <eduard.braun2@gmx.de> | 2019-09-22 18:58:48 +0000 |
| commit | 8d68ead6a2f33755ec7d1ce3b1929b8623506d1c (patch) | |
| tree | 1b1eded1f370e36e3b7569dc39006ab92a820c48 /src/display | |
| parent | Object properties: fix values of image-rendering enum (diff) | |
| download | inkscape-8d68ead6a2f33755ec7d1ce3b1929b8623506d1c.tar.gz inkscape-8d68ead6a2f33755ec7d1ce3b1929b8623506d1c.zip | |
Try to improve match of image-rendering values to cairo filters
Specifically image-rendering="crisp-edges" should use a scaling
algorithm that does *not* blur edges.
Unfortunately this only leaves CAIRO_FILTER_NEAREST, but seems to
be the most suitable choice.
Diffstat (limited to 'src/display')
| -rw-r--r-- | src/display/drawing-image.cpp | 27 |
1 files changed, 13 insertions, 14 deletions
diff --git a/src/display/drawing-image.cpp b/src/display/drawing-image.cpp index fb1342edf..0ac716dfb 100644 --- a/src/display/drawing-image.cpp +++ b/src/display/drawing-image.cpp @@ -116,26 +116,25 @@ unsigned DrawingImage::_renderItem(DrawingContext &dc, Geom::IntRect const &/*ar if (_style) { // See: http://www.w3.org/TR/SVG/painting.html#ImageRenderingProperty - // http://www.w3.org/TR/css4-images/#the-image-rendering - // It's back in CSS Images 3 now. - // style.h/style.cpp + // https://drafts.csswg.org/css-images-3/#the-image-rendering + // style.h/style.cpp, cairo-render-context.cpp + // + // CSS 3 defines: + // 'optimizeSpeed' as alias for "pixelated" + // 'optimizeQuality' as alias for "smooth" switch (_style->image_rendering.computed) { + case SP_CSS_IMAGE_RENDERING_OPTIMIZESPEED: + case SP_CSS_IMAGE_RENDERING_PIXELATED: + // we don't have an implementation for crisp-edges, but it should *not* smooth or blur + case SP_CSS_IMAGE_RENDERING_CRISPEDGES: + dc.patternSetFilter( CAIRO_FILTER_NEAREST ); + break; case SP_CSS_IMAGE_RENDERING_AUTO: case SP_CSS_IMAGE_RENDERING_OPTIMIZEQUALITY: - case SP_CSS_IMAGE_RENDERING_CRISPEDGES: - // CSS 3 defines: - // 'auto' to use smoothing - // 'optimize-quality' as alias for auto - // We don't have special rendering for 'crisp-edges' yet - // so follow what browsers do. + default: // In recent Cairo, BEST used Lanczos3, which is prohibitively slow dc.patternSetFilter( CAIRO_FILTER_GOOD ); break; - case SP_CSS_IMAGE_RENDERING_OPTIMIZESPEED: - case SP_CSS_IMAGE_RENDERING_PIXELATED: - default: - dc.patternSetFilter( CAIRO_FILTER_NEAREST ); - break; } } |
