Merge "[AT-SPI] Rework intercepting key events" into devel/master
authorSeoyeon Kim <seoyeon2.kim@samsung.com>
Thu, 14 Mar 2024 05:03:55 +0000 (05:03 +0000)
committerGerrit Code Review <gerrit@review>
Thu, 14 Mar 2024 05:03:55 +0000 (05:03 +0000)
24 files changed:
dali/devel-api/text-abstraction/glyph-buffer-data.cpp
dali/internal/accessibility/bridge/bridge-base.cpp
dali/internal/accessibility/bridge/bridge-base.h
dali/internal/graphics/gles-impl/egl-graphics-controller.cpp
dali/internal/graphics/gles-impl/gles-graphics-buffer.cpp
dali/internal/graphics/gles-impl/gles2-graphics-memory.cpp
dali/internal/graphics/gles/gl-proxy-implementation.cpp
dali/internal/imaging/common/gif-loading.cpp
dali/internal/imaging/common/image-operations.cpp
dali/internal/imaging/common/loader-jpeg-turbo.cpp
dali/internal/imaging/common/loader-png.cpp
dali/internal/imaging/common/pixel-buffer-impl.cpp
dali/internal/imaging/common/webp-loading.cpp
dali/internal/network/common/socket-impl.cpp
dali/internal/system/common/async-task-manager-impl.cpp
dali/internal/text/text-abstraction/bidirectional-support-impl.cpp
dali/internal/text/text-abstraction/cairo-renderer.cpp
dali/internal/text/text-abstraction/hyphenation-impl.cpp
dali/internal/text/text-abstraction/plugin/embedded-item.cpp
dali/internal/text/text-abstraction/plugin/font-client-plugin-impl.cpp
dali/internal/text/text-abstraction/plugin/font-client-utils.cpp
dali/internal/text/text-abstraction/plugin/font-face-glyph-cache-manager.cpp
dali/public-api/dali-adaptor-version.cpp
packaging/dali-adaptor.spec

index fec3884..39a3a34 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -97,6 +97,7 @@ size_t GlyphBufferData::Compress(const uint8_t* const __restrict__ inBuffer, Gly
       compressedBuffer = (uint8_t*)malloc(bufferSize);
       if(DALI_UNLIKELY(compressedBuffer == nullptr))
       {
+        DALI_LOG_ERROR("malloc is failed. request malloc size : %zu\n", bufferSize);
         return 0u;
       }
       outBufferData.isBufferOwned = true;
@@ -116,6 +117,7 @@ size_t GlyphBufferData::Compress(const uint8_t* const __restrict__ inBuffer, Gly
       compressedBuffer = (uint8_t*)malloc(bufferSize);
       if(DALI_UNLIKELY(compressedBuffer == nullptr))
       {
+        DALI_LOG_ERROR("malloc is failed. request malloc size : %zu\n", bufferSize);
         return 0u;
       }
       outBufferData.isBufferOwned = true;
@@ -148,6 +150,7 @@ size_t GlyphBufferData::Compress(const uint8_t* const __restrict__ inBuffer, Gly
       uint8_t* __restrict__ tempBuffer = (uint8_t*)malloc(outBufferData.height * (widthByte + 1));
       if(DALI_UNLIKELY(tempBuffer == nullptr))
       {
+        DALI_LOG_ERROR("malloc is failed. request malloc size : %u\n", outBufferData.height * (widthByte + 1));
         return 0u;
       }
 
@@ -294,6 +297,7 @@ size_t GlyphBufferData::Compress(const uint8_t* const __restrict__ inBuffer, Gly
       compressedBuffer = (uint8_t*)malloc(bufferSize);
       if(DALI_UNLIKELY(compressedBuffer == nullptr))
       {
+        DALI_LOG_ERROR("malloc is failed. request malloc size : %zu\n", bufferSize);
         free(tempBuffer);
         return 0u;
       }
index 4509694..a819f25 100644 (file)
@@ -25,6 +25,7 @@
 #include <memory>
 
 // INTERNAL INCLUDES
+#include <dali/devel-api/adaptor-framework/window-devel.h>
 #include <dali/public-api/adaptor-framework/timer.h>
 
 using namespace Dali::Accessibility;
@@ -227,28 +228,68 @@ void BridgeBase::RemoveTopLevelWindow(Accessible* windowAccessible)
   }
 }
 
+void BridgeBase::CompressDefaultLabels()
+{
+  // Remove entries for objects which no longer exist
+  mDefaultLabels.remove_if([](const DefaultLabelType& label) {
+    return !label.first.GetBaseHandle(); // Check window's weak handle
+    // TODO: Once Accessible becomes a handle type, check its weak handle here as well
+  });
+}
+
 void BridgeBase::RegisterDefaultLabel(Accessible* object)
 {
-  if(std::find(mDefaultLabels.begin(), mDefaultLabels.end(), object) == mDefaultLabels.end())
+  CompressDefaultLabels();
+
+  Dali::WeakHandle<Dali::Window> window = GetWindow(object);
+  if(!window.GetBaseHandle()) // true also if `object` is null
+  {
+    DALI_LOG_ERROR("Cannot register default label: object does not belong to any window");
+    return;
+  }
+
+  auto it = std::find_if(mDefaultLabels.begin(), mDefaultLabels.end(), [object](const DefaultLabelType& label) {
+    return object == label.second;
+  });
+
+  if(it == mDefaultLabels.end())
+  {
+    mDefaultLabels.push_back({window, object});
+  }
+  else if(it->first != window)
+  {
+    // TODO: Tentative implementation. It is yet to be specified what should happen
+    // when the same object is re-registered as a default label for another window.
+    *it = {window, object};
+  }
+  else // it->first == window && it->second == object
   {
-    mDefaultLabels.push_back(object);
+    // Nothing to do
   }
 }
 
 void BridgeBase::UnregisterDefaultLabel(Accessible* object)
 {
-  auto it = std::find(mDefaultLabels.begin(), mDefaultLabels.end(), object);
-  if(it != mDefaultLabels.end())
-  {
-    mDefaultLabels.erase(it);
-  }
+  CompressDefaultLabels();
+
+  mDefaultLabels.remove_if([object](const DefaultLabelType& label) {
+    return object == label.second;
+  });
 }
 
 Accessible* BridgeBase::GetDefaultLabel(Accessible* root) const
 {
-  // TODO (multi-window support): Change mDefaultLabels to a collection of vectors
-  // (one per window) and select the right one based on the window that 'root' belongs to.
-  return mDefaultLabels.empty() ? root : mDefaultLabels.back();
+  Dali::WeakHandle<Dali::Window> window = GetWindow(root);
+  if(!window.GetBaseHandle())
+  {
+    return root;
+  }
+
+  auto it = std::find_if(mDefaultLabels.rbegin(), mDefaultLabels.rend(), [&window](const DefaultLabelType& label) {
+    return window == label.first;
+  });
+
+  return (it == mDefaultLabels.rend()) ? root : it->second;
 }
 
 std::string BridgeBase::StripPrefix(const std::string& path)
@@ -360,3 +401,17 @@ auto BridgeBase::CreateCacheElement(Accessible* item) -> CacheElementType
     item->GetDescription(),
     item->GetStates().GetRawData());
 }
