// INTERNAL HEADER
#include <dali-toolkit/public-api/visuals/image-visual-properties.h>
-#include <dali-toolkit/devel-api/visual-factory/devel-visual-properties.h>
+#include <dali-toolkit/devel-api/visuals/visual-properties-devel.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
void main()\n
{\n
- mediump vec4 vertexPosition = uMvpMatrix *ComputeVertexPosition();\n
+ mediump vec4 vertexPosition = uMvpMatrix * ComputeVertexPosition();\n
vTexCoord = pixelArea.xy+pixelArea.zw*(aPosition + vec2(0.5) );\n
gl_Position = vertexPosition;\n
}\n
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;
+ }
+
+ // 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 );
mWrapModeV = Dali::WrapMode::Type( value );
}
- mDesiredSize = ImageDimensions( desiredWidth, desiredHeight );
-
Property::Value* syncLoading = propertyMap.Find( Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING, SYNCHRONOUS_LOADING );
if( syncLoading )
{
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;
void ImageVisual::DoCreatePropertyMap( Property::Map& map ) const
{
map.Clear();
- map.Insert( Toolkit::VisualProperty::TYPE, Toolkit::Visual::IMAGE );
+ map.Insert( Toolkit::DevelVisual::Property::TYPE, Toolkit::Visual::IMAGE );
bool sync = IsSynchronousResourceLoading();
map.Insert( SYNCHRONOUS_LOADING, sync );
map.Insert( Toolkit::ImageVisual::Property::WRAP_MODE_V, mWrapModeV );
}
-void ImageVisual::DoSetProperty( Dali::Property::Index index, const Dali::Property::Value& propertyValue )
-{
- // TODO
-}
-
-Dali::Property::Value ImageVisual::DoGetProperty( Dali::Property::Index index )
-{
- // TODO
- return Dali::Property::Value();
-}
-
void ImageVisual::OnSetTransform()
{
if( mImpl->mRenderer )