From: Roman Marchenko Date: Thu, 15 Jun 2017 12:28:57 +0000 (+0300) Subject: add scale factor to tbm_bufmgr_debug_dump_all() and tbm_bufmgr_debug_queue_dump(... X-Git-Tag: accepted/tizen/3.0/common/20170707.091524~3 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=refs%2Fchanges%2F58%2F134258%2F9;p=platform%2Fcore%2Fuifw%2Flibtbm.git add scale factor to tbm_bufmgr_debug_dump_all() and tbm_bufmgr_debug_queue_dump() func. Change-Id: I45803fdc89a1aa050be1365d41501325c263f81d Signed-off-by: Roman Marchenko --- diff --git a/src/tbm_bufmgr.c b/src/tbm_bufmgr.c index 64b12f6..f101e73 100644 --- a/src/tbm_bufmgr.c +++ b/src/tbm_bufmgr.c @@ -56,7 +56,7 @@ int b_dump_queue; static pthread_mutex_t gLock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t tbm_bufmgr_lock = PTHREAD_MUTEX_INITIALIZER; static __thread tbm_error_e tbm_last_error = TBM_ERROR_NONE; - +static double scale_factor = 0; static void _tbm_bufmgr_mutex_unlock(void); //#define TBM_BUFMGR_INIT_TIME @@ -1628,6 +1628,14 @@ tbm_bufmgr_debug_trace(tbm_bufmgr bufmgr, int onoff) _tbm_bufmgr_mutex_unlock(); } +void +tbm_bufmgr_debug_dump_set_scale(double scale) +{ + pthread_mutex_lock(&gLock); + scale_factor = scale; + pthread_mutex_unlock(&gLock); +} + int tbm_bufmgr_debug_queue_dump(char *path, int count, int onoff) { @@ -1653,7 +1661,9 @@ tbm_bufmgr_debug_queue_dump(char *path, int count, int onoff) return 0; } - tbm_surface_internal_dump_start(path, w, h, count); + tbm_surface_internal_dump_with_scale_start(path, w, h, count, scale_factor); + scale_factor = 0; + b_dump_queue = 1; } @@ -1679,7 +1689,8 @@ tbm_bufmgr_debug_dump_all(char *path) return 1; } - tbm_surface_internal_dump_start(path, w, h, count); + tbm_surface_internal_dump_with_scale_start(path, w, h, count, scale_factor); + scale_factor = 0; LIST_FOR_EACH_ENTRY(surface, &gBufMgr->surf_list, item_link) tbm_surface_internal_dump_buffer(surface, "dump_all"); diff --git a/src/tbm_bufmgr.h b/src/tbm_bufmgr.h index 6ba3edb..7d89204 100644 --- a/src/tbm_bufmgr.h +++ b/src/tbm_bufmgr.h @@ -1062,6 +1062,26 @@ int tbm_bufmgr_debug_dump_all(char *path); */ int tbm_bufmgr_debug_queue_dump(char *path, int count, int onoff); +/** + * @brief Set scale factor for the nearest calling tbm_bufmgr_debug_dump_all() or tbm_bufmgr_debug_queue_dump() + * @since_tizen 3.0 + * @param[in] scale : the scale factor, 0 - disable scaling + * @par Example + @code + #include + + // Dump all surface with scale factor 0.5 + tbm_bufmgr_debug_dump_set_scale(0.5); + tbm_bufmgr_debug_dump_all("/tmp/"); + + // Start the dump debugging for queue with scale factor 0.5 + tbm_bufmgr_debug_dump_set_scale(0.2); + tbm_bufmgr_debug_queue_dump("/tmp/", 10, 1); + + @endcode + */ +void tbm_bufmgr_debug_dump_set_scale(double scale); + int tbm_bufmgr_bind_native_display(tbm_bufmgr bufmgr, void *NativeDisplay); #ifdef __cplusplus diff --git a/src/tbm_surface_internal.c b/src/tbm_surface_internal.c index afcf94f..df77fe7 100644 --- a/src/tbm_surface_internal.c +++ b/src/tbm_surface_internal.c @@ -1708,10 +1708,12 @@ fail: void tbm_surface_internal_dump_with_scale_start(char *path, int w, int h, int count, double scale) { - TBM_RETURN_IF_FAIL(scale > 0.0); - - tbm_surface_internal_dump_start(path, (int)(scale * w), (int)(scale * h), count); + if (scale > 0.0) { + w *= scale; + h *= scale; + } + tbm_surface_internal_dump_start(path, w, h, count); scale_factor = scale; }