Fix a wrong implementation 89/121289/3
authorHwankyu Jhun <h.jhun@samsung.com>
Mon, 27 Mar 2017 11:59:56 +0000 (20:59 +0900)
committerHwankyu Jhun <h.jhun@samsung.com>
Mon, 27 Mar 2017 12:25:12 +0000 (21:25 +0900)
The watch_manager_get_opr API should uses the watch image object.

Change-Id: Ia5991883413ad7786b08697755ca7823c0eef2f9
Signed-off-by: Hwankyu Jhun <h.jhun@samsung.com>
packaging/libwidget_viewer.spec
watch-control/CMakeLists.txt
watch-control/include/watch_control.h
watch-control/src/control.c

index 481ff7d..d45135d 100644 (file)
@@ -37,7 +37,6 @@ BuildRequires: pkgconfig(ecore-wayland)
 BuildRequires: pkgconfig(wayland-tbm-client)
 BuildRequires: pkgconfig(screen_connector_watcher)
 BuildRequires: pkgconfig(screen_connector_watcher_evas)
-BuildRequires: pkgconfig(capi-ui-efl-util)
 
 %description
 API for creating a new instance of the widget and managing its life-cycle.
index a83ccaf..83bbe71 100644 (file)
@@ -17,7 +17,6 @@ pkg_check_modules(watch-control REQUIRED
        capi-appfw-application
        aul
        screen_connector_watcher_evas
-       capi-ui-efl-util
 )
 
 SET(BUILD_SOURCE
index dd993e0..b208655 100644 (file)
@@ -45,8 +45,6 @@ extern int watch_manager_get_resource_id(Evas_Object *watch, int *resource_id);
 /**
  * @brief Gets the opr of the Evas Object
  * @since_tizen 3.0
- * @privlevel platform
- * @privilege %http://tizen.org/privilege/screenshot
  * @param[out] opr The OPR(On Pixel Ratio)
  * @return @c 0 on success, otherwise a negative error value
  */
index 1c96f06..98f6c91 100644 (file)
@@ -24,7 +24,6 @@
 #include <unistd.h>
 #include "watch_control.h"
 #include <aul.h>
-#include <efl_util.h>
 #include <Elementary.h>
 #include <system_info.h>
 
@@ -311,9 +310,9 @@ static float __get_opr(void *source_data, int width, int height)
 API int watch_manager_get_opr(float *opr)
 {
        Evas_Object *image;
-       efl_util_screenshot_h screenshot;
        tbm_surface_h surface;
        tbm_surface_info_s info = { 0, };
+       Evas_Native_Surface *ns;
        void *source_data;
        int width = 0;
        int height = 0;
@@ -338,25 +337,21 @@ API int watch_manager_get_opr(float *opr)
        evas_object_geometry_get(image, NULL, NULL, &width, &height);
        _D("width(%d), height(%d)", width, height);
 
-       screenshot = efl_util_screenshot_initialize(width, height);
-       if (screenshot == NULL) {
-               _E("Failed to initialize efl util screenshot - %d",
-                               get_last_result());
+       ns = evas_object_image_native_surface_get(image);
+       if (ns == NULL) {
+               _E("Failed to get evas native surface");
                return -1;
        }
 
-       surface = efl_util_screenshot_take_tbm_surface(screenshot);
+       surface = (tbm_surface_h)ns->data.tbm.buffer;
        if (surface == NULL) {
-               _E("Failed to take tbm surface - %d", get_last_result());
-               efl_util_screenshot_deinitialize(screenshot);
+               _E("tbm surface is NULL");
                return -1;
        }
 
        ret = tbm_surface_map(surface, TBM_SURF_OPTION_READ, &info);
        if (ret != TBM_SURFACE_ERROR_NONE) {
                _E("Failed to map tbm surface - %d", ret);
-               tbm_surface_destroy(surface);
-               efl_util_screenshot_deinitialize(screenshot);
                return -1;
        }
 
@@ -364,17 +359,12 @@ API int watch_manager_get_opr(float *opr)
        if (source_data == NULL) {
                _E("Failed to get source");
                tbm_surface_unmap(surface);
-               tbm_surface_destroy(surface);
-               efl_util_screenshot_deinitialize(screenshot);
                return -1;
        }
 
        *opr = __get_opr(source_data, width, height);
        _D("On Pixel Ratio(%f)", *opr);
-
        tbm_surface_unmap(surface);
-       tbm_surface_destroy(surface);
-       efl_util_screenshot_deinitialize(screenshot);
 
        return 0;
 }