X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=blobdiff_plain;f=dali-toolkit%2Finternal%2Fvisuals%2Fimage%2Fimage-visual.cpp;h=dcc35908986b00c66417720fe93ae6775e5c548b;hp=723afb6e818443b938bddfb40624fa94d66958ca;hb=25b212f44160ea19465962203f604cdbc6623871;hpb=533d8c2ec94a43bbe098b556bb905cbe10f427ab diff --git a/dali-toolkit/internal/visuals/image/image-visual.cpp b/dali-toolkit/internal/visuals/image/image-visual.cpp index 723afb6..dcc3590 100644 --- a/dali-toolkit/internal/visuals/image/image-visual.cpp +++ b/dali-toolkit/internal/visuals/image/image-visual.cpp @@ -201,11 +201,6 @@ Geometry CreateGeometry( VisualFactoryCache& factoryCache, ImageDimensions gridS } // unnamed namespace -ImageVisualPtr ImageVisual::New( VisualFactoryCache& factoryCache ) -{ - return new ImageVisual( factoryCache ); -} - ImageVisualPtr ImageVisual::New( VisualFactoryCache& factoryCache, const std::string& imageUrl, ImageDimensions size, @@ -220,21 +215,6 @@ ImageVisualPtr ImageVisual::New( VisualFactoryCache& factoryCache, const Image& return new ImageVisual( factoryCache, image ); } -ImageVisual::ImageVisual( VisualFactoryCache& factoryCache ) -: Visual::Base( factoryCache ), - mImage(), - mPixels(), - mPixelArea( FULL_TEXTURE_RECT ), - mPlacementActor(), - mImageUrl(), - mDesiredSize(), - mFittingMode( FittingMode::DEFAULT ), - mSamplingMode( SamplingMode::DEFAULT ), - mWrapModeU( WrapMode::DEFAULT ), - mWrapModeV( WrapMode::DEFAULT ) -{ -} - ImageVisual::ImageVisual( VisualFactoryCache& factoryCache, const std::string& imageUrl, ImageDimensions size, @@ -275,70 +255,61 @@ ImageVisual::~ImageVisual() void ImageVisual::DoSetProperties( const Property::Map& propertyMap ) { - Property::Value* imageURLValue = propertyMap.Find( Toolkit::ImageVisual::Property::URL, IMAGE_URL_NAME ); - if( imageURLValue ) + // Url is already received in constructor + Property::Value* fittingValue = propertyMap.Find( Toolkit::ImageVisual::Property::FITTING_MODE, IMAGE_FITTING_MODE ); + if( fittingValue ) { - imageURLValue->Get( mImageUrl ); - if( !mImageUrl.empty() ) - { - mImage.Reset(); - } - - Property::Value* fittingValue = propertyMap.Find( Toolkit::ImageVisual::Property::FITTING_MODE, IMAGE_FITTING_MODE ); - if( fittingValue ) - { - int value; - Scripting::GetEnumerationProperty( *fittingValue, FITTING_MODE_TABLE, FITTING_MODE_TABLE_COUNT, value ); - mFittingMode = Dali::FittingMode::Type( value ); - } - - Property::Value* samplingValue = propertyMap.Find( Toolkit::ImageVisual::Property::SAMPLING_MODE, IMAGE_SAMPLING_MODE ); - if( samplingValue ) - { - int value; - Scripting::GetEnumerationProperty( *samplingValue, SAMPLING_MODE_TABLE, SAMPLING_MODE_TABLE_COUNT, value ); - mSamplingMode = Dali::SamplingMode::Type( value ); - } + int value; + Scripting::GetEnumerationProperty( *fittingValue, FITTING_MODE_TABLE, FITTING_MODE_TABLE_COUNT, value ); + mFittingMode = Dali::FittingMode::Type( value ); + } - int desiredWidth = 0; - Property::Value* desiredWidthValue = propertyMap.Find( Toolkit::ImageVisual::Property::DESIRED_WIDTH, IMAGE_DESIRED_WIDTH ); - if( desiredWidthValue ) - { - desiredWidthValue->Get( desiredWidth ); - } + Property::Value* samplingValue = propertyMap.Find( Toolkit::ImageVisual::Property::SAMPLING_MODE, IMAGE_SAMPLING_MODE ); + if( samplingValue ) + { + int value; + Scripting::GetEnumerationProperty( *samplingValue, SAMPLING_MODE_TABLE, SAMPLING_MODE_TABLE_COUNT, value ); + mSamplingMode = Dali::SamplingMode::Type( value ); + } - int desiredHeight = 0; - Property::Value* desiredHeightValue = propertyMap.Find( Toolkit::ImageVisual::Property::DESIRED_HEIGHT, IMAGE_DESIRED_HEIGHT ); - if( desiredHeightValue ) - { - desiredHeightValue->Get( desiredHeight ); - } + int desiredWidth = 0; + Property::Value* desiredWidthValue = propertyMap.Find( Toolkit::ImageVisual::Property::DESIRED_WIDTH, IMAGE_DESIRED_WIDTH ); + if( desiredWidthValue ) + { + desiredWidthValue->Get( desiredWidth ); + } - Property::Value* pixelAreaValue = propertyMap.Find( Toolkit::ImageVisual::Property::PIXEL_AREA, PIXEL_AREA_UNIFORM_NAME ); - if( pixelAreaValue ) - { - pixelAreaValue->Get( mPixelArea ); - } + int desiredHeight = 0; + Property::Value* desiredHeightValue = propertyMap.Find( Toolkit::ImageVisual::Property::DESIRED_HEIGHT, IMAGE_DESIRED_HEIGHT ); + if( desiredHeightValue ) + { + desiredHeightValue->Get( desiredHeight ); + } - Property::Value* wrapModeValueU = propertyMap.Find( Toolkit::ImageVisual::Property::WRAP_MODE_U, IMAGE_WRAP_MODE_U ); - if( wrapModeValueU ) - { - int value; - Scripting::GetEnumerationProperty( *wrapModeValueU, WRAP_MODE_TABLE, WRAP_MODE_TABLE_COUNT, value ); - mWrapModeU = Dali::WrapMode::Type( value ); - } + Property::Value* pixelAreaValue = propertyMap.Find( Toolkit::ImageVisual::Property::PIXEL_AREA, PIXEL_AREA_UNIFORM_NAME ); + if( pixelAreaValue ) + { + pixelAreaValue->Get( mPixelArea ); + } - Property::Value* wrapModeValueV = propertyMap.Find( Toolkit::ImageVisual::Property::WRAP_MODE_V, IMAGE_WRAP_MODE_V ); - if( wrapModeValueV ) - { - int value; - Scripting::GetEnumerationProperty( *wrapModeValueV, WRAP_MODE_TABLE, WRAP_MODE_TABLE_COUNT, value ); - mWrapModeV = Dali::WrapMode::Type( value ); - } + Property::Value* wrapModeValueU = propertyMap.Find( Toolkit::ImageVisual::Property::WRAP_MODE_U, IMAGE_WRAP_MODE_U ); + if( wrapModeValueU ) + { + int value; + Scripting::GetEnumerationProperty( *wrapModeValueU, WRAP_MODE_TABLE, WRAP_MODE_TABLE_COUNT, value ); + mWrapModeU = Dali::WrapMode::Type( value ); + } - mDesiredSize = ImageDimensions( desiredWidth, desiredHeight ); + Property::Value* wrapModeValueV = propertyMap.Find( Toolkit::ImageVisual::Property::WRAP_MODE_V, IMAGE_WRAP_MODE_V ); + if( wrapModeValueV ) + { + int value; + Scripting::GetEnumerationProperty( *wrapModeValueV, WRAP_MODE_TABLE, WRAP_MODE_TABLE_COUNT, value ); + mWrapModeV = Dali::WrapMode::Type( value ); } + mDesiredSize = ImageDimensions( desiredWidth, desiredHeight ); + Property::Value* syncLoading = propertyMap.Find( Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING, SYNCHRONOUS_LOADING ); if( syncLoading ) { @@ -349,7 +320,7 @@ void ImageVisual::DoSetProperties( const Property::Map& propertyMap ) mImpl->mFlags |= Impl::IS_SYNCHRONOUS_RESOURCE_LOADING; // if sync loading is required, the loading should start immediately when new image url is set or the actor is off stage // ( for on-stage actor with image url unchanged, resource loading is already finished) - if( imageURLValue ) + if( mImageUrl.size() > 0u ) { LoadResourceSynchronously(); }