Add additional parameters for the captureLayer functions.
1. Added new captureLayers function that will return a GraphicBuffer
instead of storing into a Surface.
2. Added crop to captureLayers function.
3. Added frameScale to allow captures to scale.
4. Removed rotation parameter from captureLayers since it will always be
in the correct orientation.
Test: Transaction_test ScreenCaptureTest.CaptureCrop, .CaptureSize
Change-Id: Ib16d8575cf0c103126b9427ad32e2d28d568ea61
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp
index 973302c..c21c5e3 100644
--- a/libs/gui/ISurfaceComposer.cpp
+++ b/libs/gui/ISurfaceComposer.cpp
@@ -124,12 +124,13 @@
virtual status_t captureLayers(const sp<IBinder>& layerHandleBinder,
const sp<IGraphicBufferProducer>& producer,
- ISurfaceComposer::Rotation rotation) {
+ const Rect& sourceCrop, float frameScale) {
Parcel data, reply;
data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor());
data.writeStrongBinder(layerHandleBinder);
data.writeStrongBinder(IInterface::asBinder(producer));
- data.writeInt32(static_cast<int32_t>(rotation));
+ data.write(sourceCrop);
+ data.writeFloat(frameScale);
remote()->transact(BnSurfaceComposer::CAPTURE_LAYERS, data, &reply);
return reply.readInt32();
}
@@ -605,10 +606,11 @@
sp<IBinder> layerHandleBinder = data.readStrongBinder();
sp<IGraphicBufferProducer> producer =
interface_cast<IGraphicBufferProducer>(data.readStrongBinder());
- int32_t rotation = data.readInt32();
+ Rect sourceCrop(Rect::EMPTY_RECT);
+ data.read(sourceCrop);
+ float frameScale = data.readFloat();
- status_t res = captureLayers(layerHandleBinder, producer,
- static_cast<ISurfaceComposer::Rotation>(rotation));
+ status_t res = captureLayers(layerHandleBinder, producer, sourceCrop, frameScale);
reply->writeInt32(res);
return NO_ERROR;
}