summaryrefslogtreecommitdiffstats
path: root/src/extension
diff options
context:
space:
mode:
authorKrzysztof Kosi??ski <tweenk.pl@gmail.com>2011-07-13 21:43:55 +0000
committerKrzysztof KosiƄski <tweenk.pl@gmail.com>2011-07-13 21:43:55 +0000
commit6973283a77d7becd6a5a1bd7396206c6840ca785 (patch)
tree548ecd769aee550eb36b1ccfce7bcc95651ccdd9 /src/extension
parentUI fixes for gcodetools extension (diff)
downloadinkscape-6973283a77d7becd6a5a1bd7396206c6840ca785.tar.gz
inkscape-6973283a77d7becd6a5a1bd7396206c6840ca785.zip
Fix crashes in print preview
Fixed bugs: - https://launchpad.net/bugs/806105 (bzr r10450)
Diffstat (limited to 'src/extension')
-rw-r--r--src/extension/internal/cairo-renderer.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp
index 6118a7ae9..1e550f7d1 100644
--- a/src/extension/internal/cairo-renderer.cpp
+++ b/src/extension/internal/cairo-renderer.cpp
@@ -475,9 +475,11 @@ static void sp_asbitmap_render(SPItem *item, CairoRenderContext *ctx)
}
// The width and height of the bitmap in pixels
- unsigned width = (unsigned) floor ((bbox->max()[Geom::X] - bbox->min()[Geom::X]) * (res / PX_PER_IN));
- unsigned height =(unsigned) floor ((bbox->max()[Geom::Y] - bbox->min()[Geom::Y]) * (res / PX_PER_IN));
-
+ unsigned width = ceil((bbox->max()[Geom::X] - bbox->min()[Geom::X]) * (res / PX_PER_IN));
+ unsigned height = ceil((bbox->max()[Geom::Y] - bbox->min()[Geom::Y]) * (res / PX_PER_IN));
+
+ if (width == 0 || height == 0) return;
+
// Scale to exactly fit integer bitmap inside bounding box
double scale_x = (bbox->max()[Geom::X] - bbox->min()[Geom::X]) / width;
double scale_y = (bbox->max()[Geom::Y] - bbox->min()[Geom::Y]) / height;