Change-Id: I1fe9eeda77d162f0471e24a81b626fe7c24d21a9
Signed-off-by: Seoyeon Kim <seoyeon2.kim@samsung.com>
TextureManager::ReloadPolicy::CACHED,
preMultiply);
TextureManager::ReloadPolicy::CACHED,
preMultiply);
- const VisualUrl& url = textureManager.GetVisualUrl( textureId );
+ VisualUrl url = textureManager.GetVisualUrl( textureId );
DALI_TEST_EQUALS( url.GetUrl().compare( filename ), 0, TEST_LOCATION );
DALI_TEST_EQUALS( url.GetUrl().compare( filename ), 0, TEST_LOCATION );
*/
void ParseAttributes( Tag& tag )
{
*/
void ParseAttributes( Tag& tag )
{
+ if( tag.buffer == NULL )
+ {
+ return;
+ }
+
tag.attributes.Resize( MAX_NUM_OF_ATTRIBUTES );
// Find first the tag name.
tag.attributes.Resize( MAX_NUM_OF_ATTRIBUTES );
// Find first the tag name.
mAllTextSelected( false ),
mUpdateInputStyle( false ),
mPasswordInput( false ),
mAllTextSelected( false ),
mUpdateInputStyle( false ),
mPasswordInput( false ),
+ mCheckScrollAmount( false ),
mIsPlaceholderPixelSize( false ),
mIsPlaceholderElideEnabled( false ),
mPlaceholderEllipsisFlag( false ),
mIsPlaceholderPixelSize( false ),
mIsPlaceholderElideEnabled( false ),
mPlaceholderEllipsisFlag( false ),
}
case Toolkit::ImageVisual::Property::WRAP_MODE_U:
{
}
case Toolkit::ImageVisual::Property::WRAP_MODE_U:
{
if(Scripting::GetEnumerationProperty( value, WRAP_MODE_TABLE, WRAP_MODE_TABLE_COUNT, wrapMode ))
{
mWrapModeU = Dali::WrapMode::Type(wrapMode);
if(Scripting::GetEnumerationProperty( value, WRAP_MODE_TABLE, WRAP_MODE_TABLE_COUNT, wrapMode ))
{
mWrapModeU = Dali::WrapMode::Type(wrapMode);
}
case Toolkit::ImageVisual::Property::WRAP_MODE_V:
{
}
case Toolkit::ImageVisual::Property::WRAP_MODE_V:
{
if(Scripting::GetEnumerationProperty( value, WRAP_MODE_TABLE, WRAP_MODE_TABLE_COUNT, wrapMode ))
{
mWrapModeV = Dali::WrapMode::Type(wrapMode);
if(Scripting::GetEnumerationProperty( value, WRAP_MODE_TABLE, WRAP_MODE_TABLE_COUNT, wrapMode ))
{
mWrapModeV = Dali::WrapMode::Type(wrapMode);
{
case Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING:
{
{
case Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING:
{
if( value.Get( sync ) )
{
if( sync )
if( value.Get( sync ) )
{
if( sync )
case Toolkit::ImageVisual::Property::DESIRED_WIDTH:
{
case Toolkit::ImageVisual::Property::DESIRED_WIDTH:
{
+ float desiredWidth = 0.0f;
if( value.Get( desiredWidth ) )
{
mDesiredSize.SetWidth( desiredWidth );
if( value.Get( desiredWidth ) )
{
mDesiredSize.SetWidth( desiredWidth );
case Toolkit::ImageVisual::Property::DESIRED_HEIGHT:
{
case Toolkit::ImageVisual::Property::DESIRED_HEIGHT:
{
+ float desiredHeight = 0.0f;
if( value.Get( desiredHeight ) )
{
mDesiredSize.SetHeight( desiredHeight );
if( value.Get( desiredHeight ) )
{
mDesiredSize.SetHeight( desiredHeight );
case Toolkit::ImageVisual::Property::FITTING_MODE:
{
case Toolkit::ImageVisual::Property::FITTING_MODE:
{
Scripting::GetEnumerationProperty( value, FITTING_MODE_TABLE, FITTING_MODE_TABLE_COUNT, fittingMode );
mFittingMode = Dali::FittingMode::Type( fittingMode );
break;
Scripting::GetEnumerationProperty( value, FITTING_MODE_TABLE, FITTING_MODE_TABLE_COUNT, fittingMode );
mFittingMode = Dali::FittingMode::Type( fittingMode );
break;
case Toolkit::ImageVisual::Property::SAMPLING_MODE:
{
case Toolkit::ImageVisual::Property::SAMPLING_MODE:
{
Scripting::GetEnumerationProperty( value, SAMPLING_MODE_TABLE, SAMPLING_MODE_TABLE_COUNT, samplingMode );
mSamplingMode = Dali::SamplingMode::Type( samplingMode );
break;
Scripting::GetEnumerationProperty( value, SAMPLING_MODE_TABLE, SAMPLING_MODE_TABLE_COUNT, samplingMode );
mSamplingMode = Dali::SamplingMode::Type( samplingMode );
break;
case Toolkit::ImageVisual::Property::WRAP_MODE_U:
{
case Toolkit::ImageVisual::Property::WRAP_MODE_U:
{
Scripting::GetEnumerationProperty( value, WRAP_MODE_TABLE, WRAP_MODE_TABLE_COUNT, wrapMode );
mWrapModeU = Dali::WrapMode::Type( wrapMode );
break;
Scripting::GetEnumerationProperty( value, WRAP_MODE_TABLE, WRAP_MODE_TABLE_COUNT, wrapMode );
mWrapModeU = Dali::WrapMode::Type( wrapMode );
break;
case Toolkit::ImageVisual::Property::WRAP_MODE_V:
{
case Toolkit::ImageVisual::Property::WRAP_MODE_V:
{
Scripting::GetEnumerationProperty( value, WRAP_MODE_TABLE, WRAP_MODE_TABLE_COUNT, wrapMode );
mWrapModeV = Dali::WrapMode::Type( wrapMode );
break;
Scripting::GetEnumerationProperty( value, WRAP_MODE_TABLE, WRAP_MODE_TABLE_COUNT, wrapMode );
mWrapModeV = Dali::WrapMode::Type( wrapMode );
break;
case Toolkit::ImageVisual::Property::ALPHA_MASK_URL:
{
case Toolkit::ImageVisual::Property::ALPHA_MASK_URL:
{
+ std::string alphaUrl = "";
if( value.Get( alphaUrl ) )
{
AllocateMaskData();
if( value.Get( alphaUrl ) )
{
AllocateMaskData();
case Toolkit::ImageVisual::Property::MASK_CONTENT_SCALE:
{
case Toolkit::ImageVisual::Property::MASK_CONTENT_SCALE:
{
if( value.Get( scale ) )
{
AllocateMaskData();
if( value.Get( scale ) )
{
AllocateMaskData();
case Toolkit::ImageVisual::Property::RELEASE_POLICY:
{
case Toolkit::ImageVisual::Property::RELEASE_POLICY:
{
Scripting::GetEnumerationProperty( value, RELEASE_POLICY_TABLE, RELEASE_POLICY_TABLE_COUNT, releasePolicy );
mReleasePolicy = Toolkit::ImageVisual::ReleasePolicy::Type( releasePolicy );
break;
Scripting::GetEnumerationProperty( value, RELEASE_POLICY_TABLE, RELEASE_POLICY_TABLE_COUNT, releasePolicy );
mReleasePolicy = Toolkit::ImageVisual::ReleasePolicy::Type( releasePolicy );
break;
case Toolkit::ImageVisual::Property::LOAD_POLICY:
{
case Toolkit::ImageVisual::Property::LOAD_POLICY:
{
Scripting::GetEnumerationProperty( value, LOAD_POLICY_TABLE, LOAD_POLICY_TABLE_COUNT, loadPolicy );
mLoadPolicy = Toolkit::ImageVisual::LoadPolicy::Type( loadPolicy );
break;
Scripting::GetEnumerationProperty( value, LOAD_POLICY_TABLE, LOAD_POLICY_TABLE_COUNT, loadPolicy );
mLoadPolicy = Toolkit::ImageVisual::LoadPolicy::Type( loadPolicy );
break;
-const VisualUrl& TextureManager::GetVisualUrl( TextureId textureId )
+VisualUrl TextureManager::GetVisualUrl( TextureId textureId )
+ VisualUrl visualUrl("");
int cacheIndex = GetCacheIndexFromId( textureId );
int cacheIndex = GetCacheIndexFromId( textureId );
- DALI_ASSERT_DEBUG( cacheIndex != INVALID_CACHE_INDEX && "TextureId out of range");
- TextureInfo& cachedTextureInfo( mTextureInfoContainer[ cacheIndex ] );
- return cachedTextureInfo.url;
+ if( cacheIndex != INVALID_CACHE_INDEX )
+ {
+ DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, "TextureManager::GetVisualUrl. Using cached texture id=%d, textureId=%d\n",
+ cacheIndex, textureId );
+
+ TextureInfo& cachedTextureInfo( mTextureInfoContainer[ cacheIndex ] );
+ visualUrl = cachedTextureInfo.url;
+ }
+ return visualUrl;
}
TextureManager::LoadState TextureManager::GetTextureState( TextureId textureId )
}
TextureManager::LoadState TextureManager::GetTextureState( TextureId textureId )
float contentScale, bool cropToMask )
{
int maskCacheIndex = GetCacheIndexFromId( maskTextureId );
float contentScale, bool cropToMask )
{
int maskCacheIndex = GetCacheIndexFromId( maskTextureId );
- Devel::PixelBuffer maskPixelBuffer = mTextureInfoContainer[maskCacheIndex].pixelBuffer;
- pixelBuffer.ApplyMask( maskPixelBuffer, contentScale, cropToMask );
+ if( maskCacheIndex != INVALID_CACHE_INDEX )
+ {
+ Devel::PixelBuffer maskPixelBuffer = mTextureInfoContainer[maskCacheIndex].pixelBuffer;
+ pixelBuffer.ApplyMask( maskPixelBuffer, contentScale, cropToMask );
+ }
void Remove( const TextureManager::TextureId textureId );
/**
void Remove( const TextureManager::TextureId textureId );
/**
- * Get the visualUrl associated with the texture id
+ * @brief Get the visualUrl associated with the texture id.
+ * @param[in] textureId The texture Id to get
+ * @return The visual Url associated with the texture id.
- const VisualUrl& GetVisualUrl( TextureId textureId );
+ VisualUrl GetVisualUrl( TextureId textureId );
/**
* @brief Get the current state of a texture
/**
* @brief Get the current state of a texture
NSVGimage* nsvgParseFromFile(const char* filename, const char* units, float dpi)
{
FILE* fp = NULL;
NSVGimage* nsvgParseFromFile(const char* filename, const char* units, float dpi)
{
FILE* fp = NULL;
+ size_t size = 0;
+ long value = 0;
char* data = NULL;
NSVGimage* image = NULL;
fp = fopen(filename, "rb");
if (!fp) goto error;
fseek(fp, 0, SEEK_END);
char* data = NULL;
NSVGimage* image = NULL;
fp = fopen(filename, "rb");
if (!fp) goto error;
fseek(fp, 0, SEEK_END);
+ value = ftell(fp);
+ /**
+ * In the original file, unsigned long type 'size' gets a return value. But, the return value of 'ftell()' is
+ * signed long type. To prevent interpreting an unexpected large value, we put the comparitive condition here.
+ */
+ if( value < 0 ) goto error;
+ size = value;
fseek(fp, 0, SEEK_SET);
data = (char*)malloc(size+1);
if (data == NULL) goto error;
fseek(fp, 0, SEEK_SET);
data = (char*)malloc(size+1);
if (data == NULL) goto error;