X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fvisual-base-data-impl.h;h=e631f4322078d386024bb3ea6abaafbe46936319;hp=c4877b48f7f50bf6ff8670a1f90cc370dccc19af;hb=abf5d9bb2bc8c3db867355573bdf8c27389dcf23;hpb=f4c1e7f52d49c3ce033b9ee4c3c7414b06a22d45 diff --git a/dali-toolkit/internal/visuals/visual-base-data-impl.h b/dali-toolkit/internal/visuals/visual-base-data-impl.h index c4877b4..64ab52f 100644 --- a/dali-toolkit/internal/visuals/visual-base-data-impl.h +++ b/dali-toolkit/internal/visuals/visual-base-data-impl.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_VISUAL_BASE_DATA_IMPL_H /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2021 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. @@ -23,52 +23,123 @@ #include // INTERNAL INCLUDES +#include #include +#include +#include +#include namespace Dali { - namespace Toolkit { - namespace Internal { - namespace Visual { - struct Base::Impl { + /** + * Constructor + * @param [in] fittingMode that the derived class prefers + * @param [in] type The type of the this visual + */ + Impl(FittingMode fittingMode, Toolkit::Visual::Type type); + + /** + * Destructor + */ + ~Impl(); + enum Flags { - IS_ON_STAGE = 1, - IS_FROM_CACHE = 1 << 1, - IS_ATLASING_APPLIED = 1<<2, - IS_PREMULTIPLIED_ALPHA = 1 << 3, - IS_SYNCHRONOUS_RESOURCE_LOADING = 1 << 4 + IS_ON_SCENE = 1, + IS_ATLASING_APPLIED = 1 << 1, + IS_PREMULTIPLIED_ALPHA = 1 << 2, + IS_SYNCHRONOUS_RESOURCE_LOADING = 1 << 3 }; struct CustomShader { - std::string mVertexShader; - std::string mFragmentShader; - Dali::ImageDimensions mGridSize; - Dali::Shader::Hint::Value mHints; //(bitfield) values from enum Shader::Hint + CustomShader(const Property::Map& map); + void SetPropertyMap(const Property::Map& map); + void CreatePropertyMap(Property::Map& map) const; - CustomShader( const Property::Map& map ); - void SetPropertyMap( const Property::Map& map ); - void CreatePropertyMap( Property::Map& map ) const; + std::string mVertexShader; + std::string mFragmentShader; + Dali::ImageDimensions mGridSize; + Dali::Shader::Hint::Value mHints; //(bitfield) values from enum Shader::Hint }; - Renderer mRenderer; - CustomShader* mCustomShader; - std::string mName; - Vector2 mSize; - float mDepthIndex; - int mFlags; + struct Transform + { + /** + * Default constructor ensures the visual fills the control + */ + Transform(); + + /** + * Use the property map to set zero or more of the transform + * attributes, and sets the remaining attributes to their default + * values. + */ + void SetPropertyMap(const Property::Map& map); + + /** + * Add the transform attributes to the map (using integer keys) + */ + void GetPropertyMap(Property::Map& map) const; + + /** + * Update zero or more attributes from the property map. + */ + void UpdatePropertyMap(const Property::Map& map); + + /** + * Register or set the uniform properties onto the renderer + */ + void RegisterUniforms(Renderer renderer, Toolkit::Direction::Type direction); + + /** + * Convert the control size and the transform attributes into the actual + * size of the visual. + */ + Vector2 GetVisualSize(const Vector2& controlSize); + + Vector2 mOffset; + Vector2 mSize; + Vector2 mExtraSize; + Vector4 mOffsetSizeMode; + Toolkit::Align::Type mOrigin; + Toolkit::Align::Type mAnchorPoint; + Property::Index mOffsetIndex; + Property::Index mSizeIndex; + }; - Impl(); - ~Impl(); + Renderer mRenderer; + CustomShader* mCustomShader; + EventObserver* mEventObserver; ///< Allows controls to observe when the visual has events to notify + std::string mName; + Transform mTransform; + Vector4 mMixColor; + Size mControlSize; + float mBorderlineWidth; + Vector4 mBorderlineColor; + float mBorderlineOffset; + Vector4 mCornerRadius; + float mCornerRadiusPolicy; + int mDepthIndex; + Property::Index mMixColorIndex; + Property::Index mBorderlineWidthIndex; + Property::Index mBorderlineColorIndex; + Property::Index mBorderlineOffsetIndex; + Property::Index mCornerRadiusIndex; + FittingMode mFittingMode; ///< How the contents should fit the view + int mFlags; + Toolkit::Visual::ResourceStatus mResourceStatus; + const Toolkit::Visual::Type mType; + bool mAlwaysUsingBorderline : 1; ///< Whether we need the borderline in shader always. + bool mAlwaysUsingCornerRadius : 1; ///< Whether we need the corner radius in shader always. }; } // namespace Visual