[Tizen] Implement partial update
[platform/core/uifw/dali-core.git] / dali / internal / render / common / render-list.h
old mode 100644 (file)
new mode 100755 (executable)
index 4f509c6..90925eb
@@ -1,8 +1,8 @@
-#ifndef __DALI_INTERNAL_SCENE_GRAPH_RENDER_LIST_H__
-#define __DALI_INTERNAL_SCENE_GRAPH_RENDER_LIST_H__
+#ifndef DALI_INTERNAL_SCENE_GRAPH_RENDER_LIST_H
+#define DALI_INTERNAL_SCENE_GRAPH_RENDER_LIST_H
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,6 +18,9 @@
  *
  */
 
+// EXTERNAL INCLUDES
+#include <cstdint>
+
 // INTERNAL INCLUDES
 #include <dali/public-api/math/rect.h>
 #include <dali/devel-api/common/owner-container.h>
@@ -47,41 +50,21 @@ struct RenderList;
 typedef OwnerContainer< RenderList* > RenderListContainer;
 
 /**
- * The RenderList structure provides the renderer with a list of renderers and
- * a set of flags to tell it what depth buffering is required.
+ * The RenderList structure provides the renderer with a list of renderers.
  */
 struct RenderList
 {
 public:
 
   /**
-   * The RenderFlags describe how the objects are rendered using the depth and stencil buffer.
-   *
-   * The flags which relate to GL_DEPTH_TEST and GL_STENCIL_TEST are called
-   * DEPTH_BUFFER_ENABLED and STENCIL_BUFFER_ENABLED to avoid any confusion.
-   * E.g. if GL_DEPTH_TEST is not enabled you can't write to the depth buffer, which can cause confusion.
-   *
-   */
-  enum RenderFlags
-  {
-    DEPTH_BUFFER_ENABLED   = 1 << 0, ///< If depth buffer should be used for writing / test operations
-    DEPTH_WRITE            = 1 << 1, ///< If the depth buffer is writable
-    DEPTH_CLEAR            = 1 << 2, ///< If the depth buffer should first be cleared
-    STENCIL_BUFFER_ENABLED = 1 << 3, ///< If stencil buffer should be used for writing / test operation
-    STENCIL_WRITE          = 1 << 4, ///< If the stencil buffer is writable
-    STENCIL_CLEAR          = 1 << 5, ///< If the stencil buffer should first be cleared
-
-  };
-
-  /**
    * Constructor
    */
   RenderList()
   : mNextFree( 0 ),
-    mRenderFlags( 0u ),
     mClippingBox( NULL ),
     mSourceLayer( NULL ),
-    mHasColorRenderItems( false )
+    mHasColorRenderItems( false ),
+    mPartialUpdateEnabled( false )
   {
   }
 
@@ -90,44 +73,17 @@ public:
    */
   ~RenderList()
   {
-    // pointer container deletes the render items
+    // Pointer container deletes the render items
     delete mClippingBox;
   }
 
   /**
-   * Clear the render flags
-   */
-  void ClearFlags()
-  {
-    mRenderFlags = 0u;
-  }
-
-  /**
-   * Set particular render flags
-   * @param[in] flags The set of flags to bitwise or with existing flags
-   */
-  void SetFlags( unsigned int flags )
-  {
-    mRenderFlags |= flags;
-  }
-
-  /**
-   * Retrieve the render flags.
-   * @return the render flags.
-   */
-  unsigned int GetFlags() const
-  {
-    return mRenderFlags;
-  }
-
-  /**
    * Reset the render list for next frame
    */
   void Reset()
   {
-    // we dont want to delete and re-create the render items every frame
+    // We don't want to delete and re-create the render items every frame
     mNextFree = 0;
-    mRenderFlags = 0u;
 
     delete mClippingBox;
     mClippingBox = NULL;
@@ -170,7 +126,7 @@ public:
   /**
    * Get item at a given position in the list
    */
-  RenderItem& GetItem( RenderItemContainer::SizeType index ) const
+  RenderItem& GetItem( uint32_t index ) const
   {
     DALI_ASSERT_DEBUG( index < GetCachedItemCount() );
     return *mItems[ index ];
@@ -179,7 +135,7 @@ public:
   /**
    * Get renderer from an item in the list
    */
-  const Render::Renderer& GetRenderer( RenderItemContainer::SizeType index ) const
+  const Render::Renderer& GetRenderer( uint32_t index ) const
   {
     DALI_ASSERT_DEBUG( index < GetCachedItemCount() );
     return *mItems[ index ]->mRenderer;
@@ -190,7 +146,7 @@ public:
    * Because of caching, the actual size may be bit more
    * @return The number of items
    */
-  RenderItemContainer::SizeType Count() const
+  uint32_t Count() const
   {
     return mNextFree;
   }
@@ -198,9 +154,9 @@ public:
   /**
    * @return the number of items cached by the list
    */
-  RenderItemContainer::SizeType GetCachedItemCount() const
+  uint32_t GetCachedItemCount() const
   {
-    return mItems.Count();
+    return static_cast<uint32_t>( mItems.Count() );
   }
 
   /**
@@ -208,7 +164,7 @@ public:
    */
   void ReuseCachedItems()
   {
-    mNextFree = mItems.Count();
+    mNextFree = static_cast<uint32_t>( mItems.Count() );
   }
 
   /**
@@ -216,7 +172,7 @@ public:
    */
   bool IsEmpty() const
   {
-    return (mNextFree == 0);
+    return ( mNextFree == 0 );
   }
 
   /**
@@ -228,9 +184,8 @@ public:
   {
     if( clipping )
     {
-      ClippingBox* newBox = new ClippingBox( box );
       delete mClippingBox;
-      mClippingBox = newBox;
+      mClippingBox = new ClippingBox( box );;
     }
   }
 
@@ -239,7 +194,7 @@ public:
    */
   bool IsClipping() const
   {
-    return (NULL != mClippingBox);
+    return ( NULL != mClippingBox );
   }
 
   /**
@@ -273,13 +228,13 @@ public:
   /**
    * @return the source layer these renderitems originate from
    */
-  Layer* GetSourceLayer()
+  Layer* GetSourceLayer() const
   {
     return mSourceLayer;
   }
 
   /**
-   * @param layer these renderitems originate from
+   * @param layer The layer these RenderItems originate from
    */
   void SetSourceLayer( Layer* layer )
   {
@@ -304,6 +259,24 @@ public:
     return mHasColorRenderItems;
   }
 
+  /**
+   * Enable/Disable Partial update dirty flag
+   * @param[in] true to mark dirty else false
+   */
+  void SetPartialUpdateEnabled( bool value )
+  {
+    mPartialUpdateEnabled = value;
+  }
+
+  /**
+   * Get Partial update dirty flag
+   * @return true if dirty else false
+   */
+  bool IsPartialUpdateEnabled() const
+  {
+    return mPartialUpdateEnabled;
+  }
+
 private:
 
   /*
@@ -313,19 +286,20 @@ private:
   const RenderList& operator=( const RenderList& rhs );
 
   RenderItemContainer mItems; ///< Each item is a renderer and matrix pair
-  RenderItemContainer::SizeType mNextFree;              ///< index for the next free item to use
-
-  unsigned int mRenderFlags;    ///< The render flags
+  uint32_t mNextFree;         ///< index for the next free item to use
 
   ClippingBox* mClippingBox;               ///< The clipping box, in window coordinates, when clipping is enabled
   Layer*       mSourceLayer;              ///< The originating layer where the renderers are from
   bool         mHasColorRenderItems : 1;  ///< True if list contains color render items
+  bool         mPartialUpdateEnabled : 1; //< True if partial update is needed.
+
 };
 
+
 } // namespace SceneGraph
 
 } // namespace Internal
 
 } // namespace Dali
 
-#endif // __DALI_INTERNAL_SCENE_GRAPH_RENDER_LIST_H__
+#endif // DALI_INTERNAL_SCENE_GRAPH_RENDER_LIST_H