From: Junkyeong Kim Date: Thu, 12 May 2016 06:32:24 +0000 (+0900) Subject: change tbm_surface_internal_dump_start parameter X-Git-Tag: accepted/tizen/ivi/20160513.004612~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F01%2F69201%2F3;p=platform%2Fcore%2Fuifw%2Flibtbm.git change tbm_surface_internal_dump_start parameter Change-Id: Icf81a414ba5a03d23efae7d11875e1099957c191 Signed-off-by: Junkyeong Kim --- diff --git a/src/tbm_surface_internal.c b/src/tbm_surface_internal.c old mode 100644 new mode 100755 index fcc5686..59eac8f --- a/src/tbm_surface_internal.c +++ b/src/tbm_surface_internal.c @@ -1265,16 +1265,21 @@ _tbm_surface_internal_dump_file_png(const char *file, const void *data, int widt } void -tbm_surface_internal_dump_start(char *path, int buffer_size, int count) +tbm_surface_internal_dump_start(char *path, int w, int h, int count) { TBM_RETURN_IF_FAIL(path != NULL); - TBM_RETURN_IF_FAIL(buffer_size > 0); + TBM_RETURN_IF_FAIL(w > 0); + TBM_RETURN_IF_FAIL(h > 0); TBM_RETURN_IF_FAIL(count > 0); tbm_surface_dump_buf_info *buf_info = NULL; tbm_surface_dump_buf_info *tmp; tbm_bo bo = NULL; int i; + int buffer_size; + tbm_surface_h tbm_surface; + tbm_surface_info_s info; + tbm_surface_error_e err; /* check running */ if (g_dump_info) { @@ -1291,6 +1296,27 @@ tbm_surface_internal_dump_start(char *path, int buffer_size, int count) g_dump_info->count = 0; g_dump_info->dump_max = count; + /* get buffer size */ + tbm_surface = tbm_surface_create(w, h, TBM_FORMAT_ARGB8888); + if (tbm_surface == NULL) { + TBM_LOG("tbm_surface_create fail\n"); + free(g_dump_info); + g_dump_info = NULL; + return; + } + err = tbm_surface_map(tbm_surface, TBM_SURF_OPTION_READ, &info); + if (err != TBM_SURFACE_ERROR_NONE) { + TBM_LOG("tbm_surface_map fail\n"); + tbm_surface_destroy(tbm_surface); + free(g_dump_info); + g_dump_info = NULL; + return; + } + buffer_size = info.planes[0].stride * h; + tbm_surface_unmap(tbm_surface); + tbm_surface_destroy(tbm_surface); + + /* create dump lists */ for (i = 0; i < count; i++) { buf_info = calloc(1, sizeof(tbm_surface_dump_buf_info)); TBM_GOTO_VAL_IF_FAIL(buf_info, fail); diff --git a/src/tbm_surface_internal.h b/src/tbm_surface_internal.h index d995d27..d6db4b1 100644 --- a/src/tbm_surface_internal.h +++ b/src/tbm_surface_internal.h @@ -401,11 +401,12 @@ int tbm_surface_internal_delete_user_data(tbm_surface_h surface, * @brief Start the dump debugging. * @since_tizen 3.0 * @param[in] path The given dump path - * @param[in] buffer_size the buffer size of a dump image + * @param[in] w The width of dump image + * @param[in] h The height of dump image * @param[in] count The dump count number * @see #tdm_helper_dump_stop() */ -void tbm_surface_internal_dump_start(char *path, int buffer_size, int count); +void tbm_surface_internal_dump_start(char *path, int w, int h, int count); /** * @brief End the dump debugging.