From 1f0a16a5d7cd00ba7fda82e7d315afa1fd1303b9 Mon Sep 17 00:00:00 2001 From: Robert Carr Date: Mon, 24 Oct 2016 16:27:39 -0700 Subject: 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 --- libs/gui/SurfaceComposerClient.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'libs/gui/SurfaceComposerClient.cpp') diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index 540dbd9238..c2be6eb751 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -610,13 +610,19 @@ sp SurfaceComposerClient::createSurface( uint32_t w, uint32_t h, PixelFormat format, - uint32_t flags) + uint32_t flags, + SurfaceControl* parent) { sp sur; if (mStatus == NO_ERROR) { sp handle; + sp parentHandle; sp gbp; - status_t err = mClient->createSurface(name, w, h, format, flags, + + if (parent != nullptr) { + parentHandle = parent->getHandle(); + } + status_t err = mClient->createSurface(name, w, h, format, flags, parentHandle, &handle, &gbp); ALOGE_IF(err, "SurfaceComposerClient::createSurface error %s", strerror(-err)); if (err == NO_ERROR) { -- cgit v1.2.3-59-g8ed1b