#define MAX_PATH_LENGTH 256
-static int screenshotIndex = 0;
static pthread_mutex_t captureScreenLock = PTHREAD_MUTEX_INITIALIZER;
struct efl_data {
return buf;
}
-static int capture_object(char *screenshot_path, int width, int height,
+static int capture_object(const char *screenshot_path, int width, int height,
Evas_Object *obj, const char *type_name)
{
- char dstpath[MAX_PATH_LENGTH];
Evas_Object *img;
Evas *canvas, *sub_canvas;
Ecore_Evas *ee, *sub_ee;
int ret = 0;
char *image_data = NULL;
- screenshotIndex++;
-
canvas = evas_object_evas_get(obj);
ee = ecore_evas_ecore_evas_get(canvas);
img = ecore_evas_object_image_new(ee);
finish:
ecore_evas_manual_render(sub_ee);
- snprintf(dstpath, sizeof(dstpath), TMP_DIR "/%d_%d.png", _getpid(),
- screenshotIndex);
-
- if (evas_object_image_save(img, dstpath, NULL, "compress=5") != 0) {
- strncpy(screenshot_path, dstpath, MAX_PATH_LENGTH);
- } else {
+ if (!evas_object_image_save(img, screenshot_path, NULL, "compress=5")) {
ui_viewer_log("ERROR: capture_object : can't save image\n");
ret = -1;
}
return ret;
}
-int ui_viewer_capture_screen(char *screenshot_path, Evas_Object *obj)
+int ui_viewer_capture_screen(const char *screenshot_path, Evas_Object *obj)
{
int view_w, view_h;
int obj_x, obj_y, obj_w, obj_h;
Evas *evas;
char type_name[MAX_PATH_LENGTH];
- if (!screenshot_path) {
- ui_viewer_log("ui_viewer_capture_screen: no screenshot path\n");
- ret = -1;
- return ret;
- }
-
pthread_mutex_lock(&captureScreenLock);
evas = evas_object_evas_get(obj);
type_name);
}
- if (ret)
- screenshot_path[0] = '\0';
-
pthread_mutex_unlock(&captureScreenLock);
return ret;
}