[Kandinsky] Inline very simple operations on KDPoint and KDSize

Change-Id: I35f6bc9450b35b1ab7a0dcadce69dddf932dd23f
This commit is contained in:
Romain Goyet
2016-08-19 10:51:25 +02:00
parent b9b3a1b2e5
commit c5916572fe
5 changed files with 8 additions and 14 deletions

View File

@@ -12,7 +12,6 @@ objs += $(addprefix kandinsky/src/,\
ion_context.o\
point.o\
rect.o\
size.o\
text.o\
)
tests += $(addprefix kandinsky/test/,\

View File

@@ -3,11 +3,12 @@
#include <kandinsky/coordinate.h>
struct KDPoint {
class KDPoint {
public:
constexpr KDPoint(KDCoordinate x, KDCoordinate y) :
m_x(x), m_y(y) {}
KDCoordinate x() const;
KDCoordinate y() const;
KDCoordinate x() const { return m_x; }
KDCoordinate y() const { return m_y; }
KDPoint translatedBy(KDPoint other) const;
KDPoint opposite() const;
private:

View File

@@ -3,11 +3,12 @@
#include <kandinsky/coordinate.h>
struct KDSize {
class KDSize {
public:
constexpr KDSize(KDCoordinate width, KDCoordinate height) :
m_width(width), m_height(height) {}
KDCoordinate width() const;
KDCoordinate height() const;
KDCoordinate width() const { return m_width; }
KDCoordinate height() const { return m_height; }
private:
KDCoordinate m_width;
KDCoordinate m_height;

View File

@@ -1,8 +1,5 @@
#include <kandinsky/point.h>
KDCoordinate KDPoint::x() const { return m_x; }
KDCoordinate KDPoint::y() const { return m_y; }
KDPoint KDPoint::translatedBy(KDPoint other) const {
return KDPoint(m_x+other.x(), m_y+other.y());
}

View File

@@ -1,4 +0,0 @@
#include <kandinsky/size.h>
KDCoordinate KDSize::width() const { return m_width; }
KDCoordinate KDSize::height() const { return m_height; }