From 17ac24b6c1252f88ccaf7089fa68bee3e1ef7ed9 Mon Sep 17 00:00:00 2001 From: chaviw Date: Thu, 28 Jan 2021 18:50:05 -0800 Subject: Added new arguments for screenshot request Added frameScaleX and frameScaleY to replace frameScale to allow callers to specify an X and Y scale separately. Added grayscale flag to allow the caller to take the screenshot in grayscale. Test: ScreenCaptureTest.CaptureWithGrayscale Bug: 155825630 Change-Id: Iea043b7074707df897d80bf057d7cc3870afad89 --- libs/gui/LayerState.cpp | 8 ++++++-- libs/gui/include/gui/LayerState.h | 5 ++++- 2 files changed, 10 insertions(+), 3 deletions(-) (limited to 'libs/gui') diff --git a/libs/gui/LayerState.cpp b/libs/gui/LayerState.cpp index 2946aaed37..ab20725936 100644 --- a/libs/gui/LayerState.cpp +++ b/libs/gui/LayerState.cpp @@ -644,11 +644,13 @@ bool ValidateFrameRate(float frameRate, int8_t compatibility, const char* inFunc status_t CaptureArgs::write(Parcel& output) const { SAFE_PARCEL(output.writeInt32, static_cast(pixelFormat)); SAFE_PARCEL(output.write, sourceCrop); - SAFE_PARCEL(output.writeFloat, frameScale); + SAFE_PARCEL(output.writeFloat, frameScaleX); + SAFE_PARCEL(output.writeFloat, frameScaleY); SAFE_PARCEL(output.writeBool, captureSecureLayers); SAFE_PARCEL(output.writeInt32, uid); SAFE_PARCEL(output.writeInt32, static_cast(dataspace)); SAFE_PARCEL(output.writeBool, allowProtected); + SAFE_PARCEL(output.writeBool, grayscale); return NO_ERROR; } @@ -657,12 +659,14 @@ status_t CaptureArgs::read(const Parcel& input) { SAFE_PARCEL(input.readInt32, &value); pixelFormat = static_cast(value); SAFE_PARCEL(input.read, sourceCrop); - SAFE_PARCEL(input.readFloat, &frameScale); + SAFE_PARCEL(input.readFloat, &frameScaleX); + SAFE_PARCEL(input.readFloat, &frameScaleY); SAFE_PARCEL(input.readBool, &captureSecureLayers); SAFE_PARCEL(input.readInt32, &uid); SAFE_PARCEL(input.readInt32, &value); dataspace = static_cast(value); SAFE_PARCEL(input.readBool, &allowProtected); + SAFE_PARCEL(input.readBool, &grayscale); return NO_ERROR; } diff --git a/libs/gui/include/gui/LayerState.h b/libs/gui/include/gui/LayerState.h index b1305c6607..f643ab50a0 100644 --- a/libs/gui/include/gui/LayerState.h +++ b/libs/gui/include/gui/LayerState.h @@ -328,7 +328,8 @@ struct CaptureArgs { ui::PixelFormat pixelFormat{ui::PixelFormat::RGBA_8888}; Rect sourceCrop; - float frameScale{1}; + float frameScaleX{1}; + float frameScaleY{1}; bool captureSecureLayers{false}; int32_t uid{UNSET_UID}; // Force capture to be in a color space. If the value is ui::Dataspace::UNKNOWN, the captured @@ -346,6 +347,8 @@ struct CaptureArgs { // the contents being accessed/captured by screenshot or unsecure display. bool allowProtected = false; + bool grayscale = false; + virtual status_t write(Parcel& output) const; virtual status_t read(const Parcel& input); }; -- cgit v1.2.3-59-g8ed1b