SF: Cleanup layer construction
Introduce a LayerCreationArg parameter object, and modify all layer
types to use it rather than having the same set of four arguments.
Along the way simplify all constructors by moving to C++11 style default
values defined in the header, and ensure the destructor is defined in
the implementation file (as a default for most layer types, as only
BufferLayer needs a non-default destructor).
Using a uniform parameter object reduces the amount of work needed to
maintain the upcoming factory interface.
Test: Works on marlin.
Test: atest libsurfaceflinger_unittest
Change-Id: Ic09291fd3213ff980bfc600166bf798ba09daa32
diff --git a/services/surfaceflinger/BufferStateLayer.cpp b/services/surfaceflinger/BufferStateLayer.cpp
index da9dcfb..9c10868 100644
--- a/services/surfaceflinger/BufferStateLayer.cpp
+++ b/services/surfaceflinger/BufferStateLayer.cpp
@@ -26,18 +26,17 @@
namespace android {
-static const std::array<float, 16> IDENTITY_MATRIX{1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1};
+// clang-format off
+const std::array<float, 16> BufferStateLayer::IDENTITY_MATRIX{
+ 1, 0, 0, 0,
+ 0, 1, 0, 0,
+ 0, 0, 1, 0,
+ 0, 0, 0, 1
+};
+// clang-format on
-BufferStateLayer::BufferStateLayer(SurfaceFlinger* flinger, const sp<Client>& client,
- const String8& name, uint32_t w, uint32_t h, uint32_t flags)
- : BufferLayer(flinger, client, name, w, h, flags),
- mSidebandStreamChanged(false),
- mFrameNumber(0) {
- mTransformMatrix = IDENTITY_MATRIX;
-}
+BufferStateLayer::BufferStateLayer(const LayerCreationArgs& args) : BufferLayer(args) {}
+BufferStateLayer::~BufferStateLayer() = default;
// -----------------------------------------------------------------------
// Interface implementation for Layer