if( gridSize == ImageDimensions( 1, 1 ) )
{
geometry = factoryCache.GetGeometry( VisualFactoryCache::QUAD_GEOMETRY );
- if( !geometry )
- {
- geometry = VisualFactoryCache::CreateQuadGeometry();
- factoryCache.SaveGeometry( VisualFactoryCache::QUAD_GEOMETRY, geometry );
- }
}
else
{
ImageVisualPtr ImageVisual::New( VisualFactoryCache& factoryCache,
const std::string& imageUrl,
+ const Property::Map& properties,
+ ImageDimensions size,
+ FittingMode::Type fittingMode,
+ Dali::SamplingMode::Type samplingMode )
+{
+ ImageVisualPtr imageVisualPtr( new ImageVisual( factoryCache, imageUrl, size, fittingMode, samplingMode ) );
+ imageVisualPtr->SetProperties( properties );
+ return imageVisualPtr;
+}
+
+ImageVisualPtr ImageVisual::New( VisualFactoryCache& factoryCache,
+ const std::string& imageUrl,
ImageDimensions size,
FittingMode::Type fittingMode,
Dali::SamplingMode::Type samplingMode )
mSamplingMode = Dali::SamplingMode::Type( value );
}
+ // Use a variable to detect if the width or height have been modified by the property map.
+ bool desiredSizeSpecified = false;
int desiredWidth = 0;
Property::Value* desiredWidthValue = propertyMap.Find( Toolkit::ImageVisual::Property::DESIRED_WIDTH, IMAGE_DESIRED_WIDTH );
if( desiredWidthValue )
{
desiredWidthValue->Get( desiredWidth );
+ desiredSizeSpecified = true;
}
int desiredHeight = 0;
if( desiredHeightValue )
{
desiredHeightValue->Get( desiredHeight );
+ desiredSizeSpecified = true;
}
- mDesiredSize = ImageDimensions( desiredWidth, desiredHeight );
+ // Only update the desired size if specified in the property map.
+ if( desiredSizeSpecified )
+ {
+ mDesiredSize = ImageDimensions( desiredWidth, desiredHeight );
+ }
Property::Value* pixelAreaValue = propertyMap.Find( Toolkit::ImageVisual::Property::PIXEL_AREA, PIXEL_AREA_UNIFORM_NAME );
if( pixelAreaValue )
void ImageVisual::InitializeRenderer( const std::string& imageUrl )
{
- DALI_ASSERT_DEBUG( !mImpl->mRenderer && "Renderer should have been removed from stage and already reset before initialization" );
-
mImageUrl = imageUrl;
mImpl->mFlags &= ~Impl::IS_ATLASING_APPLIED;
if( !mImpl->mCustomShader &&
- ( strncasecmp( imageUrl.c_str(), HTTP_URL, sizeof(HTTP_URL) -1 ) != 0 ) && // ignore remote images
+ ( strncasecmp( imageUrl.c_str(), HTTP_URL, sizeof(HTTP_URL) -1 ) != 0 ) && // dont atlas remote images
( strncasecmp( imageUrl.c_str(), HTTPS_URL, sizeof(HTTPS_URL) -1 ) != 0 ) )
{
bool defaultWrapMode = mWrapModeU <= WrapMode::CLAMP_TO_EDGE && mWrapModeV <= WrapMode::CLAMP_TO_EDGE;
void ImageVisual::InitializeRenderer( const Image& image )
{
- DALI_ASSERT_DEBUG( !mImpl->mRenderer && "Renderer should have been removed from stage and already reset before initialization" );
mImpl->mFlags &= ~Impl::IS_FROM_CACHE;