Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6aae18af authored by Robert Carr's avatar Robert Carr
Browse files

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
parent 6b3f6c50
Loading
Loading
Loading
Loading
+7 −5
Original line number Diff line number Diff line
@@ -25,6 +25,8 @@
#include <ui/Rect.h>
#include <utils/Flattenable.h>

#include <android-base/macros.h>

namespace android {
// ---------------------------------------------------------------------------

@@ -93,11 +95,11 @@ public:
            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;