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
diff --git a/services/surfaceflinger/LayerVector.cpp b/services/surfaceflinger/LayerVector.cpp
index 6ac4b14..7ba6ad3 100644
--- a/services/surfaceflinger/LayerVector.cpp
+++ b/services/surfaceflinger/LayerVector.cpp
@@ -41,15 +41,14 @@
}
void LayerVector::traverseInZOrder(const std::function<void(Layer*)>& consume) const {
- const size_t n = size();
- for (size_t i = 0; i < n; i++) {
- consume((*this)[i].get());
+ for (size_t i = 0; i < size(); i++) {
+ (*this)[i]->traverseInZOrder(consume);
}
}
void LayerVector::traverseInReverseZOrder(const std::function<void(Layer*)>& consume) const {
for (auto i = static_cast<int64_t>(size()) - 1; i >= 0; i--) {
- consume((*this)[i].get());
+ (*this)[i]->traverseInReverseZOrder(consume);
}
}
} // namespace android