Merge "(Partial Update) Mark as not rendered if the node is transparent or culled...
[platform/core/uifw/dali-core.git] / dali / internal / event / rendering / texture-impl.cpp
index 54d611f..234b934 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
 #include <dali/internal/event/common/stage-impl.h>
 #include <dali/internal/update/manager/update-manager.h>
 
-// EXTERNAL INCLUDES
-#include <cstring>
-
-namespace
-{
-const char* DEFAULT_SAMPLER_TYPENAME = "sampler2D";
-} // namespace
-
 namespace Dali
 {
 namespace Internal
@@ -205,40 +197,15 @@ unsigned int Texture::GetHeight() const
 
 bool Texture::IsNative() const
 {
-  return mNativeImage != nullptr;
+  return static_cast<bool>(mNativeImage);
 }
 
 bool Texture::ApplyNativeFragmentShader(std::string& shader)
 {
-  std::string fragmentShader;
-  bool        modified = false;
-  if(mNativeImage != nullptr && !shader.empty())
-  {
-    const char* fragmentPrefix        = mNativeImage->GetCustomFragmentPrefix();
-    const char* customSamplerTypename = mNativeImage->GetCustomSamplerTypename();
-
-    if(fragmentPrefix != nullptr)
-    {
-      modified       = true;
-      fragmentShader = fragmentPrefix;
-      fragmentShader += "\n";
-    }
-    fragmentShader += shader;
-
-    if(customSamplerTypename != nullptr)
-    {
-      modified   = true;
-      size_t pos = fragmentShader.find(DEFAULT_SAMPLER_TYPENAME);
-      if(pos < fragmentShader.length())
-      {
-        fragmentShader.replace(pos, strlen(DEFAULT_SAMPLER_TYPENAME), customSamplerTypename);
-      }
-    }
-  }
-
-  if(modified)
+  bool modified = false;
+  if(mNativeImage && !shader.empty())
   {
-    shader = fragmentShader;
+    modified = mNativeImage->ApplyNativeFragmentShader(shader);
   }
 
   return modified;