summaryrefslogtreecommitdiffstats
path: root/src/libnr/nr-rect-l.cpp
blob: 1cb26826605b9815e93498df210210c084c091e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#include "libnr/nr-rect-l.h"

NRRectL::NRRectL()
{
    x0 = G_MAXINT32;
    y0 = G_MAXINT32;
    x1 = G_MININT32;
    y1 = G_MININT32;
}

NRRectL::NRRectL(gint32 xmin, gint32 ymin, gint32 xmax, gint32 ymax)
{
    x0 = xmin;
    y0 = ymin;
    x1 = xmax;
    y1 = ymax;
}

NRRectL::NRRectL(Geom::OptIntRect const &r)
{
    if (r) {
        x0 = r->left();
        y0 = r->top();
        x1 = r->right();
        y1 = r->bottom();
    } else {
        x0 = G_MAXINT32;
        y0 = G_MAXINT32;
        x1 = G_MININT32;
        y1 = G_MININT32;
    }
}

NRRectL::NRRectL(Geom::IntRect const &r)
{
    x0 = r.left();
    y0 = r.top();
    x1 = r.right();
    y1 = r.bottom();
}

Geom::OptIntRect NRRectL::upgrade_2geom() const
{
    Geom::OptIntRect ret;
    if (x0 > x1 || y0 > y1) return ret;
    ret = Geom::IntRect(x0, y0, x1, y1);
    return ret;
}

/*
  Local Variables:
  mode:c++
  c-file-style:"stroustrup"
  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
  indent-tabs-mode:nil
  fill-column:99
  End:
*/
// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:fileencoding=utf-8:textwidth=99 :