Use rect instead of four int frame values for WindowInfo
Test: Builds
Bug: 290795410
Change-Id: Iff104ad14c5da792f32a68d25145b936f6ea71f6
diff --git a/libs/gui/WindowInfo.cpp b/libs/gui/WindowInfo.cpp
index 52af9d5..2eb6bd6 100644
--- a/libs/gui/WindowInfo.cpp
+++ b/libs/gui/WindowInfo.cpp
@@ -43,7 +43,7 @@
}
bool WindowInfo::frameContainsPoint(int32_t x, int32_t y) const {
- return x >= frameLeft && x < frameRight && y >= frameTop && y < frameBottom;
+ return x >= frame.left && x < frame.right && y >= frame.top && y < frame.bottom;
}
bool WindowInfo::supportsSplitTouch() const {
@@ -59,18 +59,15 @@
}
bool WindowInfo::overlaps(const WindowInfo* other) const {
- const bool nonEmpty = (frameRight - frameLeft > 0) || (frameBottom - frameTop > 0);
- return nonEmpty && frameLeft < other->frameRight && frameRight > other->frameLeft &&
- frameTop < other->frameBottom && frameBottom > other->frameTop;
+ return !frame.isEmpty() && frame.left < other->frame.right && frame.right > other->frame.left &&
+ frame.top < other->frame.bottom && frame.bottom > other->frame.top;
}
bool WindowInfo::operator==(const WindowInfo& info) const {
return info.token == token && info.id == id && info.name == name &&
- info.dispatchingTimeout == dispatchingTimeout && info.frameLeft == frameLeft &&
- info.frameTop == frameTop && info.frameRight == frameRight &&
- info.frameBottom == frameBottom && info.surfaceInset == surfaceInset &&
- info.globalScaleFactor == globalScaleFactor && info.transform == transform &&
- info.touchableRegion.hasSameRects(touchableRegion) &&
+ info.dispatchingTimeout == dispatchingTimeout && info.frame == frame &&
+ info.surfaceInset == surfaceInset && info.globalScaleFactor == globalScaleFactor &&
+ info.transform == transform && info.touchableRegion.hasSameRects(touchableRegion) &&
info.touchOcclusionMode == touchOcclusionMode && info.ownerPid == ownerPid &&
info.ownerUid == ownerUid && info.packageName == packageName &&
info.inputConfig == inputConfig && info.displayId == displayId &&
@@ -103,10 +100,7 @@
parcel->writeInt32(layoutParamsFlags.get()) ?:
parcel->writeInt32(
static_cast<std::underlying_type_t<WindowInfo::Type>>(layoutParamsType)) ?:
- parcel->writeInt32(frameLeft) ?:
- parcel->writeInt32(frameTop) ?:
- parcel->writeInt32(frameRight) ?:
- parcel->writeInt32(frameBottom) ?:
+ parcel->write(frame) ?:
parcel->writeInt32(surfaceInset) ?:
parcel->writeFloat(globalScaleFactor) ?:
parcel->writeFloat(alpha) ?:
@@ -155,10 +149,7 @@
// clang-format off
status = parcel->readInt32(&lpFlags) ?:
parcel->readInt32(&lpType) ?:
- parcel->readInt32(&frameLeft) ?:
- parcel->readInt32(&frameTop) ?:
- parcel->readInt32(&frameRight) ?:
- parcel->readInt32(&frameBottom) ?:
+ parcel->read(frame) ?:
parcel->readInt32(&surfaceInset) ?:
parcel->readFloat(&globalScaleFactor) ?:
parcel->readFloat(&alpha) ?: