From: Adeel Kazmi Date: Wed, 17 Jun 2020 21:15:25 +0000 (+0100) Subject: Remove Image & ResourceImage X-Git-Tag: dali_1.9.17~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e222f9bd46196df9001cb28af1cded149a3e017d;p=platform%2Fcore%2Fuifw%2Fdali-core.git Remove Image & ResourceImage Change-Id: I7d485c47641bbb8efbae58968bbdd636badfedcf --- diff --git a/automated-tests/src/dali/CMakeLists.txt b/automated-tests/src/dali/CMakeLists.txt index 4ec8ec059..cd300d090 100644 --- a/automated-tests/src/dali/CMakeLists.txt +++ b/automated-tests/src/dali/CMakeLists.txt @@ -36,7 +36,6 @@ SET(TC_SOURCES utc-Dali-Hash.cpp utc-Dali-HitTestAlgorithm.cpp utc-Dali-HoverProcessing.cpp - utc-Dali-Image.cpp utc-Dali-IntrusivePtr.cpp utc-Dali-KeyEvent.cpp utc-Dali-Layer.cpp @@ -73,7 +72,6 @@ SET(TC_SOURCES utc-Dali-Renderer.cpp utc-Dali-RenderTask.cpp utc-Dali-RenderTaskList.cpp - utc-Dali-ResourceImage.cpp utc-Dali-RotationGesture.cpp utc-Dali-RotationGestureDetector.cpp utc-Dali-RotationGestureRecognizer.cpp diff --git a/automated-tests/src/dali/dali-test-suite-utils/dali-test-suite-utils.cpp b/automated-tests/src/dali/dali-test-suite-utils/dali-test-suite-utils.cpp index d76ce606b..b494a989c 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/dali-test-suite-utils.cpp +++ b/automated-tests/src/dali/dali-test-suite-utils/dali-test-suite-utils.cpp @@ -328,21 +328,6 @@ void ConstraintAppliedCheck::CheckSignalNotReceived() } } -void PrepareResourceImage( TestApplication& application, uint32_t imageWidth, uint32_t imageHeight, Pixel::Format pixelFormat ) -{ - TestPlatformAbstraction& platform = application.GetPlatform(); - platform.SetClosestImageSize(Vector2( imageWidth, imageHeight)); - - Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN ); - Integration::PixelBuffer* pixbuffer = bitmap->GetPackedPixelsProfile()->ReserveBuffer( pixelFormat, imageWidth, imageHeight, imageWidth, imageHeight ); - uint32_t bytesPerPixel = GetBytesPerPixel( pixelFormat ); - uint32_t initialColor = 0xFF; - memset( pixbuffer, initialColor, imageHeight*imageWidth*bytesPerPixel); - - Integration::ResourcePointer resourcePtr(bitmap); - platform.SetSynchronouslyLoadedResource( resourcePtr ); -} - namespace Test { diff --git a/automated-tests/src/dali/dali-test-suite-utils/dali-test-suite-utils.h b/automated-tests/src/dali/dali-test-suite-utils/dali-test-suite-utils.h index 94ef86a09..1635ef8ad 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/dali-test-suite-utils.h +++ b/automated-tests/src/dali/dali-test-suite-utils/dali-test-suite-utils.h @@ -393,9 +393,6 @@ struct DefaultFunctionCoverage } }; -// Prepare a resource image to be loaded. Should be called before creating the ResourceImage -void PrepareResourceImage( TestApplication& application, uint32_t imageWidth, uint32_t imageHeight, Pixel::Format pixelFormat ); - // Test namespace to prevent pollution of Dali namespace, add Test helper functions here namespace Test { diff --git a/automated-tests/src/dali/dali-test-suite-utils/mesh-builder.cpp b/automated-tests/src/dali/dali-test-suite-utils/mesh-builder.cpp index f8e3917c8..2e8f7242e 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/mesh-builder.cpp +++ b/automated-tests/src/dali/dali-test-suite-utils/mesh-builder.cpp @@ -18,9 +18,6 @@ // CLASS HEADER #include "mesh-builder.h" -// EXTERNAL INCLUDES -#include - namespace Dali { @@ -34,13 +31,6 @@ TextureSet CreateTextureSet() return TextureSet::New(); } -TextureSet CreateTextureSet( Image image ) -{ - TextureSet textureSet = TextureSet::New(); - TextureSetImage( textureSet, 0u, image ); - return textureSet; -} - TextureSet CreateTextureSet( Texture texture ) { TextureSet textureSet = TextureSet::New(); diff --git a/automated-tests/src/dali/dali-test-suite-utils/mesh-builder.h b/automated-tests/src/dali/dali-test-suite-utils/mesh-builder.h index ea0b156cd..37d13ec52 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/mesh-builder.h +++ b/automated-tests/src/dali/dali-test-suite-utils/mesh-builder.h @@ -26,7 +26,6 @@ namespace Dali Shader CreateShader(); TextureSet CreateTextureSet(); -TextureSet CreateTextureSet( Image image ); TextureSet CreateTextureSet( Texture texture ); Geometry CreateQuadGeometry(); PropertyBuffer CreatePropertyBuffer(); diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-actor-utils.cpp b/automated-tests/src/dali/dali-test-suite-utils/test-actor-utils.cpp index 32bccddd1..5d45a121b 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-actor-utils.cpp +++ b/automated-tests/src/dali/dali-test-suite-utils/test-actor-utils.cpp @@ -20,7 +20,6 @@ // EXTERNAL INCLUDES #include -#include // INTERNAL INCLUDES #include "mesh-builder.h" @@ -94,38 +93,4 @@ Actor CreateRenderableActor( Texture texture, const std::string& vertexShader, c return actor; } -Actor CreateRenderableActor( Image texture ) -{ - return CreateRenderableActor( texture, VERTEX_SHADER, FRAGMENT_SHADER ); -} - -Actor CreateRenderableActor( Image texture, const std::string& vertexShader, const std::string& fragmentShader ) -{ - // Create the geometry - Geometry geometry = CreateQuadGeometry(); - - // Create Shader - Shader shader = Shader::New( vertexShader, fragmentShader ); - - // Create renderer from geometry and material - Renderer renderer = Renderer::New( geometry, shader ); - - // Create actor and set renderer - Actor actor = Actor::New(); - actor.AddRenderer( renderer ); - - // If we a texture, then create a texture-set and add to renderer - if( texture ) - { - TextureSet textureSet = TextureSet::New(); - TextureSetImage( textureSet, 0u, texture ); - renderer.SetTextures( textureSet ); - - // Set actor to the size of the texture if set - actor.SetProperty( Actor::Property::SIZE, Vector2( texture.GetWidth(), texture.GetHeight() ) ); - } - - return actor; -} - } // namespace Dali diff --git a/automated-tests/src/dali/dali-test-suite-utils/test-actor-utils.h b/automated-tests/src/dali/dali-test-suite-utils/test-actor-utils.h index 8b8859fb2..4a8716e20 100644 --- a/automated-tests/src/dali/dali-test-suite-utils/test-actor-utils.h +++ b/automated-tests/src/dali/dali-test-suite-utils/test-actor-utils.h @@ -34,22 +34,6 @@ class Texture; */ Actor CreateRenderableActor(); -/** - * @brief Creates a renderable-actor with a texture. - * @param[in] texture Texture to set. - * @return An actor with a renderer. - */ -Actor CreateRenderableActor( Image texture ); - -/** - * @brief Creates a renderable-actor with a texture and custom shaders. - * @param[in] texture Texture to set. - * @param[in] vertexShader The vertex-shader. - * @param[in] fragmentShader The fragment-shader. - * @return An actor with a renderer. - */ -Actor CreateRenderableActor( Image texture, const std::string& vertexShader, const std::string& fragmentShader ); - /** * @brief Creates a renderable-actor with a texture. * @param[in] texture Texture to set. diff --git a/automated-tests/src/dali/utc-Dali-Image.cpp b/automated-tests/src/dali/utc-Dali-Image.cpp deleted file mode 100644 index 58ba988f8..000000000 --- a/automated-tests/src/dali/utc-Dali-Image.cpp +++ /dev/null @@ -1,119 +0,0 @@ -/* - * 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. - * - */ - -#include -#include -#include -#include -#include -#include -#include - -using namespace Dali; - -void utc_dali_image_startup(void) -{ - test_return_value = TET_UNDEF; -} - -void utc_dali_image_cleanup(void) -{ - test_return_value = TET_PASS; -} - -static const char* gTestImageFilename = "icon_wrt.png"; - -namespace -{ - -} - -int UtcDaliImageDownCast(void) -{ - TestApplication application; - tet_infoline("Testing Dali::Image::DownCast()"); - - Image image = ResourceImage::New(gTestImageFilename); - - BaseHandle object(image); - - Image image2 = Image::DownCast(object); - DALI_TEST_CHECK(image2); - - Image image3 = DownCast< Image >(object); - DALI_TEST_CHECK(image3); - - BaseHandle unInitializedObject; - Image image4 = Image::DownCast(unInitializedObject); - DALI_TEST_CHECK(!image4); - - Image image5 = DownCast< Image >(unInitializedObject); - DALI_TEST_CHECK(!image5); - END_TEST; -} - -int UtcDaliImageGetWidthHeight(void) -{ - TestApplication application; - - tet_infoline("UtcDaliImageGetWidthHeight - Image::GetWidth() & Image::GetHeight"); - - Vector2 testSize(8.0f, 16.0f); - application.GetPlatform().SetClosestImageSize(testSize); - PrepareResourceImage( application, testSize.x, testSize.y, Pixel::RGBA8888 ); - Image image1 = ResourceImage::New(gTestImageFilename); - DALI_TEST_EQUALS( image1.GetWidth(), testSize.x, TEST_LOCATION ); - DALI_TEST_EQUALS( image1.GetHeight(), testSize.y, TEST_LOCATION ); - - testSize = Vector2(128.0f, 256.0f); - PrepareResourceImage( application, testSize.x, testSize.y, Pixel::RGBA8888 ); - Image image2 = ResourceImage::New( gTestImageFilename, ImageDimensions(testSize.x, testSize.y), FittingMode::SCALE_TO_FILL, SamplingMode::DEFAULT ); - DALI_TEST_EQUALS( image2.GetWidth(), testSize.x, TEST_LOCATION ); - DALI_TEST_EQUALS( image2.GetHeight(), testSize.y, TEST_LOCATION ); - - END_TEST; -} - -int UtcDaliImageDiscard01(void) -{ - TestApplication application; - tet_infoline("UtcDaliImageDiscard01 - no actors"); - - { - Image image = ResourceImage::New(gTestImageFilename); - - // Load image - application.SendNotification(); - application.Render(16); - std::vector ids; - ids.push_back( 23 ); - application.GetGlAbstraction().SetNextTextureIds( ids ); - application.Render(16); - application.SendNotification(); - } // Drop image handle - - application.SendNotification(); - application.Render(16); - application.Render(16); - application.SendNotification(); - - // Shouldn't have been sent to GL... - const std::vector& texIds = application.GetGlAbstraction().GetNextTextureIds(); - DALI_TEST_CHECK( texIds.size() == 1 ); - DALI_TEST_CHECK( texIds[0] == 23 ); - END_TEST; -} diff --git a/automated-tests/src/dali/utc-Dali-RenderTask.cpp b/automated-tests/src/dali/utc-Dali-RenderTask.cpp index 169752fb2..eb60d6d15 100644 --- a/automated-tests/src/dali/utc-Dali-RenderTask.cpp +++ b/automated-tests/src/dali/utc-Dali-RenderTask.cpp @@ -171,28 +171,14 @@ bool TestScreenToFrameBufferFunction( Vector2& coordinates ) Actor CreateRenderableActorSuccess(TestApplication& application, std::string filename) { - PrepareResourceImage( application, 80u, 80u, Pixel::RGBA8888 ); - Image image = ResourceImage::New(filename); - Actor actor = CreateRenderableActor(image); + Actor actor = CreateRenderableActor(); actor.SetProperty( Actor::Property::SIZE, Vector2( 80.0f, 80.0f ) ); return actor; } -Actor CreateRenderableActorFailed(TestApplication& application, std::string filename) +Texture CreateTexture() { - Image image = ResourceImage::New(filename); - DALI_TEST_CHECK( image ); - Actor actor = CreateRenderableActor(image); - actor.SetProperty( Actor::Property::SIZE, Vector2( 80.0f, 80.0f ) ); - return actor; -} - -Image CreateResourceImage(TestApplication& application, std::string filename) -{ - PrepareResourceImage( application, 80u, 80u, Pixel::RGBA8888 ); - Image image = ResourceImage::New(filename); - DALI_TEST_CHECK( image ); - return image; + return Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 80u, 80u); } RenderTask CreateRenderTask(TestApplication& application, @@ -2013,7 +1999,7 @@ int UtcDaliRenderTaskContinuous04(void) CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) ); Stage::GetCurrent().Add( offscreenCameraActor ); - Actor secondRootActor = CreateRenderableActorFailed(application, "aFile.jpg"); + Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg"); Stage::GetCurrent().Add(secondRootActor); RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, true); @@ -2084,7 +2070,7 @@ int UtcDaliRenderTaskOnce02(void) Stage::GetCurrent().Add( offscreenCameraActor ); Shader shader = CreateShader(); - Image image = CreateResourceImage(application, "aFile.jpg"); + Texture image = CreateTexture(); TextureSet textureSet = CreateTextureSet( image ); Geometry geometry = CreateQuadGeometry(); @@ -2177,7 +2163,7 @@ int UtcDaliRenderTaskOnce04(void) Stage::GetCurrent().Add( offscreenCameraActor ); Shader shader = CreateShader(); - Image image = CreateResourceImage(application, "aFile.jpg"); + Texture image = CreateTexture(); TextureSet textureSet = CreateTextureSet( image ); Geometry geometry = CreateQuadGeometry(); @@ -2259,7 +2245,7 @@ int UtcDaliRenderTaskOnceNoSync02(void) Stage::GetCurrent().Add( offscreenCameraActor ); Shader shader = CreateShader(); - Image image = CreateResourceImage(application, "aFile.jpg"); + Texture image = CreateTexture(); TextureSet textureSet = CreateTextureSet( image ); Geometry geometry = CreateQuadGeometry(); @@ -2340,7 +2326,7 @@ int UtcDaliRenderTaskOnceNoSync04(void) Stage::GetCurrent().Add( offscreenCameraActor ); Shader shader = CreateShader(); - Image image = CreateResourceImage(application, "aFile.jpg"); + Texture image = CreateTexture(); TextureSet textureSet = CreateTextureSet( image ); Geometry geometry = CreateQuadGeometry(); @@ -2393,7 +2379,7 @@ int UtcDaliRenderTaskOnceNoSync05(void) CameraActor offscreenCameraActor = CameraActor::New( Size( TestApplication::DEFAULT_SURFACE_WIDTH, TestApplication::DEFAULT_SURFACE_HEIGHT ) ); Stage::GetCurrent().Add( offscreenCameraActor ); - Actor secondRootActor = CreateRenderableActorFailed(application, "aFile.jpg"); + Actor secondRootActor = CreateRenderableActorSuccess(application, "aFile.jpg"); Stage::GetCurrent().Add(secondRootActor); RenderTask newTask = CreateRenderTask(application, offscreenCameraActor, rootActor, secondRootActor, RenderTask::REFRESH_ALWAYS, false); @@ -2580,7 +2566,7 @@ int UtcDaliRenderTaskFinishMissingImage(void) rootActor.SetProperty( Actor::Property::SIZE, Vector2( 10.0f, 10.0f ) ); stage.Add( rootActor ); - Actor actorWithMissingImage = CreateRenderableActor( Image() ); + Actor actorWithMissingImage = CreateRenderableActor( Texture() ); actorWithMissingImage.SetProperty( Actor::Property::SIZE, Vector2( 10.0f, 10.0f ) ); stage.Add( actorWithMissingImage ); diff --git a/automated-tests/src/dali/utc-Dali-Renderer.cpp b/automated-tests/src/dali/utc-Dali-Renderer.cpp index 300767ad1..57188cf93 100644 --- a/automated-tests/src/dali/utc-Dali-Renderer.cpp +++ b/automated-tests/src/dali/utc-Dali-Renderer.cpp @@ -20,7 +20,6 @@ #include #include -#include #include #include #include diff --git a/automated-tests/src/dali/utc-Dali-ResourceImage.cpp b/automated-tests/src/dali/utc-Dali-ResourceImage.cpp deleted file mode 100644 index ccd3eb40a..000000000 --- a/automated-tests/src/dali/utc-Dali-ResourceImage.cpp +++ /dev/null @@ -1,218 +0,0 @@ -/* - * Copyright (c) 2017 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 - -using namespace Dali; - -void utc_dali_resource_image_startup(void) -{ - test_return_value = TET_UNDEF; -} - -void utc_dali_resource_image_cleanup(void) -{ - test_return_value = TET_PASS; -} - -namespace -{ -const char* gTestImageFilename = "icon_wrt.png"; -} // unnamed namespace - - -// 1.1 -int UtcDaliResourceImageNew01(void) -{ - TestApplication application; - - tet_infoline("UtcDaliResourceImageNew01 - ResourceImage::New(const std::string&)"); - - // invoke default handle constructor - ResourceImage image; - - DALI_TEST_CHECK( !image ); - - // initialise handle - image = ResourceImage::New(gTestImageFilename); - - DALI_TEST_CHECK( image ); - END_TEST; -} - -// 1.2 -int UtcDaliResourceImageNew02(void) -{ - TestApplication application; - - tet_infoline("UtcDaliREsourceImageNew02 - ResourceImage New( const std::string& url, ImageDimensions size, FittingMode scalingMode, SamplingMode samplingMode, bool orientationCorrection = true )"); - - // invoke default handle constructor - ResourceImage image; - - DALI_TEST_CHECK( !image ); - - // initialise handle - image = ResourceImage::New(gTestImageFilename, ImageDimensions( 128, 256 ), FittingMode::FIT_HEIGHT ); - - DALI_TEST_CHECK( image ); - END_TEST; -} - -// 1.7 -int UtcDaliResourceImageDownCast(void) -{ - TestApplication application; - tet_infoline("Testing Dali::ResourceImage::DownCast()"); - - ResourceImage image = ResourceImage::New(gTestImageFilename); - - BaseHandle object(image); - - ResourceImage image2 = ResourceImage::DownCast(object); - DALI_TEST_CHECK(image2); - - ResourceImage image3 = DownCast< ResourceImage >(object); - DALI_TEST_CHECK(image3); - - BaseHandle unInitializedObject; - ResourceImage image4 = ResourceImage::DownCast(unInitializedObject); - DALI_TEST_CHECK(!image4); - - ResourceImage image5 = DownCast< ResourceImage >(unInitializedObject); - DALI_TEST_CHECK(!image5); - - Image image6 = ResourceImage::New(gTestImageFilename); - ResourceImage image7 = ResourceImage::DownCast(image6); - DALI_TEST_CHECK(image7); - END_TEST; -} - -// 1.8 -int UtcDaliResourceImageGetImageSize(void) -{ - TestApplication application; - TestPlatformAbstraction& platform = application.GetPlatform(); - - tet_infoline("UtcDaliResourceImageGetImageSize - ResourceImage::GetImageSize()"); - - Vector2 testSize(8.0f, 16.0f); - platform.SetClosestImageSize(testSize); - - const ImageDimensions size = ResourceImage::GetImageSize(gTestImageFilename); - - DALI_TEST_CHECK( application.GetPlatform().GetTrace().FindMethod("GetClosestImageSize")); - DALI_TEST_EQUALS( Vector2( size.GetX(), size.GetY() ), testSize, TEST_LOCATION); - END_TEST; -} - -// 1.9 -int UtcDaliResourceImageGetUrl(void) -{ - TestApplication application; - - tet_infoline("UtcDaliResourceImageGetFilename - ResourceImage::GetUrl()"); - - // invoke default handle constructor - ResourceImage image; - - DALI_TEST_CHECK( !image ); - - // initialise handle - image = ResourceImage::New(gTestImageFilename); - - DALI_TEST_EQUALS( image.GetUrl(), gTestImageFilename, TEST_LOCATION); - END_TEST; -} - -// 1.10 -int UtcDaliResourceImageGetLoadingState01(void) -{ - TestApplication application; - tet_infoline("UtcDaliResourceImageGetLoadingState01"); - - ResourceImage image = ResourceImage::New(gTestImageFilename); - DALI_TEST_CHECK(image.GetLoadingState() == ResourceLoadingFailed); - - // simulate load success - PrepareResourceImage( application, 100u, 100u, Pixel::RGBA8888 ); - image.Reload(); - - // Test state == ResourceLoadingSucceeded - DALI_TEST_CHECK(image.GetLoadingState() == ResourceLoadingSucceeded); - END_TEST; -} - -// 1.11 -int UtcDaliResourceImageGetLoadingState02(void) -{ - TestApplication application; - - tet_infoline("UtcDaliResourceImageGetLoadingState02"); - - // invoke default handle constructor - ResourceImage image; - - DALI_TEST_CHECK( !image ); - - // initialise handle - image = ResourceImage::New(gTestImageFilename); - - // Test state == ResourceLoadingFailed - DALI_TEST_CHECK(image.GetLoadingState() == ResourceLoadingFailed); - - PrepareResourceImage( application, 100u, 100u, Pixel::RGBA8888 ); - image.Reload(); - - // Test state == ResourceLoadingFailed - DALI_TEST_CHECK(image.GetLoadingState() == ResourceLoadingSucceeded); - END_TEST; -} - -static bool SignalLoadFlag = false; - -static void SignalLoadHandler(ResourceImage image) -{ - tet_infoline("Received image load finished signal"); - - SignalLoadFlag = true; -} - -// 1.13 -int UtcDaliResourceImageSignalLoadingFinished(void) -{ - TestApplication application; - - tet_infoline("UtcDaliResourceImageSignalLoadingFinished"); - - SignalLoadFlag = false; - - PrepareResourceImage( application, 100u, 100u, Pixel::RGBA8888 ); - ResourceImage image = ResourceImage::New(gTestImageFilename); - - image.LoadingFinishedSignal().Connect( SignalLoadHandler ); - image.Reload(); - application.SendNotification(); - application.Render(16); - - DALI_TEST_CHECK( SignalLoadFlag == true ); - END_TEST; -} diff --git a/automated-tests/src/dali/utc-Dali-Sampler.cpp b/automated-tests/src/dali/utc-Dali-Sampler.cpp index d1c1d1095..4ea197bb6 100644 --- a/automated-tests/src/dali/utc-Dali-Sampler.cpp +++ b/automated-tests/src/dali/utc-Dali-Sampler.cpp @@ -17,7 +17,6 @@ // EXTERNAL INCLUDES #include -#include #include #include diff --git a/automated-tests/src/dali/utc-Dali-TextureSet.cpp b/automated-tests/src/dali/utc-Dali-TextureSet.cpp index 7c6fcb3c9..2b0f58d11 100644 --- a/automated-tests/src/dali/utc-Dali-TextureSet.cpp +++ b/automated-tests/src/dali/utc-Dali-TextureSet.cpp @@ -17,7 +17,6 @@ // EXTERNAL INCLUDES #include -#include // INTERNAL INCLUDES #include diff --git a/dali/devel-api/file.list b/dali/devel-api/file.list index c21720acc..4755a445a 100644 --- a/dali/devel-api/file.list +++ b/dali/devel-api/file.list @@ -18,7 +18,6 @@ SET( devel_api_src_files ${devel_api_src_dir}/events/touch-data-devel.cpp ${devel_api_src_dir}/events/key-event-devel.cpp ${devel_api_src_dir}/images/distance-field.cpp - ${devel_api_src_dir}/images/texture-set-image.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 @@ -76,7 +75,6 @@ SET( devel_api_core_events_header_files SET( devel_api_core_images_header_files ${devel_api_src_dir}/images/distance-field.h ${devel_api_src_dir}/images/native-image-interface-extension.h - ${devel_api_src_dir}/images/texture-set-image.h ${devel_api_src_dir}/images/pixel-data-devel.h ) diff --git a/dali/devel-api/images/texture-set-image.cpp b/dali/devel-api/images/texture-set-image.cpp deleted file mode 100644 index 4f911e2b1..000000000 --- a/dali/devel-api/images/texture-set-image.cpp +++ /dev/null @@ -1,48 +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 "texture-set-image.h" - -// INTERNAL INCLUDES -#include -#include - -namespace Dali -{ - -void TextureSetImage( TextureSet textureSet, size_t index, Image image ) -{ - Internal::ImagePtr imagePointer( NULL ); - if( image ) - { - imagePointer = &GetImplementation( image ); - } - - GetImplementation( textureSet ).SetImage( static_cast( index ), imagePointer ); -} - -Image TextureGetImage( TextureSet textureSet, size_t index ) -{ - // Get a pointer to the image implementation. - Internal::Image* imagePointer = GetImplementation( textureSet ).GetImage( static_cast( index ) ); - - // Return a handle to the image. - return Dali::Image( imagePointer ); -} - -} // namespace Dali diff --git a/dali/devel-api/images/texture-set-image.h b/dali/devel-api/images/texture-set-image.h deleted file mode 100644 index cd74e45a0..000000000 --- a/dali/devel-api/images/texture-set-image.h +++ /dev/null @@ -1,51 +0,0 @@ -#ifndef DALI_TEXTURE_SET_IMAGE_H -#define DALI_TEXTURE_SET_IMAGE_H - -/* - * 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. - * - */ - -// EXTERNAL INCLUDES -#include - -// INTERNAL INCLUDES -#include - -namespace Dali -{ - -class Image; -class TextureSet; - -/** - * @brief Set the image at the specified position index. - * @param[in] textureSet The TextureSet to use - * @param[in] index The position in the TextureSet that the image will be set - * @param[in] image The image to set - */ -DALI_CORE_API void TextureSetImage( TextureSet textureSet, size_t index, Image image ); - -/** - * @brief Get the image at the specified position index. - * @param[in] textureSet The TextureSet to use - * @param[in] index The position in the TextureSet that the image will be set - * @return A handle to the image at the the specified position - */ -DALI_CORE_API Image TextureGetImage( TextureSet textureSet, size_t index ); - -} //namespace Dali - -#endif // DALI_TEXTURE_SET_IMAGE_H diff --git a/dali/integration-api/profiling.cpp b/dali/integration-api/profiling.cpp index 04d11d5e3..86c7f5e0d 100644 --- a/dali/integration-api/profiling.cpp +++ b/dali/integration-api/profiling.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. @@ -36,8 +36,6 @@ #include -#include - #include #include @@ -97,9 +95,6 @@ const std::size_t CAMERA_ACTOR_MEMORY_SIZE( const std::size_t LAYER_MEMORY_SIZE( sizeof( Internal::Layer ) + sizeof( Internal::SceneGraph::Layer ) ); -const std::size_t IMAGE_MEMORY_SIZE( - sizeof( Internal::Image ) + - sizeof( Integration::Bitmap ) ); const std::size_t RENDERER_MEMORY_SIZE( sizeof( Internal::Renderer ) + sizeof( Internal::SceneGraph::Renderer ) + diff --git a/dali/internal/event/images/image-impl.cpp b/dali/internal/event/images/image-impl.cpp deleted file mode 100644 index 49d7f5435..000000000 --- a/dali/internal/event/images/image-impl.cpp +++ /dev/null @@ -1,78 +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 - -// EXTERNAL INCLUDES -#include // for strcmp - -// INTERNAL INCLUDES -#include -#include - -#include -#include -#include - -using namespace Dali::Integration; - -namespace Dali -{ - -namespace Internal -{ - -unsigned int Image::GetWidth() const -{ - return mWidth; -} - -unsigned int Image::GetHeight() const -{ - return mHeight; -} - -Vector2 Image::GetNaturalSize() const -{ - return Vector2( static_cast( mWidth ), static_cast( mHeight ) ); -} - -Image::Image() -: mTexture(), - mWidth( 0 ), - mHeight( 0 ), - mConnectionCount( 0 ) -{ -} - -Image::~Image() -{ - if( Stage::IsInstalled() ) - { - UnregisterObject(); - } -} - -void Image::Initialize() -{ - RegisterObject(); -} - -} // namespace Internal - -} // namespace Dali diff --git a/dali/internal/event/images/image-impl.h b/dali/internal/event/images/image-impl.h deleted file mode 100644 index 88fdd0b45..000000000 --- a/dali/internal/event/images/image-impl.h +++ /dev/null @@ -1,152 +0,0 @@ -#ifndef DALI_INTERNAL_IMAGE_H -#define DALI_INTERNAL_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. - * - */ - -// EXTERNAL INCLUDES -#include - -// INTERNAL INCLUDES -#include -#include -#include - -namespace Dali -{ - -namespace Internal -{ - -class Image; -class ImageFactory; -typedef IntrusivePtr ImagePtr; - -/** - * Image represents an image resource that can be added to actors etc. - * When the Image object is created, resource loading will be attempted. - * Provided this is successful, the resource will exist until the Image is destroyed. - */ -class Image : public BaseObject -{ -public: - - /** - * @copydoc Dali::Image::UploadedSignal() - */ - Dali::Image::ImageSignalType& UploadedSignal() { return mUploaded; } - - /** - * Get the width of the image. - * Only to be used after the image has finished loading. - * (Ticket's LoadingSucceeded callback was called) - * The returned value will reflect the true image dimensions once the asynchronous loading has finished. - * @pre image should be loaded - */ - virtual unsigned int GetWidth() const; - - /** - * Get the height of the image. - * Only to be used after the image has finished loading. - * (Ticket's LoadingSucceeded callback was called) - * The returned value will reflect the true image dimensions once the asynchronous loading has finished. - * @pre image should be loaded - */ - virtual unsigned int GetHeight() const; - - /** - * Return the natural size of the image. - * This is the size that the loaded image will take - */ - virtual Vector2 GetNaturalSize() const; - - /** - * Returns a pointer to the internal texture used by the image - */ - Texture* GetTexture() const - { - return mTexture.Get(); - } - -public: - - /** - * Indicates that the image is used. - */ - virtual void Connect() {} - - /** - * Indicates that the image is not used anymore. - */ - virtual void Disconnect() {} - -protected: - - /** - * A reference counted object may only be deleted by calling Unreference() - */ - virtual ~Image(); - - /** - * Constructor, with default parameters - */ - Image(); - - /** - * Second stage initialization - */ - void Initialize(); - -protected: - - TexturePtr mTexture; ///< smart pointer to the texture used by the image - - unsigned int mWidth; ///< natural width of the image - unsigned int mHeight; ///< natural height of the image - - unsigned int mConnectionCount; ///< number of on-stage objects using this image - -private: - - Dali::Image::ImageSignalType mUploaded; -}; - -} // namespace Internal - -/** - * Helper methods for public API. - */ -inline Internal::Image& GetImplementation(Dali::Image& image) -{ - DALI_ASSERT_ALWAYS( image && "Image handle is empty" ); - - BaseObject& handle = image.GetBaseObject(); - - return static_cast(handle); -} - -inline const Internal::Image& GetImplementation(const Dali::Image& image) -{ - DALI_ASSERT_ALWAYS( image && "Image handle is empty" ); - - const BaseObject& handle = image.GetBaseObject(); - - return static_cast(handle); -} - -} // namespace Dali -#endif // DALI_INTERNAL_IMAGE_H diff --git a/dali/internal/event/images/resource-image-impl.cpp b/dali/internal/event/images/resource-image-impl.cpp deleted file mode 100644 index a91bed6d1..000000000 --- a/dali/internal/event/images/resource-image-impl.cpp +++ /dev/null @@ -1,161 +0,0 @@ -/* - * 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. - * - */ - -// CLASS HEADER -#include - -// EXTERNAL INCLUDES -#include // for strcmp - -// INTERNAL INCLUDES -#include -#include -#include -#include -#include -#include - -using namespace Dali::Integration; - -namespace Dali -{ - -namespace Internal -{ - -ResourceImage::ResourceImage() -: Image(), - mLoadingFinished(), - mAttributes(), - mUrl(), - mLoadingState( Dali::ResourceLoading ) -{ -} - -ResourceImage::ResourceImage( const std::string& url, const ImageAttributes& attributes) -: Image(), - mLoadingFinished(), - mAttributes(attributes), - mUrl(url), - mLoadingState( Dali::ResourceLoading ) -{ -} - -ResourceImagePtr ResourceImage::New() -{ - ResourceImagePtr image = new ResourceImage; - image->Initialize(); - return image; -} - -ResourceImagePtr ResourceImage::New( const std::string& url, const ImageAttributes& attributes ) -{ - ResourceImagePtr image; - image = new ResourceImage(url, attributes); - image->Initialize(); - image->Reload(); - - DALI_LOG_SET_OBJECT_STRING( image, url ); - - return image; -} - -ResourceImage::~ResourceImage() -{ -} - -const ImageAttributes& ResourceImage::GetAttributes() const -{ - return mAttributes; -} - -const std::string& ResourceImage::GetUrl() const -{ - return mUrl; -} - -void ResourceImage::Reload() -{ - ThreadLocalStorage& tls = ThreadLocalStorage::Get(); - Integration::PlatformAbstraction& platformAbstraction = tls.GetPlatformAbstraction(); - Integration::BitmapResourceType resourceType( ImageDimensions(mAttributes.GetWidth(), mAttributes.GetHeight()), - mAttributes.GetScalingMode(), - mAttributes.GetFilterMode(), - mAttributes.GetOrientationCorrection() ); - - // Note, bitmap is only destroyed when the image is destroyed. - Integration::ResourcePointer resource = platformAbstraction.LoadImageSynchronously( resourceType, mUrl ); - if( resource ) - { - Integration::Bitmap* bitmap = static_cast( resource.Get() ); - unsigned width = bitmap->GetImageWidth(); - unsigned height = bitmap->GetImageHeight(); - - //Create texture - Pixel::Format format = bitmap->GetPixelFormat(); - mTexture = Texture::New( Dali::TextureType::TEXTURE_2D, format, width, height ); - - //Upload data to the texture - uint32_t bufferSize = bitmap->GetBufferSize(); - PixelDataPtr pixelData = PixelData::New( bitmap->GetBufferOwnership(), bufferSize, width, height, format, - static_cast< Dali::PixelData::ReleaseFunction >( bitmap->GetReleaseFunction() ) ); - mTexture->Upload( pixelData ); - - mWidth = mAttributes.GetWidth(); - if( mWidth == 0 ) - { - mWidth = width; - } - - mHeight = mAttributes.GetHeight(); - if( mHeight == 0 ) - { - mHeight = height; - } - - mLoadingState = Dali::ResourceLoadingSucceeded; - - } - else - { - mTexture = Texture::New( Dali::TextureType::TEXTURE_2D, Pixel::RGBA8888, 0u, 0u ); - mWidth = mHeight = 0u; - mLoadingState = Dali::ResourceLoadingFailed; - } - - mLoadingFinished.Emit( Dali::ResourceImage( this ) ); -} - -unsigned int ResourceImage::GetWidth() const -{ - return mWidth; -} - -unsigned int ResourceImage::GetHeight() const -{ - return mHeight; -} - -Vector2 ResourceImage::GetNaturalSize() const -{ - return Vector2( static_cast( mWidth ), static_cast( mHeight ) ); -} - - -} // namespace Internal - -} // namespace Dali diff --git a/dali/internal/event/images/resource-image-impl.h b/dali/internal/event/images/resource-image-impl.h deleted file mode 100644 index 00f3fbf86..000000000 --- a/dali/internal/event/images/resource-image-impl.h +++ /dev/null @@ -1,161 +0,0 @@ -#ifndef DALI_INTERNAL_RESOURCE_IMAGE_H -#define DALI_INTERNAL_RESOURCE_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. - * - */ - -// EXTERNAL INCLUDES -#include - -// INTERNAL INCLUDES -#include -#include -#include -#include // For DALI_LOG_OBJECT_STRING_DECLARATION - -namespace Dali -{ - -namespace Internal -{ - -class ResourceImage; -typedef IntrusivePtr ResourceImagePtr; - -/** - * ResourceImage is an image loaded using a URL, it is an image resource that can be added to actors etc. - */ -class ResourceImage : public Image -{ -public: - - /** - * Creates a pointer to an uninitialized Image object. - * @return a pointer to a newly created object. - */ - static ResourceImagePtr New(); - - /** - * Creates object and loads image from filesystem - * the maximum size of the image is limited by GL_MAX_TEXTURE_SIZE - * @param [in] url The URL of the image file. - * @param [in] attributes requested parameters for loading (size, scaling etc.) - * if width or height is specified as 0, the natural size will be used. - * @return a pointer to a newly created object. - */ - static ResourceImagePtr New( const std::string& url, - const ImageAttributes& attributes ); - - /** - * @copydoc Dali::ResourceImage::GetLoadingState() - */ - Dali::LoadingState GetLoadingState() const { return mLoadingState; } - - /** - * @copydoc Dali::ResourceImage::LoadingFinishedSignal() - */ - Dali::ResourceImage::ResourceImageSignal& LoadingFinishedSignal() { return mLoadingFinished; } - - /** - * Get the attributes of the image. - * Only to be used after the image has finished loading. - * (Ticket's LoadingSucceeded callback was called) - * Reflects the last cached values after a LoadComplete. - * If requested width or height was 0, they are replaced by concrete dimensions. - * @return a copy of the attributes - */ - const ImageAttributes& GetAttributes() const; - - /** - * @copydoc Dali::ResourceImage::GetUrl() - * virtual so deriving class can override it - */ - virtual const std::string& GetUrl() const; - - /** - * @copydoc Dali::ResourceImage::Reload() - */ - void Reload(); - - /** - * @copydoc Dali::Image::GetWidth() - */ - virtual unsigned int GetWidth() const; - - /** - * @copydoc Dali::Image::GetWidth() - */ - virtual unsigned int GetHeight() const; - - /** - * @copydoc Dali::Internal::Image::GetNaturalSize() - */ - virtual Vector2 GetNaturalSize() const; - - -protected: - - /** - * A reference counted object may only be deleted by calling Unreference() - */ - virtual ~ResourceImage(); - - /** - * Constructor, with default parameters - */ - ResourceImage(); - - /** - * Constructor, with url and attributes - */ - ResourceImage( const std::string& url, const ImageAttributes& attributes); - -private: - Dali::ResourceImage::ResourceImageSignal mLoadingFinished; - ImageAttributes mAttributes; - std::string mUrl; - Dali::LoadingState mLoadingState; - - // Changes scope, should be at end of class - DALI_LOG_OBJECT_STRING_DECLARATION; -}; - -} // namespace Internal - -/** - * Helper methods for public API. - */ -inline Internal::ResourceImage& GetImplementation(Dali::ResourceImage& image) -{ - DALI_ASSERT_ALWAYS( image && "Image handle is empty" ); - - BaseObject& handle = image.GetBaseObject(); - - return static_cast(handle); -} - -inline const Internal::ResourceImage& GetImplementation(const Dali::ResourceImage& image) -{ - DALI_ASSERT_ALWAYS( image && "Image handle is empty" ); - - const BaseObject& handle = image.GetBaseObject(); - - return static_cast(handle); -} - -} // namespace Dali -#endif // DALI_INTERNAL_RESOURCE_IMAGE_H diff --git a/dali/internal/event/rendering/texture-set-impl.cpp b/dali/internal/event/rendering/texture-set-impl.cpp index 07001a405..56f917900 100644 --- a/dali/internal/event/rendering/texture-set-impl.cpp +++ b/dali/internal/event/rendering/texture-set-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. @@ -86,39 +86,6 @@ Texture* TextureSet::GetTexture( uint32_t index ) const return result; } -void TextureSet::SetImage( uint32_t index, ImagePtr image ) -{ - Texture* texture( NULL ); - if( image ) - { - uint32_t textureCount = static_cast( mImages.size() ); - if( index >= textureCount ) - { - mImages.resize(index + 1); - } - mImages[index] = image; - - texture = image->GetTexture(); - } - - SetTexture( index, texture ); -} - -Image* TextureSet::GetImage( uint32_t index ) const -{ - Image* result( NULL ); - if( index < mImages.size() ) - { - result = mImages[index].Get(); - } - else - { - DALI_LOG_ERROR( "Error: Invalid index to TextureSet::GetImage\n"); - } - - return result; -} - void TextureSet::SetSampler( uint32_t index, SamplerPtr sampler ) { uint32_t samplerCount = static_cast( mSamplers.size() ); diff --git a/dali/internal/event/rendering/texture-set-impl.h b/dali/internal/event/rendering/texture-set-impl.h index 44f511738..295b322c5 100644 --- a/dali/internal/event/rendering/texture-set-impl.h +++ b/dali/internal/event/rendering/texture-set-impl.h @@ -2,7 +2,7 @@ #define DALI_INTERNAL_TEXTURE_SET_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. @@ -27,7 +27,6 @@ #include // Dali::TextureSet #include // Dali::Internal::Object #include // Dali::Internal::PropertyBuffer -#include // Dali::Internal::Image #include // Dali::Internal::Sampler #include // Dali::Internal::Texture #include // Dali::Internal::Shader @@ -67,16 +66,6 @@ public: */ Texture* GetTexture( uint32_t index ) const; - /** - * @copydoc Dali::TextureSet::SetImage() - */ - void SetImage( uint32_t index, ImagePtr image ); - - /** - * @copydoc Dali::TextureSet::GetImage() - */ - Image* GetImage( uint32_t index ) const; - /** * @copydoc Dali::TextureSet::SetSampler() */ @@ -121,7 +110,6 @@ private: // unimplemented methods private: // Data EventThreadServices& mEventThreadServices; /// mImages; std::vector mSamplers; std::vector mTextures; }; diff --git a/dali/internal/file.list b/dali/internal/file.list index 87095579c..96fb14945 100644 --- a/dali/internal/file.list +++ b/dali/internal/file.list @@ -79,8 +79,6 @@ SET( internal_src_files ${internal_src_dir}/event/events/tap-gesture/tap-gesture-recognizer.cpp ${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/resource-image-impl.cpp ${internal_src_dir}/event/images/pixel-data-impl.cpp ${internal_src_dir}/event/render-tasks/render-task-impl.cpp ${internal_src_dir}/event/render-tasks/render-task-list-impl.cpp diff --git a/dali/public-api/dali-core.h b/dali/public-api/dali-core.h index d0d0e5763..b141f8a81 100644 --- a/dali/public-api/dali-core.h +++ b/dali/public-api/dali-core.h @@ -65,9 +65,7 @@ #include #include -#include #include -#include #include #include diff --git a/dali/public-api/file.list b/dali/public-api/file.list index 8ef2c36a4..eadaa1f07 100644 --- a/dali/public-api/file.list +++ b/dali/public-api/file.list @@ -37,10 +37,8 @@ SET( public_api_src_files ${public_api_src_dir}/events/touch-point.cpp ${public_api_src_dir}/events/touch-event.cpp ${public_api_src_dir}/events/touch-data.cpp - ${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/resource-image.cpp ${public_api_src_dir}/math/compile-time-math.cpp ${public_api_src_dir}/math/degree.cpp ${public_api_src_dir}/math/matrix.cpp @@ -158,11 +156,9 @@ SET( public_api_core_events_header_files SET( public_api_core_images_header_files - ${public_api_src_dir}/images/image.h ${public_api_src_dir}/images/image-operations.h ${public_api_src_dir}/images/pixel.h ${public_api_src_dir}/images/pixel-data.h - ${public_api_src_dir}/images/resource-image.h ${public_api_src_dir}/images/native-image-interface.h ) diff --git a/dali/public-api/images/image.cpp b/dali/public-api/images/image.cpp deleted file mode 100644 index e5888ba76..000000000 --- a/dali/public-api/images/image.cpp +++ /dev/null @@ -1,71 +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 - - -namespace Dali -{ - -Image::Image() -{ -} - -Image::Image(Internal::Image* internal) : BaseHandle(internal) -{ -} - -Image::~Image() -{ -} - -Image::Image(const Image& handle) -: BaseHandle(handle) -{ -} - -Image& Image::operator=(const Image& rhs) -{ - BaseHandle::operator=(rhs); - return *this; -} - -Image Image::DownCast( BaseHandle handle ) -{ - return Image( dynamic_cast(handle.GetObjectPtr()) ); -} - -uint32_t Image::GetWidth() const -{ - return GetImplementation(*this).GetWidth(); -} - -uint32_t Image::GetHeight() const -{ - return GetImplementation(*this).GetHeight(); -} - -Image::ImageSignalType& Image::UploadedSignal() -{ - return GetImplementation(*this).UploadedSignal(); -} - -} // namespace Dali diff --git a/dali/public-api/images/image.h b/dali/public-api/images/image.h deleted file mode 100644 index f226a648d..000000000 --- a/dali/public-api/images/image.h +++ /dev/null @@ -1,181 +0,0 @@ -#ifndef DALI_IMAGE_H -#define DALI_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. - * - */ - -// EXTERNAL INCLUDES -#include -#include // uint32_t - -// INTERNAL INCLUDES -#include -#include - -namespace Dali -{ -/** - * @addtogroup dali_core_images - * @{ - */ - -namespace Internal DALI_INTERNAL -{ -class Image; -} - -/** - * @DEPRECATED_1_2.41 - * - * @brief An Image object represents an image resource that can be used for rendering. - * - * Image objects can be shared between Actors. This is practical if you have a visual element on screen - * which is repeatedly used. - * - * The image resource is released as soon as the last Image handle is released. - * @SINCE_1_0.0 - * @note If a resource was shared between Image objects it exists until its last reference is gone. - * - * Image objects are responsible for the underlying resource's lifetime. - * - * Signals - * | %Signal Name | Method | - * |------------------------|------------------------------| - * | uploaded | @ref UploadedSignal() | - * @SINCE_1_0.0 - */ -class DALI_CORE_API Image : public BaseHandle -{ -public: - - /** - * @DEPRECATED_1_2.41 - * - * @brief Type of signal for Image Uploaded. - * @SINCE_1_0.0 - */ - typedef Signal< void (Image) > ImageSignalType; - -public: - - /** - * @DEPRECATED_1_2.41 - * - * @brief Constructor which creates an empty Image handle. - * - * This class has no New method. - * Use the appropriate New method of its subclasses to create an initialized handle. - * (Dali::BufferImage::New(), Dali::EncodedBufferImage::New(), Dali::FrameBufferImage::New(), - * Dali::NativeImage::New(), Dali::ResourceImage::New()). - * @SINCE_1_0.0 - */ - Image() 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 - */ - ~Image() 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 - */ - Image(const Image& 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 - */ - Image& operator=(const Image& rhs) DALI_DEPRECATED_API; - - /** - * @DEPRECATED_1_2.41 - * - * @brief Downcasts a handle to Image handle. - * - * If handle points to a Image 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 Image object or an uninitialized handle - */ - static Image DownCast( BaseHandle handle ) DALI_DEPRECATED_API; - - /** - * @DEPRECATED_1_2.41 - * - * @brief Returns the width of the image. - * - * Returns either the requested width or the actual loaded width if no specific size was requested. - * - * @SINCE_1_0.0 - * @return Width of the image in pixels - */ - uint32_t GetWidth() const DALI_DEPRECATED_API; - - /** - * @DEPRECATED_1_2.41 - * - * @brief Returns the height of the image. - * - * Returns either the requested height or the actual loaded height if no specific size was requested. - * - * @SINCE_1_0.0 - * @return Height of the image in pixels - */ - uint32_t GetHeight() const DALI_DEPRECATED_API; - -public: // Signals - - /** - * @DEPRECATED_1_2.41 - * - * @brief This signal is emitted when the image data gets uploaded to GL. - * - * It Will be sent after an actor using the image is added to - * the stage, when such a staged image is reloaded, or when a staged - * BufferImage calls Update(). - * @SINCE_1_0.0 - * @return A signal object to Connect() with - */ - ImageSignalType& UploadedSignal() DALI_DEPRECATED_API; - -public: // Not intended for application developers - - explicit DALI_INTERNAL Image(Internal::Image*); -}; - -/** - * @} - */ -} // namespace Dali - -#endif // DALI_IMAGE_H diff --git a/dali/public-api/images/resource-image.cpp b/dali/public-api/images/resource-image.cpp deleted file mode 100644 index c87cc0a4f..000000000 --- a/dali/public-api/images/resource-image.cpp +++ /dev/null @@ -1,103 +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 -#include -#include - -namespace Dali -{ - -ImageDimensions ResourceImage::GetImageSize( const std::string& url ) -{ - const Internal::ImageAttributes& attribs = Internal::ImageAttributes::DEFAULT_ATTRIBUTES; - const ImageDimensions desiredSize = ImageDimensions( attribs.GetWidth(), attribs.GetHeight() ); - const ImageDimensions size = Internal::ThreadLocalStorage::Get().GetPlatformAbstraction().GetClosestImageSize( url, desiredSize, attribs.GetScalingMode(), attribs.GetFilterMode(), attribs.GetOrientationCorrection() ); - return size; -} - -ResourceImage::ResourceImage() -{ -} - -ResourceImage::ResourceImage(Internal::ResourceImage* internal) : Image(internal) -{ -} - -ResourceImage::~ResourceImage() -{ -} - -ResourceImage::ResourceImage( const ResourceImage& handle ) -: Image(handle) -{ -} - -ResourceImage& ResourceImage::operator=( const ResourceImage& rhs ) -{ - BaseHandle::operator=(rhs); - return *this; -} - -ResourceImage ResourceImage::New( const std::string& url, bool orientationCorrection ) -{ - Internal::ImageAttributes attributes = Internal::ImageAttributes::DEFAULT_ATTRIBUTES; - attributes.SetOrientationCorrection( orientationCorrection ); - return ResourceImage( Internal::ResourceImage::New( url, attributes ).Get() ); -} - -ResourceImage ResourceImage::New( const std::string& url, ImageDimensions size, FittingMode::Type scalingMode, SamplingMode::Type samplingMode, bool orientationCorrection ) -{ - Internal::ImageAttributes attributes = Internal::ImageAttributes::DEFAULT_ATTRIBUTES; - attributes.SetSize( Size( size.GetWidth(), size.GetHeight() ) ); - attributes.SetScalingMode( scalingMode ); - attributes.SetFilterMode( samplingMode ); - attributes.SetOrientationCorrection( orientationCorrection ); - return ResourceImage( Internal::ResourceImage::New( url, attributes ).Get() ); -} - -ResourceImage ResourceImage::DownCast( BaseHandle handle ) -{ - return ResourceImage( dynamic_cast(handle.GetObjectPtr()) ); -} - -LoadingState ResourceImage::GetLoadingState() const -{ - return GetImplementation(*this).GetLoadingState(); -} - -std::string ResourceImage::GetUrl() const -{ - return GetImplementation(*this).GetUrl(); -} - -void ResourceImage::Reload() -{ - GetImplementation(*this).Reload(); -} - -ResourceImage::ResourceImageSignal& ResourceImage::LoadingFinishedSignal() -{ - return GetImplementation(*this).LoadingFinishedSignal(); -} - -} // namespace Dali diff --git a/dali/public-api/images/resource-image.h b/dali/public-api/images/resource-image.h deleted file mode 100644 index 35feec22c..000000000 --- a/dali/public-api/images/resource-image.h +++ /dev/null @@ -1,249 +0,0 @@ -#ifndef DALI_RESOURCE_IMAGE_H -#define DALI_RESOURCE_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. - * - */ - -// EXTERNAL INCLUDES -#include - -// INTERNAL INCLUDES -#include -#include -#include -#include - -namespace Dali -{ -/** - * @addtogroup dali_core_images - * @{ - */ - -namespace Internal DALI_INTERNAL -{ -class ResourceImage; -} - -/** - * @DEPRECATED_1_2.41 - * - * @brief ResourceImage is an image loaded using a URL. - * - * Customizing load requests - * - * Size, scaling mode, filter mode, and orientation compensation can be set when requesting an image. - * - * Reloading images - * - * The same request used on creating the ResourceImage is re-issued when reloading images. - * If the file changed since the last load operation, this might result in a different resource. - * Reload only takes effect if the ResourceImage has already finished loading. - * - * Signals - * | %Signal Name | Method | - * |----------------------|------------------------------| - * | imageLoadingFinished | @ref LoadingFinishedSignal() | - * @SINCE_1_0.0 - */ -class DALI_CORE_API ResourceImage : public Image -{ -public: - - /** - * @DEPRECATED_1_2.41 - * - * @brief Type of signal for LoadingFinished and Uploaded. - * @SINCE_1_0.0 - */ - typedef Signal< void (ResourceImage) > ResourceImageSignal; - -public: - - /** - * @DEPRECATED_1_2.41 - * - * @brief Gets the size of an image from disk. - * - * This function will read the header info from file on disk and is - * synchronous, so it should not be used repeatedly or in tight - * loops. - * - * @SINCE_1_0.0 - * @REMARK_STORAGE - * @param[in] url The URL of the image file - * @return The width and height in pixels of the image - */ - static ImageDimensions GetImageSize( const std::string& url ) DALI_DEPRECATED_API; - - /** - * @DEPRECATED_1_2.41 - * - * @brief Constructor which creates an empty ResourceImage object. - * - * Use ResourceImage::New(...) to create an initialised object. - * @SINCE_1_0.0 - */ - ResourceImage() 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 - */ - ~ResourceImage() 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 - */ - ResourceImage( const ResourceImage& 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 - */ - ResourceImage& operator=( const ResourceImage& rhs ) DALI_DEPRECATED_API; - - /** - * @name ResourceImageFactoryFunctions - * Creates ResourceImage object instances using these functions. - */ - ///@{ - - /** - * @DEPRECATED_1_2.41 - * - * @brief Creates an initialized ResourceImage object. - * - * Uses defaults for all options. - * - * @sa Dali::FittingMode::Type Dali::SamplingMode::Type - * @SINCE_1_0.0 - * @REMARK_INTERNET - * @REMARK_STORAGE - * @param[in] url The URL of the image file to use - * @param[in] orientationCorrection Reorient the image to respect any orientation metadata in its header - * @return A handle to a newly allocated object - */ - static ResourceImage New( const std::string& url, bool orientationCorrection = true ) DALI_DEPRECATED_API; - - /** - * @DEPRECATED_1_2.41 - * - * @brief Creates an initialized ResourceImage object. - * - * @SINCE_1_0.0 - * @REMARK_INTERNET - * @REMARK_STORAGE - * @param[in] url The URL of the image file to use - * @param[in] size The width and height to fit the loaded image to - * @param[in] fittingMode The method used to fit the shape of the image before loading to the shape defined by the size parameter - * @param[in] samplingMode The filtering method used when sampling pixels from the input image while fitting it to desired size - * @param[in] orientationCorrection Reorient the image to respect any orientation metadata in its header - * @return A handle to a newly allocated object - */ - static ResourceImage New( const std::string& url, - ImageDimensions size, - FittingMode::Type fittingMode = FittingMode::DEFAULT, - SamplingMode::Type samplingMode = SamplingMode::DEFAULT, - bool orientationCorrection = true ) DALI_DEPRECATED_API; - - ///@} - - /** - * @DEPRECATED_1_2.41 - * - * @brief Downcasts a handle to ResourceImage handle. - * - * If handle points to a ResourceImage 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 Image object or an uninitialized handle - */ - static ResourceImage DownCast( BaseHandle handle ) DALI_DEPRECATED_API; - - /** - * @DEPRECATED_1_2.41 - * - * @brief Queries whether the image data has loaded. - * - * The asynchronous loading begins when the Image object is created. - * After the Image object is discarded, the image data will be released from memory. - * @SINCE_1_0.0 - * @return The loading state, either Loading, Success or Failed - */ - LoadingState GetLoadingState() const DALI_DEPRECATED_API; - - /** - * @DEPRECATED_1_2.41 - * - * @brief Returns the URL of the image. - * - * @SINCE_1_0.0 - * @return The URL of the image file - */ - std::string GetUrl() const DALI_DEPRECATED_API; - - /** - * @DEPRECATED_1_2.41 - * - * @brief Reloads image from filesystem. - * - * The original set of image loading attributes (requested dimensions, scaling - * mode and filter mode) are used when requesting the image again. - * @SINCE_1_0.0 - * @note If image is offstage and OnDemand policy is set, the reload request is ignored. - */ - void Reload() DALI_DEPRECATED_API; - -public: // Signals - - /** - * @DEPRECATED_1_2.41 - * - * @brief Emitted when the image data loads successfully, or when the loading fails. - * - * @SINCE_1_0.0 - * @return A signal object to Connect() with - */ - ResourceImageSignal& LoadingFinishedSignal() DALI_DEPRECATED_API; - -public: // Not intended for application developers - - explicit DALI_INTERNAL ResourceImage( Internal::ResourceImage* ); -}; - -/** - * @} - */ -} // namespace Dali - -#endif // DALI_RESOURCE_IMAGE_H