* [NON-SMACK Targets](#non-smack-targets)
* [SMACK enabled Targets](#smack-enabled-targets)
* [DEBUG Builds](#debug-builds)
+ * [3. Building for MS Windows](#3-building-for-ms-windows)
# Build Instructions
$ gbs build -A [TARGET_ARCH] --define "%enable_debug 1"
+## 3. Building for MS Windows
+
+Third party dependencies are built using vcpkg. Instructions on how to install vcpkg can be found in the
+vcpkg-script folder in the windows-dependencies repository.
+
+- Download the windows-dependencies repository from DaliHub
+
+ $ git clone https://github.com/dalihub/windows-dependencies.git
+
+- Read the README.md and vcpkg-script/Readme.md files for more instructions on how to install and build the third-party dependencies.
\ No newline at end of file
mActiveTextureUnit = 0;
mCheckFramebufferStatusResult = 0;
mFramebufferStatus = 0;
- mFramebufferColorAttached = 0;
mFramebufferDepthAttached = 0;
mFramebufferStencilAttached = 0;
+ mFramebufferColorAttachmentCount = 0;
+ mFrameBufferColorStatus = 0;
mNumBinaryFormats = 0;
mBinaryFormats = 0;
mProgramBinaryLength = 0;
mLastShaderCompiled = 0;
mLastClearBitMask = 0;
+ mLastClearColor = Color::TRANSPARENT;
mClearCount = 0;
mLastBlendEquationRgb = 0;
bool blendEnabled = callStack.FindMethodAndParams( "Disable", out.str() );
return blendEnabled;
}
+
#define TEST_GL_ABSTRACTION_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
// INTERNAL INCLUDES
#include <dali/public-api/dali-core.h>
+#include <dali/devel-api/rendering/frame-buffer-devel.h>
#include <dali/integration-api/core.h>
#include <dali/integration-api/gl-abstraction.h>
#include <dali/integration-api/gl-defines.h>
return mCheckFramebufferStatusResult;
}
- inline GLenum CheckFramebufferColorAttachment()
+ inline GLuint CheckFramebufferColorAttachmentCount()
{
- return mFramebufferColorAttached;
+ return mFramebufferColorAttachmentCount;
}
inline GLenum CheckFramebufferDepthAttachment()
inline void ClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)
{
+ mLastClearColor.r = red;
+ mLastClearColor.g = green;
+ mLastClearColor.b = blue;
+ mLastClearColor.a = alpha;
+ }
+
+ inline const Vector4& GetLastClearColor() const
+ {
+ return mLastClearColor;
}
inline void ClearDepthf(GLclampf depth)
mFramebufferStatus |= 4;
//We check 4 attachment colors
- if ((attachment == GL_COLOR_ATTACHMENT0) || (attachment == GL_COLOR_ATTACHMENT1) || (attachment == GL_COLOR_ATTACHMENT2) || (attachment == GL_COLOR_ATTACHMENT4))
+ if ((attachment >= GL_COLOR_ATTACHMENT0) && (attachment < GL_COLOR_ATTACHMENT0 + Dali::DevelFrameBuffer::MAX_COLOR_ATTACHMENTS))
{
- mFramebufferColorAttached = true;
+ uint8_t mask = 1 << (attachment - GL_COLOR_ATTACHMENT0);
+ if ((mFrameBufferColorStatus & mask) == 0)
+ {
+ mFrameBufferColorStatus |= mask;
+ ++mFramebufferColorAttachmentCount;
+ }
}
}
GLenum mActiveTextureUnit;
GLenum mCheckFramebufferStatusResult;
GLint mFramebufferStatus;
- GLenum mFramebufferColorAttached;
GLenum mFramebufferDepthAttached;
GLenum mFramebufferStencilAttached;
+ GLuint mFramebufferColorAttachmentCount;
+ GLuint mFrameBufferColorStatus;
GLint mNumBinaryFormats;
GLint mBinaryFormats;
GLint mProgramBinaryLength;
ShaderSourceMap mShaderSources;
GLuint mLastShaderCompiled;
GLbitfield mLastClearBitMask;
+ Vector4 mLastClearColor;
unsigned int mClearCount;
Vector4 mLastBlendColor;
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
#include <dali/public-api/dali-core.h>
#include <dali-test-suite-utils.h>
+#include <dali/devel-api/rendering/frame-buffer-devel.h>
using namespace Dali;
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 0u, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 0u, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 0u, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 0u, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 0u, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
FrameBuffer frameBuffer = FrameBuffer::New( width, height );
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 1u, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
// check that texture is not empty handle
FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::COLOR );
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 1u, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
// check that texture is not empty handle
FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::COLOR_DEPTH );
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 1u, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
// check that texture is not empty handle
FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::COLOR_STENCIL );
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 1u, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
// check that texture is not empty handle
FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::COLOR_DEPTH_STENCIL );
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 1u, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
// check that texture is not empty handle
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 1u, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 1u, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 1u, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 1u, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
END_TEST;
}
+int UtcDaliFrameBufferAttachColorTexture05(void)
+{
+ TestApplication application;
+
+ unsigned int width(64);
+ unsigned int height(64);
+ FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE );
+ Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
+
+ // N.B. it doesn't make sense per se, however the OGL standard doesn't seem to forbid attaching the same texture to different slots.
+ for (int i = 0; i < Dali::DevelFrameBuffer::MAX_COLOR_ATTACHMENTS + 1; ++i)
+ {
+ frameBuffer.AttachColorTexture( texture );
+ }
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), Dali::DevelFrameBuffer::MAX_COLOR_ATTACHMENTS, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
+
+ END_TEST;
+}
+
int UtcDaliFrameBufferGetColorTexture01(void)
{
TestApplication application;
END_TEST;
}
+int UtcDaliFrameBufferGetColorTexture03(void)
+{ // FrameBuffer::GetColorTexture() and GetColorTexture(0) are equivalent
+ TestApplication application;
+
+ unsigned int width(64);
+ unsigned int height(64);
+ FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE );
+ Texture texture = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height );
+ frameBuffer.AttachColorTexture( texture, 0u, 1u );
+
+ DALI_TEST_EQUALS(frameBuffer.GetColorTexture(), texture, TEST_LOCATION);
+ DALI_TEST_EQUALS(DevelFrameBuffer::GetColorTexture(frameBuffer, 0), texture, TEST_LOCATION);
+
+ END_TEST;
+}
+
+int UtcDaliFrameBufferGetColorTexture04(void)
+{
+ TestApplication application;
+
+ unsigned int width(64);
+ unsigned int height(64);
+ FrameBuffer frameBuffer = FrameBuffer::New( width, height, FrameBuffer::Attachment::NONE );
+ Texture textures[] = {
+ Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ),
+ Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ),
+ Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ),
+ Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ),
+ Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ),
+ Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ),
+ Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ),
+ Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ),
+ };
+
+ for (auto& t: textures)
+ {
+ frameBuffer.AttachColorTexture( t, 0u, 1u );
+ }
+
+ for (unsigned int i = 0; i < std::extent<decltype(textures)>::value; ++i)
+ {
+ DALI_TEST_EQUALS(DevelFrameBuffer::GetColorTexture(frameBuffer, i), textures[i], TEST_LOCATION);
+ }
+
+ END_TEST;
+}
+
int UtcDaliFramebufferContextLoss(void)
{
tet_infoline("UtcDaliFramebufferContextLoss\n");
application.Render();
application.SendNotification();
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 1u, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
application.Render();
application.SendNotification();
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 1u, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
application.Render();
application.SendNotification();
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 1u, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_FALSE, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
application.Render();
application.SendNotification();
- DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
+ DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferColorAttachmentCount(), 1u, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferDepthAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
DALI_TEST_EQUALS(application.GetGlAbstraction().CheckFramebufferStencilAttachment(), (GLenum)GL_TRUE, TEST_LOCATION);
#include <stdlib.h>
#include <dali/public-api/dali-core.h>
#include <dali/integration-api/events/touch-event-integ.h>
+#include <dali/integration-api/input-options.h>
#include <dali/integration-api/render-task-list-integ.h>
+#include <dali/devel-api/events/long-press-gesture-detector-devel.h>
#include <dali-test-suite-utils.h>
#include <test-touch-utils.h>
END_TEST;
}
+
+int UtcDaliLongPressGestureSetMinimumHoldingTime(void)
+{
+ TestApplication application;
+
+ const uint32_t kMinumumHolding1 = 5000;
+ const uint32_t kMinumumHolding2 = 3000;
+
+ Integration::SetLongPressMinimumHoldingTime( kMinumumHolding1 );
+
+ Actor actor = Actor::New();
+ actor.SetSize( 100.0f, 100.0f );
+ actor.SetAnchorPoint( AnchorPoint::TOP_LEFT );
+ Stage::GetCurrent().Add( actor );
+
+ // Render and notify
+ application.SendNotification();
+ application.Render();
+
+ SignalData data;
+ GestureReceivedFunctor functor( data );
+
+ LongPressGestureDetector detector = LongPressGestureDetector::New();
+ detector.Attach(actor);
+ detector.DetectedSignal().Connect(&application, functor);
+
+ DALI_TEST_EQUALS( DevelLongPressGestureDetector::GetMinimumHoldingTime( detector ), kMinumumHolding1, TEST_LOCATION );
+
+ Integration::SetLongPressMinimumHoldingTime( kMinumumHolding2 );
+ DALI_TEST_EQUALS( DevelLongPressGestureDetector::GetMinimumHoldingTime( detector ), kMinumumHolding2, TEST_LOCATION );
+
+ END_TEST;
+}
RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
RenderTask task = taskList.GetTask( 0u );
- DALI_TEST_CHECK( !task.GetClearEnabled() ); // defaults to false
-
- task.SetClearEnabled( true );
- DALI_TEST_EQUALS( task.GetClearEnabled(), true, TEST_LOCATION );
+ DALI_TEST_CHECK( task.GetClearEnabled() ); // defaults to true
task.SetClearEnabled( false );
DALI_TEST_EQUALS( task.GetClearEnabled(), false, TEST_LOCATION );
+
+ task.SetClearEnabled( true );
+ DALI_TEST_EQUALS( task.GetClearEnabled(), true, TEST_LOCATION );
END_TEST;
}
RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
RenderTask task = taskList.GetTask( 0u );
- DALI_TEST_CHECK( !task.GetClearEnabled() ); // defaults to false
+ DALI_TEST_CHECK( task.GetClearEnabled() ); // defaults to true
END_TEST;
}
TestApplication application;
- // Create a new scene and set the background colors of both the new and the main scenes
- auto defaultScene = application.GetScene();
- defaultScene.SetBackgroundColor( Color::WHITE );
+ auto& glAbstraction = application.GetGlAbstraction();
+ auto clearCountBefore = glAbstraction.GetClearCountCalled();
- TestRenderSurface surface( PositionSize( 0.0f, 0.0f, 480.0f, 800.0f ) );
- auto newScene = Integration::Scene::New( surface );
- newScene.SetBackgroundColor( Color::RED );
+ application.SendNotification();
+ application.Render();
+
+ // No actor, no rendering at all
+ DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore, TEST_LOCATION );
+ DALI_TEST_EQUALS( glAbstraction.GetLastClearColor(), Color::TRANSPARENT, TEST_LOCATION );
// Need to create a renderable as we don't start rendering until we have at least one
// We don't need to add this to any scene
auto actor = CreateRenderableActor();
- auto& glAbstraction = application.GetGlAbstraction();
- auto clearCountBefore = glAbstraction.GetClearCountCalled();
+ application.SendNotification();
+ application.Render();
+
+ // Default background color
+ DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION );
+ DALI_TEST_EQUALS( glAbstraction.GetLastClearColor(), Color::BLACK, TEST_LOCATION );
+
+ // Create a new scene and set the background colors of both the new and the main scenes
+ auto defaultScene = application.GetScene();
+ defaultScene.SetBackgroundColor( Color::WHITE );
application.SendNotification();
application.Render();
DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 2, TEST_LOCATION );
+ DALI_TEST_EQUALS( glAbstraction.GetLastClearColor(), Color::WHITE, TEST_LOCATION );
+
+ TestRenderSurface surface( PositionSize( 0.0f, 0.0f, 480.0f, 800.0f ) );
+ auto newScene = Integration::Scene::New( surface );
+ newScene.SetBackgroundColor( Color::RED );
+
+ application.SendNotification();
+ application.Render();
+
+ // + 2 clear for 2 scenes
+ DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 4, TEST_LOCATION );
+ DALI_TEST_EQUALS( glAbstraction.GetLastClearColor(), Color::RED, TEST_LOCATION );
// Add the actor to the main scene
defaultScene.Add( actor );
application.SendNotification();
application.Render();
- // Add another scene and set its background color, ensure we clear it to the appropriate color
+ // + 2 clear for 2 scenes
+ DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 6, TEST_LOCATION );
+ DALI_TEST_EQUALS( glAbstraction.GetLastClearColor(), Color::RED, TEST_LOCATION );
+ // Add another scene and set its background color, ensure we clear it to the appropriate color
+ // + 3 clear for 3 scenes
TestRenderSurface surface2( PositionSize( 0.0f, 0.0f, 480.0f, 800.0f ) );
auto thirdScene = Integration::Scene::New( surface2 );
thirdScene.SetBackgroundColor( Color::BLUE );
- clearCountBefore = glAbstraction.GetClearCountCalled();
-
application.SendNotification();
application.Render();
- DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 3, TEST_LOCATION );
+ DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 9, TEST_LOCATION );
+ DALI_TEST_EQUALS( glAbstraction.GetLastClearColor(), Color::BLUE, TEST_LOCATION );
END_TEST;
}
DALI_TEST_CHECK( event4.state == static_cast<Integration::KeyEvent::State>( data.receivedKeyEvent.state ) );
END_TEST;
}
+
+int UtcDaliSceneEnsureReplacedSurfaceKeepsClearColor(void)
+{
+ tet_infoline( "Ensure we keep background color when the scene surface is replaced " );
+
+ TestApplication application;
+
+ // Create a new scene and set the background color of the main scene
+ auto defaultScene = application.GetScene();
+ defaultScene.SetBackgroundColor( Color::BLUE );
+
+ // Need to create a renderable as we don't start rendering until we have at least one
+ // We don't need to add this to any scene
+ auto actor = CreateRenderableActor();
+
+ auto& glAbstraction = application.GetGlAbstraction();
+ auto clearCountBefore = glAbstraction.GetClearCountCalled();
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 1, TEST_LOCATION );
+ DALI_TEST_EQUALS( glAbstraction.GetLastClearColor(), Color::BLUE, TEST_LOCATION );
+
+ TestRenderSurface surface( PositionSize( 0.0f, 0.0f, 480.0f, 800.0f ) );
+ defaultScene.SetSurface( surface );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 2, TEST_LOCATION );
+ DALI_TEST_EQUALS( glAbstraction.GetLastClearColor(), Color::BLUE, TEST_LOCATION );
+
+ // Check when the main render task viewport is set the clear color is clipped using scissors
+ TraceCallStack& scissorTrace = glAbstraction.GetScissorTrace();
+ TraceCallStack& enabledDisableTrace = glAbstraction.GetEnableDisableTrace();
+ scissorTrace.Enable( true );
+ enabledDisableTrace.Enable( true );
+
+ defaultScene.GetRenderTaskList().GetTask( 0 ).SetViewport( Viewport( 0.0f, 0.0f, 100.0f, 100.0f ) );
+
+ application.SendNotification();
+ application.Render();
+
+ // Check scissor test was enabled.
+ DALI_TEST_CHECK( enabledDisableTrace.FindMethodAndParams( "Enable", "3089" ) ); // 3089 = 0xC11 (GL_SCISSOR_TEST)
+
+ // Check the scissor was set, and the coordinates are correct.
+ DALI_TEST_CHECK( scissorTrace.FindMethodAndParams( "Scissor", "0, 700, 100, 100" ) );
+
+ DALI_TEST_EQUALS( glAbstraction.GetClearCountCalled(), clearCountBefore + 3, TEST_LOCATION );
+ DALI_TEST_EQUALS( glAbstraction.GetLastClearColor(), Color::BLUE, TEST_LOCATION );
+
+ scissorTrace.Enable( false );
+ scissorTrace.Reset();
+
+ enabledDisableTrace.Enable( false );
+ enabledDisableTrace.Reset();
+
+ END_TEST;
+}
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
+CMAKE_MINIMUM_REQUIRED(VERSION 3.1)
CMAKE_POLICY(SET CMP0012 NEW) # Prevent dereferencing of OFF/ON as variables
SET(name "dali-core")
SET(PKG_NAME ${name})
SET(GCC_COMPILER_VERSION_REQUIRED "6")
-if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
- if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS GCC_COMPILER_VERSION_REQUIRED)
+IF(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
+ IF(CMAKE_CXX_COMPILER_VERSION VERSION_LESS GCC_COMPILER_VERSION_REQUIRED)
MESSAGE(FATAL_ERROR "The GCC required compiler version is " ${GCC_COMPILER_VERSION_REQUIRED})
- endif()
-endif()
+ ENDIF()
+ENDIF()
# API VERSION (Not DALi release version)
SET(${name}_VERSION_MAJOR 0)
OPTION(ENABLE_LOCK_BACKTRACE "Enable" OFF)
OPTION(ENABLE_COVERAGE "Coverage" OFF)
OPTION(ENABLE_TRACE "Enable Trace" OFF)
+OPTION(ENABLE_PKG_CONFIGURE "Use pkgconfig" ON)
+OPTION(ENABLE_LINK_TEST "Enable the link test" ON)
+
+IF( WIN32 ) # WIN32 includes x64 as well according to the cmake doc.
+ FIND_PACKAGE( dali-windows-dependencies REQUIRED )
+ FIND_PATH( SYSTEM_INCLUDE_DIR "dali-windows-dependencies.h" )
+ENDIF()
# Set up compiler definitions
MESSAGE( STATUS "CMAKE_BUILD_TYPE: " Release )
ENDIF()
-ADD_DEFINITIONS(-DPIC -DSTDC_HEADERS)
-
-IF("${ARCH}" STREQUAL "arm")
- ADD_DEFINITIONS("-DTARGET")
-ENDIF("${ARCH}" STREQUAL "arm")
-
IF( ENABLE_DEBUG )
ADD_DEFINITIONS( "-DDEBUG_ENABLED" )
SET( ENABLE_EXPORTALL ON )
-ENDIF( ENABLE_DEBUG )
+ENDIF()
+
+IF( WIN32 ) # WIN32 includes x64 as well according to the cmake doc.
+
+ IF(NOT DEFINED STATIC)
+ ADD_DEFINITIONS( "-DBUILDING_DALI_CORE" )
+ ENDIF()
+
+ELSEIF( UNIX )
+
+ IF( NOT ${ENABLE_EXPORTALL} )
+ ADD_DEFINITIONS( "-DHIDE_DALI_INTERNALS" )
+ ENDIF()
-IF( NOT ${ENABLE_EXPORTALL} )
- ADD_DEFINITIONS( "-fvisibility=hidden -DHIDE_DALI_INTERNALS" )
-ENDIF( NOT ${ENABLE_EXPORTALL} )
+ ADD_DEFINITIONS(-DPIC -DSTDC_HEADERS)
+
+ IF("${ARCH}" STREQUAL "arm")
+ ADD_DEFINITIONS("-DTARGET")
+ ENDIF()
+
+ IF( NOT ${ENABLE_EXPORTALL} )
+ ADD_DEFINITIONS( "-fvisibility=hidden" )
+ ENDIF()
+
+ENDIF()
IF( ENABLE_BACKTRACE OR ENABLE_LOCK_BACKTRACE )
ADD_DEFINITIONS( "-DBACKTRACE_ENABLED" )
-ENDIF( ENABLE_BACKTRACE OR ENABLE_LOCK_BACKTRACE )
+ENDIF()
IF( ENABLE_LOCK_BACKTRACE )
ADD_DEFINITIONS( "-DLOCK_BACKTRACE_ENABLED" )
-ENDIF( ENABLE_LOCK_BACKTRACE )
+ENDIF()
+
+IF( ENABLE_TRACE )
+ ADD_DEFINITIONS("-DTRACE_ENABLED")
+ENDIF()
# Deployment folder should come from spec file or command line:
SET( PREFIX ${CMAKE_INSTALL_PREFIX})
ENDIF()
# Set up the lib dir
-SET( LIB_DIR $ENV{libdir} )
-IF( NOT LIB_DIR )
- SET( LIB_DIR ${CMAKE_INSTALL_LIBDIR} )
-ENDIF()
-IF( NOT LIB_DIR )
+IF( SET_VCPKG_INSTALL_PREFIX )
SET( LIB_DIR ${PREFIX}/lib )
+ SET( BIN_DIR ${PREFIX}/bin )
+ELSE()
+ SET( LIB_DIR $ENV{libdir} )
+ IF( NOT LIB_DIR )
+ SET( LIB_DIR ${CMAKE_INSTALL_LIBDIR} )
+ ENDIF()
+ IF( NOT LIB_DIR )
+ SET( LIB_DIR ${PREFIX}/lib )
+ ENDIF()
ENDIF()
-# Configure the pkg-config file
-# Requires the following variables to be setup:
-# @PREFIX@ @EXEC_PREFIX@ @DALI_VERSION@ @LIB_DIR@ @DEV_INCLUDE_PATH@
-SET( DEV_INCLUDE_PATH ${INCLUDE_DIR} )
-SET( CORE_PKG_CFG_FILE ${CMAKE_CURRENT_SOURCE_DIR}/dali-core.pc )
-CONFIGURE_FILE( ${CORE_PKG_CFG_FILE}.in ${CORE_PKG_CFG_FILE} @ONLY )
-
-# Set up compiler flags and warnings
-ADD_COMPILE_OPTIONS( -std=c++11 )
-ADD_COMPILE_OPTIONS( -Wnon-virtual-dtor -Woverloaded-virtual -Wold-style-cast )
-
-# TODO: Clang is a lot more strict with warnings, we should address
-# those issues at some point.
-IF( NOT "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" )
- ADD_COMPILE_OPTIONS( -Werror )
+IF( ENABLE_PKG_CONFIGURE )
+ # Configure the pkg-config file
+ # Requires the following variables to be setup:
+ # @PREFIX@ @EXEC_PREFIX@ @DALI_VERSION@ @LIB_DIR@ @DEV_INCLUDE_PATH@
+ SET( DEV_INCLUDE_PATH ${INCLUDE_DIR} )
+ SET( CORE_PKG_CFG_FILE ${CMAKE_CURRENT_SOURCE_DIR}/dali-core.pc )
+ CONFIGURE_FILE( ${CORE_PKG_CFG_FILE}.in ${CORE_PKG_CFG_FILE} @ONLY )
ENDIF()
-ADD_COMPILE_OPTIONS( -Wall -Wextra -Wno-unused-parameter -Wfloat-equal -Wno-class-memaccess -Wno-cast-function-type )
+IF( WIN32 ) # WIN32 includes x64 as well according to the cmake doc.
-IF( ENABLE_COVERAGE OR "$ENV{CXXFLAGS}" MATCHES --coverage )
- ADD_COMPILE_OPTIONS( --coverage )
- SET(ENABLE_COVERAGE ON)
- SET(COVERAGE --coverage)
-ENDIF()
+ ADD_COMPILE_OPTIONS( /FIdali-windows-dependencies.h ) # Adds missing definitions.
+ ADD_COMPILE_OPTIONS( /vmg ) # Avoids a 'reinterpret_cast' compile error while compiling signals and callbacks.
-IF( ENABLE_TRACE )
- ADD_DEFINITIONS("-DTRACE_ENABLED")
-ENDIF()
+ELSEIF( UNIX )
+
+ # Set up compiler flags and warnings
+ ADD_COMPILE_OPTIONS( -std=c++11 )
+ ADD_COMPILE_OPTIONS( -Wnon-virtual-dtor -Woverloaded-virtual -Wold-style-cast )
+
+ # TODO: Clang is a lot more strict with warnings, we should address
+ # those issues at some point.
+ IF( NOT ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" )
+ ADD_COMPILE_OPTIONS( -Werror )
+ ENDIF()
+
+ ADD_COMPILE_OPTIONS( -Wall -Wextra -Wno-unused-parameter -Wfloat-equal -Wno-class-memaccess -Wno-cast-function-type )
+
+ IF( ENABLE_COVERAGE OR "$ENV{CXXFLAGS}" MATCHES --coverage )
+ ADD_COMPILE_OPTIONS( --coverage )
+ SET(ENABLE_COVERAGE ON)
+ SET(COVERAGE --coverage)
+ ENDIF()
+ENDIF()
INCLUDE_DIRECTORIES(
${ROOT_SRC_DIR}
+ ${SYSTEM_INCLUDE_DIR}
)
SET(SOURCE_DIR "${ROOT_SRC_DIR}/dali")
INCLUDE( ${ROOT_SRC_DIR}/dali/integration-api/file.list )
INCLUDE( ${ROOT_SRC_DIR}/dali/public-api/file.list )
INCLUDE( ${ROOT_SRC_DIR}/dali/devel-api/file.list )
+IF( WIN32 )
+ INCLUDE( ${ROOT_SRC_DIR}/dali/internal/file-windows.list )
+ELSEIF( UNIX )
+ INCLUDE( ${ROOT_SRC_DIR}/dali/internal/file-unix.list )
+ENDIF()
INCLUDE( ${ROOT_SRC_DIR}/doc/file.list )
SET(LIBTYPE SHARED)
ADD_LIBRARY( ${name} ${LIBTYPE} ${SOURCES} )
# pthread required due to gcc issue
-FIND_LIBRARY(PTHREAD pthread)
-IF(PTHREAD)
- SET(OPTIONAL_LIBS ${OPTIONAL_LIBS} -lpthread)
+IF( WIN32 )
+ SET( OPTIONAL_LIBS ${OPTIONAL_LIBS} dali-windows-dependencies::dali-windows-dependencies )
+ELSEIF( UNIX )
+ FIND_LIBRARY(PTHREAD pthread)
+ IF(PTHREAD)
+ SET(OPTIONAL_LIBS ${OPTIONAL_LIBS} -lpthread)
+ ENDIF()
ENDIF()
TARGET_LINK_LIBRARIES( ${name}
)
# Install the library so file and symlinks
-INSTALL( TARGETS ${name} DESTINATION ${LIB_DIR} )
+IF( INSTALL_CMAKE_MODULES )
+ INSTALL( TARGETS ${name}
+ EXPORT ${name}-targets
+ LIBRARY DESTINATION ${LIB_DIR}
+ ARCHIVE DESTINATION ${LIB_DIR}
+ RUNTIME DESTINATION ${BIN_DIR}
+ )
+
+ INSTALL(
+ EXPORT ${name}-targets
+ NAMESPACE ${name}::
+ FILE ${name}-targets.cmake
+ DESTINATION share/${name}
+ )
+
+ FILE( WRITE ${CMAKE_CURRENT_BINARY_DIR}/${name}-config.cmake "
+ include(CMakeFindDependencyMacro)
+ include(\${CMAKE_CURRENT_LIST_DIR}/${name}-targets.cmake)
+ ")
+ INSTALL( FILES ${CMAKE_CURRENT_BINARY_DIR}/${name}-config.cmake DESTINATION share/${name} )
+ELSE()
+ INSTALL( TARGETS ${name} DESTINATION ${LIB_DIR} )
+ENDIF()
+
# Install the pkg-config file
-INSTALL( FILES ${CORE_PKG_CFG_FILE} DESTINATION ${LIB_DIR}/pkgconfig )
+IF( ENABLE_PKG_CONFIGURE )
+ INSTALL( FILES ${CORE_PKG_CFG_FILE} DESTINATION ${LIB_DIR}/pkgconfig )
+ENDIF()
# macro for installing headers by replacing prefix. (TODO, investigate
# if there is a CMAKE way of doing this automatically)
# The DALI_CORE_PREFIX must be set if this CMakeLists.txt is executed
# from the top-level CMake script using ADD_SUBDIRECTORY() to avoid
# target names duplication with other DALi modules.
-IF( UNIX )
+IF( ENABLE_COVERAGE )
FIND_PROGRAM( LCOV_BIN "lcov" )
IF( LCOV_BIN )
)
ENDIF( LCOV_BIN )
-ENDIF( UNIX )
-
-# Linker Test
-SET( DALI_TEST_SUITE_DIR ${ROOT_SRC_DIR}/automated-tests/src/dali/dali-test-suite-utils )
-SET( LINKER_TEST_NAME ${DALI_CORE_PREFIX}linker-test )
-SET( LINKER_TEST_SOURCES
- linker-test.cpp
- ${DALI_TEST_SUITE_DIR}/test-application.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-gl-abstraction.cpp
- ${DALI_TEST_SUITE_DIR}/test-gl-sync-abstraction.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_INCLUDE_DIRECTORIES( ${LINKER_TEST_NAME} PRIVATE ${DALI_TEST_SUITE_DIR} )
+ENDIF()
+
+IF( ENABLE_LINK_TEST )
+ # Linker Test
+ SET( DALI_TEST_SUITE_DIR ${ROOT_SRC_DIR}/automated-tests/src/dali/dali-test-suite-utils )
+ SET( LINKER_TEST_NAME ${DALI_CORE_PREFIX}linker-test )
+ SET( LINKER_TEST_SOURCES
+ linker-test.cpp
+ ${DALI_TEST_SUITE_DIR}/test-application.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-gl-abstraction.cpp
+ ${DALI_TEST_SUITE_DIR}/test-gl-sync-abstraction.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_INCLUDE_DIRECTORIES( ${LINKER_TEST_NAME} PRIVATE ${DALI_TEST_SUITE_DIR} )
+ENDIF()
# Configuration Messages
MESSAGE( STATUS "Configuration:\n" )
MESSAGE( STATUS "Prefix: " ${PREFIX} )
MESSAGE( STATUS "Lib Dir: " ${LIB_DIR} )
+MESSAGE( STATUS "Bin Dir: " ${BIN_DIR} )
MESSAGE( STATUS "Include Dir: " ${INCLUDE_DIR} )
MESSAGE( STATUS "Debug build: " ${ENABLE_DEBUG} )
MESSAGE( STATUS "Export all symbols: " ${ENABLE_EXPORTALL} )
MESSAGE( STATUS "Scoped Lock backtrace: " ${ENABLE_LOCK_BACKTRACE} )
MESSAGE( STATUS "Coverage: " ${ENABLE_COVERAGE} )
MESSAGE( STATUS "Trace: " ${ENABLE_TRACE} )
+MESSAGE( STATUS "Use pkg configure: " ${ENABLE_PKG_CONFIGURE} )
+MESSAGE( STATUS "Enable link test: " ${ENABLE_LINK_TEST} )
MESSAGE( STATUS "CXXFLAGS: " ${CMAKE_CXX_FLAGS} )
MESSAGE( STATUS "LDFLAGS: " ${CMAKE_SHARED_LINKER_FLAGS_INIT}${CMAKE_SHARED_LINKER_FLAGS} )
--- /dev/null
+/*
+ * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// // EXTERNAL INCLUDES
+// #include <dali/public-api/events/key-event.h>
+// #include <dali/public-api/events/touch-event.h>
+// #include <dali/public-api/events/wheel-event.h>
+
+// INTERNAL INCLUDES
+#include <dali/devel-api/events/long-press-gesture-detector-devel.h>
+#include <dali/internal/event/events/long-press-gesture/long-press-gesture-detector-impl.h>
+
+namespace Dali
+{
+
+namespace DevelLongPressGestureDetector
+{
+
+uint32_t GetMinimumHoldingTime( LongPressGestureDetector longPressGestureDetector )
+{
+ return GetImplementation( longPressGestureDetector ).GetMinimumHoldingTime();
+}
+
+
+} // namespace DevelLongPressGestureDetector
+
+} // namespace Dali
+
--- /dev/null
+#ifndef DALI_LONG_PRESS_GESTURE_DETECTOR_DEVEL_H
+#define DALI_LONG_PRESS_GESTURE_DETECTOR_DEVEL_H
+
+/*
+ * Copyright (c) 2020 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/public-api/events/long-press-gesture-detector.h>
+
+namespace Dali
+{
+
+class LongPressGestureDetector;
+
+namespace DevelLongPressGestureDetector
+{
+
+/**
+ * @brief Get the minimum holding time required to be recognized as a long press gesture in milliseconds
+ *
+ * @param[in] longPressGestureDetector The target LongPressGestureDetector instance
+ * @return The time value in milliseconds
+ */
+DALI_CORE_API uint32_t GetMinimumHoldingTime( LongPressGestureDetector longPressGestureDetector );
+
+} // namespace DevelLongPressGestureDetector
+
+} // namespace Dali
+
+#endif // DALI_LONG_PRESS_GESTURE_DETECTOR_DEVEL_H
${devel_api_src_dir}/common/hash.cpp
${devel_api_src_dir}/common/stage-devel.cpp
${devel_api_src_dir}/events/hit-test-algorithm.cpp
+ ${devel_api_src_dir}/events/long-press-gesture-detector-devel.cpp
${devel_api_src_dir}/events/rotation-gesture.cpp
${devel_api_src_dir}/events/rotation-gesture-detector.cpp
${devel_api_src_dir}/events/touch-data-devel.cpp
${devel_api_src_dir}/images/pixel-data-devel.cpp
${devel_api_src_dir}/object/handle-devel.cpp
${devel_api_src_dir}/object/csharp-type-registry.cpp
+ ${devel_api_src_dir}/rendering/frame-buffer-devel.cpp
${devel_api_src_dir}/scripting/scripting.cpp
${devel_api_src_dir}/signals/signal-delegate.cpp
${devel_api_src_dir}/threading/conditional-wait.cpp
SET( devel_api_core_events_header_files
${devel_api_src_dir}/events/gesture-devel.h
${devel_api_src_dir}/events/hit-test-algorithm.h
+ ${devel_api_src_dir}/events/long-press-gesture-detector-devel.h
${devel_api_src_dir}/events/rotation-gesture.h
${devel_api_src_dir}/events/rotation-gesture-detector.h
${devel_api_src_dir}/events/touch-data-devel.h
SET( devel_api_core_rendering_header_files
+ ${devel_api_src_dir}/rendering/frame-buffer-devel.h
${devel_api_src_dir}/rendering/renderer-devel.h
)
--- /dev/null
+/*
+ * Copyright (c) 2020 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.
+ *
+ */
+
+// HEADER
+#include <dali/devel-api/rendering/frame-buffer-devel.h>
+
+// INTERNAL INCLUDES
+#include <dali/internal/event/rendering/frame-buffer-impl.h> // Dali::Internal::FrameBuffer
+
+namespace Dali
+{
+
+namespace DevelFrameBuffer
+{
+
+Texture GetColorTexture( const FrameBuffer frameBuffer, uint8_t index )
+{
+ Internal::Texture* texturePtr = GetImplementation( frameBuffer ).GetColorTexture(index);
+ return Dali::Texture( texturePtr );
+}
+
+} // namespace DevelFrameBuffer
+
+} // namespace Dali
--- /dev/null
+#ifndef DALI_FRAME_BUFFER_DEVEL_H
+#define DALI_FRAME_BUFFER_DEVEL_H
+
+/*
+ * Copyright (c) 2020 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/public-api/rendering/frame-buffer.h>
+
+namespace Dali
+{
+
+namespace DevelFrameBuffer
+{
+
+/**
+ * @brief Maximum number of color attachments supported.
+ */
+constexpr uint8_t MAX_COLOR_ATTACHMENTS = 8;
+
+/**
+ * @brief Gets the color texture at the given @a index used as output in the FrameBuffer.
+ *
+ * @param[in] frameBuffer A handle to the framebuffer
+ * @param[in] index The index required
+ *
+ * @return A handle to the texture used as color output, or an uninitialized handle
+ *
+ * @note A maximum of 8 color attachments are supported. Passing an invalid index will return
+ * an uninitialized handle.
+ */
+Texture GetColorTexture( const FrameBuffer frameBuffer, uint8_t index );
+
+} // namespace DevelFrameBuffer
+
+} // namespace Dali
+
+#endif // DALI_FRAME_BUFFER_DEVEL_H
#include <dali/integration-api/context-notifier.h>
#include <dali/integration-api/resource-policies.h>
+#undef FALSE
+#undef TRUE
+
namespace Dali
{
namespace Log
{
-thread_local LogFunction gthreadLocalLogFunction = NULL;
+thread_local LogFunction gthreadLocalLogFunction = nullptr;
/* Forward declarations */
std::string FormatToString(const char *format, ...);
void UninstallLogFunction()
{
- gthreadLocalLogFunction = NULL;
+ gthreadLocalLogFunction = nullptr;
}
#ifdef DEBUG_ENABLED
Filter* Filter::gRender = Filter::New(Debug::Concise, false, "LOG_RENDER");
Filter* Filter::gResource = Filter::New(Debug::Concise, false, "LOG_RESOURCE");
Filter* Filter::gGLResource = Filter::New(Debug::Concise, false, "LOG_GL_RESOURCE");
-Filter* Filter::gObject = NULL;
+Filter* Filter::gObject = nullptr;
Filter* Filter::gImage = Filter::New(Debug::Concise, false, "LOG_IMAGE");
Filter* Filter::gModel = Filter::New(Debug::Concise, false, "LOG_MODEL");
-Filter* Filter::gNode = NULL;
-Filter* Filter::gElement = NULL;
+Filter* Filter::gNode = nullptr;
+Filter* Filter::gElement = nullptr;
Filter* Filter::gActor = Filter::New(Debug::Concise, false, "LOG_ACTOR");
Filter* Filter::gShader = Filter::New(Debug::Concise, false, "LOG_SHADER");
if( mTraceEnabled )
{
- char *buffer = NULL;
+ char *buffer = nullptr;
int numChars = asprintf( &buffer, " %-*c %s", mNesting, ':', format );
if( numChars >= 0 ) // No error
{
#endif // DEBUG_ENABLED
-
std::string ArgListToString(const char *format, va_list args)
{
std::string str; // empty string
/**
* Provides unfiltered logging for global warning level messages
*/
-#define DALI_LOG_WARNING(format, ...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugWarning, "%s " format, __PRETTY_FUNCTION__, ## __VA_ARGS__)
+#define DALI_LOG_WARNING(format, ...) Dali::Integration::Log::LogMessage(Dali::Integration::Log::DebugWarning, "%s " format, ASSERT_LOCATION, ## __VA_ARGS__)
#else // DEBUG_ENABLED
#define DALI_LOG_TRACE_METHOD_FMT(filter, format, ...) \
- Dali::Integration::Log::TraceObj debugTraceObj(filter, "%s: " format, __PRETTY_FUNCTION__, ## __VA_ARGS__)
+ Dali::Integration::Log::TraceObj debugTraceObj(filter, "%s: " format, ASSERT_LOCATION, ## __VA_ARGS__)
#define DALI_LOG_TRACE_METHOD(filter) \
- Dali::Integration::Log::TraceObj debugTraceObj(filter, __PRETTY_FUNCTION__)
+ Dali::Integration::Log::TraceObj debugTraceObj(filter, ASSERT_LOCATION)
#else // DEBUG_ENABLED
# Set the source directory
SET( platform_abstraction_src_dir ${ROOT_SRC_DIR}/dali/integration-api )
-# Add platform abstraction headers here
+# Add platform abstraction source files here
SET( platform_abstraction_src_files
${platform_abstraction_src_dir}/bitmap.cpp
${platform_abstraction_src_dir}/core.cpp
eventProcessor.SetPinchGestureMinimumDistance( value );
}
+void SetLongPressMinimumHoldingTime( unsigned int value )
+{
+ GestureEventProcessor& eventProcessor = ThreadLocalStorage::Get().GetGestureEventProcessor();
+ eventProcessor.SetLongPressMinimumHoldingTime( value );
+}
+
} // namespace Integration
* @param[in] value Distance to move in pixels
*/
DALI_CORE_API void SetPinchGestureMinimumDistance( float value );
+
+/**
+ * @brief Sets the minimum holding time required to be recognized as a long press gesture
+ *
+ * @param[in] value The time value in milliseconds
+ */
+DALI_CORE_API void SetLongPressMinimumHoldingTime( unsigned int value );
+
} // namespace Integration
} // namespace Dali
* Used for function tracing. It logs tracing of the fuction from start to end.
*/
#define DALI_TRACE_FUNCTION( filter ) \
- Dali::Integration::Trace::Tracer logTraceFunction( filter, __PRETTY_FUNCTION__ );
+ Dali::Integration::Trace::Tracer logTraceFunction( filter, ASSERT_LOCATION );
/**
* Used for scope tracing. It logs tracing around a scope.
{
EnsureRelayoutData();
- if( size.width > 0.0f )
- {
- SetResizePolicy( ResizePolicy::FIXED, Dimension::WIDTH );
- }
-
- if( size.height > 0.0f )
- {
- SetResizePolicy( ResizePolicy::FIXED, Dimension::HEIGHT );
- }
+ SetResizePolicy( ResizePolicy::FIXED, Dimension::WIDTH );
+ SetResizePolicy( ResizePolicy::FIXED, Dimension::HEIGHT );
mRelayoutData->preferredSize = size;
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*
*/
-//
-// gcc and clang minimal demangling
-// Both follow Itanium C++ ABI
-//
-// We only decode namespaces and class typeid names for simplicity as its all we need.
-//
-// From http://mentorembedded.github.io/cxx-abi/abi.html#mangling-structure
-//
-// <nested-name> ::= N [<CV-qualifiers>] <prefix> <unqualified-name> E
-// ::= N [<CV-qualifiers>] <template-prefix> <template-args> E
-//
-// <prefix> ::= <prefix> <unqualified-name>
-// ::= <template-prefix> <template-args>
-// ::= <template-param>
-// ::= <decltype>
-// ::= # empty
-// ::= <substitution>
-// ::= <prefix> <data-member-prefix>
-//
-// <template-prefix> ::= <prefix> <template unqualified-name>
-// ::= <template-param>
-// ::= <substitution>
-// <unqualified-name> ::= <operator-name>
-// ::= <ctor-dtor-name>
-// ::= <source-name>
-// ::= <unnamed-type-name>
-//
-// <source-name> ::= <positive length number> <identifier>
-// <number> ::= [n] <non-negative decimal integer>
-// <identifier> ::= <unqualified source code identifier>
-//
-// So for example
-//
-// Dali::Internal::Actor would be
-//
-// N4Dali8Internal5ActorE
-//
-
-// CLASS HEADER
+// FILE HEADER
#include <dali/internal/event/common/demangler.h>
+// INTERNAL HEADERS
+#include <dali/public-api/common/vector-wrapper.h>
+
namespace
{
return i - start;
}
-} // anon namespace
-
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-#if defined(__clang__) || defined(__GNUC__)
-
-// Demangle class name mangled according to the Itanium C++ ABI
-// Returns demangled names ie "N4Dali8Internal5ActorE" is ["Dali","Internal","Actor"]
+/**
+ * @brief Demangle a nested typeid name into its component parts.
+ * A nested type name is one containing namespaces and class names only.
+ * eg DemangleNestedNames(typeid(Dali::Actor).name());
+ * @param[in] typeIdName The type id name string to demangle.
+ * @returns the demangled list of names ie ["Dali","Actor"] or an empty list
+ */
std::vector<std::string> DemangleNestedNames(const char *typeIdName)
{
+ // Demangle class name mangled according to the Itanium C++ ABI
+ // Returns demangled names ie "N4Dali8Internal5ActorE" is ["Dali","Internal","Actor"]
std::vector<std::string> ret;
const std::string mangledName(typeIdName);
return ret;
}
-#else
-# error Unsupported Compiler
-#endif
+} // anon namespace
+namespace Dali
+{
+
+namespace Internal
+{
const std::string DemangleClassName(const char *typeIdName)
{
--- /dev/null
+/*
+ * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+// FILE HEADER
+#include <dali/internal/event/common/demangler.h>
+
+namespace Dali
+{
+
+namespace Internal
+{
+
+const std::string DemangleClassName(const char *typeIdName)
+{
+ std::string name = typeIdName;
+ int index = name.find_last_of(' ');
+
+ if( 0 <= index )
+ {
+ name = name.substr( index + 1, name.size() - index );
+ }
+
+ index = name.find_last_of(':');
+
+ if( 0 <= index )
+ {
+ name = name.substr(index + 1, name.size() - index);
+ }
+
+ return name;
+}
+
+} // namespace Internal
+
+} // namespace Dali
// EXTERNAL INCLUDES
#include <string>
-// INTERNAL INCLUDES
-#include <dali/public-api/common/vector-wrapper.h>
-
namespace Dali
{
{
/**
- * Demangle a nested typeid name into its component parts.
- * A nested type name is one containing namespaces and class names only.
- * eg DemangleNestedNames(typeid(Dali::Actor).name());
- * @param[in] typeIdName The type id name string to demangle.
- * @returns the demangled list of names ie ["Dali","Actor"] or an empty list
- */
-std::vector<std::string> DemangleNestedNames(const char *typeIdName);
-
-/**
- * Demangle a nested typeid name to its class name.
+ * @brief Demangle a nested typeid name to its class name.
* @param[in] typeIdName The type id name string to demangle.
* @returns the class name ie "Actor" or an empty string
*/
if( mSurface )
{
- mRenderTaskList->GetTask( 0u )->GetFrameBuffer()->SetBackgroundColor( color );
+ mRenderTaskList->GetTask( 0u )->SetClearColor( color );
+ mRenderTaskList->GetTask( 0u )->SetClearEnabled( true );
}
}
#include <dali/internal/event/common/type-registry-impl.h>
// INTERNAL INCLUDES
-#include <dali/internal/event/common/thread-local-storage.h>
#include <dali/public-api/object/type-registry.h>
#include <dali/public-api/object/base-handle.h>
#include <dali/internal/event/actors/custom-actor-internal.h>
#include <dali/internal/event/common/demangler.h>
+#include <dali/internal/event/common/thread-local-storage.h>
#include <dali/integration-api/debug.h>
namespace Dali
{
-extern std::string Demangle(const char* symbol);
-
namespace Internal
{
mPinchGestureProcessor.SetMinimumPinchDistance( value );
}
+void GestureEventProcessor::SetLongPressMinimumHoldingTime( uint32_t value )
+{
+ mLongPressGestureProcessor.SetMinimumHoldingTime( value );
+}
+
+uint32_t GestureEventProcessor::GetLongPressMinimumHoldingTime() const
+{
+ return mLongPressGestureProcessor.GetMinimumHoldingTime();
+}
+
const PanGestureProcessor& GestureEventProcessor::GetPanGestureProcessor()
{
return mPanGestureProcessor;
*/
void SetPinchGestureMinimumDistance( float value);
+ /**
+ * @brief Sets the minimum holding time required to be recognized as a long press gesture
+ *
+ * @param[in] value The time value in milliseconds
+ */
+ void SetLongPressMinimumHoldingTime( uint32_t value );
+
+ /**
+ * @return The minimum holding time required to be recognized as a long press gesture in milliseconds
+ */
+ uint32_t GetLongPressMinimumHoldingTime() const;
+
public: // needed for PanGesture
/**
// Do nothing
}
+uint32_t LongPressGestureDetector::GetMinimumHoldingTime() const
+{
+ return mGestureEventProcessor.GetLongPressMinimumHoldingTime();
+}
+
} // namespace Internal
} // namespace Dali
*/
unsigned int GetMaximumTouchesRequired() const;
+ /**
+ * @return The minimum holding time required to be recognized as a long press gesture in milliseconds
+ */
+ uint32_t GetMinimumHoldingTime() const;
+
public:
/**
namespace
{
+const unsigned long DEFAULT_MINIMUM_HOLDING_TIME = 500u;
+
/**
* Creates a LongPressGesture and asks the specified detector to emit its detected signal.
* @param[in] actor The actor on which the long press gesture has occurred.
mCurrentRenderTask(),
mMinTouchesRequired( 1 ),
mMaxTouchesRequired( 1 ),
- mCurrentLongPressEvent( NULL )
+ mCurrentLongPressEvent( NULL ),
+ mMinimumHoldingTime( DEFAULT_MINIMUM_HOLDING_TIME )
{
}
Size size = scene.GetSize();
- mGestureRecognizer = new LongPressGestureRecognizer(*this, Vector2(size.width, size.height), static_cast<const LongPressGestureRequest&>(request));
+ mGestureRecognizer = new LongPressGestureRecognizer(*this, Vector2(size.width, size.height), static_cast<const LongPressGestureRequest&>(request), mMinimumHoldingTime );
}
else
{
UpdateDetection();
}
+void LongPressGestureProcessor::SetMinimumHoldingTime( uint32_t time )
+{
+ if( time > 0u && mMinimumHoldingTime != time )
+ {
+ mMinimumHoldingTime = time;
+
+ if( mGestureRecognizer )
+ {
+ LongPressGestureRecognizer* longPressRecognizer = dynamic_cast<LongPressGestureRecognizer*>( mGestureRecognizer.Get() );
+ if( longPressRecognizer )
+ {
+ longPressRecognizer->SetMinimumHoldingTime( time );
+ }
+ }
+ }
+}
+
+uint32_t LongPressGestureProcessor::GetMinimumHoldingTime() const
+{
+ return mMinimumHoldingTime;
+}
+
void LongPressGestureProcessor::UpdateDetection()
{
DALI_ASSERT_DEBUG(!mLongPressGestureDetectors.empty());
*/
void GestureDetectorUpdated(LongPressGestureDetector* gestureDetector);
+ /**
+ * @brief This method sets the minimum holding time required to be recognized as a long press gesture
+ *
+ * @param[in] value The time value in milliseconds
+ */
+ void SetMinimumHoldingTime( uint32_t time );
+
+ /**
+ * @return The minimum holding time required to be recognized as a long press gesture in milliseconds
+ */
+ uint32_t GetMinimumHoldingTime() const;
+
private:
// Undefined
uint32_t mMaxTouchesRequired;
const LongPressGestureEvent* mCurrentLongPressEvent; ///< Pointer to current longPressEvent, used when calling ProcessAndEmit()
+
+ uint32_t mMinimumHoldingTime;
};
} // namespace Internal
{
// TODO: Set these according to DPI
const float MAXIMUM_MOTION_ALLOWED = 60.0f;
-// TODO: Set this time according to system setting (vconf)
-const unsigned long LONG_PRESS_TIME = 500u;
+
} // unnamed namespace
-LongPressGestureRecognizer::LongPressGestureRecognizer(Observer& observer, Vector2 screenSize, const LongPressGestureRequest& request )
+LongPressGestureRecognizer::LongPressGestureRecognizer(Observer& observer, Vector2 screenSize, const LongPressGestureRequest& request, uint32_t minimumHoldingTime )
: GestureRecognizer( screenSize, Gesture::LongPress ),
mObserver( observer ),
mState( Clear ),
mMinimumTouchesRequired( request.minTouches ),
mMaximumTouchesRequired( request.maxTouches ),
mTouchTime( 0 ),
- mTimerId( 0 )
+ mTimerId( 0 ),
+ mMinimumHoldingTime( minimumHoldingTime )
{
}
mTouchTime = event.time;
- mTimerId = platformAbstraction.StartTimer(GetSystemValue(), MakeCallback( this, &LongPressGestureRecognizer::TimerCallback));
+ mTimerId = platformAbstraction.StartTimer( mMinimumHoldingTime, MakeCallback( this, &LongPressGestureRecognizer::TimerCallback ) );
// A long press gesture may be possible, tell Core about this and change state to Touched.
mState = Touched;
mMaximumTouchesRequired = longPress.maxTouches;
}
+void LongPressGestureRecognizer::SetMinimumHoldingTime( uint32_t time )
+{
+ mMinimumHoldingTime = time;
+}
+
+
bool LongPressGestureRecognizer::TimerCallback()
{
EmitGesture(Gesture::Started);
longPress.time = mTouchTime;
if ( state != Gesture::Possible )
{
- longPress.time += GetSystemValue();
+ longPress.time += mMinimumHoldingTime;
}
if( mScene )
}
}
-int LongPressGestureRecognizer::GetSystemValue()
-{
- return LONG_PRESS_TIME;
-}
-
} // namespace Internal
} // namespace Dali
* @param[in] coreEventInterface Used to send events to Core.
* @param[in] screenSize The size of the screen.
* @param[in] request The long press gesture request.
+ * @param[in] minimumHoldingTime The minimum holding time required in milliseconds.
*/
- LongPressGestureRecognizer( Observer& observer, Vector2 screenSize, const LongPressGestureRequest& request );
+ LongPressGestureRecognizer( Observer& observer, Vector2 screenSize, const LongPressGestureRequest& request, uint32_t minimumHoldingTime );
/**
* Virtual destructor.
*/
virtual void Update(const GestureRequest& request);
+ /**
+ * @brief This method sets the minimum holding time required to be recognized as a long press gesture
+ *
+ * @param[in] value The time value in milliseconds
+ */
+ void SetMinimumHoldingTime( uint32_t time );
+
private:
/**
*/
void EmitGesture(Gesture::State state);
- /**
- * Get current system setting value for tap and hold gesture
- * @return system value for tap and hold gesture [ms]
- */
- int GetSystemValue();
-
private:
// Reference to the gesture processor for this recognizer
uint32_t mTouchTime; ///< The time we first pressed down.
uint32_t mTimerId;
+
+ uint32_t mMinimumHoldingTime;
};
} // namespace Internal
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
FrameBuffer::FrameBuffer( uint32_t width, uint32_t height, Mask attachments )
: mEventThreadServices( EventThreadServices::Get() ),
mRenderObject( NULL ),
- mColor( NULL ),
+ mColor{ nullptr },
mWidth( width ),
mHeight( height ),
mAttachments( attachments ),
+ mColorAttachmentCount( 0 ),
mIsSurfaceBacked( false )
{
}
}
else
{
- if( ( texture->GetWidth() / ( 1u << mipmapLevel ) == mWidth ) &&
- ( texture->GetHeight() / ( 1u << mipmapLevel ) == mHeight ) )
+ if( ( texture->GetWidth() / ( 1u << mipmapLevel ) != mWidth ) ||
+ ( texture->GetHeight() / ( 1u << mipmapLevel ) != mHeight ) )
{
- mColor = texture;
- AttachColorTextureToFrameBuffer( mEventThreadServices.GetUpdateManager(), *mRenderObject, texture->GetRenderObject(), mipmapLevel, layer );
+ DALI_LOG_ERROR( "Failed to attach color texture to FrameBuffer: Size mismatch \n" );
+ }
+ else if ( mColorAttachmentCount >= Dali::DevelFrameBuffer::MAX_COLOR_ATTACHMENTS )
+ {
+ DALI_LOG_ERROR( "Failed to attach color texture to FrameBuffer: Exceeded maximum supported color attachments.\n" );
}
else
{
- DALI_LOG_ERROR( "Failed to attach color texture to FrameBuffer: Size mismatch \n" );
+ mColor[mColorAttachmentCount] = texture;
+ ++mColorAttachmentCount;
+
+ AttachColorTextureToFrameBuffer( mEventThreadServices.GetUpdateManager(), *mRenderObject, texture->GetRenderObject(), mipmapLevel, layer );
}
}
}
-Texture* FrameBuffer::GetColorTexture()
+Texture* FrameBuffer::GetColorTexture(uint8_t index) const
{
- return mIsSurfaceBacked ? nullptr : mColor.Get();
+ return ( mIsSurfaceBacked || index >= mColorAttachmentCount ) ? nullptr : mColor[index].Get();
}
void FrameBuffer::SetSize( uint32_t width, uint32_t height )
}
}
-void FrameBuffer::SetBackgroundColor( const Vector4& color )
-{
- if( mRenderObject->IsSurfaceBacked() )
- {
- SetFrameBufferBackgroundColorMessage( mEventThreadServices.GetUpdateManager(), static_cast<Render::SurfaceFrameBuffer*>( mRenderObject ), color );
- }
-}
-
void FrameBuffer::MarkSurfaceAsInvalid()
{
if ( mIsSurfaceBacked )
#define DALI_INTERNAL_FRAME_BUFFER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
#include <dali/public-api/common/intrusive-ptr.h> // Dali::IntrusivePtr
#include <dali/public-api/object/base-object.h>
#include <dali/public-api/rendering/frame-buffer.h>
+#include <dali/devel-api/rendering/frame-buffer-devel.h>
#include <dali/internal/event/common/event-thread-services.h>
#include <dali/internal/event/rendering/texture-impl.h>
/**
* @copydoc Dali::FrameBuffer::GetColorTexture()
*/
- Texture* GetColorTexture();
+ Texture* GetColorTexture(uint8_t index) const;
/**
* @brief Sets the frame buffer size.
void SetSize( uint32_t width, uint32_t height );
/**
- * @brief Sets the background color
- * @param[in] color The new background color
- */
- void SetBackgroundColor( const Vector4& color );
-
- /**
* @brief Mark the render surface as invalid
*
* The render surface is maked as invalid when it is deleted.
Internal::EventThreadServices& mEventThreadServices; ///< Used to send messages to the render thread via update thread
Internal::Render::FrameBuffer* mRenderObject; ///< The Render::Texture associated to this texture
- TexturePtr mColor;
+ TexturePtr mColor[ Dali::DevelFrameBuffer::MAX_COLOR_ATTACHMENTS ];
uint32_t mWidth;
uint32_t mHeight;
Mask mAttachments; ///< Bit-mask of type FrameBuffer::Attachment::Mask
+ uint8_t mColorAttachmentCount;
bool mIsSurfaceBacked:1;
--- /dev/null
+# Set the source directory
+SET( internal_src_dir ${ROOT_SRC_DIR}/dali/internal )
+
+# Add internal unix source files here
+SET( internal_unix_src_files
+ ${internal_src_dir}/event/common/demangler-unix.cpp
+)
+
+SET( SOURCES ${SOURCES}
+ ${internal_unix_src_files}
+)
\ No newline at end of file
--- /dev/null
+# Set the source directory
+SET( internal_src_dir ${ROOT_SRC_DIR}/dali/internal )
+
+# Add internal windows source files here
+SET( internal_windows_src_files
+ ${internal_src_dir}/event/common/demangler-windows.cpp
+)
+
+SET( SOURCES ${SOURCES}
+ ${internal_windows_src_files}
+)
\ No newline at end of file
${internal_src_dir}/event/animation/linear-constrainer-impl.cpp
${internal_src_dir}/event/animation/path-impl.cpp
${internal_src_dir}/event/animation/path-constrainer-impl.cpp
- ${internal_src_dir}/event/common/demangler.cpp
${internal_src_dir}/event/common/event-thread-services.cpp
${internal_src_dir}/event/common/notification-manager.cpp
${internal_src_dir}/event/common/object-impl.cpp
${internal_src_dir}/update/rendering/scene-graph-renderer.cpp
)
-
SET( SOURCES ${SOURCES}
${internal_src_files}
)
renderQueue(),
instructions(),
renderAlgorithms(),
- backgroundColor( Dali::Stage::DEFAULT_BACKGROUND_COLOR ),
frameCount( 0u ),
renderBufferIndex( SceneGraphBuffers::INITIAL_UPDATE_BUFFER_INDEX ),
defaultSurfaceRect(),
RenderInstructionContainer instructions;
Render::RenderAlgorithms renderAlgorithms; ///< The RenderAlgorithms object is used to action the renders required by a RenderInstruction
- Vector4 backgroundColor; ///< The glClear color used at the beginning of each frame.
-
uint32_t frameCount; ///< The current frame count
BufferIndex renderBufferIndex; ///< The index of the buffer to read from; this is opposite of the "update" buffer
return mImpl->instructions;
}
-void RenderManager::SetBackgroundColor( const Vector4& color )
-{
- mImpl->backgroundColor = color;
-}
-
void RenderManager::SetDefaultSurfaceRect(const Rect<int32_t>& rect)
{
mImpl->defaultSurfaceRect = rect;
}
Rect<int32_t> surfaceRect = mImpl->defaultSurfaceRect;
- Vector4 backgroundColor = mImpl->backgroundColor;
Integration::DepthBufferAvailable depthBufferAvailable = mImpl->depthBufferAvailable;
Integration::StencilBufferAvailable stencilBufferAvailable = mImpl->stencilBufferAvailable;
}
surfaceRect = Rect<int32_t>( 0, 0, static_cast<int32_t>( surfaceFrameBuffer->GetWidth() ), static_cast<int32_t>( surfaceFrameBuffer->GetHeight() ) );
- backgroundColor = surfaceFrameBuffer->GetBackgroundColor();
}
else
{
{
// For each offscreen buffer, update the dependency list with the new texture id used by this frame buffer.
Render::TextureFrameBuffer* textureFrameBuffer = static_cast<Render::TextureFrameBuffer*>( instruction.mFrameBuffer );
- mImpl->textureDependencyList.PushBack( textureFrameBuffer->GetTextureId() );
+ for (unsigned int i0 = 0, i1 = textureFrameBuffer->GetColorAttachmentCount(); i0 < i1; ++i0)
+ {
+ mImpl->textureDependencyList.PushBack( textureFrameBuffer->GetTextureId(i0) );
+ }
}
}
else
surfaceRect.y,
surfaceRect.width,
surfaceRect.height );
-
- mImpl->currentContext->ClearColor( backgroundColor.r,
- backgroundColor.g,
- backgroundColor.b,
- backgroundColor.a );
}
// Clear the entire color, depth and stencil buffers for the default framebuffer, if required.
// It is important to clear all 3 buffers when they are being used, for performance on deferred renderers
// e.g. previously when the depth & stencil buffers were NOT cleared, it caused the DDK to exceed a "vertex count limit",
// and then stall. That problem is only noticeable when rendering a large number of vertices per frame.
-
- mImpl->currentContext->SetScissorTest( false );
-
GLbitfield clearMask = GL_COLOR_BUFFER_BIT;
mImpl->currentContext->ColorMask( true );
clearMask |= GL_STENCIL_BUFFER_BIT;
}
- mImpl->currentContext->Clear( clearMask, Context::FORCE_CLEAR );
-
if( !instruction.mIgnoreRenderToFbo && ( instruction.mFrameBuffer != 0 ) )
{
if ( instruction.mFrameBuffer->IsSurfaceBacked() ) // Surface rendering
}
}
+ bool clearFullFrameRect = true;
+ if( instruction.mFrameBuffer != 0 )
+ {
+ Viewport frameRect( 0, 0, instruction.mFrameBuffer->GetWidth(), instruction.mFrameBuffer->GetHeight() );
+ clearFullFrameRect = ( frameRect == viewportRect );
+ }
+ else
+ {
+ clearFullFrameRect = ( surfaceRect == viewportRect );
+ }
+
mImpl->currentContext->Viewport(viewportRect.x, viewportRect.y, viewportRect.width, viewportRect.height);
+ mImpl->currentContext->ClearColor( clearColor.r,
+ clearColor.g,
+ clearColor.b,
+ clearColor.a );
- if ( instruction.mIsClearColorSet )
+ if( instruction.mIsClearColorSet && !clearFullFrameRect )
{
- mImpl->currentContext->ClearColor( clearColor.r,
- clearColor.g,
- clearColor.b,
- clearColor.a );
-
- // Clear the viewport area only
mImpl->currentContext->SetScissorTest( true );
mImpl->currentContext->Scissor( viewportRect.x, viewportRect.y, viewportRect.width, viewportRect.height );
- mImpl->currentContext->ColorMask( true );
- mImpl->currentContext->Clear( GL_COLOR_BUFFER_BIT , Context::CHECK_CACHED_VALUES );
+ mImpl->currentContext->Clear( clearMask, Context::FORCE_CLEAR );
+ mImpl->currentContext->SetScissorTest( false );
+ }
+ else
+ {
mImpl->currentContext->SetScissorTest( false );
+ mImpl->currentContext->Clear( clearMask, Context::FORCE_CLEAR );
}
// Clear the list of bound textures
// The following methods should be called via RenderQueue messages
- /**
- * Set the background color i.e. the glClear color used at the beginning of each frame.
- * @param[in] color The new background color.
- */
- void SetBackgroundColor( const Vector4& color );
-
/*
* Set the frame time delta (time elapsed since the last frame.
* @param[in] deltaTime the delta time
mContext( nullptr ),
mWidth( mSurface->GetPositionSize().width ),
mHeight( mSurface->GetPositionSize().height ),
- mBackgroundColor( 0.f, 0.f, 0.f, 1.f ),
mSizeChanged( false ),
mIsSurfaceInvalid( false )
{
}
}
-Vector4 SurfaceFrameBuffer::GetBackgroundColor()
-{
- return mBackgroundColor;
-}
-
void SurfaceFrameBuffer::SetSize( uint32_t width, uint32_t height )
{
mWidth = width;
mSizeChanged = true;
}
-void SurfaceFrameBuffer::SetBackgroundColor( const Vector4& color )
-{
- mBackgroundColor = color;
-}
-
bool SurfaceFrameBuffer::IsSurfaceValid() const
{
return mSurface && !mIsSurfaceInvalid;
void SetSize( uint32_t width, uint32_t height );
/**
- * @brief Sets the background color.
- * @param[in] color The new background color
- */
- void SetBackgroundColor( const Vector4& color );
-
- /**
* @copydoc Dali::Internal::FrameBuffer::MarkSurfaceAsInvalid()
*/
void MarkSurfaceAsInvalid() { mIsSurfaceInvalid = true; };
*/
void MakeContextCurrent();
- /**
- * @brief Gets the background color of the surface.
- * @return The background color
- */
- Vector4 GetBackgroundColor();
-
private:
Integration::RenderSurface* mSurface; ///< The render surface
uint32_t mWidth;
uint32_t mHeight;
- Vector4 mBackgroundColor;
bool mSizeChanged;
std::atomic<bool> mIsSurfaceInvalid; ///< This is set only from the event thread and read only from the render thread
};
new (slot) LocalType( surfaceFrameBuffer, &SurfaceFrameBuffer::SetSize, width, height );
}
-inline void SetFrameBufferBackgroundColorMessage( SceneGraph::UpdateManager& updateManager, SurfaceFrameBuffer* surfaceFrameBuffer, const Vector4& color )
-{
- typedef MessageValue1< SurfaceFrameBuffer, Vector4 > LocalType;
-
- // Reserve some memory inside the message queue
- uint32_t* slot = updateManager.ReserveMessageSlot( sizeof( LocalType ) );
-
- // Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( surfaceFrameBuffer, &SurfaceFrameBuffer::SetBackgroundColor, color );
-}
-
} // namespace Render
} // namespace Internal
{
namespace Render
{
+namespace
+{
+const GLenum COLOR_ATTACHMENTS[] =
+{
+ GL_COLOR_ATTACHMENT0,
+ GL_COLOR_ATTACHMENT1,
+ GL_COLOR_ATTACHMENT2,
+ GL_COLOR_ATTACHMENT3,
+ GL_COLOR_ATTACHMENT4,
+ GL_COLOR_ATTACHMENT5,
+ GL_COLOR_ATTACHMENT6,
+ GL_COLOR_ATTACHMENT7,
+};
+}
TextureFrameBuffer::TextureFrameBuffer( uint32_t width, uint32_t height, Mask attachments )
: FrameBuffer(),
mId( 0u ),
- mTextureId( 0u ),
+ mTextureId{ 0u },
mDepthBuffer( attachments & Dali::FrameBuffer::Attachment::DEPTH ),
mStencilBuffer( attachments & Dali::FrameBuffer::Attachment::STENCIL ),
mWidth( width ),
- mHeight( height )
+ mHeight( height ),
+ mColorAttachmentCount( 0u )
{
}
{
context.BindFramebuffer( GL_FRAMEBUFFER, mId );
- mTextureId = texture->GetId();
+ const GLuint textureId = texture->GetId();
+ mTextureId[mColorAttachmentCount] = textureId;
// Create a color attachment.
+ const GLenum iAttachment = COLOR_ATTACHMENTS[mColorAttachmentCount];
if( texture->GetType() == TextureType::TEXTURE_2D )
{
- context.FramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, texture->GetTarget(), mTextureId, mipmapLevel );
+ context.FramebufferTexture2D( GL_FRAMEBUFFER, iAttachment, texture->GetTarget(), textureId, mipmapLevel );
}
else
{
- context.FramebufferTexture2D( GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_CUBE_MAP_POSITIVE_X + layer, mTextureId, mipmapLevel );
+ context.FramebufferTexture2D( GL_FRAMEBUFFER, iAttachment, GL_TEXTURE_CUBE_MAP_POSITIVE_X + layer, textureId, mipmapLevel );
}
+ ++mColorAttachmentCount;
+ context.DrawBuffers(mColorAttachmentCount, COLOR_ATTACHMENTS);
+ DALI_ASSERT_DEBUG(context.CheckFramebufferStatus(GL_FRAMEBUFFER) == GL_FRAMEBUFFER_COMPLETE);
+
context.BindFramebuffer( GL_FRAMEBUFFER, 0 );
}
#define DALI_INTERNAL_RENDER_TEXTURE_FRAME_BUFFER_H
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
*/
// INTERNAL INCLUDES
+#include <dali/devel-api/rendering/frame-buffer-devel.h>
#include <dali/internal/render/renderers/render-frame-buffer.h>
namespace Dali
/**
* @brief Attach a texture for color rendering. Valid only for Framebuffers with COLOR attachments.
- * param[in] context The GL context
+ * @param[in] context The GL context
* @param[in] texture The texture that will be used as output when rendering
* @param[in] mipmapLevel The mipmap of the texture to be attached
* @param[in] layer Indicates which layer of a cube map or array texture to attach. Unused for 2D textures
+ * @note A maximum of Dali::FrameBuffer::MAX_COLOR_ATTACHMENTS are supported.
*/
void AttachColorTexture( Context& context, Render::Texture* texture, uint32_t mipmapLevel, uint32_t layer );
/**
- * @brief Get the id of the texture binded to this frame buffer
- * @return The texture id
+ * @brief Get the number of textures bound to this frame buffer as color attachments.
+ * @return The number of color attachments.
*/
- GLuint GetTextureId() { return mTextureId; };
+ uint8_t GetColorAttachmentCount() const { return mColorAttachmentCount; }
+
+ /**
+ * @brief Get the id (OpenGL handle) of the texture bound to this frame buffer as color attachment @a index.
+ * @return The texture id.
+ */
+ GLuint GetTextureId(uint8_t index) { return mTextureId[index]; };
private:
GLuint mId;
- GLuint mTextureId;
+ GLuint mTextureId[ Dali::DevelFrameBuffer::MAX_COLOR_ATTACHMENTS ];
GLuint mDepthBuffer;
GLuint mStencilBuffer;
uint32_t mWidth;
uint32_t mHeight;
+ uint8_t mColorAttachmentCount;
};
return keepUpdatingRequest;
}
-void UpdateManager::SetBackgroundColor( const Vector4& color )
-{
- typedef MessageValue1< RenderManager, Vector4 > DerivedType;
-
- // Reserve some memory inside the render queue
- uint32_t* slot = mImpl->renderQueue.ReserveMessageSlot( mSceneGraphBuffers.GetUpdateBufferIndex(), sizeof( DerivedType ) );
-
- // Construct message in the render queue memory; note that delete should not be called on the return value
- new (slot) DerivedType( &mImpl->renderManager, &RenderManager::SetBackgroundColor, color );
-}
-
void UpdateManager::SetDefaultSurfaceRect( const Rect<int32_t>& rect )
{
mImpl->surfaceRectChanged = true;
bool isRenderingToFbo );
/**
- * Set the background color i.e. the glClear color used at the beginning of each frame.
- * @param[in] color The new background color.
- */
- void SetBackgroundColor(const Vector4& color);
-
- /**
* Set the default surface rect.
* @param[in] rect The rect value representing the surface.
*/
new (slot) LocalType( &manager, &UpdateManager::SetShaderProgram, const_cast<Shader*>( &shader ), shaderData, modifiesGeometry );
}
-inline void SetBackgroundColorMessage( UpdateManager& manager, const Vector4& color )
-{
- typedef MessageValue1< UpdateManager, Vector4 > LocalType;
-
- // Reserve some memory inside the message queue
- uint32_t* slot = manager.ReserveMessageSlot( sizeof( LocalType ) );
-
- // Construct message in the message queue memory; note that delete should not be called on the return value
- new (slot) LocalType( &manager, &UpdateManager::SetBackgroundColor, color );
-}
-
inline void SetDefaultSurfaceRectMessage( UpdateManager& manager, const Rect<int32_t>& rect )
{
typedef MessageValue1< UpdateManager, Rect<int32_t> > LocalType;
* @SINCE_1_0.0
*/
#if defined(DEBUG_ENABLED)
+#if defined(WIN32)
+#define ASSERT_LOCATION __FUNCSIG__
+#else
#define ASSERT_LOCATION __PRETTY_FUNCTION__
+#endif
#else
#define ASSERT_LOCATION NULL
#endif
const uint32_t CORE_MAJOR_VERSION = 1;
const uint32_t CORE_MINOR_VERSION = 4;
-const uint32_t CORE_MICRO_VERSION = 54;
+const uint32_t CORE_MICRO_VERSION = 55;
const char * const CORE_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
/*
- * Copyright (c) 2019 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
Texture FrameBuffer::GetColorTexture()
{
- Internal::Texture* texturePtr = GetImplementation(*this).GetColorTexture();
+ Internal::Texture* texturePtr = GetImplementation(*this).GetColorTexture(0);
return Dali::Texture( texturePtr );
}
#define DALI_FRAMEBUFFER_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2020 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.
/**
* @brief Attach the base LOD of a 2D texture to the framebuffer for color rendering.
* @note This causes a color attachment to be added.
+ * @note Repeated calls to this method add textures as subsequent color attachments.
+ * @note A maximum of 8 color attachments are supported.
*
* @SINCE_1_1.43
* @param[in] texture The texture that will be used as output when rendering
/**
* @brief Attach a texture to the framebuffer for color rendering.
* @note This causes a color attachment to be added.
+ * @note Repeated calls to this method add textures as subsequent color attachments.
+ * @note A maximum of 8 color attachments are supported.
*
* @SINCE_1_1.43
* @param[in] texture The texture that will be used as output when rendering
void AttachColorTexture( Texture& texture, uint32_t mipmapLevel, uint32_t layer );
/**
- * @brief Gets the color texture used as output in the FrameBuffer.
+ * @brief Gets the first color texture used as output in the FrameBuffer.
*
* @SINCE_1_1.43
* @returns A handle to the texture used as color output, or an uninitialized handle
Name: dali
Summary: DALi 3D Engine
-Version: 1.4.54
+Version: 1.4.55
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT