return mImpl->EnqueueBuffer(buffer);
}
+void NativeImageSourceQueue::FreeReleasedBuffers()
+{
+ mImpl->FreeReleasedBuffers();
+}
+
bool NativeImageSourceQueue::CreateResource()
{
return mImpl->CreateResource();
bool EnqueueBuffer(uint8_t* buffer);
/**
+ * @brief Free all released buffers.
+ */
+ void FreeReleasedBuffers();
+
+ /**
* @copydoc Dali::NativeImageInterface::GetTextureTarget()
*/
int GetTextureTarget() const override;
virtual bool Render(uint32_t frameNumber) = 0;
/**
+ * @brief Notify the Renderer that rendering is stopped.
+ */
+ virtual void RenderStopped() = 0;
+
+ /**
* @brief Gets the total number of frames of the file.
*
* @return The total number of frames
return GetImplementation(*this).Render(frameNumber);
}
+void VectorAnimationRenderer::RenderStopped()
+{
+ GetImplementation(*this).RenderStopped();
+}
+
uint32_t VectorAnimationRenderer::GetTotalFrameNumber() const
{
return GetImplementation(*this).GetTotalFrameNumber();
bool Render(uint32_t frameNumber);
/**
+ * @brief Notify the Renderer that rendering is stopped.
+ */
+ void RenderStopped();
+
+ /**
* @brief Gets the total number of frames of the file
*
* @return The total number of frames
void Application::ChangePreInitializedWindowSize()
{
+ // The real screen size may be different from the value of the preinitialized state. Update it.
+ Dali::Internal::Adaptor::WindowSystem::UpdateScreenSize();
+
int screenWidth, screenHeight;
Dali::Internal::Adaptor::WindowSystem::GetScreenSize(screenWidth, screenHeight);
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
return false;
}
+void NativeImageSourceQueueAndroid::FreeReleasedBuffers()
+{
+}
+
bool NativeImageSourceQueueAndroid::CreateResource()
{
return true;
#define DALI_INTERNAL_NATIVE_IMAGE_SOURCE_QUEUE_IMPL_ANDROID_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
bool EnqueueBuffer(uint8_t* buffer) override;
/**
+ * @copydoc Dali::NativeImageSourceQueue::EnqueueBuffer
+ */
+ void FreeReleasedBuffers() override;
+
+ /**
* destructor
*/
~NativeImageSourceQueueAndroid() override;
#define DALI_INTERNAL_NATIVE_IMAGE_SOURCE_QUEUE_IMPL_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
virtual bool EnqueueBuffer(uint8_t* buffer) = 0;
/**
+ * @copydoc Dali::NativeImageSourceQueue::FreeReleasedBuffers
+ */
+ virtual void FreeReleasedBuffers() = 0;
+
+ /**
* destructor
*/
virtual ~NativeImageSourceQueue() = default;
mEglImageExtensions(NULL),
mOwnTbmQueue(false),
mBlendingRequired(false),
- mIsResized(false)
+ mIsResized(false),
+ mFreeRequest(false)
{
DALI_ASSERT_ALWAYS(Adaptor::IsAvailable());
return false;
}
+void NativeImageSourceQueueTizen::FreeReleasedBuffers()
+{
+ Dali::Mutex::ScopedLock lock(mMutex);
+ mFreeRequest = true;
+}
+
bool NativeImageSourceQueueTizen::CreateResource()
{
mEglImageExtensions = mEglGraphics->GetImageExtensions();
{
Dali::Mutex::ScopedLock lock(mMutex);
- tbm_surface_h oldSurface = mConsumeSurface;
+ bool updated = false;
- if(tbm_surface_queue_can_acquire(mTbmQueue, 0))
+ do
{
- if(tbm_surface_queue_acquire(mTbmQueue, &mConsumeSurface) != TBM_SURFACE_QUEUE_ERROR_NONE)
- {
- DALI_LOG_ERROR("Failed to aquire a tbm_surface\n");
- return;
- }
+ tbm_surface_h oldSurface = mConsumeSurface;
- if(oldSurface)
+ if(tbm_surface_queue_can_acquire(mTbmQueue, 0))
{
- if(tbm_surface_internal_is_valid(oldSurface))
+ if(tbm_surface_queue_acquire(mTbmQueue, &mConsumeSurface) != TBM_SURFACE_QUEUE_ERROR_NONE)
+ {
+ DALI_LOG_ERROR("Failed to aquire a tbm_surface\n");
+ return;
+ }
+
+ if(oldSurface)
{
- tbm_surface_queue_release(mTbmQueue, oldSurface);
+ if(tbm_surface_internal_is_valid(oldSurface))
+ {
+ tbm_surface_queue_release(mTbmQueue, oldSurface);
+ }
}
+ updated = true;
+ }
+ else
+ {
+ break;
}
+ } while(mFreeRequest); // Get the last one if buffer free was requested
+ if(updated)
+ {
if(mIsResized)
{
ResetEglImageList(false);
}
}
}
+
+ if(mFreeRequest)
+ {
+ auto iter = std::remove_if(mEglImages.begin(), mEglImages.end(), [&](EglImagePair& eglImage) {
+ if(mConsumeSurface == eglImage.first) return false;
+ mEglImageExtensions->DestroyImageKHR(eglImage.second);
+ tbm_surface_internal_unref(eglImage.first);
+ return true; });
+ mEglImages.erase(iter, mEglImages.end());
+
+ tbm_surface_queue_free_flush(mTbmQueue);
+ mFreeRequest = false;
+ }
}
bool NativeImageSourceQueueTizen::ApplyNativeFragmentShader(std::string& shader)
#define DALI_INTERNAL_NATIVE_IMAGE_SOURCE_QUEUE_IMPL_TIZEN_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
bool EnqueueBuffer(uint8_t* buffer) override;
/**
+ * @copydoc Dali::NativeImageSourceQueue::EnqueueBuffer
+ */
+ void FreeReleasedBuffers() override;
+
+ /**
* destructor
*/
~NativeImageSourceQueueTizen() override;
bool mOwnTbmQueue; ///< Whether we created tbm queue
bool mBlendingRequired; ///< Whether blending is required
bool mIsResized; ///< Whether the size has changed
+ bool mFreeRequest; ///< Whether it is requested to free the released buffers
};
} // namespace Adaptor
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
return false;
}
+void NativeImageSourceQueueX::FreeReleasedBuffers()
+{
+}
+
bool NativeImageSourceQueueX::CreateResource()
{
return true;
#define DALI_INTERNAL_NATIVE_IMAGE_SOURCE_QUEUE_IMPL_X_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
bool EnqueueBuffer(uint8_t* buffer) override;
/**
+ * @copydoc Dali::NativeImageSourceQueue::EnqueueBuffer
+ */
+ void FreeReleasedBuffers() override;
+
+ /**
* destructor
*/
~NativeImageSourceQueueX() override;
{
namespace Adaptor
{
-
NativeImageSourceQueueX* NativeImageSourceQueueX::New(uint32_t width, uint32_t height, Dali::NativeImageSourceQueue::ColorFormat colorFormat, Any nativeImageSourceQueue)
{
NativeImageSourceQueueX* image = new NativeImageSourceQueueX(width, height, colorFormat, nativeImageSourceQueue);
return false;
}
+void NativeImageSourceQueueX::FreeReleasedBuffers()
+{
+}
+
bool NativeImageSourceQueueX::CreateResource()
{
return true;
bool EnqueueBuffer(uint8_t* buffer) override;
/**
+ * @copydoc Dali::NativeImageSourceQueue::EnqueueBuffer
+ */
+ void FreeReleasedBuffers() override;
+
+ /**
* destructor
*/
~NativeImageSourceQueueX() override;
return mPlugin.Render(frameNumber);
}
+void VectorAnimationRenderer::RenderStopped()
+{
+ mPlugin.RenderStopped();
+}
+
uint32_t VectorAnimationRenderer::GetTotalFrameNumber() const
{
return mPlugin.GetTotalFrameNumber();
bool Render(uint32_t frameNumber);
/**
+ * @copydoc Dali::VectorAnimationRenderer::RenderStopped()
+ */
+ void RenderStopped();
+
+ /**
* @copydoc Dali::VectorAnimationRenderer::GetTotalFrameNumber()
*/
uint32_t GetTotalFrameNumber() const;
return false;
}
+void VectorAnimationRendererPluginProxy::RenderStopped()
+{
+ if(mPlugin)
+ {
+ mPlugin->RenderStopped();
+ }
+}
+
uint32_t VectorAnimationRendererPluginProxy::GetTotalFrameNumber() const
{
if(mPlugin)
bool Render(uint32_t frameNumber);
/**
+ * @copydoc Dali::VectorAnimationRendererPlugin::RenderStopped()
+ */
+ void RenderStopped();
+
+ /**
* @copydoc Dali::VectorAnimationRendererPlugin::GetTotalFrameNumber()
*/
uint32_t GetTotalFrameNumber() const;
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
{
}
-void GetScreenSize(int& width, int& height)
+void GetScreenSize(int32_t& width, int32_t& height)
{
ANativeWindow* window = Dali::Integration::AndroidFramework::Get().GetApplicationWindow();
width = ANativeWindow_getWidth(window);
DALI_LOG_WARNING("Native window width %d, height %d", width, height);
}
+void UpdateScreenSize()
+{
+}
+
bool SetKeyboardRepeatInfo(float rate, float delay)
{
return false;
*
*/
+// EXTERNAL_HEADERS
#include <dali/public-api/object/any.h>
+#include <cstdint>
namespace Dali
{
/**
* @brief Get the screen size
*/
-void GetScreenSize(int& width, int& height);
+void GetScreenSize(int32_t& width, int32_t& height);
+
+/**
+ * @brief Update the screen size
+ * @note The screen size may be updated while application is running. So update the stored size.
+ */
+void UpdateScreenSize();
/**
* @copydoc Dali::Keyboard::SetRepeatInfo()
* @param[out] width The width of the screen
* @param[out] height The height of the screen
*/
- virtual void GetScreenSize(int& width, int& height) = 0;
+ virtual void GetScreenSize(int32_t& width, int32_t& height) = 0;
};
} // namespace Adaptor
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
{
}
-void GetScreenSize( int& width, int& height )
+void GetScreenSize( int32_t& width, int32_t& height )
{
NSRect r = [[NSScreen mainScreen] frame];
- width = static_cast<int>(r.size.width);
- height = static_cast<int>(r.size.height);
+ width = static_cast<int32_t>(r.size.width);
+ height = static_cast<int32_t>(r.size.height);
+}
+
+void UpdateScreenSize()
+{
}
bool SetKeyboardRepeatInfo( float rate, float delay )
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
ecore_wl_shutdown();
}
-void GetScreenSize(int& width, int& height)
+void GetScreenSize(int32_t& width, int32_t& height)
{
ecore_wl_screen_size_get(&width, &height);
}
+void UpdateScreenSize()
+{
+}
+
bool SetKeyboardRepeatInfo(float rate, float delay)
{
return ecore_wl_keyboard_repeat_info_set(static_cast<double>(rate), static_cast<double>(delay));
mWindowRotationAngle(0),
mScreenRotationAngle(0),
mSupportedPreProtation(0),
- mScreenWidth(0),
- mScreenHeight(0),
mNotificationChangeState(0),
mScreenOffModeChangeState(0),
mBrightnessChangeState(0),
PositionSize WindowBaseEcoreWl2::RecalculatePositionSizeToSystem(PositionSize positionSize)
{
PositionSize newPositionSize;
+ int32_t screenWidth, screenHeight;
+ WindowSystem::GetScreenSize(screenWidth, screenHeight);
if(mWindowRotationAngle == 90)
{
newPositionSize.x = positionSize.y;
- newPositionSize.y = mScreenHeight - (positionSize.x + positionSize.width);
+ newPositionSize.y = screenHeight - (positionSize.x + positionSize.width);
newPositionSize.width = positionSize.height;
newPositionSize.height = positionSize.width;
}
else if(mWindowRotationAngle == 180)
{
- newPositionSize.x = mScreenWidth - (positionSize.x + positionSize.width);
- newPositionSize.y = mScreenHeight - (positionSize.y + positionSize.height);
+ newPositionSize.x = screenWidth - (positionSize.x + positionSize.width);
+ newPositionSize.y = screenHeight - (positionSize.y + positionSize.height);
newPositionSize.width = positionSize.width;
newPositionSize.height = positionSize.height;
}
else if(mWindowRotationAngle == 270)
{
- newPositionSize.x = mScreenWidth - (positionSize.y + positionSize.height);
+ newPositionSize.x = screenWidth - (positionSize.y + positionSize.height);
newPositionSize.y = positionSize.x;
newPositionSize.width = positionSize.height;
newPositionSize.height = positionSize.width;
PositionSize WindowBaseEcoreWl2::RecalculatePositionSizeToCurrentOrientation(PositionSize positionSize)
{
PositionSize newPositionSize;
+ int32_t screenWidth, screenHeight;
+ WindowSystem::GetScreenSize(screenWidth, screenHeight);
if(mWindowRotationAngle == 90)
{
- newPositionSize.x = mScreenHeight - (positionSize.y + positionSize.height);
+ newPositionSize.x = screenHeight - (positionSize.y + positionSize.height);
newPositionSize.y = positionSize.x;
newPositionSize.width = positionSize.height;
newPositionSize.height = positionSize.width;
}
else if(mWindowRotationAngle == 180)
{
- newPositionSize.x = mScreenWidth - (positionSize.x + positionSize.width);
- newPositionSize.y = mScreenHeight - (positionSize.y + positionSize.height);
+ newPositionSize.x = screenWidth - (positionSize.x + positionSize.width);
+ newPositionSize.y = screenHeight - (positionSize.y + positionSize.height);
newPositionSize.width = positionSize.width;
newPositionSize.height = positionSize.height;
}
else if(mWindowRotationAngle == 270)
{
newPositionSize.x = positionSize.y;
- newPositionSize.y = mScreenWidth - (positionSize.x + positionSize.width);
+ newPositionSize.y = screenWidth - (positionSize.x + positionSize.width);
newPositionSize.width = positionSize.height;
newPositionSize.height = positionSize.width;
}
// Set default type
ecore_wl2_window_type_set(mEcoreWindow, ECORE_WL2_WINDOW_TYPE_TOPLEVEL);
-
- // Get Screen width, height
- ecore_wl2_display_screen_size_get(display, &mScreenWidth, &mScreenHeight);
}
void WindowBaseEcoreWl2::SetParent(WindowBase* parentWinBase, bool belowParent)
int mWindowRotationAngle;
int mScreenRotationAngle;
int mSupportedPreProtation;
- int mScreenWidth;
- int mScreenHeight;
uint32_t mNotificationChangeState;
uint32_t mScreenOffModeChangeState;
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
{
namespace WindowSystem
{
+namespace
+{
+static int32_t gScreenWidth = 0;
+static int32_t gScreenHeight = 0;
+} // unnamed namespace
+
void Initialize()
{
ecore_wl2_init();
ecore_wl2_shutdown();
}
-void GetScreenSize(int& width, int& height)
+void GetScreenSize(int32_t& width, int32_t& height)
+{
+ if(gScreenWidth == 0 || gScreenHeight == 0)
+ {
+ Ecore_Wl2_Display* display = ecore_wl2_display_connect(NULL);
+ if(display)
+ {
+ ecore_wl2_display_screen_size_get(display, &gScreenWidth, &gScreenHeight);
+ DALI_ASSERT_ALWAYS((gScreenWidth > 0) && "screen width is 0");
+ DALI_ASSERT_ALWAYS((gScreenHeight > 0) && "screen height is 0");
+ }
+ }
+ width = gScreenWidth;
+ height = gScreenHeight;
+}
+
+void UpdateScreenSize()
{
Ecore_Wl2_Display* display = ecore_wl2_display_connect(NULL);
if(display)
{
- ecore_wl2_display_screen_size_get(display, &width, &height);
- DALI_ASSERT_ALWAYS((width > 0) && "screen width is 0");
- DALI_ASSERT_ALWAYS((height > 0) && "screen height is 0");
+ ecore_wl2_display_screen_size_get(display, &gScreenWidth, &gScreenHeight);
}
}
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
ecore_x_shutdown();
}
-void GetScreenSize(int& width, int& height)
+void GetScreenSize(int32_t& width, int32_t& height)
{
ecore_x_screen_size_get(ecore_x_default_screen_get(), &width, &height);
}
+void UpdateScreenSize()
+{
+}
+
bool SetKeyboardRepeatInfo(float rate, float delay)
{
return false;
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
{
}
-void GetScreenSize(int& width, int& height)
+void GetScreenSize(int32_t& width, int32_t& height)
{
width = GetSystemMetrics(SM_CXSCREEN);
height = GetSystemMetrics(SM_CYSCREEN);
}
+void UpdateScreenSize()
+{
+}
+
bool SetKeyboardRepeatInfo(float rate, float delay)
{
return false;
}
}
+void UpdateScreenSize()
+{
+}
+
bool SetKeyboardRepeatInfo(float rate, float delay)
{
return false;
{
const unsigned int ADAPTOR_MAJOR_VERSION = 2;
const unsigned int ADAPTOR_MINOR_VERSION = 2;
-const unsigned int ADAPTOR_MICRO_VERSION = 4;
+const unsigned int ADAPTOR_MICRO_VERSION = 5;
const char* const ADAPTOR_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
Name: dali2-adaptor
Summary: The DALi Tizen Adaptor
-Version: 2.2.4
+Version: 2.2.5
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT