diff options
author | Mathias Agopian <mathias@google.com> | 2011-02-09 13:24:48 -0800 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-02-09 13:24:48 -0800 |
commit | 2847d395536aa94b06cdc6b64ca1a250d5b207bc (patch) | |
tree | c60c0305b2e12c5c73b9c522cafc84197cbc3e8b | |
parent | 9ac8484e0b677802474e2fd73edb9cbac02d98a6 (diff) | |
parent | 0909af57d59422be672ad02e72837e773e1ddd4b (diff) | |
download | system_core-2847d395536aa94b06cdc6b64ca1a250d5b207bc.zip system_core-2847d395536aa94b06cdc6b64ca1a250d5b207bc.tar.gz system_core-2847d395536aa94b06cdc6b64ca1a250d5b207bc.tar.bz2 |
am 0909af57: am c1fbf7c1: fix [3374821] Cannot take screenshot of HC preview
* commit '0909af57d59422be672ad02e72837e773e1ddd4b':
fix [3374821] Cannot take screenshot of HC preview
-rw-r--r-- | adb/framebuffer_service.c | 88 |
1 files changed, 75 insertions, 13 deletions
diff --git a/adb/framebuffer_service.c b/adb/framebuffer_service.c index 434eb1c..862dd91 100644 --- a/adb/framebuffer_service.c +++ b/adb/framebuffer_service.c @@ -80,20 +80,82 @@ void framebuffer_service(int fd, void *cookie) if(readx(fd_screencap, &h, 4)) goto done; if(readx(fd_screencap, &f, 4)) goto done; - /* for now always assume RGBX_8888 format */ fbinfo.version = DDMS_RAWIMAGE_VERSION; - fbinfo.bpp = 32; - fbinfo.size = w * h * 4; - fbinfo.width = w; - fbinfo.height = h; - fbinfo.red_offset = 0; - fbinfo.red_length = 8; - fbinfo.green_offset = 8; - fbinfo.green_length = 8; - fbinfo.blue_offset = 16; - fbinfo.blue_length = 8; - fbinfo.alpha_offset = 24; - fbinfo.alpha_length = 8; + /* see hardware/hardware.h */ + switch (f) { + case 1: /* RGBA_8888 */ + fbinfo.bpp = 32; + fbinfo.size = w * h * 4; + fbinfo.width = w; + fbinfo.height = h; + fbinfo.red_offset = 0; + fbinfo.red_length = 8; + fbinfo.green_offset = 8; + fbinfo.green_length = 8; + fbinfo.blue_offset = 16; + fbinfo.blue_length = 8; + fbinfo.alpha_offset = 24; + fbinfo.alpha_length = 8; + break; + case 2: /* RGBX_8888 */ + fbinfo.bpp = 32; + fbinfo.size = w * h * 4; + fbinfo.width = w; + fbinfo.height = h; + fbinfo.red_offset = 0; + fbinfo.red_length = 8; + fbinfo.green_offset = 8; + fbinfo.green_length = 8; + fbinfo.blue_offset = 16; + fbinfo.blue_length = 8; + fbinfo.alpha_offset = 24; + fbinfo.alpha_length = 0; + break; + case 3: /* RGB_888 */ + fbinfo.bpp = 24; + fbinfo.size = w * h * 3; + fbinfo.width = w; + fbinfo.height = h; + fbinfo.red_offset = 0; + fbinfo.red_length = 8; + fbinfo.green_offset = 8; + fbinfo.green_length = 8; + fbinfo.blue_offset = 16; + fbinfo.blue_length = 8; + fbinfo.alpha_offset = 24; + fbinfo.alpha_length = 0; + break; + case 4: /* RGB_565 */ + fbinfo.bpp = 16; + fbinfo.size = w * h * 2; + fbinfo.width = w; + fbinfo.height = h; + fbinfo.red_offset = 11; + fbinfo.red_length = 5; + fbinfo.green_offset = 5; + fbinfo.green_length = 6; + fbinfo.blue_offset = 0; + fbinfo.blue_length = 5; + fbinfo.alpha_offset = 0; + fbinfo.alpha_length = 0; + break; + case 5: /* BGRA_8888 */ + fbinfo.bpp = 32; + fbinfo.size = w * h * 4; + fbinfo.width = w; + fbinfo.height = h; + fbinfo.red_offset = 16; + fbinfo.red_length = 8; + fbinfo.green_offset = 8; + fbinfo.green_length = 8; + fbinfo.blue_offset = 0; + fbinfo.blue_length = 8; + fbinfo.alpha_offset = 24; + fbinfo.alpha_length = 8; + break; + default: + goto done; + } /* write header */ if(writex(fd, &fbinfo, sizeof(fbinfo))) goto done; |