END_TEST;
}
+
+int UtcTextureManagerGenerateHash(void)
+{
+ ToolkitTestApplication application;
+
+ TextureManager textureManager; // Create new texture manager
+
+ TestObserver observer;
+ std::string filename( "image.png" );
+ auto preMultiply = TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
+ TextureManager::TextureId textureId = textureManager.RequestLoad(
+ filename,
+ ImageDimensions(),
+ FittingMode::SCALE_TO_FILL,
+ SamplingMode::BOX_THEN_LINEAR,
+ TextureManager::USE_ATLAS,
+ &observer,
+ true,
+ TextureManager::ReloadPolicy::CACHED,
+ preMultiply);
+
+ VisualUrl url = textureManager.GetVisualUrl( textureId );
+
+ DALI_TEST_EQUALS( url.GetUrl().compare( filename ), 0, TEST_LOCATION );
+
+ END_TEST;
+}
//Register transform properties
mImpl->mTransform.RegisterUniforms( mImpl->mRenderer, Direction::LEFT_TO_RIGHT );
- if( IsPreMultipliedAlphaEnabled() )
- {
- EnablePreMultipliedAlpha( true );
- }
+ EnablePreMultipliedAlpha( IsPreMultipliedAlphaEnabled() );
}
void ImageVisual::CreateNativeImageRenderer( NativeImage& nativeImage )
mWrapModeV, textureObserver, atlasUploadObserver, atlasManager,
mOrientationCorrection, forceReload, preMultiplyOnLoad);
- if( textures && preMultiplyOnLoad == TextureManager::MultiplyOnLoad::MULTIPLY_ON_LOAD)
+ if( textures )
{
- EnablePreMultipliedAlpha( true );
+ EnablePreMultipliedAlpha( preMultiplyOnLoad == TextureManager::MultiplyOnLoad::MULTIPLY_ON_LOAD );
}
if( atlasing ) // Flag needs to be set before creating renderer
{
mImpl->mRenderer.RegisterProperty( ATLAS_RECT_UNIFORM_NAME, mAtlasRect );
}
- else if( preMultiplied )
- {
- EnablePreMultipliedAlpha( true );
- }
+
+ EnablePreMultipliedAlpha( preMultiplied );
actor.AddRenderer( mImpl->mRenderer );
// reset the weak handle so that the renderer only get added to actor once
mId = mLoader.Load( mImageUrl.GetUrl(), mBorder, preMultiplyOnLoad );
- if( preMultiplyOnLoad )
- {
- EnablePreMultipliedAlpha( true );
- }
+ EnablePreMultipliedAlpha( preMultiplyOnLoad );
}
if( ! mAuxiliaryPixelBuffer && mAuxiliaryUrl.IsValid() && mAuxiliaryUrl.IsLocalResource() )
{
// We are not including sizing information, but we still need an extra byte for atlasing.
hashTarget.resize( urlLength + 1u );
+
// Add the atlasing to the hash input.
- hashTarget[ urlLength ] = useAtlas;
+ switch( useAtlas )
+ {
+ case UseAtlas::NO_ATLAS:
+ {
+ hashTarget[ urlLength ] = 'f';
+ break;
+ }
+ case UseAtlas::USE_ATLAS:
+ {
+ hashTarget[ urlLength ] = 't';
+ break;
+ }
+ }
}
if( maskTextureId != INVALID_TEXTURE_ID )