Use modern construct 'using' instead of typedef.
[platform/core/uifw/dali-core.git] / dali / internal / event / images / bitmap-packed-pixel.h
index 1da80fb..3eeebdd 100644 (file)
@@ -1,21 +1,22 @@
-#ifndef __DALI_INTERNAL_BITMAP_H__
-#define __DALI_INTERNAL_BITMAP_H__
-
-//
-// Copyright (c) 2014 Samsung Electronics Co., Ltd.
-//
-// Licensed under the Flora License, Version 1.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://floralicense.org/license/
-//
-// 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.
-//
+#ifndef DALI_INTERNAL_BITMAP_H
+#define DALI_INTERNAL_BITMAP_H
+
+/*
+ * Copyright (c) 2019 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
 
@@ -28,7 +29,7 @@ namespace Internal
 {
 
 class BitmapPackedPixel;
-typedef IntrusivePtr<BitmapPackedPixel>        BitmapPackedPixelPtr;
+using BitmapPackedPixelPtr = IntrusivePtr<BitmapPackedPixel>;
 
 /**
  * BitmapPackedPixel class.
@@ -37,17 +38,15 @@ typedef IntrusivePtr<BitmapPackedPixel>        BitmapPackedPixelPtr;
  * number of bytes.
  * This is a vanilla Bitmap class, typically used to hold data decompressed
  * from PNG and JPEG file formats for example.
- *
- * \sa{Bitmap BitmapCompressed BitmapExternal}
  */
-class DALI_IMPORT_API BitmapPackedPixel : public Dali::Integration::Bitmap, Dali::Integration::Bitmap::PackedPixelsProfile
+class BitmapPackedPixel : public Dali::Integration::Bitmap, Dali::Integration::Bitmap::PackedPixelsProfile
 {
 public:
   /**
    * Constructor
    * @param[in] discardable Flag to tell the bitmap if it can delete the buffer with the pixel data.
    */
-  BitmapPackedPixel( bool discardable = false, Dali::Integration::PixelBuffer* pixBuf = 0 );
+  BitmapPackedPixel( ResourcePolicy::Discardable discardable = ResourcePolicy::OWNED_RETAIN, Dali::Integration::PixelBuffer* pixBuf = 0 );
 
 public:
   virtual const Bitmap::PackedPixelsProfile* GetPackedPixelsProfile() const { return this; }
@@ -66,10 +65,10 @@ public:
    * @return pixel buffer pointer
    */
   virtual Dali::Integration::PixelBuffer* ReserveBuffer(Pixel::Format pixelFormat,
-                                     unsigned int width,
-                                     unsigned int height,
-                                     unsigned int bufferWidth = 0,
-                                     unsigned int bufferHeight = 0);
+                                     uint32_t width,
+                                     uint32_t height,
+                                     uint32_t bufferWidth = 0,
+                                     uint32_t bufferHeight = 0);
 
   /**
    * Assign a pixel buffer. Any previously allocated pixel buffer is deleted.
@@ -86,11 +85,11 @@ public:
    */
   virtual void AssignBuffer(Pixel::Format pixelFormat,
                             Dali::Integration::PixelBuffer* buffer,
-                            std::size_t bufferSize,
-                            unsigned int width,
-                            unsigned int height,
-                            unsigned int bufferWidth = 0,
-                            unsigned int bufferHeight = 0);
+                            uint32_t bufferSize,
+                            uint32_t width,
+                            uint32_t height,
+                            uint32_t bufferWidth = 0,
+                            uint32_t bufferHeight = 0);
 
   /**
    * Get the width of the buffer (stride)
@@ -114,20 +113,21 @@ public:
    * Get the pixel buffer size in bytes
    * @return The buffer size in bytes.
    */
-  // unsigned int GetBufferSize() const
-  virtual size_t GetBufferSize() const
+  virtual uint32_t GetBufferSize() const
   {
-    return mBufferWidth*mBytesPerPixel*mBufferHeight;
+    return mBufferWidth * mBytesPerPixel * mBufferHeight;
   }
 
   /**
+   * See Dali::Integration::Bitmap::GetReleaseFunction()
+   */
+  ReleaseFunction GetReleaseFunction(){ return FREE; }
+
+  /**
    * Get the pixel buffer stride.
    * @return The buffer stride (in bytes).
    */
-  virtual unsigned int GetBufferStride() const;
-  //{
-  //  return mBufferWidth*mBytesPerPixel;
-  //}
+  virtual uint32_t GetBufferStride() const;
 
   /**
    * Get the pixel format
@@ -153,9 +153,9 @@ protected:
 
 protected:
 
-  unsigned int  mBufferWidth;         ///< Buffer width (stride) in pixels
-  unsigned int  mBufferHeight;        ///< Buffer height in pixels
-  unsigned int  mBytesPerPixel;       ///< Bytes per pixel
+  uint32_t  mBufferWidth;         ///< Buffer width (stride) in pixels
+  uint32_t  mBufferHeight;        ///< Buffer height in pixels
+  uint32_t  mBytesPerPixel;       ///< Bytes per pixel
 
 private:
 
@@ -168,10 +168,10 @@ private:
    * @param[in] bufferHeight  Buffer height in pixels
    */
   void Initialize(Pixel::Format pixelFormat,
-                           unsigned int width,
-                           unsigned int height,
-                           unsigned int bufferWidth,
-                           unsigned int bufferHeight);
+                           uint32_t width,
+                           uint32_t height,
+                           uint32_t bufferWidth,
+                           uint32_t bufferHeight);
 
 
   BitmapPackedPixel(const BitmapPackedPixel& other);  ///< defined private to prevent use
@@ -185,4 +185,4 @@ private:
 
 } // namespace Dali
 
-#endif // __DALI_INTERNAL_BITMAP_H__
+#endif // DALI_INTERNAL_BITMAP_H