diff options
| author | Matthew Petroff <matthew@mpetroff.net> | 2013-08-06 18:54:40 +0000 |
|---|---|---|
| committer | Matthew Petroff <matthew@mpetroff.net> | 2013-08-06 18:54:40 +0000 |
| commit | bb88a2cb94ec34ee838a972bab17ca05ba92d1da (patch) | |
| tree | 4b4580dbe1bec0968254d1b362611ab57ad3c223 /src/extension/internal/cairo-renderer.cpp | |
| parent | init SPStyle better: fixes a bunch of bugs resulting from improper re-init of... (diff) | |
| parent | Fixed bug in page sizer. (diff) | |
| download | inkscape-bb88a2cb94ec34ee838a972bab17ca05ba92d1da.tar.gz inkscape-bb88a2cb94ec34ee838a972bab17ca05ba92d1da.zip | |
Merge Google Summer of Code unit refactor.
(bzr r12471)
Diffstat (limited to 'src/extension/internal/cairo-renderer.cpp')
| -rw-r--r-- | src/extension/internal/cairo-renderer.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/extension/internal/cairo-renderer.cpp b/src/extension/internal/cairo-renderer.cpp index 0a3cff26a..f7ab63c98 100644 --- a/src/extension/internal/cairo-renderer.cpp +++ b/src/extension/internal/cairo-renderer.cpp @@ -55,7 +55,7 @@ #include "sp-mask.h" #include "sp-clippath.h" -#include <unit-constants.h> +#include "util/units.h" #include "helper/png-write.h" #include "helper/pixbuf-ops.h" @@ -442,7 +442,7 @@ static void sp_asbitmap_render(SPItem *item, CairoRenderContext *ctx) */ res = ctx->getBitmapResolution(); if(res == 0) { - res = PX_PER_IN; + res = Inkscape::Util::Quantity::convert(1, "in", "px"); } TRACE(("sp_asbitmap_render: resolution: %f\n", res )); @@ -463,8 +463,8 @@ static void sp_asbitmap_render(SPItem *item, CairoRenderContext *ctx) } // The width and height of the bitmap in pixels - unsigned width = ceil(bbox->width() * (res / PX_PER_IN)); - unsigned height = ceil(bbox->height() * (res / PX_PER_IN)); + unsigned width = ceil(bbox->width() * (res / Inkscape::Util::Quantity::convert(1, "in", "px"))); + unsigned height = ceil(bbox->height() * (res / Inkscape::Util::Quantity::convert(1, "in", "px"))); if (width == 0 || height == 0) return; @@ -477,7 +477,7 @@ static void sp_asbitmap_render(SPItem *item, CairoRenderContext *ctx) double shift_y = bbox->max()[Geom::Y]; // For default 90 dpi, snap bitmap to pixel grid - if (res == PX_PER_IN) { + if (res == Inkscape::Util::Quantity::convert(1, "in", "px")) { shift_x = round (shift_x); shift_y = -round (-shift_y); // Correct rounding despite coordinate inversion. // Remove the negations when the inversion is gone. @@ -629,7 +629,7 @@ CairoRenderer::setupDocument(CairoRenderContext *ctx, SPDocument *doc, bool page if (ctx->_vector_based_target) { // convert from px to pt - d *= Geom::Scale(PT_PER_PX); + d *= Geom::Scale(Inkscape::Util::Quantity::convert(1, "px", "pt")); } ctx->_width = d.width(); @@ -647,11 +647,11 @@ CairoRenderer::setupDocument(CairoRenderContext *ctx, SPDocument *doc, bool page } else { double high = doc->getHeight(); if (ctx->_vector_based_target) - high *= PT_PER_PX; + high *= Inkscape::Util::Quantity::convert(1, "px", "pt"); // this transform translates the export drawing to a virtual page (0,0)-(width,height) - Geom::Affine tp(Geom::Translate(-d.left() * (ctx->_vector_based_target ? PX_PER_PT : 1.0), - (d.bottom() - high) * (ctx->_vector_based_target ? PX_PER_PT : 1.0))); + Geom::Affine tp(Geom::Translate(-d.left() * (ctx->_vector_based_target ? Inkscape::Util::Quantity::convert(1, "pt", "px") : 1.0), + (d.bottom() - high) * (ctx->_vector_based_target ? Inkscape::Util::Quantity::convert(1, "pt", "px") : 1.0))); ctx->transform(tp); } } |
