frameworks/base
Revision | 16e9784f3219cc04a30dc20aab00e64da84a5d61 (tree) |
---|---|
Zeit | 2010-04-15 15:34:53 |
Autor | Wallace Wang <wallace1_wang@gmai...> |
Commiter | Chih-Wei Huang |
make camera preview ok
@@ -276,17 +276,31 @@ LayerBuffer::Buffer::Buffer(const ISurface::BufferHeap& buffers, ssize_t offset) | ||
276 | 276 | src.img.handle = 0; |
277 | 277 | |
278 | 278 | gralloc_module_t const * module = LayerBuffer::getGrallocModule(); |
279 | - if (module && module->perform) { | |
280 | - int err = module->perform(module, | |
281 | - GRALLOC_MODULE_PERFORM_CREATE_HANDLE_FROM_BUFFER, | |
282 | - buffers.heap->heapID(), buffers.heap->getSize(), | |
283 | - offset, buffers.heap->base(), | |
284 | - &src.img.handle); | |
285 | - | |
286 | - LOGE_IF(err, "CREATE_HANDLE_FROM_BUFFER (heapId=%d, size=%d, " | |
287 | - "offset=%ld, base=%p) failed (%s)", | |
288 | - buffers.heap->heapID(), buffers.heap->getSize(), | |
289 | - offset, buffers.heap->base(), strerror(-err)); | |
279 | + if (module) { | |
280 | + if (module->perform) { | |
281 | + int err = module->perform(module, | |
282 | + GRALLOC_MODULE_PERFORM_CREATE_HANDLE_FROM_BUFFER, | |
283 | + buffers.heap->heapID(), buffers.heap->getSize(), | |
284 | + offset, buffers.heap->base(), | |
285 | + &src.img.handle); | |
286 | + if (err != NO_ERROR) { | |
287 | + LOGE("CREATE_HANDLE_FROM_BUFFER (heapId=%d, size=%d, " | |
288 | + "offset=%ld, base=%p) failed (%s)", | |
289 | + buffers.heap->heapID(), buffers.heap->getSize(), | |
290 | + offset, buffers.heap->base(), strerror(-err)); | |
291 | + return; | |
292 | + } | |
293 | + } | |
294 | + | |
295 | + src.crop.l = 0; | |
296 | + src.crop.t = 0; | |
297 | + src.crop.r = buffers.w; | |
298 | + src.crop.b = buffers.h; | |
299 | + | |
300 | + src.img.w = buffers.hor_stride ?: buffers.w; | |
301 | + src.img.h = buffers.ver_stride ?: buffers.h; | |
302 | + src.img.format = buffers.format; | |
303 | + src.img.base = (void*)(intptr_t(buffers.heap->base()) + offset); | |
290 | 304 | } |
291 | 305 | } |
292 | 306 |
@@ -133,7 +133,7 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYIMAGEKHRPROC) (EGLDisplay dpy, EGL | ||
133 | 133 | |
134 | 134 | |
135 | 135 | #ifndef EGL_ANDROID_image_native_buffer |
136 | -#define EGL_ANDROID_image_native_buffer 1 | |
136 | +//#define EGL_ANDROID_image_native_buffer 1 | |
137 | 137 | struct android_native_buffer_t; |
138 | 138 | #define EGL_NATIVE_BUFFER_ANDROID 0x3140 /* eglCreateImageKHR target */ |
139 | 139 | #endif |