diff options
author | Mathias Agopian <mathias@google.com> | 2013-03-05 02:30:13 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-03-05 02:30:13 +0000 |
commit | 306f18c5fb15ac05db09ece7241af02b9713a23d (patch) | |
tree | 25ad5112b9963cd7f6f822690ad1c7f8afef9ef6 /libs | |
parent | eabe3140f11e515639e7a70a1286dd6af7352c9e (diff) | |
parent | 2a9fc493dfdba67108e4335bb1fe931bc1e2a025 (diff) | |
download | frameworks_native-306f18c5fb15ac05db09ece7241af02b9713a23d.zip frameworks_native-306f18c5fb15ac05db09ece7241af02b9713a23d.tar.gz frameworks_native-306f18c5fb15ac05db09ece7241af02b9713a23d.tar.bz2 |
Merge "rework screenshot API and implementation" into jb-mr2-dev
Diffstat (limited to 'libs')
-rw-r--r-- | libs/gui/ISurfaceComposer.cpp | 34 | ||||
-rw-r--r-- | libs/gui/SurfaceComposerClient.cpp | 11 |
2 files changed, 43 insertions, 2 deletions
diff --git a/libs/gui/ISurfaceComposer.cpp b/libs/gui/ISurfaceComposer.cpp index 72b6277..0a79ff7 100644 --- a/libs/gui/ISurfaceComposer.cpp +++ b/libs/gui/ISurfaceComposer.cpp @@ -115,7 +115,7 @@ public: data.writeInt32(reqHeight); data.writeInt32(minLayerZ); data.writeInt32(maxLayerZ); - remote()->transact(BnSurfaceComposer::CAPTURE_SCREEN, data, &reply); + remote()->transact(BnSurfaceComposer::CAPTURE_SCREEN_DEPRECATED, data, &reply); *heap = interface_cast<IMemoryHeap>(reply.readStrongBinder()); *width = reply.readInt32(); *height = reply.readInt32(); @@ -123,6 +123,23 @@ public: return reply.readInt32(); } + virtual status_t captureScreen(const sp<IBinder>& display, + const sp<IGraphicBufferProducer>& producer, + uint32_t reqWidth, uint32_t reqHeight, + uint32_t minLayerZ, uint32_t maxLayerZ) + { + Parcel data, reply; + data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); + data.writeStrongBinder(display); + data.writeStrongBinder(producer->asBinder()); + data.writeInt32(reqWidth); + data.writeInt32(reqHeight); + data.writeInt32(minLayerZ); + data.writeInt32(maxLayerZ); + remote()->transact(BnSurfaceComposer::CAPTURE_SCREEN, data, &reply); + return reply.readInt32(); + } + virtual bool authenticateSurfaceTexture( const sp<IGraphicBufferProducer>& bufferProducer) const { @@ -268,7 +285,7 @@ status_t BnSurfaceComposer::onTransact( CHECK_INTERFACE(ISurfaceComposer, data, reply); bootFinished(); } break; - case CAPTURE_SCREEN: { + case CAPTURE_SCREEN_DEPRECATED: { CHECK_INTERFACE(ISurfaceComposer, data, reply); sp<IBinder> display = data.readStrongBinder(); uint32_t reqWidth = data.readInt32(); @@ -286,6 +303,19 @@ status_t BnSurfaceComposer::onTransact( reply->writeInt32(f); reply->writeInt32(res); } break; + case CAPTURE_SCREEN: { + CHECK_INTERFACE(ISurfaceComposer, data, reply); + sp<IBinder> display = data.readStrongBinder(); + sp<IGraphicBufferProducer> producer = + interface_cast<IGraphicBufferProducer>(data.readStrongBinder()); + uint32_t reqWidth = data.readInt32(); + uint32_t reqHeight = data.readInt32(); + uint32_t minLayerZ = data.readInt32(); + uint32_t maxLayerZ = data.readInt32(); + status_t res = captureScreen(display, producer, + reqWidth, reqHeight, minLayerZ, maxLayerZ); + reply->writeInt32(res); + } break; case AUTHENTICATE_SURFACE: { CHECK_INTERFACE(ISurfaceComposer, data, reply); sp<IGraphicBufferProducer> bufferProducer = diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp index e8e208f..edfa78a 100644 --- a/libs/gui/SurfaceComposerClient.cpp +++ b/libs/gui/SurfaceComposerClient.cpp @@ -606,6 +606,17 @@ void SurfaceComposerClient::unblankDisplay(const sp<IBinder>& token) { // ---------------------------------------------------------------------------- +status_t ScreenshotClient::capture( + const sp<IBinder>& display, + const sp<IGraphicBufferProducer>& producer, + uint32_t reqWidth, uint32_t reqHeight, + uint32_t minLayerZ, uint32_t maxLayerZ) { + sp<ISurfaceComposer> s(ComposerService::getComposerService()); + if (s == NULL) return NO_INIT; + return s->captureScreen(display, producer, + reqWidth, reqHeight, minLayerZ, maxLayerZ); +} + ScreenshotClient::ScreenshotClient() : mWidth(0), mHeight(0), mFormat(PIXEL_FORMAT_NONE) { } |