utc-Dali-DistanceField.cpp
utc-Dali-Extents.cpp
utc-Dali-FrameBuffer.cpp
- utc-Dali-FrameBufferImage.cpp
utc-Dali-FrameCallbackInterface.cpp
utc-Dali-Geometry.cpp
utc-Dali-Gesture.cpp
+++ /dev/null
-/*
- * Copyright (c) 2016 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 <iostream>
-#include <algorithm>
-
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali-test-suite-utils.h>
-#include <test-native-image.h>
-#include <dali/integration-api/gl-abstraction.h>
-
-using std::max;
-using namespace Dali;
-
-void utc_dali_framebuffer_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void utc_dali_framebuffer_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-int UtcDaliFrameBufferImageNew01(void)
-{
- TestApplication application;
-
- tet_infoline("UtcDaliFrameBufferImageNew01 - FrameBufferImage::New(unsigned int, unsigned int, Pixel::Format)");
-
- // invoke default handle constructor
- FrameBufferImage image;
- Vector2 stageSize = Stage::GetCurrent().GetSize();
-
- // initialise handle
- image = FrameBufferImage::New(); // create framebuffer with the same dimensions as the stage
- Actor actor = CreateRenderableActor( image );
- Stage::GetCurrent().Add(actor);
-
- application.SendNotification();
- application.Render();
- application.Render();
- application.SendNotification();
-
- DALI_TEST_CHECK( image );
- DALI_TEST_EQUALS((float)image.GetWidth(), stageSize.width, TEST_LOCATION);
- DALI_TEST_EQUALS((float)image.GetHeight(), stageSize.height, TEST_LOCATION);
-
- image = FrameBufferImage::New(16, 16); // create framebuffer with dimensions of 16x16
-
- DALI_TEST_CHECK( image );
- DALI_TEST_EQUALS(image.GetWidth(), 16u, TEST_LOCATION);
- DALI_TEST_EQUALS(image.GetHeight(), 16u, TEST_LOCATION);
- END_TEST;
-}
-
-int UtcDaliFrameBufferImageNew02(void)
-{
- TestApplication application;
-
- tet_infoline("UtcDaliFrameBufferImageNew02 - FrameBufferImage::New(NativeImageInterface&)");
-
- // invoke default handle constructor
- FrameBufferImage image;
- TestNativeImagePointer nativeImage = TestNativeImage::New(16, 16);
-
- DALI_TEST_CHECK( !image );
-
- // initialise handle
- image = FrameBufferImage::New(*(nativeImage.Get()));
-
- DALI_TEST_CHECK( image );
- END_TEST;
-}
-
-int UtcDaliFrameBufferImageNew03(void)
-{
- TestApplication application;
-
- tet_infoline("UtcDaliFrameBufferImageNew03 - FrameBufferImage::New(NativeImageInterface&, ReleasePolicy)");
-
- // invoke default handle constructor
- FrameBufferImage image;
- TestNativeImagePointer nativeImage = TestNativeImage::New(16, 16);
-
- DALI_TEST_CHECK( !image );
-
- // initialise handle
- image = FrameBufferImage::New(*(nativeImage.Get()));
-
- DALI_TEST_CHECK( image );
-
- END_TEST;
-}
-
-int UtcDaliFrameBufferImageAttachments01(void)
-{
- TestApplication application;
-
- tet_infoline("UtcDaliFrameBufferImageAttachments01 - FrameBufferImage::New(unsigned int, unsigned int, Pixel::Format, RenderBuffer::Format)");
-
- // invoke default handle constructor
- FrameBufferImage image;
-
- // initialise handle
- image = FrameBufferImage::New(64, 64, Pixel::RGBA8888, RenderBuffer::COLOR); // create framebuffer with Color buffer
- Actor actor = CreateRenderableActor(image);
- Stage::GetCurrent().Add(actor);
-
- application.SendNotification();
- application.Render();
- application.Render();
- application.SendNotification();
-
- 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);
-
- END_TEST;
-}
-
-int UtcDaliFrameBufferImageAttachments02(void)
-{
- TestApplication application;
-
- tet_infoline("UtcDaliFrameBufferImageAttachments02 - FrameBufferImage::New(unsigned int, unsigned int, Pixel::Format, RenderBuffer::Format)");
-
- // invoke default handle constructor
- FrameBufferImage image;
-
- // initialise handle
- image = FrameBufferImage::New(64, 64, Pixel::RGBA8888, RenderBuffer::COLOR_DEPTH); // create framebuffer with Color and Depth buffer
- Actor actor = CreateRenderableActor(image);
- Stage::GetCurrent().Add(actor);
-
- application.SendNotification();
- application.Render();
- application.Render();
- application.SendNotification();
-
- 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);
-
- END_TEST;
-}
-
-int UtcDaliFrameBufferImageAttachments03(void)
-{
- TestApplication application;
-
- tet_infoline("UtcDaliFrameBufferImageAttachments03 - FrameBufferImage::New(unsigned int, unsigned int, Pixel::Format, RenderBuffer::Format)");
-
- // invoke default handle constructor
- FrameBufferImage image;
-
- // initialise handle
- image = FrameBufferImage::New(64, 64, Pixel::RGBA8888, RenderBuffer::COLOR_STENCIL); // create framebuffer with Color and Stencil
- Actor actor = CreateRenderableActor(image);
- Stage::GetCurrent().Add(actor);
-
- application.SendNotification();
- application.Render();
- application.Render();
- application.SendNotification();
-
- 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);
-
- END_TEST;
-}
-
-int UtcDaliFrameBufferImageAttachments04(void)
-{
- TestApplication application;
-
- tet_infoline("UtcDaliFrameBufferImageAttachments04 - FrameBufferImage::New(unsigned int, unsigned int, Pixel::Format, RenderBuffer::Format)");
-
- // invoke default handle constructor
- FrameBufferImage image;
-
- // initialise handle
- image = FrameBufferImage::New(64, 64, Pixel::RGBA8888, RenderBuffer::COLOR_DEPTH_STENCIL); // create framebuffer with Color, Depth and Stencil buffers
- Actor actor = CreateRenderableActor(image);
- Stage::GetCurrent().Add(actor);
-
- application.SendNotification();
- application.Render();
- application.Render();
- application.SendNotification();
-
- 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 UtcDaliFrameBufferImageDownCast(void)
-{
- TestApplication application;
- tet_infoline("Testing Dali::FrameBufferImage::DownCast()");
-
- FrameBufferImage image = FrameBufferImage::New();
-
- BaseHandle object(image);
-
- FrameBufferImage image2 = FrameBufferImage::DownCast(object);
- DALI_TEST_CHECK(image2);
-
- FrameBufferImage image3 = DownCast< FrameBufferImage >(object);
- DALI_TEST_CHECK(image3);
-
- BaseHandle unInitializedObject;
- FrameBufferImage image4 = FrameBufferImage::DownCast(unInitializedObject);
- DALI_TEST_CHECK(!image4);
-
- FrameBufferImage image5 = DownCast< FrameBufferImage >(unInitializedObject);
- DALI_TEST_CHECK(!image5);
-
- Image image6 = FrameBufferImage::New();
- FrameBufferImage image7 = FrameBufferImage::DownCast(image6);
- DALI_TEST_CHECK(image7);
- END_TEST;
-}
DALI_TEST_EQUALS( image2.GetWidth(), testSize.x, TEST_LOCATION );
DALI_TEST_EQUALS( image2.GetHeight(), testSize.y, TEST_LOCATION );
- testSize = Vector2(16.0f, 32.0f);
- Image image3 = FrameBufferImage::New(testSize.x, testSize.y);
- DALI_TEST_EQUALS(image3.GetWidth(), testSize.x, TEST_LOCATION);
- DALI_TEST_EQUALS(image3.GetHeight(), testSize.y, TEST_LOCATION);
-
END_TEST;
}
RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
taskList.GetTask(0u).SetSourceActor( rootActor );
- FrameBufferImage frameBufferImage;
+ FrameBuffer frameBuffer = FrameBuffer::New(10,10);
if( glSync )
{
NativeImageInterfacePtr testNativeImagePtr = TestNativeImage::New(10, 10);
- frameBufferImage= FrameBufferImage::New( *(testNativeImagePtr.Get()) );
- }
- else
- {
- frameBufferImage = FrameBufferImage::New( 10, 10 );
+ Texture texture = Texture::New(*testNativeImagePtr);
+ frameBuffer.AttachColorTexture(texture);
}
// Don't draw output framebuffer // '
newTask.SetClearEnabled( true );
newTask.SetExclusive( true );
newTask.SetRefreshRate( refreshRate );
- newTask.SetTargetFrameBuffer( frameBufferImage );
+ newTask.SetFrameBuffer( frameBuffer );
newTask.SetProperty( RenderTask::Property::REQUIRES_SYNC, glSync );
return newTask;
}
END_TEST;
}
-int UtcDaliRenderTaskSetTargetFrameBufferP(void)
-{
- TestApplication application;
-
- tet_infoline("Testing RenderTask::SetTargetFrameBuffer()");
-
- RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
-
- RenderTask task = taskList.GetTask( 0u );
-
- FrameBufferImage newImage = FrameBufferImage::New();
- task.SetTargetFrameBuffer( newImage );
- DALI_TEST_CHECK( task.GetTargetFrameBuffer() == newImage );
- END_TEST;
-}
-
-int UtcDaliRenderTaskSetTargetFrameBufferN(void)
-{
- TestApplication application;
-
- tet_infoline("Testing RenderTask::SetTargetFrameBuffer()");
-
- RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
-
- RenderTask task = taskList.GetTask( 0u );
- FrameBufferImage newImage; // Empty handle
- task.SetTargetFrameBuffer( newImage );
- DALI_TEST_EQUALS( (bool)task.GetTargetFrameBuffer(), false, TEST_LOCATION );
- END_TEST;
-}
-
-int UtcDaliRenderTaskGetTargetFrameBufferP(void)
-{
- TestApplication application;
-
- tet_infoline("Testing RenderTask::GetTargetFrameBuffer()");
-
- RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
-
- RenderTask newTask = taskList.CreateTask();
- FrameBufferImage fb = FrameBufferImage::New(128, 128, Pixel::RGBA8888);
- newTask.SetTargetFrameBuffer( fb );
- DALI_TEST_EQUALS( newTask.GetTargetFrameBuffer(), fb, TEST_LOCATION );
- END_TEST;
-}
-
-int UtcDaliRenderTaskGetTargetFrameBufferN(void)
-{
- TestApplication application;
-
- tet_infoline("Testing RenderTask::GetTargetFrameBuffer()");
-
- RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
-
- RenderTask task = taskList.GetTask( 0u );
-
- // By default render-tasks do not render off-screen
- FrameBufferImage image = task.GetTargetFrameBuffer();
- DALI_TEST_CHECK( !image );
-
- END_TEST;
-}
-
int UtcDaliRenderTaskSetFrameBufferP(void)
{
TestApplication application;
RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
NativeImageInterfacePtr testNativeImagePtr = TestNativeImage::New(10, 10);
- FrameBufferImage frameBufferImage = FrameBufferImage::New( *testNativeImagePtr.Get() );
+ Texture frameBufferTexture = Texture::New( *testNativeImagePtr );
+ FrameBuffer frameBuffer = FrameBuffer::New(frameBufferTexture.GetWidth(),frameBufferTexture.GetHeight());
+ frameBuffer.AttachColorTexture(frameBufferTexture);
RenderTask newTask = taskList.CreateTask();
newTask.SetCameraActor( offscreenCameraActor );
newTask.SetClearEnabled( true );
newTask.SetExclusive( true );
newTask.SetRefreshRate( RenderTask::REFRESH_ONCE );
- newTask.SetTargetFrameBuffer( frameBufferImage );
+ newTask.SetFrameBuffer( frameBuffer );
newTask.SetProperty( RenderTask::Property::REQUIRES_SYNC, true );
bool finished = false;
firstTask.FinishedSignal().Connect( &application, renderTask1Finished );
// Second render task
- FrameBufferImage fbo = firstTask.GetTargetFrameBuffer();
- Actor secondRootActor = CreateRenderableActor( fbo );
+ FrameBuffer fbo = firstTask.GetFrameBuffer();
+ Actor secondRootActor = CreateRenderableActor( fbo.GetColorTexture() );
Stage::GetCurrent().Add(secondRootActor);
RenderTask secondTask = CreateRenderTask(application, offscreenCameraActor, defaultRootActor, secondRootActor, RenderTask::REFRESH_ONCE, false);
bool secondFinished = false;
RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
NativeImageInterfacePtr testNativeImagePtr = TestNativeImage::New(10, 10);
- FrameBufferImage frameBufferImage = FrameBufferImage::New( *testNativeImagePtr.Get() );
+ Texture frameBufferTexture = Texture::New( *testNativeImagePtr );
+ FrameBuffer frameBuffer = FrameBuffer::New(frameBufferTexture.GetWidth(), frameBufferTexture.GetHeight());
+ frameBuffer.AttachColorTexture(frameBufferTexture);
// Flush all outstanding messages
application.SendNotification();
newTask.SetClearEnabled( true );
newTask.SetExclusive( true );
newTask.SetRefreshRate( RenderTask::REFRESH_ONCE );
- newTask.SetTargetFrameBuffer( frameBufferImage );
+ newTask.SetFrameBuffer( frameBuffer );
newTask.SetProperty( RenderTask::Property::REQUIRES_SYNC, true );
// Framebuffer doesn't actually get created until Connected, i.e. by previous line
RenderTaskList taskList = Stage::GetCurrent().GetRenderTaskList();
RenderTask task = taskList.CreateTask();
- FrameBufferImage newFrameBuffer = FrameBufferImage::New( 10, 10 );
- task.SetTargetFrameBuffer( newFrameBuffer );
+ FrameBuffer newFrameBuffer = FrameBuffer::New(10, 10);
+ task.SetFrameBuffer( newFrameBuffer );
task.SetSourceActor( actor );
task.SetScreenToFrameBufferMappingActor( actor );
/*
- * 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/internal/event/actors/layer-impl.h>
#include <dali/internal/event/actors/layer-list.h>
#include <dali/internal/event/common/projection.h>
-#include <dali/internal/event/images/frame-buffer-image-impl.h>
#include <dali/internal/event/render-tasks/render-task-impl.h>
#include <dali/internal/event/render-tasks/render-task-list-impl.h>
for( RenderTaskList::RenderTaskContainer::reverse_iterator iter = tasks.rbegin(); endIter != iter; ++iter )
{
RenderTask& renderTask = *iter->Get();
- bool isOffscreenRenderTask = ( renderTask.GetTargetFrameBuffer() || renderTask.GetFrameBuffer() );
+ const bool isOffscreenRenderTask = renderTask.GetFrameBuffer();
if( (onScreen && isOffscreenRenderTask) || (!onScreen && !isOffscreenRenderTask) )
{
// Skip to next task
+++ /dev/null
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali/internal/event/images/frame-buffer-image-impl.h>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/object/type-registry.h>
-#include <dali/internal/event/common/thread-local-storage.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-namespace
-{
-const Dali::FrameBuffer::Attachment::Mask RenderBufferFormatToFrameBufferAttachments[] =
- { Dali::FrameBuffer::Attachment::NONE,
- Dali::FrameBuffer::Attachment::DEPTH,
- Dali::FrameBuffer::Attachment::STENCIL,
- Dali::FrameBuffer::Attachment::DEPTH_STENCIL };
-} // unnamed namespace
-
-FrameBufferImagePtr FrameBufferImage::New( unsigned int width,
- unsigned int height,
- Pixel::Format pixelFormat,
- RenderBuffer::Format bufferformat )
-{
- FrameBufferImagePtr image = new FrameBufferImage( width, height );
- image->Initialize();
-
- image->mTexture = Texture::New( Dali::TextureType::TEXTURE_2D, pixelFormat, width, height );
- image->mFrameBufferObject = FrameBuffer::New( width, height, RenderBufferFormatToFrameBufferAttachments[bufferformat] );
- image->mFrameBufferObject->AttachColorTexture( image->mTexture, 0u, 0u );
-
- return image;
-}
-
-FrameBufferImagePtr FrameBufferImage::New( NativeImageInterface& nativeImage )
-{
- FrameBufferImagePtr image = new FrameBufferImage( nativeImage );
- image->Initialize();
-
- image->mTexture = Texture::New( nativeImage );
- image->mFrameBufferObject = FrameBuffer::New( image->mTexture->GetWidth(), image->mTexture->GetHeight(), Dali::FrameBuffer::Attachment::NONE );
- image->mFrameBufferObject->AttachColorTexture( image->mTexture, 0u, 0u );
-
- return image;
-}
-
-FrameBufferImage::FrameBufferImage( unsigned int width, unsigned int height)
-: Image(),
- mNativeImage(0),
- mIsNativeFbo( false )
-{
- mWidth = width;
- mHeight = height;
-}
-
-FrameBufferImage::FrameBufferImage( NativeImageInterface& nativeImage )
-: Image(),
- mNativeImage( &nativeImage ),
- mIsNativeFbo( true )
-{
- mWidth = nativeImage.GetWidth();
- mHeight = nativeImage.GetHeight();
-}
-
-
-bool FrameBufferImage::IsNativeFbo() const
-{
- return mIsNativeFbo;
-}
-
-FrameBufferImage::~FrameBufferImage()
-{
-}
-
-} // namespace Internal
-
-} // namespace Dali
+++ /dev/null
-#ifndef DALI_INTERNAL_FRAME_BUFFER_IMAGE_H
-#define DALI_INTERNAL_FRAME_BUFFER_IMAGE_H
-
-/*
- * 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.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/internal/event/images/image-impl.h>
-#include <dali/public-api/images/frame-buffer-image.h>
-#include <dali/internal/event/rendering/frame-buffer-impl.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-class FrameBufferImage;
-typedef IntrusivePtr<FrameBufferImage> FrameBufferImagePtr;
-
-/**
- * @copydoc Dali::FrameBufferImage
- */
-class FrameBufferImage : public Image
-{
-public:
-
- /**
- * @copydoc Dali::FrameBufferImage::New(unsigned int, unsigned int, Pixel::Format)
- */
- static FrameBufferImagePtr New( unsigned int width, unsigned int height, Pixel::Format pixelFormat, RenderBuffer::Format bufferformat );
-
- /**
- * @copydoc Dali::FrameBufferImage::New(NativeImageInterface&)
- */
- static FrameBufferImagePtr New( NativeImageInterface& nativeImage );
-
- /**
- * @copydoc Dali::FrameBufferImage::FrameBufferImage
- */
- FrameBufferImage( unsigned int width, unsigned int height );
-
- /**
- * @copydoc Dali::FrameBufferImage::FrameBufferImage
- */
- FrameBufferImage( NativeImageInterface& image );
-
- /**
- * @return true if this FBO is targeting a NativeImageInterface
- */
- bool IsNativeFbo() const;
-
- /**
- * @return Internal FrameBuffer used by this FrameBufferImage
- */
- FrameBuffer* GetFrameBuffer() const
- {
- return mFrameBufferObject.Get();
- }
-
-protected:
- /**
- * A reference counted object may only be deleted by calling Unreference()
- */
- virtual ~FrameBufferImage();
-
-private:
- // cached values for the size / pixel format we were created with. Needed to recreate us when we Connect() to stage and mTicket was reset from a previous call to Disconnect().
- FrameBufferPtr mFrameBufferObject;
- NativeImageInterfacePtr mNativeImage;
- bool mIsNativeFbo;
-}; // class FrameBufferImage
-
-} // namespace Internal
-
-/**
- * Helper methods for public API.
- */
-inline Internal::FrameBufferImage& GetImplementation(Dali::FrameBufferImage& image)
-{
- DALI_ASSERT_ALWAYS( image && "FrameBufferImage handle is empty" );
-
- BaseObject& handle = image.GetBaseObject();
-
- return static_cast<Internal::FrameBufferImage&>(handle);
-}
-
-inline const Internal::FrameBufferImage& GetImplementation(const Dali::FrameBufferImage& image)
-{
- DALI_ASSERT_ALWAYS( image && "FrameBufferImage handle is empty" );
-
- const BaseObject& handle = image.GetBaseObject();
-
- return static_cast<const Internal::FrameBufferImage&>(handle);
-}
-
-} // namespace Dali
-
-#endif // DALI_INTERNAL_FRAME_BUFFER_IMAGE_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/internal/event/common/stage-impl.h>
#include <dali/internal/event/common/scene-impl.h>
#include <dali/internal/event/common/projection.h>
-#include <dali/internal/event/images/frame-buffer-image-impl.h>
#include <dali/internal/update/nodes/node.h>
#include <dali/internal/update/render-tasks/scene-graph-render-task.h>
return nullptr;
}
-void RenderTask::SetTargetFrameBuffer( FrameBufferImagePtr image )
-{
- mFrameBufferImage = image;
- FrameBuffer* frameBufferPtr( NULL );
- if( image )
- {
- frameBufferPtr = image->GetFrameBuffer();
- }
-
- SetFrameBuffer( frameBufferPtr );
-}
-
void RenderTask::SetFrameBuffer( FrameBufferPtr frameBuffer )
{
mFrameBuffer = frameBuffer;
return mFrameBuffer.Get();
}
-FrameBufferImage* RenderTask::GetTargetFrameBuffer() const
-{
- return mFrameBufferImage.Get();
-}
-
void RenderTask::SetScreenToFrameBufferFunction( ScreenToFrameBufferFunction conversionFunction )
{
mScreenToFrameBufferFunction = conversionFunction;
if( !GetRenderTaskSceneObject().GetViewportEnabled( bufferIndex ) )
{
- if ( mFrameBufferImage )
- {
- viewPort.x = viewPort.y = 0;
- viewPort.width = mFrameBufferImage->GetWidth();
- viewPort.height = mFrameBufferImage->GetHeight();
- }
- else
+ Internal::Stage* stage = Internal::Stage::GetCurrent();
+ if ( stage )
{
- Internal::Stage* stage = Internal::Stage::GetCurrent();
- if ( stage )
+ Vector2 size( stage->GetSize() );
+ Actor* sourceActor = mSourceActor.GetActor();
+ if ( sourceActor && sourceActor->OnStage() )
{
- Vector2 size( stage->GetSize() );
- Actor* sourceActor = mSourceActor.GetActor();
- if ( sourceActor && sourceActor->OnStage() )
- {
- Scene& scene = sourceActor->GetScene();
- size = scene.GetSize();
- }
-
- viewPort.x = viewPort.y = 0;
- viewPort.width = static_cast<int32_t>( size.width ); // truncated
- viewPort.height = static_cast<int32_t>( size.height ); // truncated
+ Scene& scene = sourceActor->GetScene();
+ size = scene.GetSize();
}
+
+ viewPort.x = viewPort.y = 0;
+ viewPort.width = static_cast<int32_t>( size.width ); // truncated
+ viewPort.height = static_cast<int32_t>( size.height ); // truncated
}
}
else
// the function should only be called for offscreen tasks
Dali::Actor mappingActor = GetScreenToFrameBufferMappingActor();
- if( mFrameBufferImage && mappingActor )
+ if( mFrameBuffer && mappingActor )
{
Internal::Actor* inputMappingActor = &GetImplementation( mappingActor );
CameraActor* localCamera = GetCameraActor();
}
}
}
- else if ( mFrameBufferImage && mScreenToFrameBufferFunction )
+ else if ( mFrameBuffer && mScreenToFrameBufferFunction )
{
inside = mScreenToFrameBufferFunction( screenCoords );
}
#define DALI_INTERNAL_RENDER_TASK_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/object/base-object.h>
#include <dali/public-api/object/weak-handle.h>
#include <dali/public-api/render-tasks/render-task.h>
-#include <dali/internal/event/images/frame-buffer-image-impl.h>
#include <dali/internal/event/common/object-impl.h>
#include <dali/internal/event/rendering/frame-buffer-impl.h>
#include <dali/internal/event/render-tasks/render-task-list-impl.h>
CameraActor* GetCameraActor() const;
/**
- * @copydoc Dali::RenderTask::SetTargetFrameBuffer()
- */
- void SetTargetFrameBuffer( FrameBufferImagePtr frameBuffer );
-
- /**
- * @copydoc Dali::RenderTask::GetTargetFrameBuffer
- */
- FrameBufferImage* GetTargetFrameBuffer() const;
-
- /**
* @copydoc Dali::RenderTask::SetFrameBuffer()
*/
void SetFrameBuffer( FrameBufferPtr frameBuffer );
uint32_t mRefreshOnceCounter;
- FrameBufferImagePtr mFrameBufferImage; ///< Optional off-screen render target.
FrameBufferPtr mFrameBuffer;
/*
- * 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.
for ( auto&& item : mTasks )
{
// If the render target renders only once to an offscreen, re-render the render task
- if( item->GetRefreshRate() == Dali::RenderTask::REFRESH_ONCE && item->GetTargetFrameBuffer() )
+ if( item->GetRefreshRate() == Dali::RenderTask::REFRESH_ONCE && item->GetFrameBuffer() )
{
item->SetRefreshRate( Dali::RenderTask::REFRESH_ONCE );
}
${internal_src_dir}/event/images/bitmap-packed-pixel.cpp
${internal_src_dir}/event/images/bitmap-compressed.cpp
${internal_src_dir}/event/images/image-impl.cpp
- ${internal_src_dir}/event/images/frame-buffer-image-impl.cpp
${internal_src_dir}/event/images/resource-image-impl.cpp
${internal_src_dir}/event/images/pixel-data-impl.cpp
${internal_src_dir}/event/render-tasks/render-task-impl.cpp
// INTERNAL INCLUDES
#include <dali/internal/event/actors/layer-impl.h>
-#include <dali/internal/event/images/frame-buffer-image-impl.h>
namespace Dali
{
#include <dali/public-api/actors/actor.h>
#include <dali/public-api/math/rect.h>
#include <dali/public-api/math/vector3.h>
-#include <dali/public-api/images/frame-buffer-image.h>
namespace Dali
{
#include <dali/public-api/events/touch-event.h>
#include <dali/public-api/events/touch-point.h>
-#include <dali/public-api/images/frame-buffer-image.h>
#include <dali/public-api/images/image.h>
#include <dali/public-api/images/native-image-interface.h>
#include <dali/public-api/images/resource-image.h>
${public_api_src_dir}/images/image.cpp
${public_api_src_dir}/images/pixel.cpp
${public_api_src_dir}/images/pixel-data.cpp
- ${public_api_src_dir}/images/frame-buffer-image.cpp
${public_api_src_dir}/images/resource-image.cpp
${public_api_src_dir}/math/compile-time-math.cpp
${public_api_src_dir}/math/degree.cpp
SET( public_api_core_images_header_files
- ${public_api_src_dir}/images/frame-buffer-image.h
${public_api_src_dir}/images/image.h
${public_api_src_dir}/images/image-operations.h
${public_api_src_dir}/images/pixel.h
+++ /dev/null
-/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali/public-api/images/frame-buffer-image.h>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/common/stage.h>
-#include <dali/public-api/math/vector2.h>
-#include <dali/internal/event/images/frame-buffer-image-impl.h>
-
-namespace Dali
-{
-
-FrameBufferImage::FrameBufferImage()
-{
-}
-
-FrameBufferImage::FrameBufferImage( Internal::FrameBufferImage* internal )
-: Image(internal)
-{
-}
-
-FrameBufferImage::~FrameBufferImage()
-{
-}
-
-FrameBufferImage::FrameBufferImage( const FrameBufferImage& handle )
-: Image(handle)
-{
-}
-
-FrameBufferImage& FrameBufferImage::operator=( const FrameBufferImage& rhs )
-{
- BaseHandle::operator=(rhs);
- return *this;
-}
-
-FrameBufferImage FrameBufferImage::New( uint32_t width, uint32_t height, Pixel::Format pixelformat, RenderBuffer::Format bufferformat )
-{
- Dali::Vector2 stageSize = Stage::GetCurrent().GetSize();
- Internal::FrameBufferImagePtr internal = Internal::FrameBufferImage::New(
- (0 == width) ? static_cast<uint32_t>( stageSize.width ) : width,
- (0 == height) ? static_cast<uint32_t>( stageSize.height ) : height,
- pixelformat,
- bufferformat);
-
- return FrameBufferImage(internal.Get());
-}
-
-FrameBufferImage FrameBufferImage::New( NativeImageInterface& image )
-{
- Internal::FrameBufferImagePtr internal = Internal::FrameBufferImage::New( image );
- return FrameBufferImage(internal.Get());
-}
-
-FrameBufferImage FrameBufferImage::DownCast( BaseHandle handle )
-{
- return FrameBufferImage( dynamic_cast<Dali::Internal::FrameBufferImage*>( handle.GetObjectPtr() ) );
-}
-
-} // namespace Dali
+++ /dev/null
-#ifndef DALI_FRAME_BUFFER_IMAGE_H
-#define DALI_FRAME_BUFFER_IMAGE_H
-
-/*
- * 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.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/public-api/images/image.h>
-#include <dali/public-api/images/native-image-interface.h>
-#include <dali/public-api/images/pixel.h>
-
-namespace Dali
-{
-/**
- * @addtogroup dali_core_images
- * @{
- */
-
-namespace Internal DALI_INTERNAL
-{
-class FrameBufferImage;
-}
-
-namespace RenderBuffer
-{
-/**
- * @brief Enumeration for rendering buffer formats.
- *
- * The default format for framebuffer creation is COLOR, so If a depth buffer for 3D rendering is required use
- * COLOR_DEPTH instead.
- * @SINCE_1_0.0
- */
-enum Format ///< Framebuffer format, default color depth is RGBA 32 bit with alpha @SINCE_1_0.0
-{
- COLOR, ///< Framebuffer will be created with color buffer. @SINCE_1_0.0
- COLOR_DEPTH, ///< Framebuffer will be created with color and depth buffer @SINCE_1_0.0
- COLOR_STENCIL, ///< Framebuffer will be created with color and stencil buffer @SINCE_1_0.0
- COLOR_DEPTH_STENCIL ///< Framebuffer will be created with color, depth and stencil buffer. @note May be not supported in all devices @SINCE_1_0.0
-};
-}
-
-/**
- * @DEPRECATED_1_2.41
- *
- * @brief FrameBufferImage represents an Open GL ES Frame Buffer Object and contains the result
- * of an 'off screen' render pass of a RenderTask.
- *
- * The FrameBufferImage can then be used for rendering to the screen.
- * @SINCE_1_0.0
- */
-class DALI_CORE_API FrameBufferImage : public Image
-{
-public:
-
- /**
- * @DEPRECATED_1_2.41
- *
- * @brief Constructor which creates an uninitialized FrameBufferImage object.
- *
- * Use @ref FrameBufferImage::New to create an initialized object.
- * @SINCE_1_0.0
- */
- FrameBufferImage() DALI_DEPRECATED_API;
-
- /**
- * @DEPRECATED_1_2.41
- *
- * @brief Creates a new FrameBufferImage.
- *
- * The maximum size of the image is limited by GL_MAX_TEXTURE_SIZE.
- *
- * @SINCE_1_0.0
- * @param[in] width The width in pixels. Setting to zero will use the width of the stage
- * @param[in] height The height in pixels. Setting to zero will use the height of the stage
- * @param[in] pixelFormat The pixel format (rgba 32 bit by default)
- * @param[in] bufferFormat The format of the buffers that are going to be created for the FBO, (COLOR and DEPTH buffer as default)
- * @return A handle to a new instance of a FrameBufferImage
- * @post When the FrameBufferImage is first used as a render target, an exception may be thrown if pixelFormat is not supported on the hardware platform.
- */
- static FrameBufferImage New(uint32_t width = 0, uint32_t height = 0, Pixel::Format pixelFormat = Pixel::RGBA8888,
- RenderBuffer::Format bufferFormat = RenderBuffer::COLOR) DALI_DEPRECATED_API;
-
- /**
- * @DEPRECATED_1_2.41
- *
- * @brief Creates a new FrameBufferImage.
- *
- * The maximum size of the image is limited by GL_MAX_TEXTURE_SIZE.
- * @SINCE_1_0.0
- * @param[in] image The native image
- *
- * @return A handle to a new instance of a FrameBufferImage
- * @post When the FrameBufferImage is first used as a render target, an exception may be thrown if the NativeImage cannot be mapped to a texture.
- */
- static FrameBufferImage New(NativeImageInterface& image) DALI_DEPRECATED_API;
-
- /**
- * @DEPRECATED_1_2.41
- *
- * @brief Downcasts a handle to FrameBufferImage handle.
- *
- * If handle points to a FrameBufferImage object, the
- * downcast produces valid handle. If not, the returned handle is left uninitialized.
- * @SINCE_1_0.0
- * @param[in] handle Handle to an object
- * @return Handle to a FrameBufferImage object or an uninitialized handle
- */
- static FrameBufferImage DownCast( BaseHandle handle ) DALI_DEPRECATED_API;
-
- /**
- * @DEPRECATED_1_2.41
- *
- * @brief Destructor.
- *
- * This is non-virtual since derived Handle types must not contain data or virtual methods.
- * @SINCE_1_0.0
- */
- ~FrameBufferImage() DALI_DEPRECATED_API;
-
- /**
- * @DEPRECATED_1_2.41
- *
- * @brief This copy constructor is required for (smart) pointer semantics.
- *
- * @SINCE_1_0.0
- * @param[in] handle A reference to the copied handle
- */
- FrameBufferImage(const FrameBufferImage& handle) DALI_DEPRECATED_API;
-
- /**
- * @DEPRECATED_1_2.41
- *
- * @brief This assignment operator is required for (smart) pointer semantics.
- *
- * @SINCE_1_0.0
- * @param[in] rhs A reference to the copied handle
- * @return A reference to this
- */
- FrameBufferImage& operator=(const FrameBufferImage& rhs) DALI_DEPRECATED_API;
-
-public: // Not intended for application developers
-
- explicit DALI_INTERNAL FrameBufferImage(Internal::FrameBufferImage*);
-}; //class FrameBufferImage
-
-/**
- * @}
- */
-} // namespace Dali
-
-#endif // DALI_FRAME_BUFFER_IMAGE_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.
#include <dali/public-api/rendering/frame-buffer.h>
#include <dali/internal/event/actors/actor-impl.h>
#include <dali/internal/event/actors/camera-actor-impl.h>
-#include <dali/internal/event/images/frame-buffer-image-impl.h>
#include <dali/internal/event/render-tasks/render-task-impl.h>
namespace Dali
return Dali::CameraActor(GetImplementation(*this).GetCameraActor());
}
-void RenderTask::SetTargetFrameBuffer( Dali::FrameBufferImage frameBuffer )
-{
- Internal::FrameBufferImage* frameBufferPtr( NULL );
- if( frameBuffer )
- {
- frameBufferPtr = &GetImplementation( frameBuffer );
- }
-
- GetImplementation(*this).SetTargetFrameBuffer( frameBufferPtr );
-}
-
-FrameBufferImage RenderTask::GetTargetFrameBuffer() const
-{
- Internal::FrameBufferImage* frameBufferPtr = GetImplementation(*this).GetTargetFrameBuffer();
- return Dali::FrameBufferImage( frameBufferPtr );
-}
-
void RenderTask::SetFrameBuffer( FrameBuffer frameBuffer )
{
Internal::FrameBuffer* frameBufferPtr( NULL );
#define DALI_RENDER_TASK_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.
/**
* @brief Sets the frame-buffer used as a render target.
- * @SINCE_1_0.0
- * @param[in] frameBuffer A valid frame-buffer handle to enable off-screen rendering, or an uninitialized handle to disable
- */
- void SetTargetFrameBuffer( FrameBufferImage frameBuffer );
-
- /**
- * @brief Retrieves the frame-buffer used as a render target.
- * @SINCE_1_0.0
- * @return A valid frame-buffer handle, or an uninitialised handle if off-screen rendering is disabled
- */
- FrameBufferImage GetTargetFrameBuffer() const;
-
- /**
- * @brief Sets the frame-buffer used as a render target.
* @SINCE_1_1.38
* @param[in] frameBuffer A valid FrameBuffer handle to enable off-screen rendering, or an uninitialized handle to disable it
*/