+
+Dali::WeakHandle<Dali::Window> BridgeBase::GetWindow(Dali::Accessibility::Accessible* accessible)
+{
+  Dali::WeakHandle<Dali::Window> windowHandle;
+  Dali::Actor                    actor = accessible ? accessible->GetInternalActor() : Dali::Actor();
+
+  if(actor)
+  {
+    Dali::Window window = Dali::DevelWindow::Get(actor);
+    windowHandle        = {window};
+  }
+
+  return windowHandle;
+}
index 81a6dfb..ab79723 100644 (file)
@@ -21,6 +21,7 @@
 // EXTERNAL INCLUDES
 #include <dali/public-api/actors/layer.h>
 #include <dali/public-api/dali-adaptor-version.h>
+#include <dali/public-api/object/weak-handle.h>
 #include <dali/public-api/signals/connection-tracker.h>
 #include <memory>
 #include <tuple>
@@ -612,9 +613,13 @@ public:
   }
 
 protected:
-  mutable ApplicationAccessible                 mApplication;
-  std::vector<Dali::Accessibility::Accessible*> mDefaultLabels;
-  bool                                          mIsScreenReaderSuppressed = false;
+  // We use a weak handle in order not to keep a window alive forever if someone forgets to UnregisterDefaultLabel()
+  using DefaultLabelType  = std::pair<Dali::WeakHandle<Dali::Window>, Dali::Accessibility::Accessible*>;
+  using DefaultLabelsType = std::list<DefaultLabelType>;
+
+  mutable ApplicationAccessible mApplication;
+  DefaultLabelsType             mDefaultLabels;
+  bool                          mIsScreenReaderSuppressed = false;
 
 private:
   /**
@@ -664,6 +669,19 @@ private:
    */
   CacheElementType CreateCacheElement(Dali::Accessibility::Accessible* item);
 
+  /**
+   * @brief Removes expired elements from the default label collection.
+   */
+  void CompressDefaultLabels();
+
+  /**
+   * @brief Gets the window to which this accessible belongs (or an empty handle).
+   *
+   * @param accessible The accessible
+   * @return The window
+   */
+  static Dali::WeakHandle<Dali::Window> GetWindow(Dali::Accessibility::Accessible* accessible);
+
 protected:
   BridgeBase();
   virtual ~BridgeBase();
index a3eb62f..88bc34e 100644 (file)
@@ -933,11 +933,18 @@ void EglGraphicsController::UpdateTextures(const std::vector<TextureUpdateInfo>&
 
         uint8_t* stagingBuffer = reinterpret_cast<uint8_t*>(malloc(info.srcSize));
 
-        uint8_t* srcMemory = &reinterpret_cast<uint8_t*>(source.memorySource.memory)[info.srcOffset];
+        if(DALI_UNLIKELY(stagingBuffer == nullptr))
+        {
+          DALI_LOG_ERROR("malloc is failed. request malloc size : %u\n", info.srcSize);
+        }
+        else
+        {
+          uint8_t* srcMemory = &reinterpret_cast<uint8_t*>(source.memorySource.memory)[info.srcOffset];
 
-        std::copy(srcMemory, srcMemory + info.srcSize, stagingBuffer);
+          std::copy(srcMemory, srcMemory + info.srcSize, stagingBuffer);
 
-        mTextureUploadTotalCPUMemoryUsed += info.srcSize;
+          mTextureUploadTotalCPUMemoryUsed += info.srcSize;
+        }
 
         // store staging buffer
         source.memorySource.memory = stagingBuffer;
index f41ca6c..d2fbaaf 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -56,11 +56,11 @@ bool Buffer::TryRecycle(const Graphics::BufferCreateInfo& createInfo, Graphics::
   mSetForGLRecycling = false;
 
   // if different buffer spec, we need new buffer
-  if(!(createInfo.size == mCreateInfo.size
-     && createInfo.allocationCallbacks == mCreateInfo.allocationCallbacks
-     && createInfo.propertiesFlags == mCreateInfo.propertiesFlags
-     && createInfo.usage == mCreateInfo.usage
-     && createInfo.nextExtension == mCreateInfo.nextExtension ))
+  if(!(createInfo.size == mCreateInfo.size &&
+       createInfo.allocationCallbacks == mCreateInfo.allocationCallbacks &&
+       createInfo.propertiesFlags == mCreateInfo.propertiesFlags &&
+       createInfo.usage == mCreateInfo.usage &&
+       createInfo.nextExtension == mCreateInfo.nextExtension))
   {
     return false;
   }
@@ -116,6 +116,10 @@ void Buffer::InitializeCPUBuffer()
   else
   {
     mBufferPtr = malloc(mCreateInfo.size);
+    if(DALI_UNLIKELY(mBufferPtr == nullptr))
+    {
+      DALI_LOG_ERROR("malloc is failed. request malloc size : %u\n", mCreateInfo.size);
+    }
   }
 }
 
index 92b4ef0..6ad22f8 100644 (file)
@@ -63,8 +63,12 @@ void* Memory2::LockRegion(uint32_t offset, uint32_t size)
     }
     else
     {
-      auto retval         = malloc(size);
-      mMappedPointer      = retval;
+      auto retval    = malloc(size);
+      mMappedPointer = retval;
+      if(DALI_UNLIKELY(mMappedPointer == nullptr))
+      {
+        DALI_LOG_ERROR("malloc is failed. request malloc size : %u\n", size);
+      }
       mIsAllocatedLocally = true;
     }
   }
