summaryrefslogtreecommitdiffstatshomepage
path: root/src/osd/modules/osdhelper.h
diff options
context:
space:
mode:
author Vas Crabb <vas@vastheman.com>2019-03-26 11:13:37 +1100
committer Vas Crabb <vas@vastheman.com>2019-03-26 11:13:37 +1100
commit97b67170277437131adf6ed4d60139c172529e4f (patch)
tree7a5cbf608f191075f1612b1af15832c206a3fe2d /src/osd/modules/osdhelper.h
parentb380514764cf857469bae61c11143a19f79a74c5 (diff)
(nw) Clean up the mess on master
This effectively reverts b380514764cf857469bae61c11143a19f79a74c5 and c24473ddff715ecec2e258a6eb38960cf8c8e98e, restoring the state at 598cd5227223c3b04ca31f0dbc1981256d9ea3ff. Before pushing, please check that what you're about to push is sane. Check your local commit log and ensure there isn't anything out-of-place before pushing to mainline. When things like this happen, it wastes everyone's time. I really don't need this in a week when real work™ is busting my balls and I'm behind where I want to be with preparing for MAME release.
Diffstat (limited to 'src/osd/modules/osdhelper.h')
-rw-r--r--src/osd/modules/osdhelper.h61
1 files changed, 28 insertions, 33 deletions
diff --git a/src/osd/modules/osdhelper.h b/src/osd/modules/osdhelper.h
index 463d8cdfb48..093c392e249 100644
--- a/src/osd/modules/osdhelper.h
+++ b/src/osd/modules/osdhelper.h
@@ -6,23 +6,23 @@
//
//============================================================
-#pragma once
+#ifndef MAME_OSD_MODULES_OSDHELPER_H
+#define MAME_OSD_MODULES_OSDHELPER_H
-#ifndef __OSDHELPER__
-#define __OSDHELPER__
+#pragma once
class osd_dim
{
public:
- osd_dim(const int &w, const int &h)
- : m_w(w), m_h(h)
- {
- }
- int width() const { return m_w; }
- int height() const { return m_h; }
+ constexpr osd_dim() : m_w(0), m_h(0) { }
+ constexpr osd_dim(int w, int h) : m_w(w), m_h(h) { }
+
+ constexpr int width() const { return m_w; }
+ constexpr int height() const { return m_h; }
+
+ constexpr bool operator!=(const osd_dim &other) { return (m_w != other.width()) || (m_h != other.height()); }
+ constexpr bool operator==(const osd_dim &other) { return (m_w == other.width()) && (m_h == other.height()); }
- bool operator!=(const osd_dim &other) { return (m_w != other.width()) || (m_h != other.height()); }
- bool operator==(const osd_dim &other) { return (m_w == other.width()) && (m_h == other.height()); }
private:
int m_w;
int m_h;
@@ -31,30 +31,25 @@ private:
class osd_rect
{
public:
- osd_rect()
- : m_x(0), m_y(0), m_d(0,0)
- {
- }
- osd_rect(const int x, const int y, const int &w, const int &h)
- : m_x(x), m_y(y), m_d(w,h)
- {
- }
- osd_rect(const int x, const int y, const osd_dim &d)
- : m_x(x), m_y(y), m_d(d)
- {
- }
- int top() const { return m_y; }
- int left() const { return m_x; }
- int width() const { return m_d.width(); }
- int height() const { return m_d.height(); }
+ constexpr osd_rect() : m_x(0), m_y(0), m_d(0, 0) { }
+ constexpr osd_rect(int x, int y, int w, int h) : m_x(x), m_y(y), m_d(w, h) { }
+ constexpr osd_rect(int x, int y, const osd_dim &d) : m_x(x), m_y(y), m_d(d) { }
+
+ constexpr int left() const { return m_x; }
+ constexpr int top() const { return m_y; }
+ constexpr int width() const { return m_d.width(); }
+ constexpr int height() const { return m_d.height(); }
+
+ constexpr osd_dim dim() const { return m_d; }
- osd_dim dim() const { return m_d; }
+ constexpr int right() const { return m_x + m_d.width(); }
+ constexpr int bottom() const { return m_y + m_d.height(); }
- int bottom() const { return m_y + m_d.height(); }
- int right() const { return m_x + m_d.width(); }
+ constexpr osd_rect move_by(int dx, int dy) const { return osd_rect(m_x + dx, m_y + dy, m_d); }
+ constexpr osd_rect resize(int w, int h) const { return osd_rect(m_x, m_y, w, h); }
- osd_rect move_by(int dx, int dy) const { return osd_rect(m_x + dx, m_y + dy, m_d); }
- osd_rect resize(int w, int h) const { return osd_rect(m_x, m_y, w, h); }
+ constexpr bool operator!=(const osd_rect &other) { return (m_x != other.left()) || (m_y != other.top()) || (m_d != other.dim()); }
+ constexpr bool operator==(const osd_rect &other) { return (m_x == other.left()) && (m_y == other.top()) && (m_d == other.dim()); }
private:
int m_x;
@@ -62,4 +57,4 @@ private:
osd_dim m_d;
};
-#endif // __OSDHELPER__
+#endif // MAME_OSD_MODULES_OSDHELPER_H