diff options
author | 2017-09-20 12:02:26 -0700 | |
---|---|---|
committer | 2017-10-26 17:39:24 -0700 | |
commit | a76b271f0e14325fa0ebb98e1cac0a15adfea1cb (patch) | |
tree | e13158ef19eed46d32d6a0984da3fe1645206fe6 /services/surfaceflinger/RenderArea.cpp | |
parent | cd8ad33289b74243e21a776a5a9170c845d990c4 (diff) |
Add captureLayers function to capture a layer and its children.
The captureLayers function gets a root layer as its argument.
It will capture the content for that layer and its descendants. The
capture will set the root layer's transform back to (0, 0).
Test: Transaction_test ScreenCaptureTest
Change-Id: I84fb66a65cd91434cddc99506b1924cf9f950935
Diffstat (limited to 'services/surfaceflinger/RenderArea.cpp')
-rw-r--r-- | services/surfaceflinger/RenderArea.cpp | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/services/surfaceflinger/RenderArea.cpp b/services/surfaceflinger/RenderArea.cpp new file mode 100644 index 0000000000..6225df134d --- /dev/null +++ b/services/surfaceflinger/RenderArea.cpp @@ -0,0 +1,34 @@ +#include "RenderArea.h" + +namespace android { + +/* + * Checks that the requested width and height are valid and updates them to the render area + * dimensions if they are set to 0 + */ +status_t RenderArea::updateDimensions() { + // get screen geometry + + uint32_t width = getWidth(); + uint32_t height = getHeight(); + + if (mRotationFlags & Transform::ROT_90) { + std::swap(width, height); + } + + if ((mReqWidth > width) || (mReqHeight > height)) { + ALOGE("size mismatch (%d, %d) > (%d, %d)", mReqWidth, mReqHeight, width, height); + return BAD_VALUE; + } + + if (mReqWidth == 0) { + mReqWidth = width; + } + if (mReqHeight == 0) { + mReqHeight = height; + } + + return NO_ERROR; +} + +} // namespace android
\ No newline at end of file |