Enable -Wnon-virtual-dtor to avoid incorrect C++ code sneaking in
[platform/core/uifw/dali-core.git] / dali / integration-api / bitmap.h
index a6a2523..1e1b9bc 100644 (file)
@@ -86,6 +86,12 @@ public:
     BITMAP_COMPRESSED
   };
 
+  enum ReleaseFunction
+  {
+    FREE,          ///< Use free function to release the buffer
+    DELETE_ARRAY,  ///< Use delete[] operator to release the buffer
+  };
+
   /**
    * Create a new instance of a Bitmap with the required profile.
    * @return Pointer to created Bitmap subclass. Clients should immediately
@@ -142,6 +148,13 @@ public:
   }
 
   /**
+   * Get the pixel buffer if it's present and take over the ownership.
+   * @note With this function called, the bitmap loses the ownership and is no longer responsible for the release of pixel buffer.
+   * @return The raw pointer pointing to the pixel buffer
+   */
+  PixelBuffer* GetBufferOwnership();
+
+  /**
    * Get the pixel buffer size in bytes
    * @return The buffer size in bytes.
    * @sa ReserveBuffer GetBuffer
@@ -167,6 +180,12 @@ public:
     return !(HasAlphaChannel() && mAlphaChannelUsed);
   }
 
+  /**
+   * Returns which release function has to be called to release the data in the bitmap
+   * @return FREE if memory has been allocated with malloc DELETE_ARRAY if memory has been allocated with new
+   */
+  virtual ReleaseFunction GetReleaseFunction() = 0;
+
   /**@}*/ ///< End of generic features
 
 
@@ -248,6 +267,13 @@ public:
      * This property can then be tested for with IsFullyOpaque().
      */
     virtual void TestForTransparency() = 0;
+
+  protected:
+
+    /**
+     * Virtual destructor, no deletion through this interface
+     */
+    virtual ~PackedPixelsProfile() {}
   };
 
   /**
@@ -285,6 +311,12 @@ public:
                                        const unsigned width,
                                        const unsigned height,
                                        const size_t numBytes ) = 0;
+  protected:
+
+    /**
+     * Virtual destructor, no deletion through this interface
+     */
+    virtual ~CompressedProfile() {}
   };
 
   virtual const CompressedProfile* GetCompressedProfile() const { return 0; }
@@ -312,6 +344,8 @@ public:
    */
   void DeletePixelBuffer();
 
+protected:
+
   /**
    * A reference counted object may only be deleted by calling Unreference()
    */