X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Frender%2Fcommon%2Frender-item.h;h=2fe74bd1f0dc70ff1697b375a5410b74e01658b7;hb=0a51ae87a615a6b7b457d7671959c31df2bb1a6a;hp=156272c4f1e6cefe6a71ee04dbf68b33f2bcb770;hpb=b96f001e13bca1a8f1cc4e13a64b7c967265e04a;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/render/common/render-item.h b/dali/internal/render/common/render-item.h index 156272c..2fe74bd 100644 --- a/dali/internal/render/common/render-item.h +++ b/dali/internal/render/common/render-item.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_SCENE_GRAPH_RENDER_ITEM_H /* - * Copyright (c) 2016 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. @@ -19,26 +19,22 @@ */ // INTERNAL INCLUDES -#include +#include #include +#include #include -#include namespace Dali { - namespace Internal { - namespace Render { class Renderer; -class RenderGeometry; } namespace SceneGraph { - /** * A RenderItem contains all the data needed for rendering */ @@ -56,36 +52,62 @@ 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. + * As the box is Axis-Aligned (in viewport space) rotations on Z axis are correctly delt with by expanding the box as necessary. + * Rotations on X & Y axis will resize the AABB, but it will not handle the projection error due to the new coordinates having non-zero Z values. + * + * 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) + */ + static ClippingBox CalculateViewportSpaceAABB(const Matrix& modelViewMatrix, const Vector3& position, const Vector3& size, const int viewportWidth, const int viewportHeight); + + /** * Overriden delete operator. * Deletes the RenderItem from its global memory pool * @param[in] A pointer to the RenderItem to delete. */ - void operator delete( void* ptr ); + void operator delete(void* ptr); Matrix mModelMatrix; Matrix mModelViewMatrix; Vector3 mSize; + Vector4 mUpdateArea; ///< Update area hint is provided for damaged area calculation. (x, y, width, height) Render::Renderer* mRenderer; Node* mNode; - const void* mTextureSet; //< Used only for sorting - - mutable Render::Geometry* mBatchRenderGeometry; - + const void* mTextureSet; ///< Used for sorting only int mDepthIndex; - bool mIsOpaque:1; - bool mBatched:1; + bool mIsOpaque : 1; + bool mIsUpdated : 1; private: - /** * Private constructor. See RenderItem::New */ RenderItem(); // RenderItems should not be copied as they are heavy - RenderItem( const RenderItem& item ); - RenderItem& operator = ( const RenderItem& item ); - + RenderItem(const RenderItem& item); + RenderItem& operator=(const RenderItem& item); }; } // namespace SceneGraph