Add simple idler for setting start point of updating Box/Pd buffer
authorYunchan Cho <yunchan.cho@samsung.com>
Mon, 27 May 2013 05:16:58 +0000 (14:16 +0900)
committerYunchan Cho <yunchan.cho@samsung.com>
Wed, 29 May 2013 06:27:36 +0000 (15:27 +0900)
[Issue#] N/A
[Problem] webkit sometimes tries to flush invalid buffer before starting rendering content
          So one or two invalid render frames are  displayed on Homescreen
[Cause] webkit didn't clear the buffer of webview at the initial time.
[Solution] web-provider delay updating of Box/Pd Gem buffer using internal idler (temporary solution)
           When specific event for notice of preparing valid rendering data of webkit is provided by webkit team, this idler will be removed.
           And when the webkit event is fired, web-provider starts updating of GEM buffer.

Change-Id: I9a3ac0625f534a3a2e45bdab2c75692ac1f7c59f

src/Core/Box.cpp
src/Core/Box.h
src/Core/Buffer/RenderBuffer.cpp
src/Core/Buffer/RenderBuffer.h

index e20c7d6..d4729be 100644 (file)
  * @author  Yunchan Cho (yunchan.cho@samsung.com)
  */
 #include <string>
+#include <Ecore.h>
 #include <Plugin/IBoxPluginFactory.h>
 #include "Buffer/IRenderBuffer.h"
+#include "Buffer/RenderBuffer.h"
 #include "Buffer/RenderBufferFactory.h"
 #include "Util/Log.h"
 #include "BoxData.h"
@@ -83,9 +85,10 @@ bool Box::show()
 
     try {
         m_updateTimer->start();
-        m_boxBuffer->startCanvasUpdate();
         RenderInfoPtr renderInfo = makeRenderInfo(renderTypeCreate);
+        m_boxBuffer->stopCanvasUpdate();
         m_view->showBox(renderInfo);
+        ecore_idler_add(startUpdateRenderBufferIdlerCallback, m_boxBuffer.get());
     } catch (...) {
         return false;
     }
@@ -197,7 +200,9 @@ bool Box::openPd(int width, int height, double x, double y)
                             m_boxInfo->pdHeight);
         m_pdBuffer->allocate();
         RenderInfoPtr renderInfo = makeRenderInfo(renderTypeOpenPd);
+        m_pdBuffer->stopCanvasUpdate();
         m_view->showPd(m_pdBuffer->getWindow(), renderInfo);
+        ecore_idler_add(startUpdateRenderBufferIdlerCallback, m_pdBuffer.get());
     } catch (...) {
         return false;
     }
@@ -316,3 +321,15 @@ Eina_Bool Box::updateCallback(void* data)
     return ECORE_CALLBACK_RENEW;
 }
 
+Eina_Bool Box::startUpdateRenderBufferIdlerCallback(void* data)
+{
+    LogD("enter");
+    RenderBuffer* buffer = static_cast<RenderBuffer*>(data);
+    if (!buffer) {
+        LogD("no buffer");
+    } else {
+        buffer->startCanvasUpdate();
+    }
+
+    return ECORE_CALLBACK_CANCEL;
+}
index 42596d4..fff3f49 100644 (file)
@@ -62,6 +62,7 @@ class Box: public IBox, public IBoxContext {
 
         // static callbacks
         static Eina_Bool updateCallback(void* data);
+        static Eina_Bool startUpdateRenderBufferIdlerCallback(void* data);
 
         // constructor
         explicit Box(
index 9bae32a..6013fac 100644 (file)
@@ -74,6 +74,7 @@ bool RenderBuffer::allocate()
     LogD("Using %s engine!", ecore_evas_engine_name_get(ee));
 
     Evas* e = ecore_evas_get(ee);
+    evas_image_cache_flush(e);
     Evas_Object *eo = evas_object_rectangle_add(e);
     evas_object_size_hint_weight_set(eo, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
     evas_object_color_set(eo, 0, 0, 0, 0);
@@ -215,10 +216,9 @@ void RenderBuffer::paintColor(unsigned int color)
         provider_buffer_sync(m_bufferInfo);
         updateBuffer();
     } else {
-        provider_buffer_pre_render(m_bufferInfo);
+        preRenderCallback(this, m_canvas, NULL);
         memset(m_bufferAddr, color, getWidth() * getHeight() * 4);
-        provider_buffer_post_render(m_bufferInfo);
-        updateBuffer();
+        postRenderCallback(this, m_canvas, NULL);
     }
 }
 
index a3397b8..b275e70 100644 (file)
@@ -40,6 +40,8 @@ class EXPORT_CLASS RenderBuffer: public IRenderBuffer {
         bool reallocate(int width, int height);
         bool free();  
         Evas_Object* getWindow();
+        void startCanvasUpdate();
+        void stopCanvasUpdate();
 
         static void preRenderCallback(void* data, Evas* canvas, void* eventInfo);
         static void postRenderCallback(void* data, Evas* canvas, void* eventInfo);
@@ -47,8 +49,6 @@ class EXPORT_CLASS RenderBuffer: public IRenderBuffer {
         virtual ~RenderBuffer();
 
     protected:
-        void startCanvasUpdate();
-        void stopCanvasUpdate();
         void paintColor(unsigned int color);
         Evas* getCanvas();
         Evas_Object* getSnapshot();