Revert "[Tizen] Set custom fragment shader to the visual used in WebView"
authorShinwoo Kim <cinoo.kim@samsung.com>
Tue, 1 Jun 2021 02:09:38 +0000 (11:09 +0900)
committerShinwoo Kim <cinoo.kim@samsung.com>
Tue, 1 Jun 2021 02:09:38 +0000 (11:09 +0900)
This reverts commit 57755dceaf86afbff2893ff27380ca78cf8b4f8e.

dali-toolkit/internal/controls/web-view/web-view-impl.cpp

index f98ea00..6a3af8d 100644 (file)
@@ -109,52 +109,7 @@ DALI_TYPE_REGISTRATION_END()
 
 const std::string kEmptyString;
 
-const char* DEFAULT_SAMPLER_TYPENAME = "sampler2D";
-
-const char* FRAGMENT_SHADER_TEXTURE = DALI_COMPOSE_SHADER(
-  varying mediump vec2 vTexCoord;\n
-  uniform sampler2D sTexture;\n
-  uniform lowp vec4 uColor;\n
-  uniform lowp vec3 mixColor;\n
-  uniform lowp float preMultipliedAlpha;\n
-  \n
-  void main()\n
-  {\n
-      gl_FragColor = texture2D( sTexture, vTexCoord ) * uColor * vec4( mixColor, 1.0 );\n
-  }\n
-);
-
-Dali::Toolkit::Visual::Base CreateNativeImageVisual( NativeImageInterfacePtr nativeImageInterface )
-{
-  std::string fragmentShader;
-
-  const char* fragmentPrefix = nativeImageInterface->GetCustomFragmentPrefix();
-  if( fragmentPrefix )
-  {
-    fragmentShader = fragmentPrefix;
-    fragmentShader += FRAGMENT_SHADER_TEXTURE;
-  }
-  else
-  {
-    fragmentShader = FRAGMENT_SHADER_TEXTURE;
-  }
-
-  const char* customSamplerTypename = nativeImageInterface->GetCustomSamplerTypename();
-  if( customSamplerTypename )
-  {
-    fragmentShader.replace( fragmentShader.find( DEFAULT_SAMPLER_TYPENAME ), strlen( DEFAULT_SAMPLER_TYPENAME ), customSamplerTypename );
-  }
-
-  Texture texture = Dali::Texture::New( *nativeImageInterface );
-  const std::string nativeImageUrl = Dali::Toolkit::TextureManager::AddTexture( texture );
-
-  return Toolkit::VisualFactory::Get().CreateVisual(
-    { { Toolkit::Visual::Property::TYPE,  Toolkit::Visual::IMAGE } ,
-      { Toolkit::Visual::Property::SHADER, { { Toolkit::Visual::Shader::Property::FRAGMENT_SHADER, fragmentShader } } },
-      { Toolkit::ImageVisual::Property::URL, nativeImageUrl } } );
-}
-
-} // anonymous namepsace
+} // namespace
 
 #define GET_ENUM_STRING(structName, inputExp) \
   Scripting::GetLinearEnumerationName<Toolkit::WebView::structName::Type>(static_cast<Toolkit::WebView::structName::Type>(inputExp), structName##_TABLE, structName##_TABLE_COUNT)
@@ -328,7 +283,11 @@ void WebView::LoadUrl(const std::string& url)
   mUrl = url;
   if(mWebEngine)
   {
-    mVisual = CreateNativeImageVisual( mWebEngine.GetNativeImageSource() );
+    Texture           texture        = Dali::Texture::New(*mWebEngine.GetNativeImageSource());
+    const std::string nativeImageUrl = Dali::Toolkit::TextureManager::AddTexture(texture);
+    mVisual                          = Toolkit::VisualFactory::Get().CreateVisual(
+      {{Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE},
+       {Toolkit::ImageVisual::Property::URL, nativeImageUrl}});
 
     if(mVisual)
     {
@@ -348,7 +307,11 @@ void WebView::LoadHtmlString(const std::string& htmlString)
 {
   if(mWebEngine)
   {
-    mVisual = CreateNativeImageVisual( mWebEngine.GetNativeImageSource() );
+    Texture           texture        = Dali::Texture::New(*mWebEngine.GetNativeImageSource());
+    const std::string nativeImageUrl = Dali::Toolkit::TextureManager::AddTexture(texture);
+    mVisual                          = Toolkit::VisualFactory::Get().CreateVisual(
+      {{Toolkit::Visual::Property::TYPE, Toolkit::Visual::IMAGE},
+       {Toolkit::ImageVisual::Property::URL, nativeImageUrl}});
 
     if(mVisual)
     {