X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fevent%2Factors%2Fimage-actor-impl.cpp;h=5c6b0280ddc2cbf8899b60b15739f5c9681af25c;hb=1c92aff3ef39de0b3f2699b432deeb3937172f1c;hp=1e48202be6b6229ff1ca7abf598d2b694292deb5;hpb=3bcb54791a6777e77f02612a1f7916e83ef1c86f;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/event/actors/image-actor-impl.cpp b/dali/internal/event/actors/image-actor-impl.cpp index 1e48202..5c6b028 100644 --- a/dali/internal/event/actors/image-actor-impl.cpp +++ b/dali/internal/event/actors/image-actor-impl.cpp @@ -18,10 +18,14 @@ // CLASS HEADER #include +// EXTERNAL INCLUDES +#include // for strcmp + // INTERNAL INCLUDES #include -#include +#include #include +#include #include #include @@ -49,7 +53,7 @@ BaseHandle Create() return Dali::ImageActor::New(); } -TypeRegistration mType( typeid( Dali::ImageActor ), typeid( Dali::RenderableActor ), Create ); +TypeRegistration mType( typeid( Dali::ImageActor ), typeid( Dali::Actor ), Create ); ImageActor::Style StyleEnum(const std::string &s) { @@ -100,6 +104,7 @@ ImageActorPtr ImageActor::New() void ImageActor::OnInitialize() { + SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); } void ImageActor::SetImage( ImagePtr& image ) @@ -127,7 +132,8 @@ void ImageActor::SetImage( ImagePtr& image ) } // set the actual image (normal or 9 patch) and natural size based on that mImageAttachment->SetImage( newImage ); - SetNaturalSize(); + + RelayoutRequest(); } ImagePtr ImageActor::GetImage() @@ -135,18 +141,11 @@ ImagePtr ImageActor::GetImage() return mImageAttachment->GetImage(); } -void ImageActor::SetToNaturalSize() -{ - mUsingNaturalSize = true; - - SetNaturalSize(); -} - void ImageActor::SetPixelArea( const PixelArea& pixelArea ) { mImageAttachment->SetPixelArea( pixelArea ); - SetNaturalSize(); + RelayoutRequest(); } const ImageActor::PixelArea& ImageActor::GetPixelArea() const @@ -163,16 +162,7 @@ void ImageActor::ClearPixelArea() { mImageAttachment->ClearPixelArea(); - if( mUsingNaturalSize ) - { - ImagePtr image = mImageAttachment->GetImage(); - if( image ) - { - mInternalSetSize = true; - SetSize( image->GetNaturalSize() ); - mInternalSetSize = false; - } - } + RelayoutRequest(); } void ImageActor::SetStyle( Style style ) @@ -207,9 +197,7 @@ RenderableAttachment& ImageActor::GetRenderableAttachment() const } ImageActor::ImageActor() -: RenderableActor(), - mUsingNaturalSize(true), - mInternalSetSize(false) +: Actor( Actor::RENDERABLE ) { } @@ -217,16 +205,6 @@ ImageActor::~ImageActor() { } -void ImageActor::SetNaturalSize() -{ - if( mUsingNaturalSize ) - { - mInternalSetSize = true; - SetSize( CalculateNaturalSize() ); - mInternalSetSize = false; - } -} - Vector3 ImageActor::GetNaturalSize() const { Vector2 naturalSize( CalculateNaturalSize() ); @@ -256,19 +234,6 @@ Vector2 ImageActor::CalculateNaturalSize() const return size; } -void ImageActor::OnSizeSet( const Vector3& targetSize ) -{ - if( !mInternalSetSize ) - { - mUsingNaturalSize = false; - } -} - -void ImageActor::OnSizeAnimation(Animation& animation, const Vector3& targetSize) -{ - mUsingNaturalSize = false; -} - void ImageActor::OnStageConnectionInternal() { } @@ -279,19 +244,19 @@ void ImageActor::OnStageDisconnectionInternal() unsigned int ImageActor::GetDefaultPropertyCount() const { - return RenderableActor::GetDefaultPropertyCount() + DEFAULT_PROPERTY_COUNT; + return Actor::GetDefaultPropertyCount() + DEFAULT_PROPERTY_COUNT; } void ImageActor::GetDefaultPropertyIndices( Property::IndexContainer& indices ) const { - RenderableActor::GetDefaultPropertyIndices( indices ); // RenderableActor class properties + Actor::GetDefaultPropertyIndices( indices ); // Actor class properties - indices.reserve( indices.size() + DEFAULT_PROPERTY_COUNT ); + indices.Reserve( indices.Size() + DEFAULT_PROPERTY_COUNT ); int index = DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX; for ( int i = 0; i < DEFAULT_PROPERTY_COUNT; ++i, ++index ) { - indices.push_back( index ); + indices.PushBack( index ); } } @@ -299,7 +264,7 @@ bool ImageActor::IsDefaultPropertyWritable( Property::Index index ) const { if( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT ) { - return RenderableActor::IsDefaultPropertyWritable(index); + return Actor::IsDefaultPropertyWritable(index); } index -= DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX; @@ -315,7 +280,7 @@ bool ImageActor::IsDefaultPropertyAnimatable( Property::Index index ) const { if( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT ) { - return RenderableActor::IsDefaultPropertyAnimatable( index ); + return Actor::IsDefaultPropertyAnimatable( index ); } index -= DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX; @@ -331,7 +296,7 @@ bool ImageActor::IsDefaultPropertyAConstraintInput( Property::Index index ) cons { if( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT ) { - return RenderableActor::IsDefaultPropertyAConstraintInput( index ); + return Actor::IsDefaultPropertyAConstraintInput( index ); } index -= DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX; @@ -347,7 +312,7 @@ Property::Type ImageActor::GetDefaultPropertyType( Property::Index index ) const { if( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT ) { - return RenderableActor::GetDefaultPropertyType( index ); + return Actor::GetDefaultPropertyType( index ); } index -= DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX; @@ -364,7 +329,7 @@ const char* ImageActor::GetDefaultPropertyName( Property::Index index ) const { if( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT) { - return RenderableActor::GetDefaultPropertyName(index); + return Actor::GetDefaultPropertyName(index); } index -= DEFAULT_DERIVED_ACTOR_PROPERTY_START_INDEX; @@ -395,7 +360,7 @@ Property::Index ImageActor::GetDefaultPropertyIndex(const std::string& name) con // If not found, check in base class if( Property::INVALID_INDEX == index ) { - index = RenderableActor::GetDefaultPropertyIndex( name ); + index = Actor::GetDefaultPropertyIndex( name ); } return index; } @@ -404,7 +369,7 @@ void ImageActor::SetDefaultProperty( Property::Index index, const Property::Valu { if( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT ) { - RenderableActor::SetDefaultProperty( index, propertyValue ); + Actor::SetDefaultProperty( index, propertyValue ); } else { @@ -454,7 +419,7 @@ Property::Value ImageActor::GetDefaultProperty( Property::Index index ) const Property::Value ret; if( index < DEFAULT_ACTOR_PROPERTY_MAX_COUNT ) { - ret = RenderableActor::GetDefaultProperty( index ); + ret = Actor::GetDefaultProperty( index ); } else { @@ -494,6 +459,115 @@ Property::Value ImageActor::GetDefaultProperty( Property::Index index ) const return ret; } + +void ImageActor::SetSortModifier(float modifier) +{ + mImageAttachment->SetSortModifier( modifier ); +} + +float ImageActor::GetSortModifier() const +{ + return mImageAttachment->GetSortModifier(); +} + +void ImageActor::SetDepthIndex( int depthIndex ) +{ + mImageAttachment->SetSortModifier( depthIndex ); +} + +int ImageActor::GetDepthIndex() const +{ + return static_cast< int >( mImageAttachment->GetSortModifier() ); +} + +void ImageActor::SetCullFace(CullFaceMode mode) +{ + mImageAttachment->SetCullFace( mode ); +} + +CullFaceMode ImageActor::GetCullFace() const +{ + return mImageAttachment->GetCullFace(); +} + +void ImageActor::SetBlendMode( BlendingMode::Type mode ) +{ + mImageAttachment->SetBlendMode( mode ); +} + +BlendingMode::Type ImageActor::GetBlendMode() const +{ + return mImageAttachment->GetBlendMode(); +} + +void ImageActor::SetBlendFunc( BlendingFactor::Type srcFactorRgba, BlendingFactor::Type destFactorRgba ) +{ + mImageAttachment->SetBlendFunc( srcFactorRgba, destFactorRgba, srcFactorRgba, destFactorRgba ); +} + +void ImageActor::SetBlendFunc( BlendingFactor::Type srcFactorRgb, BlendingFactor::Type destFactorRgb, + BlendingFactor::Type srcFactorAlpha, BlendingFactor::Type destFactorAlpha ) +{ + mImageAttachment->SetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha ); +} + +void ImageActor::GetBlendFunc( BlendingFactor::Type& srcFactorRgb, BlendingFactor::Type& destFactorRgb, + BlendingFactor::Type& srcFactorAlpha, BlendingFactor::Type& destFactorAlpha ) const +{ + mImageAttachment->GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha ); +} + +void ImageActor::SetBlendEquation( BlendingEquation::Type equationRgba ) +{ + mImageAttachment->SetBlendEquation( equationRgba, equationRgba ); +} + +void ImageActor::SetBlendEquation( BlendingEquation::Type equationRgb, BlendingEquation::Type equationAlpha ) +{ + mImageAttachment->SetBlendEquation( equationRgb, equationAlpha ); +} + +void ImageActor::GetBlendEquation( BlendingEquation::Type& equationRgb, BlendingEquation::Type& equationAlpha ) const +{ + mImageAttachment->GetBlendEquation( equationRgb, equationAlpha ); +} + +void ImageActor::SetBlendColor( const Vector4& color ) +{ + mImageAttachment->SetBlendColor( color ); +} + +const Vector4& ImageActor::GetBlendColor() const +{ + return mImageAttachment->GetBlendColor(); +} + +void ImageActor::SetFilterMode( FilterMode::Type minFilter, FilterMode::Type magFilter ) +{ + mImageAttachment->SetFilterMode( minFilter, magFilter ); +} + +void ImageActor::GetFilterMode( FilterMode::Type& minFilter, FilterMode::Type& magFilter ) const +{ + return mImageAttachment->GetFilterMode( minFilter, magFilter ); +} + +void ImageActor::SetShaderEffect(ShaderEffect& effect) +{ + mImageAttachment->SetShaderEffect( effect ); +} + +ShaderEffectPtr ImageActor::GetShaderEffect() const +{ + return mImageAttachment->GetShaderEffect(); +} + +void ImageActor::RemoveShaderEffect() +{ + return mImageAttachment->RemoveShaderEffect(); +} + + } // namespace Internal } // namespace Dali