~hikiko/nux/arb-srgba-shader

« back to all changes in this revision

Viewing changes to NuxCore/Size.cpp

  • Committer: Neil Jagdish Patel
  • Date: 2010-09-01 19:25:37 UTC
  • Revision ID: neil.patel@canonical.com-20100901192537-mfz7rm6q262pewg6
Import and build NuxCore

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "NKernel.h"
 
2
#include "Size.h"
 
3
 
 
4
NAMESPACE_BEGIN
 
5
 
 
6
Size::Size(t_int32 w, t_int32 h)
 
7
 
8
        width_  = w; 
 
9
        height_ = h;
 
10
}
 
11
 
 
12
//----------------------------------------------------------------------------
 
13
Size::~Size()
 
14
{
 
15
 
 
16
}
 
17
 
 
18
//----------------------------------------------------------------------------
 
19
Size::Size(const Size& s)
 
20
{
 
21
        width_ = s.width_;
 
22
        height_ = s.height_;
 
23
}
 
24
 
 
25
//----------------------------------------------------------------------------
 
26
Size& Size::operator =(const Size& s)
 
27
{
 
28
        width_ = s.width_;
 
29
        height_ = s.height_;
 
30
        return *this;
 
31
}
 
32
 
 
33
t_bool Size::operator== (const Size& s) const
 
34
{
 
35
        if((width_ == s.width_) && (height_ == s.height_))
 
36
        {
 
37
                return true;
 
38
        }
 
39
        return false;
 
40
}
 
41
 
 
42
//----------------------------------------------------------------------------
 
43
t_bool Size::operator!= (const Size& s) const
 
44
{
 
45
        if((width_ == s.width_) && (height_ == s.height_))
 
46
        {
 
47
                return false;
 
48
        }
 
49
        return true;
 
50
}
 
51
 
 
52
//----------------------------------------------------------------------------
 
53
Size Size::operator+ (const Size& s) const
 
54
{
 
55
    Size size;
 
56
    size.width_ = width_ + size.width_;
 
57
    size.height_ = height_ + size.height_;
 
58
    return size;
 
59
}
 
60
 
 
61
//----------------------------------------------------------------------------
 
62
Size Size::operator- (const Size& s) const
 
63
{
 
64
    Size size;
 
65
    size.width_ = width_ - size.width_;
 
66
    size.height_ = height_ - size.height_;
 
67
    return size;
 
68
}
 
69
 
 
70
//----------------------------------------------------------------------------
 
71
t_int32 Size::GetWidth() const
 
72
{
 
73
        return width_;
 
74
}
 
75
 
 
76
//----------------------------------------------------------------------------
 
77
t_int32 Size::GetHeight() const
 
78
{
 
79
        return height_;
 
80
}
 
81
 
 
82
//----------------------------------------------------------------------------
 
83
void Size::SetWidth(t_int32 w)
 
84
{
 
85
        width_ = w;
 
86
}
 
87
 
 
88
//----------------------------------------------------------------------------
 
89
void Size::SetHeight(t_int32 h)
 
90
{
 
91
        height_ = h;
 
92
}
 
93
 
 
94
//----------------------------------------------------------------------------
 
95
 
 
96
NAMESPACE_END