Add NativeImageSourceQueueX 72/191972/4
authorHeeyong Song <heeyong.song@samsung.com>
Fri, 26 Oct 2018 07:17:35 +0000 (16:17 +0900)
committerHeeyong Song <heeyong.song@samsung.com>
Wed, 7 Nov 2018 02:53:02 +0000 (11:53 +0900)
It has only empty functions because it is not supported on Ubuntu.

Change-Id: Ibb4840aca7eb23a97b48a8feeaf4d25041707ee6

dali/internal/imaging/file.list
dali/internal/imaging/ubuntu-x11/native-image-source-factory-x.cpp
dali/internal/imaging/ubuntu-x11/native-image-source-queue-impl-x.cpp [new file with mode: 0644]
dali/internal/imaging/ubuntu-x11/native-image-source-queue-impl-x.h [new file with mode: 0755]

index 6aa7fb2..83f82f7 100755 (executable)
@@ -30,4 +30,6 @@ adaptor_imaging_tizen_src_files=\
 # module: imaging, backend: ubuntu-x11
 adaptor_imaging_ubuntu_x11_src_files=\
     ${adaptor_imaging_dir}/ubuntu-x11/native-image-source-factory-x.cpp \
-    ${adaptor_imaging_dir}/ubuntu-x11/native-image-source-impl-x.cpp
+    ${adaptor_imaging_dir}/ubuntu-x11/native-image-source-impl-x.cpp \
+    ${adaptor_imaging_dir}/ubuntu-x11/native-image-source-queue-impl-x.cpp
+
index b072c67..76969b9 100644 (file)
@@ -20,7 +20,7 @@
 
 // INTERNAL HEADERS
 #include <dali/internal/imaging/ubuntu-x11/native-image-source-impl-x.h>
