From 597c7f67b5f2491c6098a1de241a3f0fd274688a Mon Sep 17 00:00:00 2001 From: Mathias Agopian Date: Wed, 29 Sep 2010 13:02:36 -0700 Subject: refactored screenshot code the core screenshot function now can capture the screen at any lower resolution performing bilinear filtering. we also now have some client code to interface with the screenshot service. it's now possible to request a screenshot at a lower resolution. Change-Id: I33689bba98507ab928d0898b21596d0d2fe4b953 --- include/surfaceflinger/ISurfaceComposer.h | 3 ++- include/surfaceflinger/SurfaceComposerClient.h | 30 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) (limited to 'include/surfaceflinger') diff --git a/include/surfaceflinger/ISurfaceComposer.h b/include/surfaceflinger/ISurfaceComposer.h index 76307b28390c..653360023859 100644 --- a/include/surfaceflinger/ISurfaceComposer.h +++ b/include/surfaceflinger/ISurfaceComposer.h @@ -115,7 +115,8 @@ public: */ virtual status_t captureScreen(DisplayID dpy, sp* heap, - uint32_t* width, uint32_t* height, PixelFormat* format) = 0; + uint32_t* width, uint32_t* height, PixelFormat* format, + uint32_t reqWidth, uint32_t reqHeight) = 0; /* Signal surfaceflinger that there might be some work to do * This is an ASYNCHRONOUS call. diff --git a/include/surfaceflinger/SurfaceComposerClient.h b/include/surfaceflinger/SurfaceComposerClient.h index 8773d7133b56..a80832d5ddfd 100644 --- a/include/surfaceflinger/SurfaceComposerClient.h +++ b/include/surfaceflinger/SurfaceComposerClient.h @@ -169,6 +169,36 @@ private: sp mClient; }; +// --------------------------------------------------------------------------- + +class ScreenshotClient +{ + sp mHeap; + uint32_t mWidth; + uint32_t mHeight; + PixelFormat mFormat; +public: + ScreenshotClient(); + + // frees the previous screenshot and capture a new one + status_t update(); + status_t update(uint32_t reqWidth, uint32_t reqHeight); + + // release memory occupied by the screenshot + void release(); + + // pixels are valid until this object is freed or + // release() or update() is called + void const* getPixels() const; + + uint32_t getWidth() const; + uint32_t getHeight() const; + PixelFormat getFormat() const; + uint32_t getStride() const; + // size of allocated memory in bytes + size_t getSize() const; +}; + // --------------------------------------------------------------------------- }; // namespace android -- cgit v1.2.3-59-g8ed1b