summaryrefslogtreecommitdiffstats
path: root/src/display/drawing-image.cpp
diff options
context:
space:
mode:
authorTavmjong Bah <tavmjong@free.fr>2013-11-12 14:28:10 +0000
committertavmjong-free <tavmjong@free.fr>2013-11-12 14:28:10 +0000
commit410223aec5614206e8fb485e181791bd3abd80f7 (patch)
tree89122466e70f7144567252c1b6ff5721d512df45 /src/display/drawing-image.cpp
parentClean up some tool related things. (diff)
downloadinkscape-410223aec5614206e8fb485e181791bd3abd80f7.tar.gz
inkscape-410223aec5614206e8fb485e181791bd3abd80f7.zip
Partial fix for blocker bug 1163449: "Imported bitmap appear blurry when zoomed in"
Setting style to include "image-rendering:optimizeSpeed" will cause nearest neighbor filter to be used in downscaling. (bzr r12796)
Diffstat (limited to 'src/display/drawing-image.cpp')
-rw-r--r--src/display/drawing-image.cpp25
1 files changed, 18 insertions, 7 deletions
diff --git a/src/display/drawing-image.cpp b/src/display/drawing-image.cpp
index a9c0499c2..1b9214c49 100644
--- a/src/display/drawing-image.cpp
+++ b/src/display/drawing-image.cpp
@@ -108,13 +108,6 @@ unsigned DrawingImage::_renderItem(DrawingContext &ct, Geom::IntRect const &/*ar
if (!outline) {
if (!_pixbuf) return RENDER_OK;
-
- // if (_style) {
- // _style->image_rendering.computed
- // See: http://www.w3.org/TR/SVG/painting.html#ImageRenderingProperty
- // http://www.w3.org/TR/css4-images/#the-image-rendering
- // style.h/style.cpp
- // }
Inkscape::DrawingContext::Save save(ct);
ct.transform(_ctm);
@@ -126,6 +119,24 @@ unsigned DrawingImage::_renderItem(DrawingContext &ct, Geom::IntRect const &/*ar
ct.scale(_scale);
ct.setSource(_pixbuf->getSurfaceRaw(), 0, 0);
+ if (_style) {
+ // See: http://www.w3.org/TR/SVG/painting.html#ImageRenderingProperty
+ // http://www.w3.org/TR/css4-images/#the-image-rendering
+ // style.h/style.cpp
+ switch (_style->image_rendering.computed) {
+ case SP_CSS_COLOR_RENDERING_AUTO:
+ // Do nothing
+ break;
+ case SP_CSS_COLOR_RENDERING_OPTIMIZEQUALITY:
+ ct.patternSetFilter( CAIRO_FILTER_BEST );
+ break;
+ case SP_CSS_COLOR_RENDERING_OPTIMIZESPEED:
+ default:
+ ct.patternSetFilter( CAIRO_FILTER_NEAREST );
+ break;
+ }
+ }
+
ct.paint(_opacity);
} else { // outline; draw a rect instead