From 3adadfc7e1c79b8b7773bb59cfa3af90fa8882cd Mon Sep 17 00:00:00 2001 From: Junkyeong Kim Date: Mon, 28 Dec 2020 18:49:25 +0900 Subject: [PATCH] e_info_server: change screen_dump function to tbm_surface_internal_capture_buffer Change-Id: I8fb2bd4c012720b00b6efd3d1b7d49940482ea8a Signed-off-by: Junkyeong Kim --- src/bin/e_info_server.c | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/src/bin/e_info_server.c b/src/bin/e_info_server.c index 2b0f19a..0e4b72d 100644 --- a/src/bin/e_info_server.c +++ b/src/bin/e_info_server.c @@ -4689,13 +4689,46 @@ static void _e_info_server_cb_screen_dump_cb(E_Output *eout, tbm_surface_h surface, void *user_data) { char *path = (char *)user_data; + char fname[PATH_MAX]; + char dir[PATH_MAX]; + char type[PATH_MAX]; + char *slash, *dot; + int dlen = 0, flen = 0; - tdm_helper_dump_buffer(surface, path); + slash = strrchr(path, '/'); + slash += 1; - free(path); - tbm_surface_destroy(surface); + dlen = strnlen(path, PATH_MAX) - strnlen(slash, PATH_MAX); + if (dlen <= 0) + { + ERR("cannot get path"); + goto done; + } + strncpy(dir, path, dlen); + dir[dlen] = '\0'; + + dot = strrchr(path, '.'); + + flen = strnlen(slash, PATH_MAX) - strnlen(dot, PATH_MAX); + if (flen <= 0) + { + ERR("cannot get file name"); + goto done; + } + strncpy(fname, slash, flen); + fname[flen] = '\0'; + + dot += 1; + strncpy(type, dot, PATH_MAX); + type[4] = '\0'; + + tbm_surface_internal_capture_buffer(surface, dir, fname, type); DBG("_e_info_server_cb_screen_dump_cb done"); + +done: + free(path); + tbm_surface_destroy(surface); } static Eldbus_Message * -- 2.7.4