use modern construct 'nullptr' instead of 'NULL' or '0'
[platform/core/uifw/dali-core.git] / dali / integration-api / bitmap.cpp
index 836c3be..794be95 100644 (file)
@@ -1,30 +1,31 @@
-//
-// 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.
-//
+/*
+ * Copyright (c) 2017 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/integration-api/bitmap.h>
 
-// EXTERNAL INCLUDES
-
 // INTERNAL INCLUDES
 #include <dali/integration-api/debug.h>
+#include <dali/integration-api/platform-abstraction.h>
+#include <dali/internal/event/common/thread-local-storage.h>
 #include <dali/internal/event/images/bitmap-packed-pixel.h>
 #include <dali/internal/event/images/bitmap-compressed.h>
-#include <dali/internal/event/images/bitmap-external.h>
 #include <dali/integration-api/gl-abstraction.h>
+#include <dali/integration-api/gl-defines.h>
 
 namespace Dali
 {
@@ -161,86 +162,299 @@ void ConvertToGlFormat( Format pixelformat, unsigned& pixelDataType, unsigned& i
       break;
     }
 
+    // GLES 2 extension compressed formats:
+    case COMPRESSED_RGB8_ETC1:
+    {
+      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using non-standard GLES 2.0 extension compressed pixel format COMPRESSED_RGB8_ETC1.\n" );
+      internalFormat = 0x8D64; ///! < Hardcoded so we can test before we move to GLES 3.0 or greater.
+      break;
+    }
+    case COMPRESSED_RGB_PVRTC_4BPPV1:
+    {
+      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using non-standard GLES 2.0 extension compressed pixel format COMPRESSED_RGB_PVRTC_4BPPV1.\n" );
+      internalFormat = 0x8C00; ///! < Hardcoded so we can test before we move to GLES 3.0 or greater.
+      break;
+    }
+
     // GLES 3.0 standard compressed formats:
     case COMPRESSED_R11_EAC:
     {
       DALI_LOG_INFO(Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_R11_EAC.\n");
-      internalFormat = 0x9270; ///! < Hardcoded until we move to GLES 3.0 or greater.
+      internalFormat = GL_COMPRESSED_R11_EAC;
       break;
     }
     case COMPRESSED_SIGNED_R11_EAC:
     {
       DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_SIGNED_R11_EAC.\n" );
-      internalFormat = 0x9271; ///! < Hardcoded until we move to GLES 3.0 or greater.
-      ;
+      internalFormat = GL_COMPRESSED_SIGNED_R11_EAC;
       break;
     }
     case COMPRESSED_RG11_EAC:
     {
       DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_RG11_EAC.\n" );
-      internalFormat = 0x9272; ///! < Hardcoded until we move to GLES 3.0 or greater.
+      internalFormat = GL_COMPRESSED_RG11_EAC;
       break;
     }
     case COMPRESSED_SIGNED_RG11_EAC:
     {
       DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_SIGNED_RG11_EAC.\n" );
-      internalFormat = 0x9273; ///! < Hardcoded until we move to GLES 3.0 or greater.
+      internalFormat = GL_COMPRESSED_SIGNED_RG11_EAC;
       break;
     }
     case COMPRESSED_RGB8_ETC2:
     {
       DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_RGB8_ETC2.\n" );
-      internalFormat = 0x9274; ///! < Hardcoded until we move to GLES 3.0 or greater.
+      internalFormat = GL_COMPRESSED_RGB8_ETC2;
       break;
     }
     case COMPRESSED_SRGB8_ETC2:
     {
       DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_SRGB8_ETC2.\n" );
-      internalFormat = 0x9275; ///! < Hardcoded until we move to GLES 3.0 or greater.
+      internalFormat = GL_COMPRESSED_SRGB8_ETC2;
       break;
     }
     case COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2:
     {
       DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2.\n" );
-      internalFormat = 0x9276; ///! < Hardcoded until we move to GLES 3.0 or greater.
+      internalFormat = GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2;
       break;
     }
     case COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2:
     {
       DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2.\n" );
-      internalFormat = 0x9277; ///! < Hardcoded until we move to GLES 3.0 or greater.
+      internalFormat = GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2;
       break;
     }
     case COMPRESSED_RGBA8_ETC2_EAC:
     {
       DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_RGBA8_ETC2_EAC.\n" );
-      internalFormat = 0x9278; ///! < Hardcoded until we move to GLES 3.0 or greater.
+      internalFormat = GL_COMPRESSED_RGBA8_ETC2_EAC;
       break;
     }
     case COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:
     {
       DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ETC2_EAC.\n" );
-      internalFormat = 0x9279; ///! < Hardcoded until we move to GLES 3.0 or greater.
+      internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC;
       break;
     }
 
-    // GLES 2 extension compressed formats:
-    case COMPRESSED_RGB8_ETC1:
+    // GLES 3.1 extension compressed formats:
+    case COMPRESSED_RGBA_ASTC_4x4_KHR:
     {
-      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using non-standard GLES 2.0 extension compressed pixel format COMPRESSED_RGB8_ETC1.\n" );
-      internalFormat = 0x8D64; ///! < Hardcoded so we can test before we move to GLES 3.0 or greater.
+      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_4x4_KHR.\n" );
+      internalFormat = GL_COMPRESSED_RGBA_ASTC_4x4_KHR;
       break;
     }
-    case COMPRESSED_RGB_PVRTC_4BPPV1:
+    case COMPRESSED_RGBA_ASTC_5x4_KHR:
     {
-      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using non-standard GLES 2.0 extension compressed pixel format COMPRESSED_RGB_PVRTC_4BPPV1.\n" );
-      internalFormat = 0x8C00; ///! < Hardcoded so we can test before we move to GLES 3.0 or greater.
+      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_5x4_KHR.\n" );
+      internalFormat = GL_COMPRESSED_RGBA_ASTC_5x4_KHR;
+      break;
+    }
+    case COMPRESSED_RGBA_ASTC_5x5_KHR:
+    {
+      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_5x5_KHR.\n" );
+      internalFormat = GL_COMPRESSED_RGBA_ASTC_5x5_KHR;
+      break;
+    }
+    case COMPRESSED_RGBA_ASTC_6x5_KHR:
+    {
+      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_6x5_KHR.\n" );
+      internalFormat = GL_COMPRESSED_RGBA_ASTC_6x5_KHR;
+      break;
+    }
+    case COMPRESSED_RGBA_ASTC_6x6_KHR:
+    {
+      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_6x6_KHR.\n" );
+      internalFormat = GL_COMPRESSED_RGBA_ASTC_6x6_KHR;
+      break;
+    }
+    case COMPRESSED_RGBA_ASTC_8x5_KHR:
+    {
+      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_8x5_KHR.\n" );
+      internalFormat = GL_COMPRESSED_RGBA_ASTC_8x5_KHR;
+      break;
+    }
+    case COMPRESSED_RGBA_ASTC_8x6_KHR:
+    {
+      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_8x6_KHR.\n" );
+      internalFormat = GL_COMPRESSED_RGBA_ASTC_8x6_KHR;
+      break;
+    }
+    case COMPRESSED_RGBA_ASTC_8x8_KHR:
+    {
+      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_8x8_KHR.\n" );
+      internalFormat = GL_COMPRESSED_RGBA_ASTC_8x8_KHR;
+      break;
+    }
+    case COMPRESSED_RGBA_ASTC_10x5_KHR:
+    {
+      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_10x5_KHR.\n" );
+      internalFormat = GL_COMPRESSED_RGBA_ASTC_10x5_KHR;
+      break;
+    }
+    case COMPRESSED_RGBA_ASTC_10x6_KHR:
+    {
+      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_10x6_KHR.\n" );
+      internalFormat = GL_COMPRESSED_RGBA_ASTC_10x6_KHR;
+      break;
+    }
+    case COMPRESSED_RGBA_ASTC_10x8_KHR:
+    {
+      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_10x8_KHR.\n" );
+      internalFormat = GL_COMPRESSED_RGBA_ASTC_10x8_KHR;
+      break;
+    }
+    case COMPRESSED_RGBA_ASTC_10x10_KHR:
+    {
+      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_10x10_KHR.\n" );
+      internalFormat = GL_COMPRESSED_RGBA_ASTC_10x10_KHR;
+      break;
+    }
+    case COMPRESSED_RGBA_ASTC_12x10_KHR:
+    {
+      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_12x10_KHR.\n" );
+      internalFormat = GL_COMPRESSED_RGBA_ASTC_12x10_KHR;
+      break;
+    }
+    case COMPRESSED_RGBA_ASTC_12x12_KHR:
+    {
+      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_RGBA_ASTC_12x12_KHR.\n" );
+      internalFormat = GL_COMPRESSED_RGBA_ASTC_12x12_KHR;
+      break;
+    }
+    case COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:
+    {
+      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR.\n" );
+      internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR;
+      break;
+    }
+    case COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:
+    {
+      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR.\n" );
+      internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR;
+      break;
+    }
+    case COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:
+    {
+      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR.\n" );
+      internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR;
+      break;
+    }
+    case COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:
+    {
+      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR.\n" );
+      internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR;
+      break;
+    }
+    case COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:
+    {
+      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR.\n" );
+      internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR;
+      break;
+    }
+    case COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:
+    {
+      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR.\n" );
+      internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR;
+      break;
+    }
+    case COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:
+    {
+      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR.\n" );
+      internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR;
+      break;
+    }
+    case COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:
+    {
+      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR.\n" );
+      internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR;
+      break;
+    }
+    case COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:
+    {
+      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR.\n" );
+      internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR;
+      break;
+    }
+    case COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:
+    {
+      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR.\n" );
+      internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR;
+      break;
+    }
+    case COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:
+    {
+      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR.\n" );
+      internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR;
+      break;
+    }
+    case COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:
+    {
+      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR.\n" );
+      internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR;
+      break;
+    }
+    case COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:
+    {
+      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR.\n" );
+      internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR;
+      break;
+    }
+    case COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:
+    {
+      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.1 standard compressed pixel format COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR.\n" );
+      internalFormat = GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR;
+      break;
+    }
+
+    // GLES 3.0 floating point formats.
+    case RGB16F:
+    {
+      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 GLES 3.0 floating point format.\n" );
+      pixelDataType = GL_HALF_FLOAT;
+      internalFormat= GL_RGB;
+      break;
+    }
+    case RGB32F:
+    {
+      DALI_LOG_INFO( Debug::Filter::gImage, Debug::Verbose, "Using GLES 3.0 GLES 3.0 floating point format.\n" );
+      pixelDataType = GL_FLOAT;
+      internalFormat= GL_RGB;
+      break;
+    }
+
+    // GLES 3.0 depth and stencil formats
+    case Pixel::DEPTH_UNSIGNED_INT:
+    {
+      pixelDataType = GL_UNSIGNED_INT;
+      internalFormat = GL_DEPTH_COMPONENT;
+      break;
+    }
+    case Pixel::DEPTH_FLOAT:
+    {
+      pixelDataType = GL_FLOAT;
+      internalFormat = GL_DEPTH_COMPONENT;
+      break;
+    }
+    case Pixel::DEPTH_STENCIL:
+    {
+      pixelDataType = GL_UNSIGNED_INT_24_8;
+      internalFormat = GL_DEPTH_STENCIL;
+      break;
+    }
+
+    case INVALID:
+    {
+      DALI_LOG_ERROR( "Invalid pixel format for bitmap\n" );
+      internalFormat = 0;
       break;
     }
   }
 }
 
-Bitmap* Bitmap::New(const Profile profile = BITMAP_2D_PACKED_PIXELS, const bool managePixelBuffer = true)
+Bitmap* Bitmap::New( const Profile profile = BITMAP_2D_PACKED_PIXELS,
+                     ResourcePolicy::Discardable discardable = ResourcePolicy::OWNED_DISCARD )
 {
   DALI_ASSERT_DEBUG(profile == BITMAP_2D_PACKED_PIXELS || profile == BITMAP_COMPRESSED);
 
@@ -252,20 +466,21 @@ Bitmap* Bitmap::New(const Profile profile = BITMAP_2D_PACKED_PIXELS, const bool
      * scanlines past the bottom of the image in the buffer if requested.*/
     case BITMAP_2D_PACKED_PIXELS:
     {
-      Bitmap * const bitmap = new Dali::Internal::BitmapPackedPixel(managePixelBuffer);
+      Bitmap * const bitmap = new Dali::Internal::BitmapPackedPixel( discardable );
       return bitmap;
     }
 
     /** The data for the bitmap is buffered in an opaque form.*/
     case BITMAP_COMPRESSED:
     {
-      return new Dali::Internal::BitmapCompressed(managePixelBuffer);
+      return new Dali::Internal::BitmapCompressed( discardable );
     }
   }
