Prevent unnecessary screen update for string substitution 55/246855/1
authorJi-hoon Lee <dalton.lee@samsung.com>
Wed, 4 Nov 2020 11:36:00 +0000 (20:36 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Wed, 4 Nov 2020 12:12:08 +0000 (21:12 +0900)
Change-Id: Ife67b8269dc5defad7b35e35067bd3fe507fd9f4

scl/sclresourcecache.cpp
scl/sclresourcecache.h
scl/sclui.cpp
scl/scluiimpl.cpp

index 91ebe95..4904ba5 100644 (file)
@@ -1803,12 +1803,16 @@ sclboolean CSCLResourceCache::get_button_geometry(const sclchar* custom_id, SclR
     return FALSE;
 }
 
-void
+sclboolean
 CSCLResourceCache::set_string_substitution(const sclchar *original, const sclchar *substitute)
 {
     if (original && substitute) {
+        if (mStringSubstitutor[std::string(original)].compare(substitute) == 0) {
+            return false;
+        }
         mStringSubstitutor[std::string(original)] = std::string(substitute);
     }
+    return true;
 }
 
 void
index 94cf125..e11bd89 100644 (file)
@@ -81,7 +81,7 @@ public:
     void enable_button(const sclchar* custom_id, sclboolean enabled);
     sclboolean get_button_geometry(const sclchar* custom_id, SclRectangle *rectangle);
 
-    void set_string_substitution(const sclchar *original, const sclchar *substitute);
+    sclboolean set_string_substitution(const sclchar *original, const sclchar *substitute);
     void unset_string_substitution(const sclchar *original);
     const sclchar* find_substituted_string(const sclchar *original);
 
index a122648..19d054f 100644 (file)
@@ -707,4 +707,4 @@ CSCLUI::get_button_geometry(const sclchar* custom_id, SclRectangle *rectangle)
         return m_impl->get_button_geometry(custom_id, rectangle);
     }
     return FALSE;
-}
\ No newline at end of file
+}
index aacd467..78772ff 100644 (file)
@@ -1143,11 +1143,12 @@ CSCLUIImpl::set_custom_magnifier_label(scltouchdevice touch_id, sclint index, co
 void
 CSCLUIImpl::set_string_substitution(const sclchar *original, const sclchar *substitute)
 {
+    CSCLWindows *windows = CSCLWindows::get_instance();
+    CSCLResourceCache *cache = CSCLResourceCache::get_instance();
+    if (!cache || !windows) return;
+
     if (m_initialized) {
-        CSCLWindows *windows = CSCLWindows::get_instance();
-        CSCLResourceCache *cache = CSCLResourceCache::get_instance();
-        if (cache && windows) {
-            cache->set_string_substitution(original, substitute);
+        if (cache->set_string_substitution(original, substitute)) {
             SclWindowContext *window_context = windows->get_window_context(windows->get_base_window());
             if (window_context) {
                 if (!(window_context->hidden)) {