diff options
author | 2016-10-24 16:27:39 -0700 | |
---|---|---|
committer | 2017-01-24 13:04:43 -0800 | |
commit | 1f0a16a5d7cd00ba7fda82e7d315afa1fd1303b9 (patch) | |
tree | 28a321d2992c122a17079f523f6e2bacfc5c1123 /libs/gui/ISurfaceComposerClient.cpp | |
parent | 2047fae0cfed99c425dc7333f31d309e5b8ee1ba (diff) |
SurfaceFlinger and libgui: Support for child layers.
Add support for parenting Layers in a tree. Layers
follow scene-graph style rules, that is to say:
1. A child is cropped to the final bounds of the parent.
2. A child inherits the parent's transform (including position)
3. A child's Z ordering is relative to the parent and bounded between
the parents siblings.
4. A childs lifetime is bounded by it's parents lifetime.
Test: New tests in Transaction_test plus manual testing with later branches.
Change-Id: I96f8ad863665b9a70b6f845561344c297b7e6eff
Diffstat (limited to 'libs/gui/ISurfaceComposerClient.cpp')
-rw-r--r-- | libs/gui/ISurfaceComposerClient.cpp | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/libs/gui/ISurfaceComposerClient.cpp b/libs/gui/ISurfaceComposerClient.cpp index 47cb0473e8..b2036dcadb 100644 --- a/libs/gui/ISurfaceComposerClient.cpp +++ b/libs/gui/ISurfaceComposerClient.cpp @@ -56,7 +56,7 @@ public: virtual status_t createSurface(const String8& name, uint32_t width, uint32_t height, PixelFormat format, uint32_t flags, - sp<IBinder>* handle, + const sp<IBinder>& parent, sp<IBinder>* handle, sp<IGraphicBufferProducer>* gbp) { Parcel data, reply; data.writeInterfaceToken(ISurfaceComposerClient::getInterfaceDescriptor()); @@ -65,6 +65,9 @@ public: data.writeUint32(height); data.writeInt32(static_cast<int32_t>(format)); data.writeUint32(flags); + if (parent != nullptr) { + data.writeStrongBinder(parent); + } remote()->transact(CREATE_SURFACE, data, &reply); *handle = reply.readStrongBinder(); *gbp = interface_cast<IGraphicBufferProducer>(reply.readStrongBinder()); @@ -145,10 +148,14 @@ status_t BnSurfaceComposerClient::onTransact( uint32_t height = data.readUint32(); PixelFormat format = static_cast<PixelFormat>(data.readInt32()); uint32_t createFlags = data.readUint32(); + sp<IBinder> parent = nullptr; + if (data.dataAvail() > 0) { + parent = data.readStrongBinder(); + } sp<IBinder> handle; sp<IGraphicBufferProducer> gbp; status_t result = createSurface(name, width, height, format, - createFlags, &handle, &gbp); + createFlags, parent, &handle, &gbp); reply->writeStrongBinder(handle); reply->writeStrongBinder(IInterface::asBinder(gbp)); reply->writeInt32(result); |