[Tizen] Revert "Remove TypeRegistration from deprecated Image classes" 65/192965/1 submit/tizen/20181113.092512
authorSeoyeon Kim <seoyeon2.kim@samsung.com>
Tue, 13 Nov 2018 08:30:07 +0000 (17:30 +0900)
committerSeoyeon Kim <seoyeon2.kim@samsung.com>
Tue, 13 Nov 2018 08:31:03 +0000 (17:31 +0900)
This reverts commit 65bb67c665fe465e388e8510eeb5fadda45cf202.

Change-Id: Id590893282037252fcfeb095b6f039bc18349d15

dali/internal/event/images/buffer-image-impl.cpp
dali/internal/event/images/encoded-buffer-image-impl.cpp
dali/internal/event/images/frame-buffer-image-impl.cpp
dali/internal/event/images/image-impl.cpp
dali/internal/event/images/image-impl.h
dali/internal/event/images/native-image-impl.cpp
dali/internal/event/images/nine-patch-image-impl.cpp
dali/internal/event/images/resource-image-impl.cpp
dali/internal/event/images/resource-image-impl.h

index 7ad879b..008a361 100644 (file)
@@ -34,6 +34,11 @@ namespace Dali
 namespace Internal
 {
 
+namespace
+{
+TypeRegistration mType( typeid( Dali::BufferImage ), typeid( Dali::Image ), NULL );
+} // unnamed namespace
+
 BufferImagePtr BufferImage::New( unsigned int width,
                                  unsigned int height,
                                  Pixel::Format pixelformat )
index 255709a..d6d5de0 100644 (file)
@@ -35,6 +35,8 @@ namespace Internal
 namespace
 {
 
+TypeRegistration mType( typeid( Dali::EncodedBufferImage ), typeid( Dali::Image ), NULL );
+
 /** Raw bytes of a resource laid out exactly as it would be in a file, but in memory. */
 typedef Dali::RefCountedVector<uint8_t> RequestBuffer;
 /** Counting smart pointer for managing a buffer of raw bytes. */
index def730a..15aa6a8 100644 (file)
@@ -30,6 +30,8 @@ namespace Internal
 
 namespace
 {
+TypeRegistration mType( typeid( Dali::FrameBufferImage ), typeid( Dali::Image ), NULL );
+
 const int RenderBufferFormatToFrameBufferAttachments[]  = { Dali::FrameBuffer::Attachment::NONE,
                                                             Dali::FrameBuffer::Attachment::DEPTH,
                                                             Dali::FrameBuffer::Attachment::STENCIL,
index 49d7f54..8357fcf 100644 (file)
@@ -37,6 +37,38 @@ namespace Dali
 namespace Internal
 {
 
+namespace
+{
+
+// Signals
+
+const char* const SIGNAL_IMAGE_UPLOADED = "uploaded";
+
+TypeRegistration mType( typeid( Dali::Image ), typeid( Dali::BaseHandle ), NULL );
+
+Dali::SignalConnectorType signalConnector1( mType, SIGNAL_IMAGE_UPLOADED, &Image::DoConnectSignal );
+
+}
+
+bool Image::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
+{
+  bool connected( true );
+  DALI_ASSERT_DEBUG( dynamic_cast<Image*>( object ) && "Failed to downcast from BaseObject to Image.\n" );
+  Image* image = static_cast<Image*>(object);
+
+  if( 0 == strcmp( signalName.c_str(), SIGNAL_IMAGE_UPLOADED ) )
+  {
+    image->UploadedSignal().Connect( tracker, functor );
+  }
+  else
+  {
+    // signalName does not match any signal
+    connected = false;
+  }
+
+  return connected;
+}
+
 unsigned int Image::GetWidth() const
 {
   return mWidth;
index de6df50..2a4f142 100644 (file)
@@ -51,6 +51,17 @@ public:
   Dali::Image::ImageSignalType& UploadedSignal() { return mUploaded; }
 
   /**
+   * Connects a callback function with the object's signals.
+   * @param[in] object The object providing the signal.
+   * @param[in] tracker Used to disconnect the signal.
+   * @param[in] signalName The signal to connect to.
+   * @param[in] functor A newly allocated FunctorDelegate.
+   * @return True if the signal was connected.
+   * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
+   */
+  static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
+
+  /**
    * Get the width of the image.
    * Only to be used after the image has finished loading.
    * (Ticket's LoadingSucceeded callback was called)
index 39c8ecb..d7e3f9e 100644 (file)
@@ -33,6 +33,11 @@ namespace Dali
 namespace Internal
 {
 
+namespace
+{
+TypeRegistration mType( typeid(Dali::NativeImage), typeid(Dali::Image), NULL );
+}
+
 NativeImage::NativeImage( NativeImageInterface& resourceData )
 : Image()
 {
index ca96236..7662edc 100644 (file)
@@ -167,6 +167,11 @@ namespace Dali
 namespace Internal
 {
 
+namespace
+{
+TypeRegistration mType( typeid( Dali::NinePatchImage ), typeid( Dali::Image ), NULL );
+} // unnamed namespace
+
 NinePatchImagePtr NinePatchImage::New( const std::string& filename )
 {
   Internal::NinePatchImagePtr internal( new NinePatchImage( filename ) );
index 737eb37..5efe567 100644 (file)
@@ -38,6 +38,26 @@ namespace Dali
 namespace Internal
 {
 
+namespace
+{
+
+// Signals
+
+const char* const SIGNAL_IMAGE_LOADING_FINISHED = "imageLoadingFinished";
+
+
+BaseHandle CreateImage()
+{
+  ImagePtr image = ResourceImage::New();
+  return Dali::Image(image.Get());
+}
+
+TypeRegistration mType( typeid( Dali::ResourceImage ), typeid( Dali::Image ), CreateImage );
+
+Dali::SignalConnectorType signalConnector1( mType, SIGNAL_IMAGE_LOADING_FINISHED, &ResourceImage::DoConnectSignal );
+
+}
+
 ResourceImage::ResourceImage()
 : Image(),
   mLoadingFinished(),
@@ -87,6 +107,26 @@ ResourceImage::~ResourceImage()
 {
 }
 
+bool ResourceImage::DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor )
+{
+  bool connected( true );
+  DALI_ASSERT_DEBUG( dynamic_cast<ResourceImage*>( object ) && "Failed to downcast from BaseObject to ResourceImage.\n" );
+  ResourceImage* image = static_cast<ResourceImage*>(object);
+
+  if( 0 == strcmp( signalName.c_str(), SIGNAL_IMAGE_LOADING_FINISHED ) )
+  {
+    image->LoadingFinishedSignal().Connect( tracker, functor );
+  }
+  else
+  {
+    // signalName does not match any signal
+    connected = false;
+  }
+
+  return connected;
+}
+
+
 const ImageAttributes& ResourceImage::GetAttributes() const
 {
   return mAttributes;
index ce1d227..5843fd8 100644 (file)
@@ -71,6 +71,17 @@ public:
   Dali::ResourceImage::ResourceImageSignal& LoadingFinishedSignal() { return mLoadingFinished; }
 
   /**
+   * Connects a callback function with the object's signals.
+   * @param[in] object The object providing the signal.
+   * @param[in] tracker Used to disconnect the signal.
+   * @param[in] signalName The signal to connect to.
+   * @param[in] functor A newly allocated FunctorDelegate.
+   * @return True if the signal was connected.
+   * @post If a signal was connected, ownership of functor was passed to CallbackBase. Otherwise the caller is responsible for deleting the unused functor.
+   */
+  static bool DoConnectSignal( BaseObject* object, ConnectionTrackerInterface* tracker, const std::string& signalName, FunctorDelegate* functor );
+
+  /**
    * Get the attributes of the image.
    * Only to be used after the image has finished loading.
    * (Ticket's LoadingSucceeded callback was called)