From 2f2435dd3471b9657408f7843cef0f52a8d8c504 Mon Sep 17 00:00:00 2001 From: Thaddeus Crews Date: Fri, 28 Jun 2024 21:39:25 -0500 Subject: [PATCH] common: ensure const equality operators A minor syntactic adjustment to two instances of operator== and one instance of operator!=, both to the end of ensuring these locally-scoped functions are properly identified as const. In the majority of cases, this shouldn't have any impact; however, this change makes these operators play nice in c++20 contexts. --- src/renderer/gl_engine/tvgGlGeometry.h | 4 ++-- src/renderer/tvgRender.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/renderer/gl_engine/tvgGlGeometry.h b/src/renderer/gl_engine/tvgGlGeometry.h index acdf5c3e..de4eea58 100644 --- a/src/renderer/gl_engine/tvgGlGeometry.h +++ b/src/renderer/gl_engine/tvgGlGeometry.h @@ -108,14 +108,14 @@ public: return *this; } - bool operator== (const GlPoint& rhs) + bool operator== (const GlPoint& rhs) const { if (&rhs == this) return true; if (rhs.x == this->x && rhs.y == this->y) return true; return false; } - bool operator!= (const GlPoint& rhs) + bool operator!= (const GlPoint& rhs) const { if (&rhs == this) return true; if (rhs.x != this->x || rhs.y != this->y) return true; diff --git a/src/renderer/tvgRender.h b/src/renderer/tvgRender.h index 8f28d37d..a915d68f 100644 --- a/src/renderer/tvgRender.h +++ b/src/renderer/tvgRender.h @@ -103,7 +103,7 @@ struct RenderRegion void intersect(const RenderRegion& rhs); void add(const RenderRegion& rhs); - bool operator==(const RenderRegion& rhs) + bool operator==(const RenderRegion& rhs) const { if (x == rhs.x && y == rhs.y && w == rhs.w && h == rhs.h) return true; return false;