diff options
author | Mathias Agopian <mathias@google.com> | 2010-10-04 20:06:51 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2010-10-04 20:06:51 -0700 |
commit | bba3b8efbe7dc9dd6fa326103ef7ddefc28d5ba5 (patch) | |
tree | 5da8b6283591ad47c1edca60a110fb3837a2459b /cmds | |
parent | 9fa7926beaf6c7fe32159a7e41fae9f618ec7504 (diff) | |
parent | 19058877df9bf94f197a72855f810f7f6bf8d068 (diff) | |
download | frameworks_base-bba3b8efbe7dc9dd6fa326103ef7ddefc28d5ba5.zip frameworks_base-bba3b8efbe7dc9dd6fa326103ef7ddefc28d5ba5.tar.gz frameworks_base-bba3b8efbe7dc9dd6fa326103ef7ddefc28d5ba5.tar.bz2 |
am 19058877: Merge "refactored screenshot code" into gingerbread
Merge commit '19058877df9bf94f197a72855f810f7f6bf8d068' into gingerbread-plus-aosp
* commit '19058877df9bf94f197a72855f810f7f6bf8d068':
refactored screenshot code
Diffstat (limited to 'cmds')
-rw-r--r-- | cmds/screencap/screencap.cpp | 25 |
1 files changed, 7 insertions, 18 deletions
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 <unistd.h> #include <fcntl.h> -#include <utils/Log.h> - -#include <binder/IPCThreadState.h> -#include <binder/ProcessState.h> -#include <binder/IServiceManager.h> - #include <binder/IMemory.h> -#include <surfaceflinger/ISurfaceComposer.h> +#include <surfaceflinger/SurfaceComposerClient.h> using namespace android; int main(int argc, char** argv) { - const String16 name("SurfaceFlinger"); - sp<ISurfaceComposer> composer; - if (getService(name, &composer) != NO_ERROR) - return 0; - - sp<IMemoryHeap> 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); |