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/include/gui/CpuConsumer.h b/include/gui/CpuConsumer.h
index 3b07a31..f9d0e7d 100644
--- a/include/gui/CpuConsumer.h
+++ b/include/gui/CpuConsumer.h
@@ -67,6 +67,25 @@
uint8_t *dataCr;
uint32_t chromaStride;
uint32_t chromaStep;
+
+ LockedBuffer() :
+ data(NULL),
+ width(0),
+ height(0),
+ format(PIXEL_FORMAT_NONE),
+ stride(0),
+ crop(0, 0, 0, 0),
+ transform(0),
+ scalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE),
+ timestamp(0),
+ dataSpace(HAL_DATASPACE_UNKNOWN),
+ frameNumber(0),
+ flexFormat(PIXEL_FORMAT_NONE),
+ dataCb(NULL),
+ dataCr(NULL),
+ chromaStride(0),
+ chromaStep(0)
+ {}
};
// Create a new CPU consumer. The maxLockedBuffers parameter specifies
diff --git a/include/private/gui/LayerState.h b/include/private/gui/LayerState.h
index cbe8733..b2574d0 100644
--- a/include/private/gui/LayerState.h
+++ b/include/private/gui/LayerState.h
@@ -58,11 +58,10 @@
: what(0),
x(0), y(0), z(0), w(0), h(0), layerStack(0),
alpha(0), flags(0), mask(0),
- reserved(0)
+ reserved(0), crop(Rect::INVALID_RECT)
{
matrix.dsdx = matrix.dtdy = 1.0f;
matrix.dsdy = matrix.dtdx = 0.0f;
- crop.makeInvalid();
}
status_t write(Parcel& output) const;
@@ -117,6 +116,8 @@
eDisplaySizeChanged = 0x08
};
+ DisplayState();
+
uint32_t what;
sp<IBinder> token;
sp<IGraphicBufferProducer> surface;
diff --git a/include/private/ui/RegionHelper.h b/include/private/ui/RegionHelper.h
index 8c190dd..84eb100 100644
--- a/include/private/ui/RegionHelper.h
+++ b/include/private/ui/RegionHelper.h
@@ -72,7 +72,7 @@
}
void operator()(region_rasterizer& rasterizer) {
- RECT current;
+ RECT current(Rect::EMPTY_RECT);
do {
SpannerInner spannerInner(spanner.lhs, spanner.rhs);
int inside = spanner.next(current.top, current.bottom);
diff --git a/include/ui/Rect.h b/include/ui/Rect.h
index 3886f93..6310502 100644
--- a/include/ui/Rect.h
+++ b/include/ui/Rect.h
@@ -32,13 +32,12 @@
typedef ARect::value_type value_type;
static const Rect INVALID_RECT;
+ static const Rect EMPTY_RECT;
// we don't provide copy-ctor and operator= on purpose
// because we want the compiler generated versions
- inline Rect() {
- left = right = top = bottom = 0;
- }
+ inline Rect() : Rect(INVALID_RECT) {}
inline Rect(int32_t w, int32_t h) {
left = top = 0;