Fix FrameBuffer sync issue, etc.
[platform/core/uifw/dali-core.git] / dali / internal / render / renderers / render-surface-frame-buffer.h
index 576ea65..ebe7eb5 100644 (file)
@@ -18,6 +18,7 @@
  */
 
 // INTERNAL INCLUDES
+#include <dali/internal/update/manager/update-manager.h>
 #include <dali/internal/render/renderers/render-frame-buffer.h>
 #include <dali/integration-api/render-surface.h>
 
@@ -82,6 +83,19 @@ public:
    */
   bool IsSurfaceBacked() override { return true; };
 
+  /**
+   * @brief Sets the frame buffer size.
+   * @param[in] width The width size
+   * @param[in] height The height size
+   */
+  void SetSize( uint32_t width, uint32_t height );
+
+  /**
+   * @brief Sets the background color.
+   * @param[in] color The new background color
+   */
+  void SetBackgroundColor( const Vector4& color );
+
 public:
 
   /**
@@ -117,8 +131,35 @@ private:
 
   Integration::RenderSurface* mSurface;   ///< The render surface
   Context*                    mContext;   ///< The context holding the GL state of rendering for the surface backed frame buffer
+
+  uint32_t                    mWidth;
+  uint32_t                    mHeight;
+  Vector4                     mBackgroundColor;
+  bool                        mSizeChanged;
 };
 
+// Messages for FrameBuffer
+inline void SetFrameBufferSizeMessage( SceneGraph::UpdateManager& updateManager, SurfaceFrameBuffer* surfaceFrameBuffer, uint32_t width, uint32_t height )
+{
+  typedef MessageValue2< SurfaceFrameBuffer, uint32_t, uint32_t  > LocalType;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = updateManager.ReserveMessageSlot( sizeof( LocalType ) );
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new (slot) LocalType( surfaceFrameBuffer, &SurfaceFrameBuffer::SetSize, width, height );
+}
+
+inline void SetFrameBufferBackgroundColorMessage( SceneGraph::UpdateManager& updateManager, SurfaceFrameBuffer* surfaceFrameBuffer, const Vector4& color )
+{
+  typedef MessageValue1< SurfaceFrameBuffer, Vector4 > LocalType;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = updateManager.ReserveMessageSlot( sizeof( LocalType ) );
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new (slot) LocalType( surfaceFrameBuffer, &SurfaceFrameBuffer::SetBackgroundColor, color );
+}
 
 } // namespace Render