-  return 0;
+  return nullptr;
 }
 
-Bitmap::Bitmap( bool discardable, Dali::Integration::PixelBuffer* pixBuf)
+
+Bitmap::Bitmap( ResourcePolicy::Discardable discardable, Dali::Integration::PixelBuffer* pixBuf)
 : mImageWidth(0),
   mImageHeight(0),
   mPixelFormat(Pixel::RGBA8888),
@@ -276,24 +491,21 @@ Bitmap::Bitmap( bool discardable, Dali::Integration::PixelBuffer* pixBuf)
 {
 }
 
+PixelBuffer* Bitmap::GetBufferOwnership()
+{
+  PixelBuffer* buffer = mData;
+  mData = nullptr;
+  return buffer;
+}
+
 void Bitmap::DiscardBuffer()
 {
-  if ( mDiscardable )
+  if( mDiscardable == ResourcePolicy::OWNED_DISCARD )
   {
     DeletePixelBuffer();
   }
 }
 
-PixelBuffer* Bitmap::ReleaseBuffer()
-{
-  PixelBuffer* const data = mData;
-
-  // Ownership of mData has been transferred, so indicate that mData pointer is no longer valid:
-  mData = NULL;
-
-  return data;
-}
-
 Bitmap::~Bitmap()
 {
   DALI_LOG_TRACE_METHOD(Debug::Filter::gImage);
@@ -308,8 +520,8 @@ void Bitmap::DeletePixelBuffer()
   {
     return;
   }
-  delete [] mData;
-  mData = NULL;
+  free ( mData );
+  mData = nullptr;
 }
 
 
@@ -328,4 +540,3 @@ void Bitmap::Initialize( Pixel::Format pixelFormat,
 } //namespace Integration
 
 } //namespace Dali
-