From d818b70bd646382c3141ceb179e53f6d20bf4478 Mon Sep 17 00:00:00 2001 From: Adeel Kazmi Date: Wed, 17 Jun 2020 11:59:43 +0100 Subject: [PATCH] Remove FrameBufferImage Change-Id: I30e53af40c6cf5c43d36ba7af4e1acffe37fdd82 --- automated-tests/src/dali/CMakeLists.txt | 1 - .../src/dali/utc-Dali-FrameBufferImage.cpp | 241 --------------------- automated-tests/src/dali/utc-Dali-Image.cpp | 5 - automated-tests/src/dali/utc-Dali-RenderTask.cpp | 94 ++------ .../event/events/hit-test-algorithm-impl.cpp | 5 +- .../event/images/frame-buffer-image-impl.cpp | 97 --------- .../event/images/frame-buffer-image-impl.h | 113 ---------- .../event/render-tasks/render-task-impl.cpp | 55 ++--- .../internal/event/render-tasks/render-task-impl.h | 14 +- .../event/render-tasks/render-task-list-impl.cpp | 4 +- dali/internal/file.list | 1 - dali/public-api/actors/layer.cpp | 1 - dali/public-api/actors/layer.h | 1 - dali/public-api/dali-core.h | 1 - dali/public-api/file.list | 2 - dali/public-api/images/frame-buffer-image.cpp | 77 ------- dali/public-api/images/frame-buffer-image.h | 165 -------------- dali/public-api/render-tasks/render-task.cpp | 20 +- dali/public-api/render-tasks/render-task.h | 16 +- 19 files changed, 37 insertions(+), 876 deletions(-) delete mode 100644 automated-tests/src/dali/utc-Dali-FrameBufferImage.cpp delete mode 100644 dali/internal/event/images/frame-buffer-image-impl.cpp delete mode 100644 dali/internal/event/images/frame-buffer-image-impl.h mode change 100755 => 100644 dali/internal/event/render-tasks/render-task-list-impl.cpp delete mode 100644 dali/public-api/images/frame-buffer-image.cpp delete mode 100644 dali/public-api/images/frame-buffer-image.h diff --git a/automated-tests/src/dali/CMakeLists.txt b/automated-tests/src/dali/CMakeLists.txt index 60a80b2..4ec8ec0 100644 --- a/automated-tests/src/dali/CMakeLists.txt +++ b/automated-tests/src/dali/CMakeLists.txt @@ -28,7 +28,6 @@ SET(TC_SOURCES 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 diff --git a/automated-tests/src/dali/utc-Dali-FrameBufferImage.cpp b/automated-tests/src/dali/utc-Dali-FrameBufferImage.cpp deleted file mode 100644 index dfdc772..0000000 --- a/automated-tests/src/dali/utc-Dali-FrameBufferImage.cpp +++ /dev/null @@ -1,241 +0,0 @@ -/* - * 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 -#include - -#include -#include -#include -#include -#include - -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; -} diff --git a/automated-tests/src/dali/utc-Dali-Image.cpp b/automated-tests/src/dali/utc-Dali-Image.cpp index c2e38d6..58ba988 100644 --- a/automated-tests/src/dali/utc-Dali-Image.cpp +++ b/automated-tests/src/dali/utc-Dali-Image.cpp @@ -85,11 +85,6 @@ int UtcDaliImageGetWidthHeight(void) 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; } diff --git a/automated-tests/src/dali/utc-Dali-RenderTask.cpp b/automated-tests/src/dali/utc-Dali-RenderTask.cpp index 40b7800..169752f 100644 --- a/automated-tests/src/dali/utc-Dali-RenderTask.cpp +++ b/automated-tests/src/dali/utc-Dali-RenderTask.cpp @@ -206,15 +206,12 @@ RenderTask CreateRenderTask(TestApplication& application, 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 // ' @@ -227,7 +224,7 @@ RenderTask CreateRenderTask(TestApplication& application, newTask.SetClearEnabled( true ); newTask.SetExclusive( true ); newTask.SetRefreshRate( refreshRate ); - newTask.SetTargetFrameBuffer( frameBufferImage ); + newTask.SetFrameBuffer( frameBuffer ); newTask.SetProperty( RenderTask::Property::REQUIRES_SYNC, glSync ); return newTask; } @@ -1065,69 +1062,6 @@ int UtcDaliRenderTaskGetCameraActorN(void) 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; @@ -1890,7 +1824,9 @@ int UtcDaliRenderTaskSignalFinished(void) 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 ); @@ -1900,7 +1836,7 @@ int UtcDaliRenderTaskSignalFinished(void) 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; @@ -2507,8 +2443,8 @@ int UtcDaliRenderTaskOnceChain01(void) 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; @@ -2564,7 +2500,9 @@ int UtcDaliRenderTaskFinishInvisibleSourceActor(void) 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(); @@ -2578,7 +2516,7 @@ int UtcDaliRenderTaskFinishInvisibleSourceActor(void) 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 @@ -2777,8 +2715,8 @@ int UtcDaliRenderTaskOffscreenViewportToLocal(void) 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 ); diff --git a/dali/internal/event/events/hit-test-algorithm-impl.cpp b/dali/internal/event/events/hit-test-algorithm-impl.cpp index 87e1693..943c6cd 100644 --- a/dali/internal/event/events/hit-test-algorithm-impl.cpp +++ b/dali/internal/event/events/hit-test-algorithm-impl.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -28,7 +28,6 @@ #include #include #include -#include #include #include @@ -546,7 +545,7 @@ bool HitTestRenderTaskList( const Vector2& sceneSize, 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 diff --git a/dali/internal/event/images/frame-buffer-image-impl.cpp b/dali/internal/event/images/frame-buffer-image-impl.cpp deleted file mode 100644 index b5a4439..0000000 --- a/dali/internal/event/images/frame-buffer-image-impl.cpp +++ /dev/null @@ -1,97 +0,0 @@ -/* - * 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 - -// INTERNAL INCLUDES -#include -#include - -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 diff --git a/dali/internal/event/images/frame-buffer-image-impl.h b/dali/internal/event/images/frame-buffer-image-impl.h deleted file mode 100644 index 97e5ecb..0000000 --- a/dali/internal/event/images/frame-buffer-image-impl.h +++ /dev/null @@ -1,113 +0,0 @@ -#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 -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -class FrameBufferImage; -typedef IntrusivePtr 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(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(handle); -} - -} // namespace Dali - -#endif // DALI_INTERNAL_FRAME_BUFFER_IMAGE_H diff --git a/dali/internal/event/render-tasks/render-task-impl.cpp b/dali/internal/event/render-tasks/render-task-impl.cpp index 99b74c7..2ed2ed3 100644 --- a/dali/internal/event/render-tasks/render-task-impl.cpp +++ b/dali/internal/event/render-tasks/render-task-impl.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -31,7 +31,6 @@ #include #include #include -#include #include #include @@ -166,18 +165,6 @@ CameraActor* RenderTask::GetCameraActor() const 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; @@ -195,11 +182,6 @@ FrameBuffer* RenderTask::GetFrameBuffer() const return mFrameBuffer.Get(); } -FrameBufferImage* RenderTask::GetTargetFrameBuffer() const -{ - return mFrameBufferImage.Get(); -} - void RenderTask::SetScreenToFrameBufferFunction( ScreenToFrameBufferFunction conversionFunction ) { mScreenToFrameBufferFunction = conversionFunction; @@ -256,29 +238,20 @@ void RenderTask::GetViewport( Viewport& viewPort ) const 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( size.width ); // truncated - viewPort.height = static_cast( size.height ); // truncated + Scene& scene = sourceActor->GetScene(); + size = scene.GetSize(); } + + viewPort.x = viewPort.y = 0; + viewPort.width = static_cast( size.width ); // truncated + viewPort.height = static_cast( size.height ); // truncated } } else @@ -408,7 +381,7 @@ bool RenderTask::TranslateCoordinates( Vector2& screenCoords ) const // 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(); @@ -451,7 +424,7 @@ bool RenderTask::TranslateCoordinates( Vector2& screenCoords ) const } } } - else if ( mFrameBufferImage && mScreenToFrameBufferFunction ) + else if ( mFrameBuffer && mScreenToFrameBufferFunction ) { inside = mScreenToFrameBufferFunction( screenCoords ); } diff --git a/dali/internal/event/render-tasks/render-task-impl.h b/dali/internal/event/render-tasks/render-task-impl.h index 89febf9..45186e3 100644 --- a/dali/internal/event/render-tasks/render-task-impl.h +++ b/dali/internal/event/render-tasks/render-task-impl.h @@ -2,7 +2,7 @@ #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. @@ -22,7 +22,6 @@ #include #include #include -#include #include #include #include @@ -105,16 +104,6 @@ public: 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 ); @@ -365,7 +354,6 @@ private: uint32_t mRefreshOnceCounter; - FrameBufferImagePtr mFrameBufferImage; ///< Optional off-screen render target. FrameBufferPtr mFrameBuffer; diff --git a/dali/internal/event/render-tasks/render-task-list-impl.cpp b/dali/internal/event/render-tasks/render-task-list-impl.cpp old mode 100755 new mode 100644 index 2ae57e8..c6d4f06 --- a/dali/internal/event/render-tasks/render-task-list-impl.cpp +++ b/dali/internal/event/render-tasks/render-task-list-impl.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -191,7 +191,7 @@ void RenderTaskList::RecoverFromContextLoss() 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 ); } diff --git a/dali/internal/file.list b/dali/internal/file.list index 84713cc..8709557 100644 --- a/dali/internal/file.list +++ b/dali/internal/file.list @@ -80,7 +80,6 @@ SET( internal_src_files ${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 diff --git a/dali/public-api/actors/layer.cpp b/dali/public-api/actors/layer.cpp index ca96f9b..7565b94 100644 --- a/dali/public-api/actors/layer.cpp +++ b/dali/public-api/actors/layer.cpp @@ -20,7 +20,6 @@ // INTERNAL INCLUDES #include -#include namespace Dali { diff --git a/dali/public-api/actors/layer.h b/dali/public-api/actors/layer.h index 49cc2af..0bb936e 100644 --- a/dali/public-api/actors/layer.h +++ b/dali/public-api/actors/layer.h @@ -26,7 +26,6 @@ #include #include #include -#include namespace Dali { diff --git a/dali/public-api/dali-core.h b/dali/public-api/dali-core.h index 98f66a8..d0d0e57 100644 --- a/dali/public-api/dali-core.h +++ b/dali/public-api/dali-core.h @@ -65,7 +65,6 @@ #include #include -#include #include #include #include diff --git a/dali/public-api/file.list b/dali/public-api/file.list index a718ad9..8ef2c36 100644 --- a/dali/public-api/file.list +++ b/dali/public-api/file.list @@ -40,7 +40,6 @@ SET( public_api_src_files ${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 @@ -159,7 +158,6 @@ SET( public_api_core_events_header_files 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 diff --git a/dali/public-api/images/frame-buffer-image.cpp b/dali/public-api/images/frame-buffer-image.cpp deleted file mode 100644 index 572ce79..0000000 --- a/dali/public-api/images/frame-buffer-image.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/* - * 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 - -// INTERNAL INCLUDES -#include -#include -#include -#include - -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( stageSize.width ) : width, - (0 == height) ? static_cast( 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( handle.GetObjectPtr() ) ); -} - -} // namespace Dali diff --git a/dali/public-api/images/frame-buffer-image.h b/dali/public-api/images/frame-buffer-image.h deleted file mode 100644 index de7bb80..0000000 --- a/dali/public-api/images/frame-buffer-image.h +++ /dev/null @@ -1,165 +0,0 @@ -#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 -#include -#include - -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 diff --git a/dali/public-api/render-tasks/render-task.cpp b/dali/public-api/render-tasks/render-task.cpp index 1e70040..83d7717 100644 --- a/dali/public-api/render-tasks/render-task.cpp +++ b/dali/public-api/render-tasks/render-task.cpp @@ -1,5 +1,5 @@ /* - * 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. @@ -23,7 +23,6 @@ #include #include #include -#include #include namespace Dali @@ -118,23 +117,6 @@ CameraActor RenderTask::GetCameraActor() const 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 ); diff --git a/dali/public-api/render-tasks/render-task.h b/dali/public-api/render-tasks/render-task.h index bd88e6b..37755fe 100644 --- a/dali/public-api/render-tasks/render-task.h +++ b/dali/public-api/render-tasks/render-task.h @@ -2,7 +2,7 @@ #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. @@ -289,20 +289,6 @@ public: /** * @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 */ -- 2.7.4