Merge "Added memory pool logging" into devel/master
[platform/core/uifw/dali-core.git] / dali / internal / render / common / render-item.h
index c601267..0a82320 100644 (file)
@@ -2,7 +2,7 @@
 #define DALI_INTERNAL_SCENE_GRAPH_RENDER_ITEM_H
 
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
@@ -52,6 +52,16 @@ struct RenderItem
   ~RenderItem();
 
   /**
+   * Produce a 2D AABB in transformed space
+   * See below for caveats.
+   *
+   * @param[in]    transformMatrix   The matrix for converting to a different space
+   * @param[in]    position          The center position of the render item
+   * @param[in]    size              The size of the render item
+   */
+  static ClippingBox CalculateTransformSpaceAABB(const Matrix& transformMatrix, const Vector3& position, const Vector3& size);
+
+  /**
    * @brief This method is an optimized calculation of a viewport-space AABB (Axis-Aligned-Bounding-Box).
    *
    * We use the model-view-matrix, but we do not use projection. Therefore we assume Z = 0.
@@ -60,11 +70,16 @@ struct RenderItem
    *
    * Note: We pass in the viewport dimensions rather than allow the caller to modify the raw AABB in order to optimally generate the final result.
    *
+   * Note: ASSUMES THAT THE VIEWPORT COVERS THE SCREEN AND THAT THE CANVAS SIZE AND VIEWPORT SIZE ARE THE SAME!!!!!  (Not the case for magnifier)
+   *
+   * @param[in]    modelViewMatrix   The model view matrix
+   * @param[in]    position          The center position of the render item
+   * @param[in]    size              The size of the render item
    * @param[in]    viewportWidth     The width of the viewport to calculate for
    * @param[in]    viewportHeight    The height of the viewport to calculate for
    * @return                         The AABB coordinates in viewport-space (x, y, width, height)
    */
-  ClippingBox CalculateViewportSpaceAABB(const Vector3& size, const int viewportWidth, const int viewportHeight) const;
+  static ClippingBox CalculateViewportSpaceAABB(const Matrix& modelViewMatrix, const Vector3& position, const Vector3& size, const int viewportWidth, const int viewportHeight);
 
   /**
    * Overriden delete operator.
@@ -75,16 +90,20 @@ struct RenderItem
 
   Matrix            mModelMatrix;
   Matrix            mModelViewMatrix;
-  Vector4           mColor;
   Vector3           mSize;
-  Vector3           mUpdateSize;
+  Vector4           mUpdateArea; ///< Update area hint is provided for damaged area calculation. (x, y, width, height)
   Render::Renderer* mRenderer;
   Node*             mNode;
-  const void*       mTextureSet; //< Used for sorting only
+  const void*       mTextureSet; ///< Used for sorting only
   int               mDepthIndex;
   bool              mIsOpaque : 1;
   bool              mIsUpdated : 1;
 
+  /**
+   * Get the capacity of the global pool.
+   */
+  static uint32_t GetMemoryPoolCapacity();
+
 private:
   /**
    * Private constructor. See RenderItem::New