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 --- cmds/screencap/screencap.cpp | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) (limited to 'cmds') diff --git a/cmds/screencap/screencap.cpp b/cmds/screencap/screencap.cpp index 6ce5b86..bc5e10d 100644 --- a/cmds/screencap/screencap.cpp +++ b/cmds/screencap/screencap.cpp @@ -17,32 +17,21 @@ #include #include -#include - -#include -#include -#include - #include -#include +#include using namespace android; int main(int argc, char** argv) { - const String16 name("SurfaceFlinger"); - sp composer; - if (getService(name, &composer) != NO_ERROR) - return 0; - - sp heap; - uint32_t w, h; - PixelFormat f; - status_t err = composer->captureScreen(0, &heap, &w, &h, &f); - if (err != NO_ERROR) + ScreenshotClient screenshot; + if (screenshot.update() != NO_ERROR) return 0; - uint8_t* base = (uint8_t*)heap->getBase(); + void const* base = screenshot.getPixels(); + uint32_t w = screenshot.getWidth(); + uint32_t h = screenshot.getHeight(); + uint32_t f = screenshot.getFormat(); int fd = dup(STDOUT_FILENO); write(fd, &w, 4); write(fd, &h, 4); -- cgit v1.1