index 33da896..0e8cd7d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -85,7 +85,7 @@ void Sampler::Accumulate()
   mNumSamples++;
 
   mAccumulated += mCurrentFrameCount;
-  mAccumulatedSquare += (mCurrentFrameCount * mCurrentFrameCount);
+  mAccumulatedSquare += (static_cast<uint64_t>(mCurrentFrameCount) * static_cast<uint64_t>(mCurrentFrameCount));
   mCurrentFrameCount = 0;
 }
 const char* Sampler::GetDescription() const
index 37d8109..c35899a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -315,8 +315,13 @@ bool LoaderInfo::FileData::LoadLocalFile()
 
   if(DALI_LIKELY(!fseek(fp, 0, SEEK_SET)))
   {
-    globalMap = reinterpret_cast<GifByteType*>(malloc(sizeof(GifByteType) * length));
-    length    = fread(globalMap, sizeof(GifByteType), length, fp);
+    globalMap = reinterpret_cast<GifByteType*>(malloc(sizeof(GifByteType) * static_cast<unsigned long long>(length)));
+    if(DALI_UNLIKELY(globalMap == nullptr))
+    {
+      DALI_LOG_ERROR("malloc is failed. request malloc size : %llu\n", sizeof(GifByteType) * static_cast<unsigned long long>(length));
+      return false;
+    }
+    length = fread(globalMap, sizeof(GifByteType), length, fp);
   }
   else
   {
@@ -346,8 +351,15 @@ bool LoaderInfo::FileData::LoadRemoteFile()
         if(DALI_LIKELY(!fseek(fp, 0, SEEK_SET)))
         {
           globalMap = reinterpret_cast<GifByteType*>(malloc(sizeof(GifByteType) * blobSize));
-          length    = fread(globalMap, sizeof(GifByteType), blobSize, fp);
-          succeeded = true;
+          if(DALI_UNLIKELY(globalMap == nullptr))
+          {
+            DALI_LOG_ERROR("malloc is failed. request malloc size : %zu\n", sizeof(GifByteType) * blobSize);
+          }
+          else
+          {
+            length    = fread(globalMap, sizeof(GifByteType), blobSize, fp);
+            succeeded = true;
+          }
         }
         else
         {
index f4863ab..93b23dd 100644 (file)
@@ -529,6 +529,7 @@ bool Rotate90(const uint8_t* const pixelsIn,
   pixelsOut = static_cast<uint8_t*>(malloc(widthOut * heightOut * pixelSize));
   if(nullptr == pixelsOut)
   {
+    DALI_LOG_ERROR("malloc is failed. request malloc size : %u x %u x %u\n", widthOut, heightOut, pixelSize);
     widthOut  = 0u;
     heightOut = 0u;
 
@@ -587,6 +588,7 @@ bool Rotate180(const uint8_t* const pixelsIn,
   pixelsOut = static_cast<uint8_t*>(malloc(widthIn * heightIn * pixelSize));
   if(nullptr == pixelsOut)
   {
+    DALI_LOG_ERROR("malloc is failed. request malloc size : %u x %u x %u\n", widthIn, heightIn, pixelSize);
     // Return if the memory allocations fails.
     return false;
   }
@@ -650,6 +652,7 @@ bool Rotate270(const uint8_t* const pixelsIn,
   pixelsOut = static_cast<uint8_t*>(malloc(widthOut * heightOut * pixelSize));
   if(nullptr == pixelsOut)
   {
+    DALI_LOG_ERROR("malloc is failed. request malloc size : %u x %u x %u\n", widthOut, heightOut, pixelSize);
     widthOut  = 0u;
     heightOut = 0u;
 
@@ -2557,6 +2560,7 @@ void RotateByShear(const uint8_t* const pixelsIn,
 
   if(nullptr == pixelsOut)
   {
+    DALI_LOG_ERROR("malloc is failed. request malloc size : %u x %u x %u\n", widthOut, heightOut, pixelSize);
     widthOut  = 0u;
     heightOut = 0u;
 
@@ -2595,6 +2599,7 @@ void RotateByShear(const uint8_t* const pixelsIn,
 
   if(nullptr == pixelsOut)
   {
+    DALI_LOG_ERROR("malloc is failed. request malloc size : %u x %u x %u\n", widthOut, heightOut, pixelSize);
     widthOut  = 0u;
     heightOut = 0u;
 
@@ -2632,6 +2637,7 @@ void RotateByShear(const uint8_t* const pixelsIn,
 
   if(nullptr == pixelsOut)
   {
+    DALI_LOG_ERROR("malloc is failed. request malloc size : %u x %u x %u\n", widthOut, heightOut, pixelSize);
     widthOut  = 0u;
     heightOut = 0u;
 
@@ -2685,6 +2691,7 @@ void HorizontalShear(const uint8_t* const pixelsIn,
 
   if(nullptr == pixelsOut)
   {
+    DALI_LOG_ERROR("malloc is failed. request malloc size : %u x %u x %u\n", widthOut, heightOut, pixelSize);
     widthOut  = 0u;
     heightOut = 0u;
 
index 7a7f42b..86daa1f 100644 (file)
@@ -894,7 +894,7 @@ bool DecodeJpeg(const Dali::ImageLoader::Input& input, std::vector<Dali::Devel::
       auto planeSize = tjPlaneSizeYUV(i, scaledPostXformWidth, 0, scaledPostXformHeight, chrominanceSubsampling);
 
       uint8_t* buffer = static_cast<uint8_t*>(malloc(planeSize));
-      if(!buffer)
+      if(DALI_UNLIKELY(!buffer))
       {
         DALI_LOG_ERROR("Buffer allocation is failed [%d]\n", planeSize);
         pixelBuffers.clear();
@@ -982,6 +982,12 @@ bool DecodeJpeg(const Dali::ImageLoader::Input& input, std::vector<Dali::Devel::
 
       uint8_t* cmykBuffer = static_cast<uint8_t*>(malloc(sizeof(uint8_t) * scaledPostXformWidth * scaledPostXformHeight * cmykBytesPerPixel));
 
+      if(DALI_UNLIKELY(!cmykBuffer))
+      {
+        DALI_LOG_ERROR("cmykBuffer allocation is failed [%zu]\n", sizeof(uint8_t) * scaledPostXformWidth * scaledPostXformHeight * cmykBytesPerPixel);
+        return false;
+      }
+
       decodeResult = tjDecompress2(jpeg.get(), jpegBufferPtr, jpegBufferSize, reinterpret_cast<uint8_t*>(cmykBuffer), scaledPreXformWidth, 0, scaledPreXformHeight, pixelLibJpegType, flags);
       if(DALI_UNLIKELY(decodeResult == -1 && IsJpegDecodingFailed()))
       {
@@ -1194,7 +1200,7 @@ bool TransformSize(int requiredWidth, int requiredHeight, FittingMode::Type fitt
     // Internal jpeg downscaling is the same as our BOX_X sampling modes so only
     // apply it if the application requested one of those:
     // (use a switch case here so this code will fail to compile if other modes are added)
-    bool downscale = true;
+    bool useTurboJpegScaleFactor = true;
     switch(samplingMode)
     {
       case SamplingMode::BOX:
@@ -1202,26 +1208,30 @@ bool TransformSize(int requiredWidth, int requiredHeight, FittingMode::Type fitt
       case SamplingMode::BOX_THEN_LINEAR:
       case SamplingMode::DONT_CARE:
       {
-        downscale = true;
+        useTurboJpegScaleFactor = true;
         break;
       }
       case SamplingMode::NO_FILTER:
       case SamplingMode::NEAREST:
       case SamplingMode::LINEAR:
       {
-        downscale = false;
+        useTurboJpegScaleFactor = false;
         break;
       }
     }
 
-    int scaleFactorIndex(0);
-    if(downscale)
+    int scaleFactorIndex(-1);
+    int fittedScaledWidth(postXformImageWidth);
+    int fittedScaledHeight(postXformImageHeight);
+    if(useTurboJpegScaleFactor)
     {
       // Find nearest supported scaling factor (factors are in sequential order, getting smaller)
-      for(int i = 1; i < numFactors; ++i)
+      for(int i = 0; i < numFactors; ++i)
       {
-        bool widthLessRequired  = TJSCALED(postXformImageWidth, factors[i]) < requiredWidth;
-        bool heightLessRequired = TJSCALED(postXformImageHeight, factors[i]) < requiredHeight;
+        int  scaledWidth        = TJSCALED(postXformImageWidth, factors[i]);
+        int  scaledHeight       = TJSCALED(postXformImageHeight, factors[i]);
+        bool widthLessRequired  = scaledWidth < requiredWidth;
+        bool heightLessRequired = scaledHeight < requiredHeight;
         // If either scaled dimension is smaller than the desired one, we were done at the last iteration
         if((fittingMode == FittingMode::SCALE_TO_FILL) && (widthLessRequired || heightLessRequired))
         {
@@ -1243,31 +1253,41 @@ bool TransformSize(int requiredWidth, int requiredHeight, FittingMode::Type fitt
           break;
         }
         // This factor stays is within our fitting mode constraint so remember it:
-        scaleFactorIndex = i;
+        scaleFactorIndex   = i;
+        fittedScaledWidth  = scaledWidth;
+        fittedScaledHeight = scaledHeight;
       }
     }
 
+    const int maxTextureSize = static_cast<int>(Dali::GetMaxTextureSize());
+
     // Regardless of requested size, downscale to avoid exceeding the maximum texture size:
-    for(int i = scaleFactorIndex; i < numFactors; ++i)
+    if(fittedScaledWidth >= maxTextureSize ||
+       fittedScaledHeight >= maxTextureSize)
     {
-      // Continue downscaling to below maximum texture size (if possible)
-      scaleFactorIndex = i;
-
-      if(TJSCALED(postXformImageWidth, (factors[i])) < static_cast<int>(Dali::GetMaxTextureSize()) &&
-         TJSCALED(postXformImageHeight, (factors[i])) < static_cast<int>(Dali::GetMaxTextureSize()))
+      for(int i = scaleFactorIndex + 1; i < numFactors; ++i)
       {
-        // Current scale-factor downscales to below maximum texture size
-        break;
+        // Continue downscaling to below maximum texture size (if possible)
+        scaleFactorIndex   = i;
+        fittedScaledWidth  = TJSCALED(postXformImageWidth, factors[i]);
+        fittedScaledHeight = TJSCALED(postXformImageHeight, factors[i]);
+
+        if(fittedScaledWidth < maxTextureSize &&
+           fittedScaledHeight < maxTextureSize)
+        {
+          // Current scale-factor downscales to below maximum texture size
+          break;
+        }
       }
     }
 
     // We have finally chosen the scale-factor, return width/height values
-    if(scaleFactorIndex > 0)
+    if(scaleFactorIndex >= 0 && scaleFactorIndex < numFactors)
     {
       preXformImageWidth   = TJSCALED(preXformImageWidth, (factors[scaleFactorIndex]));
       preXformImageHeight  = TJSCALED(preXformImageHeight, (factors[scaleFactorIndex]));
-      postXformImageWidth  = TJSCALED(postXformImageWidth, (factors[scaleFactorIndex]));
-      postXformImageHeight = TJSCALED(postXformImageHeight, (factors[scaleFactorIndex]));
+      postXformImageWidth  = fittedScaledWidth;
+      postXformImageHeight = fittedScaledHeight;
     }
   }
 
index 8351aa7..fa855db 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -315,7 +315,7 @@ bool LoadBitmapFromPng(const Dali::ImageLoader::Input& input, Dali::Devel::Pixel
   rows = reinterpret_cast<png_bytep*>(malloc(sizeof(png_bytep) * height));
   if(DALI_UNLIKELY(!rows))
   {
-    DALI_LOG_ERROR("malloc is failed\n");
+    DALI_LOG_ERROR("malloc is failed. request malloc size : %zu\n", sizeof(png_bytep) * height);
     return false;
   }
 
index 3afdce5..0ed142e 100644 (file)
@@ -84,6 +84,10 @@ PixelBufferPtr PixelBuffer::New(uint32_t            width,
   if(bufferSize > 0)
   {
     buffer = static_cast<uint8_t*>(malloc(bufferSize));
+    if(DALI_UNLIKELY(!buffer))
+    {
+      DALI_LOG_ERROR("malloc is failed. request malloc size : %u\n", bufferSize);
+    }
 #if defined(DEBUG_ENABLED)
     gPixelBufferAllocationTotal += bufferSize;
 #endif
@@ -180,6 +184,11 @@ Dali::PixelData PixelBuffer::CreatePixelData() const
   if(mBufferSize > 0)
   {
     destBuffer = static_cast<uint8_t*>(malloc(mBufferSize));
+    if(DALI_UNLIKELY(!destBuffer))
+    {
+      DALI_LOG_ERROR("malloc is failed. request malloc size : %u\n", mBufferSize);
+      return Dali::PixelData();
+    }
     memcpy(destBuffer, mBuffer, mBufferSize);
   }
 
@@ -264,6 +273,10 @@ void PixelBuffer::AllocateFixedSize(uint32_t size)
   ReleaseBuffer();
   mBuffer     = reinterpret_cast<unsigned char*>(malloc(size));
   mBufferSize = size;
+  if(DALI_UNLIKELY(!mBuffer))
+  {
+    DALI_LOG_ERROR("malloc is failed. request malloc size : %u\n", mBufferSize);
+  }
 #if defined(DEBUG_ENABLED)
   gPixelBufferAllocationTotal += size;
 #endif
index 0dd3c85..24f1506 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -206,7 +206,12 @@ public:
 
       if(DALI_LIKELY(!fseek(fp, 0, SEEK_SET)))
       {
-        mBuffer     = reinterpret_cast<WebPByteType*>(malloc(sizeof(WebPByteType) * mBufferSize));
+        mBuffer = reinterpret_cast<WebPByteType*>(malloc(sizeof(WebPByteType) * mBufferSize));
+        if(DALI_UNLIKELY(!mBuffer))
+        {
+          DALI_LOG_ERROR("malloc is failed. request malloc size : %zu\n", sizeof(WebPByteType) * mBufferSize);
+          return false;
+        }
         mBufferSize = fread(mBuffer, sizeof(WebPByteType), mBufferSize, fp);
         return true;
       }
@@ -337,7 +342,7 @@ Dali::Devel::PixelBuffer WebPLoading::LoadFrame(uint32_t frameIndex, ImageDimens
 
         if(desiredSize.GetWidth() > 0 && desiredSize.GetHeight() > 0)
         {
-          const int desiredWidth = desiredSize.GetWidth();
+          const int desiredWidth  = desiredSize.GetWidth();
           const int desiredHeight = desiredSize.GetHeight();
 
           WebPDecoderConfig config;
@@ -348,8 +353,8 @@ Dali::Devel::PixelBuffer WebPLoading::LoadFrame(uint32_t frameIndex, ImageDimens
           }
 
           // Apply config for scaling
-          config.options.use_scaling = 1;
-          config.options.scaled_width = desiredWidth;
+          config.options.use_scaling   = 1;
+          config.options.scaled_width  = desiredWidth;
           config.options.scaled_height = desiredHeight;
 
           if(channelNumber == 4)
@@ -372,9 +377,9 @@ Dali::Devel::PixelBuffer WebPLoading::LoadFrame(uint32_t frameIndex, ImageDimens
 
           if(frameBuffer != nullptr)
           {
-            Pixel::Format                     pixelFormat = (channelNumber == 4) ? Pixel::RGBA8888 : Pixel::RGB888;
-            int32_t                           bufferSize  = desiredWidth * desiredHeight * Dali::Pixel::GetBytesPerPixel(pixelFormat);
-            pixelBuffer  = Dali::Devel::PixelBuffer::New(desiredWidth, desiredHeight, pixelFormat);
+            Pixel::Format pixelFormat = (channelNumber == 4) ? Pixel::RGBA8888 : Pixel::RGB888;
+            int32_t       bufferSize  = desiredWidth * desiredHeight * Dali::Pixel::GetBytesPerPixel(pixelFormat);
+            pixelBuffer               = Dali::Devel::PixelBuffer::New(desiredWidth, desiredHeight, pixelFormat);
             memcpy(pixelBuffer.GetBuffer(), frameBuffer, bufferSize);
           }
 
@@ -395,9 +400,8 @@ Dali::Devel::PixelBuffer WebPLoading::LoadFrame(uint32_t frameIndex, ImageDimens
           {
             Pixel::Format                     pixelFormat = (channelNumber == 4) ? Pixel::RGBA8888 : Pixel::RGB888;
             int32_t                           bufferSize  = width * height * Dali::Pixel::GetBytesPerPixel(pixelFormat);
-            Internal::Adaptor::PixelBufferPtr internal =
-            Internal::Adaptor::PixelBuffer::New(frameBuffer, bufferSize, width, height, width, pixelFormat);
-            pixelBuffer = Devel::PixelBuffer(internal.Get());
+            Internal::Adaptor::PixelBufferPtr internal    = Internal::Adaptor::PixelBuffer::New(frameBuffer, bufferSize, width, height, width, pixelFormat);
+            pixelBuffer                                   = Devel::PixelBuffer(internal.Get());
           }
         }
       }
index e34ed4a..5929e13 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -336,12 +336,18 @@ bool Socket::Write(const void* buffer, unsigned int bufferSizeInBytes)
     return false;
   }
 
-  int bytesWritten = 0;
+  unsigned int bytesWritten = 0;
 
   // write isn't guaranteed to write the entire buffer in one go
 
-  while(bytesWritten != static_cast<int>(bufferSizeInBytes))
+  while(bytesWritten != bufferSizeInBytes)
   {
+    if(bufferSizeInBytes < bytesWritten)
+    {
+      DALI_LOG_ERROR("Socket writer error! required size : %u byte, real written : %u byte \n", bufferSizeInBytes, bytesWritten);
+      return false;
+    }
+
     const char* byteBuffer = static_cast<const char*>(buffer);
     byteBuffer += bytesWritten;
 
index 3f9ee4e..2f2a2bf 100644 (file)
@@ -711,7 +711,7 @@ void AsyncTaskManager::RemoveTask(AsyncTaskPtr task)
         for(auto& iterator : mapIter->second)
         {
           DALI_ASSERT_DEBUG((*iterator) == task);
-          if((*iterator)->GetPriorityType() == AsyncTask::PriorityType::HIGH)
+          if((*iterator)->GetPriorityType() == AsyncTask::PriorityType::HIGH && mWaitingHighProirityTaskCounts > 0u)
           {
             // Decrease the number of waiting tasks for high priority.
             --mWaitingHighProirityTaskCounts;
@@ -1057,7 +1057,7 @@ AsyncTaskPtr AsyncTaskManager::PopNextTaskToProcess()
           }
         }
 
-        if(priorityType == AsyncTask::PriorityType::HIGH)
+        if(priorityType == AsyncTask::PriorityType::HIGH && mWaitingHighProirityTaskCounts > 0u)
         {
           // Decrease the number of waiting tasks for high priority.
           --mWaitingHighProirityTaskCounts;
index 726ac92..7439466 100644 (file)
@@ -110,15 +110,17 @@ struct BidirectionalSupport::Plugin
     BidirectionalInfo* bidirectionalInfo = new BidirectionalInfo();
 
     bidirectionalInfo->characterTypes = reinterpret_cast<FriBidiCharType*>(malloc(numberOfCharacters * sizeof(FriBidiCharType)));
-    if(!bidirectionalInfo->characterTypes)
+    if(DALI_UNLIKELY(!bidirectionalInfo->characterTypes))
     {
+      DALI_LOG_ERROR("malloc is failed. request malloc size : %zu\n", numberOfCharacters * sizeof(FriBidiCharType));
       delete bidirectionalInfo;
       return 0;
     }
 
     bidirectionalInfo->embeddedLevels = reinterpret_cast<FriBidiLevel*>(malloc(numberOfCharacters * sizeof(FriBidiLevel)));
-    if(!bidirectionalInfo->embeddedLevels)
+    if(DALI_UNLIKELY(!bidirectionalInfo->embeddedLevels))
     {
+      DALI_LOG_ERROR("malloc is failed. request malloc size : %zu\n", numberOfCharacters * sizeof(FriBidiLevel));
       free(bidirectionalInfo->characterTypes);
       delete bidirectionalInfo;
       return 0;
@@ -133,7 +135,9 @@ struct BidirectionalSupport::Plugin
     bidirectionalInfo->bracketTypes = reinterpret_cast<FriBidiBracketType*>(malloc(numberOfCharacters * sizeof(FriBidiBracketType)));
     if(!bidirectionalInfo->bracketTypes)
     {
-      free(bidirectionalInfo->bracketTypes);
+      DALI_LOG_ERROR("malloc is failed. request malloc size : %zu\n", numberOfCharacters * sizeof(FriBidiBracketType));
+      free(bidirectionalInfo->embeddedLevels);
+      free(bidirectionalInfo->characterTypes);
       delete bidirectionalInfo;
       return 0;
     }
@@ -143,8 +147,9 @@ struct BidirectionalSupport::Plugin
     // Retrieve the embedding levels.
     if(fribidi_get_par_embedding_levels_ex(bidirectionalInfo->characterTypes, bidirectionalInfo->bracketTypes, numberOfCharacters, &bidirectionalInfo->paragraphDirection, bidirectionalInfo->embeddedLevels) == 0)
     {
-      free(bidirectionalInfo->characterTypes);
       free(bidirectionalInfo->bracketTypes);
+      free(bidirectionalInfo->embeddedLevels);
+      free(bidirectionalInfo->characterTypes);
       delete bidirectionalInfo;
       return 0;
     }
@@ -216,7 +221,7 @@ struct BidirectionalSupport::Plugin
     // Copy embedded levels as fribidi_reorder_line() may change them.
     const size_t  embeddedLevelsSize = static_cast<std::size_t>(numberOfCharacters) * sizeof(FriBidiLevel);
     FriBidiLevel* embeddedLevels     = reinterpret_cast<FriBidiLevel*>(malloc(embeddedLevelsSize));
-    if(embeddedLevels)
+    if(DALI_LIKELY(embeddedLevels))
     {
       memcpy(embeddedLevels, bidirectionalInfo->embeddedLevels + firstCharacterIndex, embeddedLevelsSize);
 
@@ -236,6 +241,10 @@ struct BidirectionalSupport::Plugin
       // Free resources.
       free(embeddedLevels);
     }
+    else
+    {
+      DALI_LOG_ERROR("malloc is failed. request malloc size : %zu\n", embeddedLevelsSize);
+    }
   }
 
   bool GetMirroredText(Character*          text,
index 4d7af0d..ed70ccb 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -369,7 +369,7 @@ void CopyImageToSurface(
   const int                                        rgbaCase,
   const double                                     glyphX,
   const double                                     glyphY,
-  const int                                        strideWidth,
+  const unsigned int                               strideWidth,
   const Vector4&                                   color,
   const bool                                       doBlendWithTextColor)
 {
@@ -685,9 +685,9 @@ Devel::PixelBuffer RenderTextCairo(const TextAbstraction::TextRenderer::Paramete
 
   // This function provides a stride value that will respect all alignment requirements of the
   // accelerated image-rendering code within cairo.
-  const int stride      = cairo_format_stride_for_width(cairoFormat,
+  const int          stride      = cairo_format_stride_for_width(cairoFormat,
                                                    static_cast<int>(parameters.width));
-  const int strideWidth = stride / bpp;
+  const unsigned int strideWidth = static_cast<unsigned int>(std::abs(stride)) / bpp;
 
   // Convert from DALi glyphs to Cairo glyphs.
   std::vector<cairo_glyph_t> cairoGlyphs;
@@ -736,7 +736,7 @@ Devel::PixelBuffer RenderTextCairo(const TextAbstraction::TextRenderer::Paramete
   Devel::PixelBuffer pixelBuffer = Devel::PixelBuffer::New(strideWidth, parameters.height, pixelFormat);
 
   unsigned char*     buffer     = pixelBuffer.GetBuffer();
-  const unsigned int bufferSize = stride * parameters.height;
+  const unsigned int bufferSize = static_cast<unsigned int>(std::abs(stride)) * parameters.height;
   memset(buffer, 0, bufferSize);
 
   std::unique_ptr<cairo_surface_t, void (*)(cairo_surface_t*)> surfacePtr(cairo_image_surface_create_for_data(buffer,
@@ -908,6 +908,10 @@ Devel::PixelBuffer RenderTextCairo(const TextAbstraction::TextRenderer::Paramete
                 data.buffer          = newBuffer;
                 data.compressionType = TextAbstraction::GlyphBufferData::CompressionType::NO_COMPRESSION;
               }
+              else
+              {
+                DALI_LOG_ERROR("malloc is failed. request malloc size : %u x %u x %u\n", widthOut, heightOut, pixelSize);
+              }
             }
 
             Dali::Internal::Platform::RotateByShear(data.buffer,
index bc460ee..972b88e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -165,7 +165,7 @@ struct Hyphenation::Plugin
     }
 
     hyphens = (char*)malloc(wordLength + 5);
-    if(hyphens)
+    if(DALI_LIKELY(hyphens))
     {
       hnj_hyphen_hyphenate2(dict, (char*)(word), wordLength, hyphens, NULL, &rep, &pos, &cut);
 
@@ -178,6 +178,10 @@ struct Hyphenation::Plugin
 
       free(hyphens);
     }
+    else
+    {
+      DALI_LOG_ERROR("malloc is failed. request malloc size : %u\n", wordLength + 5);
+    }
 #endif
 
     return hyphensList;
index a0c8335..fc1e529 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -18,6 +18,8 @@
 
 #include <dali/internal/text/text-abstraction/plugin/font-client-utils.h>
 
+#include <dali/integration-api/debug.h>
+
 namespace Dali::TextAbstraction::Internal
 {
 void EmbeddedItem::GetGlyphMetrics(GlyphInfo& glyph)
@@ -51,8 +53,14 @@ void EmbeddedItem::CreateBitmap(const std::vector<PixelBufferCacheItem>& pixelBu
     // Creates the output buffer
     const uint32_t bufferSize = data.width * data.height * 4u;
     data.buffer               = (uint8_t*)malloc(bufferSize); // @note The caller is responsible for deallocating the bitmap data using free.
-
-    memset(data.buffer, 0u, bufferSize);
+    if(DALI_UNLIKELY(!data.buffer))
+    {
+      DALI_LOG_ERROR("malloc is failed. request malloc size : %u\n", bufferSize);
+    }
+    else
+    {
+      memset(data.buffer, 0u, bufferSize);
+    }
 
     // Just creates a void buffer. Doesn't matter what pixel format is set as is the application code the responsible of filling it.
   }
index 2d9ac73..2c962a6 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -765,21 +765,24 @@ FontId FontClient::Plugin::GetFontId(const FontDescription& fontDescription,
   // Check if exists a pair 'fontDescriptionId, requestedPointSize' in the cache.
   if(!mCacheHandler->FindFont(fontDescriptionId, requestedPointSize, fontCacheIndex))
   {
-    // Retrieve the font file name path.
-    const FontDescription& description = *(mCacheHandler->mFontDescriptionCache.begin() + fontDescriptionId - 1u);
+    if(fontDescriptionId > 0u && fontDescriptionId <= mCacheHandler->mCharacterSetCache.Count())
+    {
+      // Retrieve the font file name path.
+      const FontDescription& description = *(mCacheHandler->mFontDescriptionCache.begin() + fontDescriptionId - 1u);
 
-    // Retrieve the font id. Do not cache the description as it has been already cached.
-    // Note : CacheFontPath() API call ValidateFont() + setup CharacterSet + cache the font description.
-    // So set cacheDescription=false, that we don't call CacheFontPath().
-    fontId = GetFontIdByPath(description.path, requestedPointSize, faceIndex, false);
+      // Retrieve the font id. Do not cache the description as it has been already cached.
+      // Note : CacheFontPath() API call ValidateFont() + setup CharacterSet + cache the font description.
+      // So set cacheDescription=false, that we don't call CacheFontPath().
+      fontId = GetFontIdByPath(description.path, requestedPointSize, faceIndex, false);
 
-    if((fontId > 0u) && (fontId - 1u < mCacheHandler->mFontIdCache.size()))
-    {
-      fontCacheIndex                                              = mCacheHandler->mFontIdCache[fontId - 1u].index;
-      mCacheHandler->mFontFaceCache[fontCacheIndex].mCharacterSet = FcCharSetCopy(mCacheHandler->mCharacterSetCache[fontDescriptionId - 1u]);
+      if((fontId > 0u) && (fontId - 1u < mCacheHandler->mFontIdCache.size()))
+      {
+        fontCacheIndex                                              = mCacheHandler->mFontIdCache[fontId - 1u].index;
+        mCacheHandler->mFontFaceCache[fontCacheIndex].mCharacterSet = FcCharSetCopy(mCacheHandler->mCharacterSetCache[fontDescriptionId - 1u]);
 
-      // Cache the pair 'fontDescriptionId, requestedPointSize' to improve the following queries.
-      mCacheHandler->CacheFontDescriptionSize(fontDescriptionId, requestedPointSize, fontCacheIndex);
+        // Cache the pair 'fontDescriptionId, requestedPointSize' to improve the following queries.
+        mCacheHandler->CacheFontDescriptionSize(fontDescriptionId, requestedPointSize, fontCacheIndex);
+      }
     }
   }
   else
@@ -950,6 +953,12 @@ PixelData FontClient::Plugin::CreateBitmap(FontId fontId, GlyphIndex glyphIndex,
   if(!data.isBufferOwned || data.compressionType != TextAbstraction::GlyphBufferData::CompressionType::NO_COMPRESSION)
   {
     uint8_t* newBuffer = (uint8_t*)malloc(data.width * data.height * Pixel::GetBytesPerPixel(data.format));
+    if(DALI_UNLIKELY(!newBuffer))
+    {
+      DALI_LOG_ERROR("malloc is failed. request malloc size : %u x %u x %u\n", data.width, data.height, Pixel::GetBytesPerPixel(data.format));
+      return Dali::PixelData();
+    }
+
     TextAbstraction::GlyphBufferData::Decompress(data, newBuffer);
     if(data.isBufferOwned)
     {
index 5bfedb1..a6d56fa 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -193,6 +193,12 @@ void ConvertBitmap(TextAbstraction::GlyphBufferData& data, unsigned int srcWidth
   {
     data.isBufferOwned = true;
     data.buffer        = (uint8_t*)malloc(bufferSize); // @note The caller is responsible for deallocating the bitmap data using free.
+
+    if(DALI_UNLIKELY(!data.buffer))
+    {
+      DALI_LOG_ERROR("malloc is failed. request malloc size : %u\n", bufferSize);
+      return;
+    }
     Dali::Internal::Platform::LanczosSample(srcBuffer,
                                             inputDimensions,
                                             srcWidth,
index 96817db..0bed3f2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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.
@@ -168,7 +168,18 @@ bool GlyphCacheManager::LoadGlyphDataFromIndex(
       {
         glyphData.mIsBitmap       = true;
         glyphData.mBitmap->buffer = (uint8_t*)malloc(bufferSize * sizeof(uint8_t)); // @note The caller is responsible for deallocating the bitmap data using free.
-        memcpy(glyphData.mBitmap->buffer, freeTypeFace->glyph->bitmap.buffer, bufferSize);
+        if(DALI_UNLIKELY(!glyphData.mBitmap->buffer))
+        {
+          DALI_LOG_ERROR("malloc is failed. request malloc size : %zu\n", bufferSize * sizeof(uint8_t));
+          delete glyphData.mBitmap;
+          glyphData.mIsBitmap = false;
+          glyphData.mBitmap   = nullptr;
+          error               = static_cast<FT_Error>(-1);
+        }
+        else
+        {
+          memcpy(glyphData.mBitmap->buffer, freeTypeFace->glyph->bitmap.buffer, bufferSize);
+        }
       }
       else
       {
@@ -225,12 +236,20 @@ void GlyphCacheManager::ResizeBitmapGlyph(
             if(glyphData.mBitmap->pitch == static_cast<int>(glyphData.mBitmap->width))
             {
               desiredBuffer = (uint8_t*)malloc(desiredWidth * desiredHeight * sizeof(uint8_t)); // @note The caller is responsible for deallocating the bitmap data using free.
-              // Resize bitmap here.
-              Dali::Internal::Platform::LanczosSample1BPP(glyphData.mBitmap->buffer,
-                                                          inputDimensions,
-                                                          glyphData.mBitmap->width,
-                                                          desiredBuffer,
-                                                          desiredDimensions);
+
+              if(DALI_UNLIKELY(!desiredBuffer))
+              {
+                DALI_LOG_ERROR("malloc is failed. request malloc size : %u x %u x 1\n", desiredWidth, desiredHeight);
+              }
+              else
+              {
+                // Resize bitmap here.
+                Dali::Internal::Platform::LanczosSample1BPP(glyphData.mBitmap->buffer,
+                                                            inputDimensions,
+                                                            glyphData.mBitmap->width,
+                                                            desiredBuffer,
+                                                            desiredDimensions);
+              }
             }
             break;
           }
@@ -240,12 +259,20 @@ void GlyphCacheManager::ResizeBitmapGlyph(
             if(glyphData.mBitmap->pitch == static_cast<int>(glyphData.mBitmap->width << 2u))
             {
               desiredBuffer = (uint8_t*)malloc((desiredWidth * desiredHeight * sizeof(uint8_t)) << 2u); // @note The caller is responsible for deallocating the bitmap data using free.
-              // Resize bitmap here.
-              Dali::Internal::Platform::LanczosSample4BPP(glyphData.mBitmap->buffer,
-                                                          inputDimensions,
-                                                          glyphData.mBitmap->width,
-                                                          desiredBuffer,
-                                                          desiredDimensions);
+
+              if(DALI_UNLIKELY(!desiredBuffer))
+              {
+                DALI_LOG_ERROR("malloc is failed. request malloc size : %u x %u x 4\n", desiredWidth, desiredHeight);
+              }
+              else
+              {
+                // Resize bitmap here.
+                Dali::Internal::Platform::LanczosSample4BPP(glyphData.mBitmap->buffer,
+                                                            inputDimensions,
+                                                            glyphData.mBitmap->width,
+                                                            desiredBuffer,
+                                                            desiredDimensions);
+              }
             }
             break;
           }
index 4c8b325..ba97161 100644 (file)
@@ -27,7 +27,7 @@ namespace Dali
 {
 const unsigned int ADAPTOR_MAJOR_VERSION = 2;
 const unsigned int ADAPTOR_MINOR_VERSION = 3;
-const unsigned int ADAPTOR_MICRO_VERSION = 12;
+const unsigned int ADAPTOR_MICRO_VERSION = 14;
 const char* const  ADAPTOR_BUILD_DATE    = __DATE__ " " __TIME__;
 
 #ifdef DEBUG_ENABLED
index 770f68b..2d17b6c 100644 (file)
@@ -17,7 +17,7 @@
 
 Name:       dali2-adaptor
 Summary:    The DALi Tizen Adaptor
-Version:    2.3.12
+Version:    2.3.14
 Release:    1
 Group:      System/Libraries
 License:    Apache-2.0 and BSD-3-Clause and MIT