const char* const VOLUME_RIGHT( "volumeRight" );
const char* const RENDERING_TYPE( "renderingTarget" );
+const char* VERTEX_SHADER = DALI_COMPOSE_SHADER(
+ attribute mediump vec2 aPosition;\n
+ varying mediump vec2 vTexCoord;\n
+ uniform mediump mat4 uMvpMatrix;\n
+ uniform mediump vec3 uSize;\n
+ \n
+ void main()\n
+ {\n
+ mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);\n
+ vertexPosition.xyz *= uSize;\n
+ vertexPosition = uMvpMatrix * vertexPosition;\n
+ \n
+ vTexCoord = aPosition + vec2(0.5);\n
+ gl_Position = vertexPosition;\n
+ }\n
+);
+
+const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER(
+ varying mediump vec2 vTexCoord;\n
+ uniform sampler2D sTexture;\n
+ uniform lowp vec4 uColor;\n
+ \n
+ void main()\n
+ {\n
+ gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor;\n
+ }\n
+);
+
}
void video_view_startup(void)
END_TEST;
}
+
+int UtcDaliVideoViewCustomShaderForCoverage(void)
+{
+ ToolkitTestApplication application;
+ VideoView videoView = VideoView::New();
+ DALI_TEST_CHECK( videoView );
+ Stage::GetCurrent().Add( videoView );
+ videoView.SetProperty( VideoView::Property::VIDEO, "testvideo" );
+
+ Property::Map customShader;
+ customShader.Insert( "vertexShader", VERTEX_SHADER );
+ customShader.Insert( "fragmentShader", FRAGMENT_SHADER );
+
+ Property::Map map;
+ map.Insert( "shader", customShader );
+
+ videoView.SetProperty( VideoView::Property::VIDEO, map );
+
+ Property::Map map2;
+ Property::Value value = videoView.GetProperty( VideoView::Property::VIDEO );
+
+ DALI_TEST_CHECK( !value.Get( map2 ) );
+
+ END_TEST;
+}
// INTERNAL INCLUDES
#include <dali-toolkit/public-api/controls/video-view/video-view.h>
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
+#include <dali-toolkit/devel-api/visual-factory/visual-factory.h>
+#include <dali-toolkit/internal/visuals/visual-string-constants.h>
+#include <dali-toolkit/internal/visuals/visual-base-impl.h>
#include <dali-toolkit/internal/visuals/visual-factory-impl.h>
namespace Dali
}
}
+ Property::Value* target = map.Find( RENDERING_TARGET );
+ std::string targetType;
+
+ if( target && target->Get( targetType ) && targetType == WINDOW_SURFACE_TARGET )
+ {
+ this->SetWindowSurfaceTarget();
+ }
+ else if( target && target->Get( targetType ) && targetType == NATIVE_IMAGE_TARGET )
+ {
+ this->SetNativeImageTarget();
+ }
+
RelayoutRequest();
}
case Toolkit::VideoView::Property::VIDEO:
{
std::string videoUrl;
+ Property::Map map;
+
if( value.Get( videoUrl ) )
{
impl.SetUrl( videoUrl );
}
-
- Property::Map map;
- if( value.Get( map ) )
+ else if( value.Get( map ) )
{
- impl.SetPropertyMap( map );
+ Property::Value* shaderValue = map.Find( Toolkit::Visual::Property::SHADER, CUSTOM_SHADER );
- Property::Value* target = map.Find( RENDERING_TARGET );
- std::string targetType;
- if( target && target->Get( targetType ) && targetType == WINDOW_SURFACE_TARGET )
+ if( map.Count() > 1u || !shaderValue )
{
- impl.SetWindowSurfaceTarget();
+ impl.SetPropertyMap( map );
}
- else if( target && target->Get( targetType ) && targetType == NATIVE_IMAGE_TARGET )
+ else if( impl.mVisual && map.Count() == 1u && shaderValue )
{
- impl.SetNativeImageTarget();
+ Property::Map shaderMap;
+ if( shaderValue->Get( shaderMap ) )
+ {
+ Internal::Visual::Base& visual = Toolkit::GetImplementation( impl.mVisual );
+ visual.SetCustomShader( shaderMap );
+ if( videoView.OnStage() )
+ {
+ visual.SetOffStage( videoView );
+ visual.SetOnStage( videoView );
+ }
+ }
}
}
break;