~7-eric/inkscape/boolop-fix

« back to all changes in this revision

Viewing changes to src/selection-chemistry.cpp

Merge Google Summer of Code unit refactor.

Show diffs side-by-side

added added

removed removed

Lines of Context:
86
86
#include <map>
87
87
#include <cstring>
88
88
#include <string>
89
 
#include "helper/units.h"
90
89
#include "sp-item.h"
91
90
#include "box3d.h"
92
91
#include "persp3d.h"
93
 
#include "unit-constants.h"
 
92
#include "util/units.h"
94
93
#include "xml/simple-document.h"
95
94
#include "sp-filter-reference.h"
96
95
#include "gradient-drag.h"
3398
3397
        res = prefs_res;
3399
3398
    } else if (0 < prefs_min) {
3400
3399
        // If minsize is given, look up minimum bitmap size (default 250 pixels) and calculate resolution from it
3401
 
        res = PX_PER_IN * prefs_min / MIN(bbox->width(), bbox->height());
 
3400
        res = Inkscape::Util::Quantity::convert(1, "in", "px") * prefs_min / MIN(bbox->width(), bbox->height());
3402
3401
    } else {
3403
3402
        float hint_xdpi = 0, hint_ydpi = 0;
3404
3403
        Glib::ustring hint_filename;
3413
3412
                res = hint_xdpi;
3414
3413
            } else {
3415
3414
                // if all else fails, take the default 90 dpi
3416
 
                res = PX_PER_IN;
 
3415
                res = Inkscape::Util::Quantity::convert(1, "in", "px");
3417
3416
            }
3418
3417
        }
3419
3418
    }
3420
3419
 
3421
3420
    // The width and height of the bitmap in pixels
3422
 
    unsigned width = (unsigned) floor(bbox->width() * res / PX_PER_IN);
3423
 
    unsigned height =(unsigned) floor(bbox->height() * res / PX_PER_IN);
 
3421
    unsigned width = (unsigned) floor(bbox->width() * res / Inkscape::Util::Quantity::convert(1, "in", "px"));
 
3422
    unsigned height =(unsigned) floor(bbox->height() * res / Inkscape::Util::Quantity::convert(1, "in", "px"));
3424
3423
 
3425
3424
    // Find out if we have to run an external filter
3426
3425
    gchar const *run = NULL;
3452
3451
 
3453
3452
    double shift_x = bbox->min()[Geom::X];
3454
3453
    double shift_y = bbox->max()[Geom::Y];
3455
 
    if (res == PX_PER_IN) { // for default 90 dpi, snap it to pixel grid
 
3454
    if (res == Inkscape::Util::Quantity::convert(1, "in", "px")) { // for default 90 dpi, snap it to pixel grid
3456
3455
        shift_x = round(shift_x);
3457
3456
        shift_y = -round(-shift_y); // this gets correct rounding despite coordinate inversion, remove the negations when the inversion is gone
3458
3457
    }
3485
3484
        // Create the repr for the image
3486
3485
        Inkscape::XML::Node * repr = xml_doc->createElement("svg:image");
3487
3486
        sp_embed_image(repr, pb, "image/png");
3488
 
        if (res == PX_PER_IN) { // for default 90 dpi, snap it to pixel grid
 
3487
        if (res == Inkscape::Util::Quantity::convert(1, "in", "px")) { // for default 90 dpi, snap it to pixel grid
3489
3488
            sp_repr_set_svg_double(repr, "width", width);
3490
3489
            sp_repr_set_svg_double(repr, "height", height);
3491
3490
        } else {