-#include <dali/internal/imaging/common/native-image-source-queue-impl.h>
+#include <dali/internal/imaging/ubuntu-x11/native-image-source-queue-impl-x.h>
 
 namespace Dali
 {
@@ -38,7 +38,7 @@ std::unique_ptr< NativeImageSource > NativeImageSourceFactoryX::CreateNativeImag
 std::unique_ptr< NativeImageSourceQueue > NativeImageSourceFactoryX::CreateNativeImageSourceQueue( unsigned int width, unsigned int height,
                                                                                                    Dali::NativeImageSourceQueue::ColorDepth depth, Any nativeImageSourceQueue )
 {
-  return std::unique_ptr< NativeImageSourceQueue >( nullptr );
+  return std::unique_ptr< NativeImageSourceQueue >( NativeImageSourceQueueX::New( width, height, depth, nativeImageSourceQueue ) );
 }
 
 // this should be created from somewhere
diff --git a/dali/internal/imaging/ubuntu-x11/native-image-source-queue-impl-x.cpp b/dali/internal/imaging/ubuntu-x11/native-image-source-queue-impl-x.cpp
new file mode 100644 (file)
index 0000000..3e44a25
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2018 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// CLASS HEADER
+#include <dali/internal/imaging/ubuntu-x11/native-image-source-queue-impl-x.h>
+
+// EXTERNAL INCLUDES
+#include <dali/integration-api/debug.h>
+#include <dali/integration-api/gl-defines.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/graphics/common/egl-image-extensions.h>
+#include <dali/internal/graphics/gles20/egl-graphics.h>
+#include <dali/internal/adaptor/common/adaptor-impl.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+namespace
+{
+#define TBM_SURFACE_QUEUE_SIZE  3
+
+const char* FRAGMENT_PREFIX = "\n";
+const char* SAMPLER_TYPE = "sampler2D";
+
+}
+
+NativeImageSourceQueueX* NativeImageSourceQueueX::New( unsigned int width, unsigned int height, Dali::NativeImageSourceQueue::ColorDepth depth, Any nativeImageSourceQueue )
+{
+  NativeImageSourceQueueX* image = new NativeImageSourceQueueX( width, height, depth, nativeImageSourceQueue );
+  return image;
+}
+
+NativeImageSourceQueueX::NativeImageSourceQueueX( unsigned int width, unsigned int height, Dali::NativeImageSourceQueue::ColorDepth depth, Any nativeImageSourceQueue )
+: mWidth( width ),
+  mHeight( height )
+{
+  DALI_LOG_ERROR( "NativeImageSourceQueueX::NativeImageSourceQueueX: Not supported\n" );
+}
+
+NativeImageSourceQueueX::~NativeImageSourceQueueX()
+{
+}
+
+Any NativeImageSourceQueueX::GetNativeImageSourceQueue() const
+{
+  return Any();
+}
+
+void NativeImageSourceQueueX::SetSource( Any source )
+{
+}
+
+bool NativeImageSourceQueueX::GlExtensionCreate()
+{
+  return true;
+}
+
+void NativeImageSourceQueueX::GlExtensionDestroy()
+{
+}
+
+unsigned int NativeImageSourceQueueX::TargetTexture()
+{
+  return 0;
+}
+
+void NativeImageSourceQueueX::PrepareTexture()
+{
+}
+
+const char* NativeImageSourceQueueX::GetCustomFragmentPreFix()
+{
+  return FRAGMENT_PREFIX;
+}
+
+const char* NativeImageSourceQueueX::GetCustomSamplerTypename()
+{
+  return SAMPLER_TYPE;
+}
+
+int NativeImageSourceQueueX::GetEglImageTextureTarget()
+{
+  return 0;
+}
+
+} // namespace Adaptor
+
+} // namespace internal
+
+} // namespace Dali
diff --git a/dali/internal/imaging/ubuntu-x11/native-image-source-queue-impl-x.h b/dali/internal/imaging/ubuntu-x11/native-image-source-queue-impl-x.h
new file mode 100755 (executable)
index 0000000..c53b51d
--- /dev/null
@@ -0,0 +1,163 @@
+#ifndef DALI_INTERNAL_NATIVE_IMAGE_SOURCE_QUEUE_IMPL_X_H
+#define DALI_INTERNAL_NATIVE_IMAGE_SOURCE_QUEUE_IMPL_X_H
+
+/*
+ * Copyright (c) 2018 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// EXTERNAL INCLUDES
+#include <dali/devel-api/images/native-image-interface-extension.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/imaging/common/native-image-source-queue-impl.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+
+class EglGraphics;
+class EglImageExtensions;
+
+/**
+ * Dali internal NativeImageSourceQueue.
+ */
+class NativeImageSourceQueueX: public Internal::Adaptor::NativeImageSourceQueue, public NativeImageInterface::Extension
+{
+public:
+
+  /**
+   * Create a new NativeImageSourceQueueX internally.
+   * Depending on hardware the width and height may have to be a power of two.
+   * @param[in] width The width of the image.
+   * @param[in] height The height of the image.
+   * @param[in] depth color depth of the image.
+   * @param[in] nativeImageSourceQueue contains tbm_surface_queue_h or is empty
+   * @return A smart-pointer to a newly allocated image.
+   */
+  static NativeImageSourceQueueX* New(unsigned int width, unsigned int height, Dali::NativeImageSourceQueue::ColorDepth depth, Any nativeImageSourceQueue );
+
+  /**
+   * @copydoc Dali::NativeImageSourceQueue::GetNativeImageSourceQueue()
+   */
+  Any GetNativeImageSourceQueue() const override;
+
+  /**
+   * @copydoc Dali::NativeImageSourceQueue::SetSource( Any source )
+   */
+  void SetSource( Any source ) override;
+
+  /**
+   * destructor
+   */
+  ~NativeImageSourceQueueX() override;
+
+  /**
+   * @copydoc Dali::NativeImageInterface::GlExtensionCreate()
+   */
+  bool GlExtensionCreate() override;
+
+  /**
+   * @copydoc Dali::NativeImageInterface::GlExtensionDestroy()
+   */
+  void GlExtensionDestroy() override;
+
+  /**
+   * @copydoc Dali::NativeImageInterface::TargetTexture()
+   */
+  unsigned int TargetTexture() override;
+
+  /**
+   * @copydoc Dali::NativeImageInterface::PrepareTexture()
+   */
+  void PrepareTexture() override;
+
+  /**
+   * @copydoc Dali::NativeImageInterface::GetWidth()
+   */
+  unsigned int GetWidth() const override
+  {
+    return mWidth;
+  }
+
+  /**
+   * @copydoc Dali::NativeImageInterface::GetHeight()
+   */
+  unsigned int GetHeight() const override
+  {
+    return mHeight;
+  }
+
+  /**
+   * @copydoc Dali::NativeImageInterface::RequiresBlending()
+   */
+  bool RequiresBlending() const override
+  {
+    return true;
+  }
+
+  /**
+   * @copydoc Dali::NativeImageInterface::GetExtension()
+   */
+  NativeImageInterface::Extension* GetNativeImageInterfaceExtension() override
+  {
+    return this;
+  }
+
+  /**
+   * @copydoc Dali::NativeImageInterface::Extension::GetCustomFragmentPreFix()
+   */
+  const char* GetCustomFragmentPreFix() override;
+
+  /**
+   * @copydoc Dali::NativeImageInterface::Extension::GetCustomSamplerTypename()
+   */
+  const char* GetCustomSamplerTypename() override;
+
+  /**
+   * @copydoc Dali::NativeImageInterface::Extension::GetEglImageTextureTarget()
+   */
+  int GetEglImageTextureTarget() override;
+
+private:
+
+  /**
+   * Private constructor; @see NativeImageSourceQueue::New()
+   * @param[in] width The width of the image.
+   * @param[in] height The height of the image.
+   * @param[in] colour depth of the image.
+   * @param[in] nativeImageSourceQueue contains tbm_surface_queue_h or is empty
+   */
+  NativeImageSourceQueueX( unsigned int width, unsigned int height, Dali::NativeImageSourceQueue::ColorDepth depth, Any nativeImageSourceQueue );
+
+private:
+
+  unsigned int    mWidth;                ///< image width
+  unsigned int    mHeight;               ///< image height
+
+};
+
+} // namespace Adaptor
+
+} // namespace Internal
+
+} // namespace Dali
+
+#endif // DALI_INTERNAL_NATIVE_IMAGE_SOURCE_QUEUE_IMPL_X_H