Binding to create Texture using TbmSurface 32/242432/2
authorhuiyu.eun <huiyu.eun@samsung.com>
Thu, 27 Aug 2020 02:52:48 +0000 (11:52 +0900)
committerhuiyu.eun <huiyu.eun@samsung.com>
Thu, 27 Aug 2020 02:54:53 +0000 (11:54 +0900)
This reverts commit 63025ee8b6f9c7fa21ff2b450fdb9a769775e4ea.

Change-Id: Ib6b8330d4c960cd1acd47e6588d354c27599825e
Signed-off-by: huiyu.eun <huiyu.eun@samsung.com>
dali-csharp-binder/file.list
dali-csharp-binder/src/tizen-dependency-wrap.cpp [new file with mode: 0644]

index 685627b..09a4b2e 100755 (executable)
@@ -40,7 +40,8 @@ dali_csharp_binder_tizen_src_files = \
   ${dali_csharp_binder_dir}/src/font-client.cpp \
   ${dali_csharp_binder_dir}/src/transition-effects.cpp \
   ${dali_csharp_binder_dir}/src/atspi.cpp \
-  ${dali_csharp_binder_dir}/src/component-application-wrap.cpp
+  ${dali_csharp_binder_dir}/src/component-application-wrap.cpp \
+  ${dali_csharp_binder_dir}/src/tizen-dependency-wrap.cpp
 
 # module: csharp-binder, backend: tizen-wearable
 dali_csharp_binder_tizen_wearable_src_files = \
diff --git a/dali-csharp-binder/src/tizen-dependency-wrap.cpp b/dali-csharp-binder/src/tizen-dependency-wrap.cpp
new file mode 100644 (file)
index 0000000..5baaf60
--- /dev/null
@@ -0,0 +1,70 @@
+/** Copyright (c) 2020 Samsung Electronics Co., Ltd.\r
+*\r
+* Licensed under the Apache License, Version 2.0 (the "License");\r
+* you may not use this file except in compliance with the License.\r
+* You may obtain a copy of the License at\r
+*\r
+* http://www.apache.org/licenses/LICENSE-2.0\r
+*\r
+* Unless required by applicable law or agreed to in writing, software\r
+* distributed under the License is distributed on an "AS IS" BASIS,\r
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+* See the License for the specific language governing permissions and\r
+* limitations under the License.\r
+*\r
+*/\r
+\r
+#ifndef CSHARP_TIZEN_DEPENDENCY_WRAP\r
+#define CSHARP_TIZEN_DEPENDENCY_WRAP\r
+#endif\r
+\r
+#include "common.h"\r
+#include <dali/dali.h>\r
+\r
+#include <dali/devel-api/adaptor-framework/native-image-source-devel.h>\r
+#include <tbm_surface.h>\r
+\r
+#ifdef __cplusplus\r
+extern "C" {\r
+#endif\r
+\r
+SWIGEXPORT void* SWIGSTDCALL CSharp_Dali_new_Texture_TbmSurface(tbm_surface_h tbm_surface) {\r
+  Dali::NativeImageSourcePtr mNativeImageSrc;\r
+  Dali::Texture mNativeTexture;\r
+  void * jresult ;\r
+\r
+  if (!tbm_surface) {\r
+    SWIG_CSharpSetPendingExceptionArgument(SWIG_CSharpArgumentNullException, "tbm surface is null", 0);\r
+    return 0;\r
+  }\r
+\r
+  try {\r
+    Dali::Any source(tbm_surface);\r
+    mNativeImageSrc = Dali::NativeImageSource::New(source);\r
+    mNativeTexture = Dali::Texture::New( *mNativeImageSrc );\r
+    } catch (std::out_of_range& e) {\r
+      {
+        SWIG_CSharpException(SWIG_IndexError, const_cast<char*>(e.what())); return 0;
+      };
+    } catch (std::exception& e) {
+      {
+        SWIG_CSharpException(SWIG_RuntimeError, const_cast<char*>(e.what())); return 0;
+      };
+    } catch (Dali::DaliException e) {
+      {
+        SWIG_CSharpException(SWIG_UnknownError, e.condition); return 0;
+      };
+    } catch (...) {
+      {
+        SWIG_CSharpException(SWIG_UnknownError, "unknown error"); return 0;
+      };
+    }\r
+\r
+  jresult = new Dali::Texture((const Dali::Texture &)mNativeTexture);\r
+  return (void*)jresult;\r
+}\r
+\r
+#ifdef __cplusplus\r
+}\r
+#endif\r
+\r