Set window to transparent when screenshotting layer.
Set the screenshot to transparent instead of black. This allows the
system to draw a color behind without having to crop out the area that
may not be drawn into.
Bug: 76442549
Test: When going to recents, area not drawn from layers is now
transparent instead of black.
Test: Transaction_test#CaptureTransparent
Change-Id: Id535eb753d3d1cae82658cd33423ce588aaa62f8
diff --git a/services/surfaceflinger/RenderArea.h b/services/surfaceflinger/RenderArea.h
index bf0707f..62a3d5b 100644
--- a/services/surfaceflinger/RenderArea.h
+++ b/services/surfaceflinger/RenderArea.h
@@ -9,10 +9,15 @@
namespace android {
class RenderArea {
+
public:
- RenderArea(uint32_t reqHeight, uint32_t reqWidth,
+ enum class CaptureFill {CLEAR, OPAQUE};
+
+ static float getCaptureFillValue(CaptureFill captureFill);
+
+ RenderArea(uint32_t reqHeight, uint32_t reqWidth, CaptureFill captureFill,
ISurfaceComposer::Rotation rotation = ISurfaceComposer::eRotateNone)
- : mReqHeight(reqHeight), mReqWidth(reqWidth) {
+ : mReqHeight(reqHeight), mReqWidth(reqWidth), mCaptureFill(captureFill) {
mRotationFlags = Transform::fromRotation(rotation);
}
@@ -36,10 +41,13 @@
status_t updateDimensions();
+ CaptureFill getCaptureFill() const { return mCaptureFill; };
+
private:
uint32_t mReqHeight;
uint32_t mReqWidth;
Transform::orientation_flags mRotationFlags;
+ CaptureFill mCaptureFill;
};
} // namespace android