From: Hwankyu Jhun Date: Fri, 28 Jul 2017 06:24:30 +0000 (+0900) Subject: Reduce system info db access X-Git-Tag: submit/tizen_3.0/20170731.092605^0 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f01cfc215f36d5b7aacae605b7218c23f7662038;p=platform%2Fcore%2Fappfw%2Fwidget-viewer.git Reduce system info db access Change-Id: I5a3f889cca98c47abca16b720070216ad79679f5 Signed-off-by: Hwankyu Jhun --- diff --git a/watch-control/src/control.c b/watch-control/src/control.c index b7da2c54..0746e3b4 100644 --- a/watch-control/src/control.c +++ b/watch-control/src/control.c @@ -375,6 +375,26 @@ API int watch_policy_set_size_hint(watch_policy_size_hint hint) return 0; } +static bool __is_circle(void) +{ + static bool initialized = false; + static bool shape_circle = false; + int r; + + if (initialized) + return shape_circle; + + r = system_info_get_platform_bool(KEY_SCREEN_SHAPE_CIRCLE, + &shape_circle); + if (r != SYSTEM_INFO_ERROR_NONE) { + _E("Failed to get system info"); + return false; + } + + initialized = true; + return shape_circle; +} + static float __get_opr(void *source_data, int width, int height) { int *source; @@ -390,9 +410,7 @@ static float __get_opr(void *source_data, int width, int height) unsigned int pixel_sum; float opr; float max_opr; - bool shape_circle = false; - - system_info_get_platform_bool(KEY_SCREEN_SHAPE_CIRCLE, &shape_circle); + bool shape_circle = __is_circle(); source = source_data; pos = width / 2;