Mark non-inplace Region operations WARN_UNUSED
Since the Java side equivalents operate in-place it can
be easy to assume Region.translate(x,y) will have some
effect whereas it is in fact a no-op unless the return
value is stored. Use WARN_UNUSED to help developers with
this.
Test: None
Change-Id: Idfd5b8b68dc144acaae62bd732eecdac7a745197
diff --git a/libs/ui/include/ui/Region.h b/libs/ui/include/ui/Region.h
index 7788452..68b60fc 100644
--- a/libs/ui/include/ui/Region.h
+++ b/libs/ui/include/ui/Region.h
@@ -25,6 +25,8 @@
#include <ui/Rect.h>
#include <utils/Flattenable.h>
+#include <android-base/macros.h>
+
namespace android {
// ---------------------------------------------------------------------------
@@ -93,11 +95,11 @@
Region& subtractSelf(const Region& rhs, int dx, int dy);
// these translate rhs first
- const Region translate(int dx, int dy) const;
- const Region merge(const Region& rhs, int dx, int dy) const;
- const Region mergeExclusive(const Region& rhs, int dx, int dy) const;
- const Region intersect(const Region& rhs, int dx, int dy) const;
- const Region subtract(const Region& rhs, int dx, int dy) const;
+ const Region translate(int dx, int dy) const WARN_UNUSED;
+ const Region merge(const Region& rhs, int dx, int dy) const WARN_UNUSED;
+ const Region mergeExclusive(const Region& rhs, int dx, int dy) const WARN_UNUSED;
+ const Region intersect(const Region& rhs, int dx, int dy) const WARN_UNUSED;
+ const Region subtract(const Region& rhs, int dx, int dy) const WARN_UNUSED;
// convenience operators overloads
inline const Region operator | (const Region& rhs) const;