libsgui: Change Rect default constructor
The current Rect default constructor initializes to all zeroes. Change
it to initialize to an invalid Rect.
Modify all of the existing invocations of the default constructor to
maintain the existing behavior.
Bug 18173359
Change-Id: Ibbad076f1550a94f56d7b1cf5350071f2022e09a
diff --git a/libs/gui/Surface.cpp b/libs/gui/Surface.cpp
index 4b76f98..0a36c56 100644
--- a/libs/gui/Surface.cpp
+++ b/libs/gui/Surface.cpp
@@ -43,6 +43,7 @@
const sp<IGraphicBufferProducer>& bufferProducer,
bool controlledByApp)
: mGraphicBufferProducer(bufferProducer),
+ mCrop(Rect::EMPTY_RECT),
mGenerationNumber(0)
{
// Initialize the ANativeWindow function pointers.
@@ -67,7 +68,6 @@
mReqUsage = 0;
mTimestamp = NATIVE_WINDOW_TIMESTAMP_AUTO;
mDataSpace = HAL_DATASPACE_UNKNOWN;
- mCrop.clear();
mScalingMode = NATIVE_WINDOW_SCALING_MODE_FREEZE;
mTransform = 0;
mStickyTransform = 0;
@@ -332,7 +332,7 @@
// Make sure the crop rectangle is entirely inside the buffer.
- Rect crop;
+ Rect crop(Rect::EMPTY_RECT);
mCrop.intersect(Rect(buffer->width, buffer->height), &crop);
sp<Fence> fence(fenceFd >= 0 ? new Fence(fenceFd) : Fence::NO_FENCE);
@@ -779,7 +779,7 @@
{
ATRACE_CALL();
- Rect realRect;
+ Rect realRect(Rect::EMPTY_RECT);
if (rect == NULL || rect->isEmpty()) {
realRect.clear();
} else {