Intersect buffer crop with buffer size
If the layer has a buffer crop, it needs to be intersected with the
buffer size in case the crop passed in is larger than the buffer size
Test: ASurfaceControlTest
Test: LayerSnapshotTest
Fixes: 297171709
Change-Id: I62a0278a42a478ab31dd383f0a7b9741c5b6e8a8
diff --git a/services/surfaceflinger/tests/unittests/LayerHierarchyTest.h b/services/surfaceflinger/tests/unittests/LayerHierarchyTest.h
index ff644ba..acfde71 100644
--- a/services/surfaceflinger/tests/unittests/LayerHierarchyTest.h
+++ b/services/surfaceflinger/tests/unittests/LayerHierarchyTest.h
@@ -372,6 +372,17 @@
mLifecycleManager.applyTransactions(transactions);
}
+ void setBufferCrop(uint32_t id, const Rect& bufferCrop) {
+ std::vector<TransactionState> transactions;
+ transactions.emplace_back();
+ transactions.back().states.push_back({});
+
+ transactions.back().states.front().state.what = layer_state_t::eBufferCropChanged;
+ transactions.back().states.front().layerId = id;
+ transactions.back().states.front().state.bufferCrop = bufferCrop;
+ mLifecycleManager.applyTransactions(transactions);
+ }
+
void setDataspace(uint32_t id, ui::Dataspace dataspace) {
std::vector<TransactionState> transactions;
transactions.emplace_back();