../dali/dali-test-suite-utils/test-native-image.cpp
../dali/dali-test-suite-utils/test-platform-abstraction.cpp
../dali/dali-test-suite-utils/test-render-controller.cpp
+ ../dali/dali-test-suite-utils/test-render-surface.cpp
../dali/dali-test-suite-utils/test-trace-call-stack.cpp
../dali/dali-test-suite-utils/test-addon-manager.cpp
)
dali-test-suite-utils/test-native-image.cpp
dali-test-suite-utils/test-platform-abstraction.cpp
dali-test-suite-utils/test-render-controller.cpp
+ dali-test-suite-utils/test-render-surface.cpp
dali-test-suite-utils/test-trace-call-stack.cpp
dali-test-suite-utils/test-addon-manager.cpp
)
mScene.SetDpi(Vector2(static_cast<float>(mDpi.x), static_cast<float>(mDpi.y)));
// Create render target for the scene
+ mRenderSurface = new TestRenderSurface(Dali::PositionSize(0, 0, mSurfaceWidth, mSurfaceHeight));
Graphics::RenderTargetCreateInfo rtInfo{};
rtInfo.SetExtent({mSurfaceWidth, mSurfaceHeight});
- rtInfo.SetSurface(reinterpret_cast<Integration::RenderSurface*>(this));
+ rtInfo.SetSurface(mRenderSurface);
mScene.SetSurfaceRenderTarget(rtInfo);
mScenes.push_back(mScene);
#include "test-graphics-controller.h"
#include "test-render-controller.h"
+#include "test-render-surface.h"
namespace Dali
{
TestPlatformAbstraction mPlatformAbstraction;
TestRenderController mRenderController;
TestGraphicsController mGraphicsController;
+ TestRenderSurface* mRenderSurface;
Integration::UpdateStatus mStatus;
Integration::RenderStatus mRenderStatus;
--- /dev/null
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+#include "test-render-surface.h"
+
+namespace Dali
+{
+namespace Integration
+{
+RenderSurfaceInterface::RenderSurfaceInterface() = default;
+RenderSurfaceInterface::~RenderSurfaceInterface() = default;
+} // namespace Integration
+
+TestRenderSurface::TestRenderSurface(Dali::PositionSize positionSize)
+: mPositionSize(positionSize),
+ mBackgroundColor()
+{
+}
+
+Dali::PositionSize TestRenderSurface::GetPositionSize() const
+{
+ return mPositionSize;
+};
+
+void TestRenderSurface::GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical)
+{
+ dpiHorizontal = dpiVertical = 96;
+};
+
+int TestRenderSurface::GetSurfaceOrientation() const
+{
+ return 0;
+}
+
+int TestRenderSurface::GetScreenOrientation() const
+{
+ return 0;
+}
+
+void TestRenderSurface::InitializeGraphics()
+{
+}
+
+void TestRenderSurface::CreateSurface()
+{
+}
+
+void TestRenderSurface::DestroySurface()
+{
+}
+
+bool TestRenderSurface::ReplaceGraphicsSurface()
+{
+ return false;
+}
+
+void TestRenderSurface::MoveResize(Dali::PositionSize positionSize)
+{
+ mPositionSize = positionSize;
+}
+
+void TestRenderSurface::StartRender()
+{
+}
+
+bool TestRenderSurface::PreRender(bool resizingSurface, const std::vector<Rect<int>>& damageRects, Rect<int>& clippingRect)
+{
+ return true;
+}
+
+void TestRenderSurface::PostRender()
+{
+}
+
+void TestRenderSurface::StopRender()
+{
+}
+
+void TestRenderSurface::ReleaseLock()
+{
+}
+
+void TestRenderSurface::SetThreadSynchronization(ThreadSynchronizationInterface& threadSynchronization)
+{
+}
+
+Dali::Integration::RenderSurfaceInterface::Type TestRenderSurface::GetSurfaceType()
+{
+ return WINDOW_RENDER_SURFACE;
+}
+
+void TestRenderSurface::MakeContextCurrent()
+{
+}
+
+Integration::DepthBufferAvailable TestRenderSurface::GetDepthBufferRequired()
+{
+ return Integration::DepthBufferAvailable::TRUE;
+}
+
+Integration::StencilBufferAvailable TestRenderSurface::GetStencilBufferRequired()
+{
+ return Integration::StencilBufferAvailable::TRUE;
+}
+
+} // namespace Dali
--- /dev/null
+#ifndef TEST_RENDER_SURFACE_H
+#define TEST_RENDER_SURFACE_H
+
+/*
+ * 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.
+ * 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.
+ *
+ */
+
+// INTERNAL INCLUDES
+#include <dali/integration-api/core.h>
+#include <dali/public-api/common/dali-common.h>
+#include <dali/public-api/math/rect.h>
+#include <vector>
+
+namespace Dali
+{
+using PositionSize = Dali::Rect<int>;
+class ThreadSynchronizationInterface;
+
+namespace Integration
+{
+class RenderSurfaceInterface
+{
+public:
+ enum Type
+ {
+ WINDOW_RENDER_SURFACE,
+ PIXMAP_RENDER_SURFACE,
+ NATIVE_RENDER_SURFACE
+ };
+ RenderSurfaceInterface();
+
+ virtual Dali::PositionSize GetPositionSize() const = 0;
+ virtual void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) = 0;
+ virtual int GetSurfaceOrientation() const = 0;
+ virtual int GetScreenOrientation() const = 0;
+ virtual void InitializeGraphics() = 0;
+ virtual void CreateSurface() = 0;
+ virtual void DestroySurface() = 0;
+ virtual bool ReplaceGraphicsSurface() = 0;
+ virtual void MoveResize(Dali::PositionSize positionSize) = 0;
+ virtual void StartRender() = 0;
+ virtual bool PreRender(bool resizingSurface, const std::vector<Rect<int>>& damageRects, Rect<int>& clippingRect) = 0;
+ virtual void PostRender() = 0;
+ virtual void StopRender() = 0;
+ virtual void ReleaseLock() = 0;
+ virtual void SetThreadSynchronization(ThreadSynchronizationInterface& threadSynchronization) = 0;
+ virtual Dali::Integration::RenderSurfaceInterface::Type GetSurfaceType() = 0;
+ virtual void MakeContextCurrent() = 0;
+ virtual Integration::DepthBufferAvailable GetDepthBufferRequired() = 0;
+ virtual Integration::StencilBufferAvailable GetStencilBufferRequired() = 0;
+
+protected:
+ virtual ~RenderSurfaceInterface();
+};
+} // namespace Integration
+
+/**
+ * Concrete implementation of the RenderSurface class.
+ */
+class TestRenderSurface : public Dali::Integration::RenderSurfaceInterface
+{
+public:
+ /**
+ * @copydoc Dali::Integration::RenderSurface::RenderSurface
+ */
+ TestRenderSurface(Dali::PositionSize positionSize);
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::~RenderSurface
+ */
+ ~TestRenderSurface() override = default;
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::GetPositionSize
+ */
+ Dali::PositionSize GetPositionSize() const override;
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::GetDpi
+ */
+ void GetDpi(unsigned int& dpiHorizontal, unsigned int& dpiVertical) override;
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::GetSurfaceOrientation
+ */
+ int GetSurfaceOrientation() const override;
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::GetScreenOrientation
+ */
+ int GetScreenOrientation() const override;
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::InitializeGraphics
+ */
+ void InitializeGraphics() override;
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::CreateSurface
+ */
+ void CreateSurface() override;
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::DestroySurface
+ */
+ void DestroySurface() override;
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::ReplaceGraphicsSurface
+ */
+ bool ReplaceGraphicsSurface() override;
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::MoveResize
+ */
+ void MoveResize(Dali::PositionSize positionSize) override;
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::StartRender
+ */
+ void StartRender() override;
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::PreRender
+ */
+ bool PreRender(bool resizingSurface, const std::vector<Rect<int>>& damageRects, Rect<int>& clippingRect) override;
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::PostRender
+ */
+ void PostRender() override;
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::StopRender
+ */
+ void StopRender() override;
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::ReleaseLock
+ */
+ void ReleaseLock() override;
+
+ void SetThreadSynchronization(ThreadSynchronizationInterface& threadSynchronization) override;
+ /**
+ * @copydoc Dali::Integration::RenderSurface::GetSurfaceType
+ */
+ Dali::Integration::RenderSurfaceInterface::Type GetSurfaceType() override;
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::MakeContextCurrent
+ */
+ void MakeContextCurrent() override;
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::GetDepthBufferRequired
+ */
+ Integration::DepthBufferAvailable GetDepthBufferRequired() override;
+
+ /**
+ * @copydoc Dali::Integration::RenderSurface::GetStencilBufferRequired
+ */
+ Integration::StencilBufferAvailable GetStencilBufferRequired() override;
+
+private:
+ /**
+ * @brief Undefined copy constructor. RenderSurface cannot be copied
+ */
+ TestRenderSurface(const TestRenderSurface& rhs);
+
+ /**
+ * @brief Undefined assignment operator. RenderSurface cannot be copied
+ */
+ TestRenderSurface& operator=(const TestRenderSurface& rhs);
+
+private:
+ Dali::PositionSize mPositionSize;
+ Vector4 mBackgroundColor; ///< The background color of the surface
+};
+
+} // namespace Dali
+
+#endif // TEST_RENDER_SURFACE_H
#include <iostream>
// Internal headers are allowed here
+#include "test-render-surface.h"
namespace
{
graphicsCallStack.Reset();
- int fakeSurface1;
+ auto testRenderSurface = new TestRenderSurface(PositionSize(0, 0, 480, 800));
+
Graphics::RenderTargetCreateInfo createInfo{};
- createInfo.SetSurface(&fakeSurface1).SetExtent(Graphics::Extent2D{480u, 800u});
+ createInfo.SetSurface(testRenderSurface).SetExtent(Graphics::Extent2D{480u, 800u});
defaultScene.SetSurfaceRenderTarget(createInfo);
application.SendNotification();
application.Render();
TraceCallStack::NamedParams query1;
- query1["surface"] << std::hex << &fakeSurface1;
+ query1["surface"] << std::hex << testRenderSurface;
const TraceCallStack::NamedParams* matching2 = graphicsCallStack.FindLastMatch("CreateRenderTarget", query1);
DALI_TEST_CHECK(matching2 != nullptr);
const TraceCallStack::NamedParams* matching3 = graphicsCallStack.FindLastMatch("PresentRenderTarget", empty);
DALI_TEST_CHECK(matching3 != nullptr);
DALI_TEST_EQUALS((*matching3)["surface"].str(), query1["surface"].str(), TEST_LOCATION);
-
+ delete testRenderSurface;
END_TEST;
}
${DALI_TEST_SUITE_DIR}/test-graphics-texture.cpp
${DALI_TEST_SUITE_DIR}/test-platform-abstraction.cpp
${DALI_TEST_SUITE_DIR}/test-render-controller.cpp
+ ${DALI_TEST_SUITE_DIR}/test-render-surface.cpp
${DALI_TEST_SUITE_DIR}/test-trace-call-stack.cpp
)
ADD_EXECUTABLE( ${LINKER_TEST_NAME} ${LINKER_TEST_SOURCES} )
- TARGET_LINK_LIBRARIES(${LINKER_TEST_NAME} ${name} )
+ TARGET_LINK_LIBRARIES(${LINKER_TEST_NAME} ${name})
TARGET_INCLUDE_DIRECTORIES( ${LINKER_TEST_NAME} PRIVATE ${DALI_TEST_SUITE_DIR} )
ENDIF()
{
namespace Integration
{
-struct RenderSurface;
+struct RenderSurfaceInterface;
}
namespace Graphics
{
* @param[in] value Pointer to the native surface
* @return reference to this structure
*/
- auto& SetSurface( Integration::RenderSurface* value )
+ auto& SetSurface(Integration::RenderSurfaceInterface* value)
{
surface = value;
return *this;
* @param[in] value Pointer to the Framebuffer object
* @return reference to this structure
*/
- auto& SetFramebuffer( Framebuffer* value )
+ auto& SetFramebuffer(Framebuffer* value)
{
framebuffer = value;
return *this;
* @param[in] value Size of render target
* @return reference to this structure
*/
- auto& SetExtent( Extent2D value )
+ auto& SetExtent(Extent2D value)
{
extent = value;
return *this;
* @param[in] value transform flags
* @return reference to this structure
*/
- auto& SetPreTransform( RenderTargetTransformFlags value )
+ auto& SetPreTransform(RenderTargetTransformFlags value)
{
preTransform = value;
return *this;
return *this;
}
- GraphicsStructureType type{GraphicsStructureType::RENDER_TARGET_CREATE_INFO_STRUCT};
- Integration::RenderSurface* surface{nullptr};
- Framebuffer* framebuffer{nullptr};
- Extent2D extent{};
- RenderTargetTransformFlags preTransform{0u};
- ExtensionCreateInfo* nextExtension{nullptr};
+ GraphicsStructureType type{GraphicsStructureType::RENDER_TARGET_CREATE_INFO_STRUCT};
+ Integration::RenderSurfaceInterface* surface{nullptr};
+ Framebuffer* framebuffer{nullptr};
+ Extent2D extent{};
+ RenderTargetTransformFlags preTransform{0u};
+ ExtensionCreateInfo* nextExtension{nullptr};
const AllocationCallbacks* allocationCallbacks{nullptr};
};
} // namespace Graphics
} // namespace Dali
-#endif //DALI_GRAPHICS_RENDER_TARGET_CREATE_INFO
+#endif // DALI_GRAPHICS_RENDER_TARGET_CREATE_INFO