Core API compatibility
authortaeyoon0.lee <taeyoon0lee@taeyoon0lee-Samsung-DeskTop-System.(none)>
Tue, 21 Oct 2014 00:27:20 +0000 (09:27 +0900)
committertaeyoon <taeyoon0.lee@samsung.com>
Tue, 6 Jan 2015 04:10:31 +0000 (13:10 +0900)
  addition of "under_tizen_2_3_capi_enable" for version under tizen 2.3 core api

Change-Id: Ic9b62d0abc047dd792513f8bba09d118d2d496a3

adaptors/tizen/framework-tizen.cpp
adaptors/tizen/tilt-sensor-impl-tizen.cpp
adaptors/wayland/pixmap-image-impl-wl.cpp.autosave [new file with mode: 0644]
packaging/dali-adaptor-mobile.spec
packaging/dali-adaptor-tv.spec
packaging/dali-adaptor-wearable.spec
packaging/dali-adaptor.spec

index c3687b0..1ccc3ae 100644 (file)
@@ -67,7 +67,13 @@ struct Framework::Impl
     mEventCallback.terminate = AppTerminate;
     mEventCallback.pause = AppPause;
     mEventCallback.resume = AppResume;
+
+#ifdef UNDER_TIZEN_2_3_CAPI
     mEventCallback.service = AppService;
+#else
+    mEventCallback.app_control = AppControl;
+#endif
+
     mEventCallback.low_memory = NULL;
     mEventCallback.low_battery = NULL;
     mEventCallback.device_orientation = DeviceRotated;
@@ -128,14 +134,23 @@ struct Framework::Impl
    * Called by AppCore when the application is launched from another module (e.g. homescreen).
    * @param[in] b the bundle data which the launcher module sent
    */
+#ifdef UNDER_TIZEN_2_3_CAPI
   static void AppService(service_h service, void *data)
+#else
+  static void AppControl(app_control_h app_control, void *data)
+#endif
   {
     Framework* framework = static_cast<Framework*>(data);
 
     if(framework)
     {
       bundle *bundleData = NULL;
+
+#ifdef UNDER_TIZEN_2_3_CAPI
       service_to_bundle(service, &bundleData);
+#else
+      app_control_to_bundle(app_control, &bundleData);
+#endif
 
       if(bundleData)
       {
index 5a93b11..9da2510 100644 (file)
 
 // EXTERNAL INCLUDES
 #include <cmath>
-#ifdef DALI_PROFILE_LITE
-#include <sensor_internal.h>
-#else
+
+#ifdef UNDER_TIZEN_2_3_CAPI
 #include <sensor.h>
+#else
+#include <sensor_internal.h>
 #endif
 
+
 #include <dali/public-api/object/type-registry.h>
 #include <dali/integration-api/debug.h>
 
diff --git a/adaptors/wayland/pixmap-image-impl-wl.cpp.autosave b/adaptors/wayland/pixmap-image-impl-wl.cpp.autosave
new file mode 100644 (file)
index 0000000..870bddd
--- /dev/null
@@ -0,0 +1,211 @@
+/*
+ * Copyright (c) 2014 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 "pixmap-image-impl.h"
+
+// EXTERNAL INCLUDES
+#include <Ecore.h>
+#include <Ecore_Wayland.h>
+#include <dali/integration-api/debug.h>
+#include <render-surface.h>
+
+// INTERNAL INCLUDES
+#include <gl/egl-image-extensions.h>
+#include <gl/egl-factory.h>
+#include <adaptor-impl.h>
+
+// Allow this to be encoded and saved:
+#include <platform-abstractions/slp/resource-loader/resource-loader.h>
+#include <bitmap-saver.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+namespace Adaptor
+{
+using Dali::Integration::PixelBuffer;
+
+PixmapImage* PixmapImage::New(unsigned int width, unsigned int height, Dali::PixmapImage::ColorDepth depth, Dali::Adaptor& adaptor,  Any pixmap )
+{
+  PixmapImage* image = new PixmapImage( width, height, depth, adaptor, pixmap );
+  DALI_ASSERT_DEBUG( image && "PixmapImage allocation failed." );
+
+  // 2nd phase construction
+  if(image) //< Defensive in case we ever compile without exceptions.
+  {
+    image->Initialize();
+  }
+
+  return image;
+}
+
+PixmapImage::PixmapImage(unsigned int width, unsigned int height, Dali::PixmapImage::ColorDepth depth, Dali::Adaptor& adaptor, Any pixmap)
+: mWidth(width),
+  mHeight(height),
+  mOwnPixmap(true),
+  mPixelFormat(Pixel::RGB888),
+  mColorDepth(depth),
+  mAdaptor(Internal::Adaptor::Adaptor::GetImplementation(adaptor)),
+  mEglImageKHR(NULL)
+{
+}
+
+void PixmapImage::Initialize()
+{
+}
+
+PixmapImage::~PixmapImage()
+{
+  // Lost the opportunity to call GlExtensionDestroy() if Adaptor is destroyed first
+  if( Adaptor::IsAvailable() )
+  {
+    // GlExtensionDestroy() called from GLCleanup on the render thread. Checking this is done here.
+    // (mEglImageKHR is now read/written from different threads although ref counted destruction
+    //  should mean this isnt concurrent)
+    DALI_ASSERT_ALWAYS( NULL == mEglImageKHR && "NativeImage GL resources have not been properly cleaned up" );
+  }
+}
+
+Any PixmapImage::GetPixmap(Dali::PixmapImage::PixmapAPI api) const
+{
+    return NULL;
+}
+
+Any PixmapImage::GetDisplay() const
+{
+    return NULL;
+}
+
+bool PixmapImage::GetPixels(std::vector<unsigned char>& pixbuf, unsigned& width, unsigned& height, Pixel::Format& pixelFormat) const
+{
+    return false;
+}
+
+bool PixmapImage::EncodeToFile(const std::string& filename) const
+{
+  std::vector< unsigned char > pixbuf;
+  unsigned int width(0), height(0);
+  Pixel::Format pixelFormat;
+
+  if(GetPixels(pixbuf, width, height, pixelFormat))
+  {
+    return Dali::EncodeToFile(&pixbuf[0], filename, pixelFormat, width, height);
+  }
+  return false;
+}
+
+bool PixmapImage::GlExtensionCreate()
+{
+    return false;
+}
+
+void PixmapImage::GlExtensionDestroy()
+{
+  EglImageExtensions* eglImageExtensions = GetEglImageExtensions();
+
+  eglImageExtensions->DestroyImageKHR(mEglImageKHR);
+
+  mEglImageKHR = NULL;
+}
+
+unsigned int PixmapImage::TargetTexture()
+{
+  EglImageExtensions* eglImageExtensions = GetEglImageExtensions();
+
+  eglImageExtensions->TargetTextureKHR(mEglImageKHR);
+
+  return 0;
+}
+
+int PixmapImage::GetPixelDepth(Dali::PixmapImage::ColorDepth depth) const
+{
+  switch (depth)
+  {
+    case Dali::PixmapImage::COLOR_DEPTH_8:
+    {
+      return 8;
+    }
+    case Dali::PixmapImage::COLOR_DEPTH_16:
+    {
+      return 16;
+    }
+    case Dali::PixmapImage::COLOR_DEPTH_24:
+    {
+      return 24;
+    }
+    case Dali::PixmapImage::COLOR_DEPTH_32:
+    {
+      return 32;
+    }
+    default:
+    {
+      DALI_ASSERT_DEBUG(0 && "unknown color enum");
+      return 0;
+    }
+  }
+}
+
+void PixmapImage::SetPixelFormat(int depth)
+{
+  // store the pixel format based on the depth
+  switch (depth)
+  {
+    case 8:
+    {
+      mPixelFormat = Pixel::A8;
+      break;
+    }
+    case 16:
+    {
+      mPixelFormat = Pixel::RGB565;
+      break;
+    }
+    case 32:
+    {
+      mPixelFormat = Pixel::RGBA8888;
+      break;
+    }
+    case 24:
+    default:
+    {
+      mPixelFormat = Pixel::RGB888;
+      break;
+    }
+  }
+}
+
+void PixmapImage::GetPixmapDetails()
+{
+}
+
+EglImageExtensions* PixmapImage::GetEglImageExtensions() const
+{
+  EglFactory& factory = mAdaptor.GetEGLFactory();
+  EglImageExtensions* egl = factory.GetImageExtensions();
+  DALI_ASSERT_DEBUG( egl && "EGL Image Extensions not initialized" );
+  return egl;
+}
+
+} // namespace Adaptor
+
+} // namespace internal
+
+} // namespace Dali
index 5deeee0..c47e2eb 100644 (file)
@@ -122,6 +122,12 @@ export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
 CXXFLAGS+=" -D_ARCH_ARM_ -lgcc"
 %endif
 
+%if 0%{?under_tizen_2_3_capi_enable}
+CFLAGS+=" -DUNDER_TIZEN_2_3_CAPI"
+CXXFLAGS+=" -DUNDER_TIZEN_2_3_CAPI"
+%endif
+
+
 libtoolize --force
 cd %{_builddir}/%{name}-%{version}/build/tizen
 autoreconf --install
index bd5ed4c..43fb377 100644 (file)
@@ -114,6 +114,11 @@ export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
 CXXFLAGS+=" -D_ARCH_ARM_ -lgcc"
 %endif
 
+%if 0%{?under_tizen_2_3_capi_enable}
+CFLAGS+=" -DUNDER_TIZEN_2_3_CAPI"
+CXXFLAGS+=" -DUNDER_TIZEN_2_3_CAPI"
+%endif
+
 libtoolize --force
 cd %{_builddir}/%{name}-%{version}/build/tizen
 autoreconf --install
index 7e14efd..58a27ba 100644 (file)
@@ -107,6 +107,11 @@ export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
 CXXFLAGS+=" -D_ARCH_ARM_ -lgcc"
 %endif
 
+%if 0%{?under_tizen_2_3_capi_enable}
+CFLAGS+=" -DUNDER_TIZEN_2_3_CAPI"
+CXXFLAGS+=" -DUNDER_TIZEN_2_3_CAPI"
+%endif
+
 libtoolize --force
 cd %{_builddir}/%{name}-%{version}/build/tizen
 autoreconf --install
index a797e52..a2eacee 100644 (file)
@@ -131,6 +131,11 @@ CXXFLAGS+=" -DWAYLAND"
 configure_flags="--enable-wayland"
 %endif
 
+%if 0%{?under_tizen_2_3_capi_enable}
+CFLAGS+=" -DUNDER_TIZEN_2_3_CAPI"
+CXXFLAGS+=" -DUNDER_TIZEN_2_3_CAPI"
+%endif
+
 libtoolize --force
 cd %{_builddir}/%{name}-%{version}/build/tizen && autoreconf --install
 cd %{_builddir}/%{name}-%{version}/build/tizen && CXXFLAGS=$CXXFLAGS LDFLAGS=$LDFLAGS DALI_DATA_RW_DIR="%{dali_data_rw_dir}" DALI_DATA_RO_DIR="%{dali_data_ro_dir}" FONT_PRELOADED_PATH="%{font_preloaded_path}" FONT_DOWNLOADED_PATH="%{font_downloaded_path}" FONT_APPLICATION_PATH="%{font_application_path}" FONT_CONFIGURATION_FILE="%{font_configuration_file}" %configure --prefix=$PREFIX --with-jpeg-turbo --enable-gles=20 --enable-profile=COMMON $configure_flags --libdir=%{_libdir}