From f9f901f8633426fa35c73876a838c9773e695c9d Mon Sep 17 00:00:00 2001 From: Adeel Kazmi Date: Tue, 9 Jun 2020 22:00:10 +0100 Subject: [PATCH] (AutomatedTests) Remove most BufferImage Usage Change-Id: I83bf923e1a85e917d34e8e28801dd7a90de89a98 --- .../utc-Dali-Internal-FrustumCulling.cpp | 9 ++--- .../dali/dali-test-suite-utils/mesh-builder.cpp | 9 ++++- .../src/dali/dali-test-suite-utils/mesh-builder.h | 3 +- .../dali-test-suite-utils/test-actor-utils.cpp | 38 ++++++++++++++++++++-- .../dali/dali-test-suite-utils/test-actor-utils.h | 19 ++++++++++- automated-tests/src/dali/utc-Dali-Actor.cpp | 12 +++---- automated-tests/src/dali/utc-Dali-CameraActor.cpp | 8 ++--- automated-tests/src/dali/utc-Dali-Context.cpp | 3 +- .../src/dali/utc-Dali-HitTestAlgorithm.cpp | 6 ++-- .../src/dali/utc-Dali-HoverProcessing.cpp | 6 ++-- automated-tests/src/dali/utc-Dali-Layer.cpp | 28 ++++------------ automated-tests/src/dali/utc-Dali-RenderTask.cpp | 27 +++++++-------- automated-tests/src/dali/utc-Dali-Renderer.cpp | 22 ++++++------- automated-tests/src/dali/utc-Dali-Sampler.cpp | 10 +++--- automated-tests/src/dali/utc-Dali-Scripting.cpp | 13 +------- automated-tests/src/dali/utc-Dali-TextureSet.cpp | 16 ++++----- .../src/dali/utc-Dali-TouchDataProcessing.cpp | 8 ++--- .../src/dali/utc-Dali-TouchProcessing.cpp | 10 +++--- 18 files changed, 140 insertions(+), 107 deletions(-) diff --git a/automated-tests/src/dali-internal/utc-Dali-Internal-FrustumCulling.cpp b/automated-tests/src/dali-internal/utc-Dali-Internal-FrustumCulling.cpp index 4054920..1d658f9 100644 --- a/automated-tests/src/dali-internal/utc-Dali-Internal-FrustumCulling.cpp +++ b/automated-tests/src/dali-internal/utc-Dali-Internal-FrustumCulling.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,7 +17,6 @@ // EXTERNAL INCLUDES #include -#include #include #include #include @@ -59,12 +58,14 @@ void main() Actor CreateMeshActorToStage( TestApplication& application, Vector3 parentOrigin = ParentOrigin::CENTER, Vector3 anchorPoint = AnchorPoint::CENTER, Shader::Hint::Value shaderHints = Shader::Hint::NONE ) { PixelBuffer* pixelBuffer = new PixelBuffer[ 4 ]; - BufferImage image = BufferImage::New( pixelBuffer, 1, 1 ); + PixelData pixelData = PixelData::New(pixelBuffer, 4, 1, 1, Pixel::RGBA8888, PixelData::DELETE_ARRAY); + Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1); + image.Upload(pixelData); Geometry geometry = CreateQuadGeometry(); Shader shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER, shaderHints ); TextureSet textureSet = TextureSet::New(); - TextureSetImage( textureSet, 0u, image ); + textureSet.SetTexture(0u, image); Renderer renderer = Renderer::New( geometry, shader ); renderer.SetTextures( textureSet ); 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 48bc26b..f8e3917 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -41,6 +41,13 @@ TextureSet CreateTextureSet( Image image ) return textureSet; } +TextureSet CreateTextureSet( Texture texture ) +{ + TextureSet textureSet = TextureSet::New(); + textureSet.SetTexture(0u, texture); + return textureSet; +} + PropertyBuffer CreatePropertyBuffer() { Property::Map texturedQuadVertexFormat; 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 d22f9c8..ea0b156 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 @@ -2,7 +2,7 @@ #define MESH_BUILDER_H /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -27,6 +27,7 @@ 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 4387ba7..32bccdd 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 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -57,7 +57,41 @@ const char* FRAGMENT_SHADER = DALI_COMPOSE_SHADER( Actor CreateRenderableActor() { - return CreateRenderableActor( Image(), VERTEX_SHADER, FRAGMENT_SHADER ); + return CreateRenderableActor( Texture(), VERTEX_SHADER, FRAGMENT_SHADER ); +} + +Actor CreateRenderableActor( Texture texture ) +{ + return CreateRenderableActor( texture, VERTEX_SHADER, FRAGMENT_SHADER ); +} + +Actor CreateRenderableActor( Texture 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(); + textureSet.SetTexture( 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; } Actor CreateRenderableActor( Image texture ) 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 a62dcca..8b8859f 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 @@ -2,7 +2,7 @@ #define DALI_TEST_ACTOR_UTILS_H /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ namespace Dali class Actor; class Image; +class Texture; /** * @brief Creates a simple renderable-actor with solid colored quad. @@ -49,6 +50,22 @@ Actor CreateRenderableActor( Image texture ); */ 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. + * @return An actor with a renderer. + */ +Actor CreateRenderableActor( Texture 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( Texture texture, const std::string& vertexShader, const std::string& fragmentShader ); + } // namespace Dali #endif // DALI_TEST_ACTOR_UTILS_H diff --git a/automated-tests/src/dali/utc-Dali-Actor.cpp b/automated-tests/src/dali/utc-Dali-Actor.cpp index 55f2ac1..bd23d7d 100644 --- a/automated-tests/src/dali/utc-Dali-Actor.cpp +++ b/automated-tests/src/dali/utc-Dali-Actor.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. @@ -2923,9 +2923,9 @@ int UtcDaliActorSetDrawModeOverlayRender(void) ids.push_back( 10 ); // third rendered actor app.GetGlAbstraction().SetNextTextureIds( ids ); - BufferImage imageA = BufferImage::New(16, 16); - BufferImage imageB = BufferImage::New(16, 16); - BufferImage imageC = BufferImage::New(16, 16); + Texture imageA = Texture::New(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 16, 16); + Texture imageB = Texture::New(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 16, 16); + Texture imageC = Texture::New(TextureType::TEXTURE_2D, Pixel::Format::RGBA8888, 16, 16); Actor a = CreateRenderableActor( imageA ); Actor b = CreateRenderableActor( imageB ); Actor c = CreateRenderableActor( imageC ); @@ -4031,7 +4031,7 @@ int UtcDaliActorRemoveRendererN(void) // Clipping test helper functions: Actor CreateActorWithContent( uint32_t width, uint32_t height) { - BufferImage image = BufferImage::New( width, height ); + Texture image = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, width, height ); Actor actor = CreateRenderableActor( image ); // Setup dimensions and position so actor is not skipped by culling. @@ -4339,7 +4339,7 @@ int UtcDaliActorPropertyClippingActorDrawOrder(void) Actor actors[5]; for( int i = 0; i < 5; ++i ) { - BufferImage image = BufferImage::New( 16u, 16u ); + Texture image = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 16u, 16u ); Actor actor = CreateRenderableActor( image ); // Setup dimensions and position so actor is not skipped by culling. diff --git a/automated-tests/src/dali/utc-Dali-CameraActor.cpp b/automated-tests/src/dali/utc-Dali-CameraActor.cpp index 5767315..8368590 100644 --- a/automated-tests/src/dali/utc-Dali-CameraActor.cpp +++ b/automated-tests/src/dali/utc-Dali-CameraActor.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. @@ -1462,9 +1462,7 @@ int UtcDaliCameraActorModelView(void) TestApplication application; tet_infoline( "Testing Dali::CameraActor Test view application" ); - BufferImage image = CreateBufferImage(); - - Actor actor = CreateRenderableActor(image); + Actor actor = CreateRenderableActor(); actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); actor.SetProperty( Actor::Property::POSITION, Vector3( 20.0f, 30.0f, 40.0f )); actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); @@ -1499,7 +1497,7 @@ int UtcDaliCameraActorReadProjectionMatrix(void) application.Render( 0 ); application.Render(); application.SendNotification(); - Image image = CreateBufferImage(); + Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 4u, 4u); Actor actor = CreateRenderableActor( image, RENDER_SHADOW_VERTEX_SOURCE, RENDER_SHADOW_FRAGMENT_SOURCE ); actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); Stage::GetCurrent().Add( actor ); diff --git a/automated-tests/src/dali/utc-Dali-Context.cpp b/automated-tests/src/dali/utc-Dali-Context.cpp index b76be32..fd63707 100644 --- a/automated-tests/src/dali/utc-Dali-Context.cpp +++ b/automated-tests/src/dali/utc-Dali-Context.cpp @@ -45,8 +45,7 @@ enum TestAttribType // Create bitmap actor static Actor CreateBitmapActor() { - BufferImage image = BufferImage::New(4,4,Pixel::RGBA8888); - Actor actor = CreateRenderableActor( image ); + Actor actor = CreateRenderableActor(); actor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); actor.SetProperty( Actor::Property::NAME,"Test Image Rendering Actor"); return actor; diff --git a/automated-tests/src/dali/utc-Dali-HitTestAlgorithm.cpp b/automated-tests/src/dali/utc-Dali-HitTestAlgorithm.cpp index c948356..c178d40 100644 --- a/automated-tests/src/dali/utc-Dali-HitTestAlgorithm.cpp +++ b/automated-tests/src/dali/utc-Dali-HitTestAlgorithm.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -288,7 +288,7 @@ int UtcDaliHitTestAlgorithmClippingActor(void) stage.Add( layer ); // Create a clipping actor and add it to the layer. - Actor clippingActor = CreateRenderableActor( Dali::BufferImage::WHITE() ); + Actor clippingActor = CreateRenderableActor(); clippingActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); clippingActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); clippingActor.SetProperty( Actor::Property::SIZE, Vector2( 50.0f, 50.0f ) ); @@ -297,7 +297,7 @@ int UtcDaliHitTestAlgorithmClippingActor(void) layer.Add( clippingActor ); // Create a renderable actor and add it to the clipping actor. - Actor childActor = CreateRenderableActor( Dali::BufferImage::WHITE() ); + Actor childActor = CreateRenderableActor(); childActor.SetProperty( Actor::Property::SIZE, Vector2( 100.0f, 100.0f ) ); childActor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::TOP_LEFT ); childActor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::TOP_LEFT ); diff --git a/automated-tests/src/dali/utc-Dali-HoverProcessing.cpp b/automated-tests/src/dali/utc-Dali-HoverProcessing.cpp index fb3e839..cd35e20 100644 --- a/automated-tests/src/dali/utc-Dali-HoverProcessing.cpp +++ b/automated-tests/src/dali/utc-Dali-HoverProcessing.cpp @@ -960,10 +960,10 @@ int UtcDaliHoverOffscreenRenderTasks(void) Vector2 stageSize ( stage.GetSize() ); // FrameBufferImage for offscreen RenderTask - FrameBufferImage frameBufferImage( FrameBufferImage::New( stageSize.width, stageSize.height, Pixel::RGBA8888 ) ); + FrameBuffer frameBuffer = FrameBuffer::New( stageSize.width, stageSize.height ); // Create a renderable actor to display the FrameBufferImage - Actor renderableActor = CreateRenderableActor( frameBufferImage ); + Actor renderableActor = CreateRenderableActor(frameBuffer.GetColorTexture()); renderableActor.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER); renderableActor.SetProperty( Actor::Property::SIZE, Vector2( stageSize.x, stageSize.y ) ); renderableActor.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // FIXME @@ -980,7 +980,7 @@ int UtcDaliHoverOffscreenRenderTasks(void) // Create a RenderTask RenderTask renderTask = stage.GetRenderTaskList().CreateTask(); renderTask.SetSourceActor( actor ); - renderTask.SetTargetFrameBuffer( frameBufferImage ); + renderTask.SetFrameBuffer(frameBuffer); renderTask.SetInputEnabled( true ); // Create another RenderTask diff --git a/automated-tests/src/dali/utc-Dali-Layer.cpp b/automated-tests/src/dali/utc-Dali-Layer.cpp index f71b499..90f11e1 100644 --- a/automated-tests/src/dali/utc-Dali-Layer.cpp +++ b/automated-tests/src/dali/utc-Dali-Layer.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 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. @@ -260,10 +260,10 @@ int UtcDaliLayerSetSortFunction(void) { tet_infoline("Testing Dali::Layer::SetSortFunction()"); TestApplication application; - BufferImage img = BufferImage::New( 1,1 ); + // create two transparent actors so there is something to sort - Actor actor = CreateRenderableActor( img ); - Actor actor2 = CreateRenderableActor( img ); + Actor actor = CreateRenderableActor(); + Actor actor2 = CreateRenderableActor(); actor.SetProperty( Actor::Property::SIZE, Vector2( 1, 1 ) ); actor.SetProperty( Actor::Property::COLOR, Vector4(1, 1, 1, 0.5f ) ); // 50% transparent actor2.SetProperty( Actor::Property::SIZE, Vector2( 1, 1 ) ); @@ -564,7 +564,7 @@ int UtcDaliLayerClippingGLCalls(void) layer.SetClippingBox( testBox ); // Add at least one renderable actor so the GL calls are actually made - BufferImage img = BufferImage::New( 1,1 ); + Texture img = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1 ); Actor actor = CreateRenderableActor( img ); stage.Add( actor ); @@ -592,23 +592,9 @@ int UtcDaliLayerBehaviour(void) Actor CreateActor( bool withAlpha ) { - Dali::BufferImage bufferImage; - - if( withAlpha ) - { - bufferImage = Dali::BufferImage::WHITE(); - } - else - { - bufferImage = BufferImage::New( 1u, 1u, Pixel::RGB888 ); - PixelBuffer* pBuffer = bufferImage.GetBuffer(); - if( pBuffer ) - { - pBuffer[0] = pBuffer[1] = pBuffer[2] = 0xFF; - } - } + Texture texture = Texture::New(TextureType::TEXTURE_2D, withAlpha ? Pixel::Format::RGBA8888 : Pixel::Format::RGB888, 1u, 1u ); - Actor actor = CreateRenderableActor( bufferImage ); + Actor actor = CreateRenderableActor( texture ); actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER ); actor.SetProperty( Actor::Property::ANCHOR_POINT, AnchorPoint::CENTER ); diff --git a/automated-tests/src/dali/utc-Dali-RenderTask.cpp b/automated-tests/src/dali/utc-Dali-RenderTask.cpp index ea71224..40b7800 100644 --- a/automated-tests/src/dali/utc-Dali-RenderTask.cpp +++ b/automated-tests/src/dali/utc-Dali-RenderTask.cpp @@ -361,7 +361,7 @@ int UtcDaliRenderTaskSetSourceActorP01(void) Actor actor = task.GetSourceActor(); DALI_TEST_CHECK( actor ); - BufferImage img = BufferImage::New( 1,1 ); + Texture img = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1 ); Actor newActor = CreateRenderableActor( img ); newActor.SetProperty( Actor::Property::SIZE, Vector2( 1.0f, 1.0f ) ); stage.Add( newActor ); @@ -407,7 +407,7 @@ int UtcDaliRenderTaskSetSourceActorP02(void) DALI_TEST_CHECK( actor ); - BufferImage img = BufferImage::New( 1,1 ); + Texture img = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1 ); Actor newActor = CreateRenderableActor( img ); newActor.SetProperty( Actor::Property::SIZE, Vector2( 1.0f, 1.0f ) ); stage.Add( newActor ); @@ -466,7 +466,7 @@ int UtcDaliRenderTaskSetSourceActorOffStage(void) TraceCallStack& drawTrace = gl.GetDrawTrace(); drawTrace.Enable(true); - BufferImage img = BufferImage::New( 1,1 ); + Texture img = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1 ); Actor newActor = CreateRenderableActor( img ); newActor.SetProperty( Actor::Property::SIZE, Vector2( 1.0f, 1.0f ) ); task.SetSourceActor( newActor ); @@ -515,7 +515,7 @@ int UtcDaliRenderTaskSetSourceActorEmpty(void) Actor actor = task.GetSourceActor(); DALI_TEST_CHECK( actor ); - BufferImage img = BufferImage::New( 1,1 ); + Texture img = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1 ); Actor newActor = CreateRenderableActor( img ); newActor.SetProperty( Actor::Property::SIZE, Vector2( 1.0f, 1.0f ) ); stage.Add( newActor ); @@ -565,7 +565,8 @@ int UtcDaliRenderTaskSetSourceActorDestroyed(void) Actor actor = task.GetSourceActor(); DALI_TEST_CHECK( actor ); - BufferImage img = BufferImage::New( 1,1 ); + Texture img = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1 ); + Actor newActor = CreateRenderableActor( img ); newActor.SetProperty( Actor::Property::SIZE, Vector2( 1.0f, 1.0f ) ); stage.Add( newActor ); @@ -659,7 +660,7 @@ int UtcDaliRenderTaskSetExclusive(void) ids.push_back( 10 ); // 10 = actor3 application.GetGlAbstraction().SetNextTextureIds( ids ); - BufferImage img1 = BufferImage::New( 1,1 ); + Texture img1 = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1 ); Actor actor1 = CreateRenderableActor( img1 ); actor1.SetProperty( Actor::Property::SIZE, Vector2( 1.0f, 1.0f ) ); Stage::GetCurrent().Add( actor1 ); @@ -682,7 +683,8 @@ int UtcDaliRenderTaskSetExclusive(void) } } - BufferImage img2 = BufferImage::New( 1,1 ); + Texture img2 = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1 ); + Actor actor2 = CreateRenderableActor( img2 ); actor2.SetProperty( Actor::Property::SIZE, Vector2( 1.0f, 1.0f ) ); @@ -711,7 +713,7 @@ int UtcDaliRenderTaskSetExclusive(void) DALI_TEST_EQUALS( boundTextures[c++], 8u/*unique to actor1*/, TEST_LOCATION ); } - BufferImage img3 = BufferImage::New( 1,1 ); + Texture img3 = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1 ); Actor actor3 = CreateRenderableActor( img3 ); actor3.SetProperty( Actor::Property::SIZE, Vector2( 1.0f, 1.0f ) ); @@ -811,7 +813,7 @@ int UtcDaliRenderTaskSetExclusive02(void) ids.push_back( 8 ); // 8 = actor1 application.GetGlAbstraction().SetNextTextureIds( ids ); - BufferImage img1 = BufferImage::New( 1,1 ); + Texture img1 = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 1, 1 ); Actor actor1 = CreateRenderableActor( img1 ); actor1.SetProperty( Actor::Property::SIZE, Vector2( 1.0f, 1.0f ) ); Stage::GetCurrent().Add( actor1 ); @@ -1881,8 +1883,7 @@ int UtcDaliRenderTaskSignalFinished(void) Stage::GetCurrent().Add( offscreenCameraActor ); - BufferImage image = BufferImage::New( 10, 10 ); - image.Update(); + Texture image = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 10, 10 ); Actor rootActor = CreateRenderableActor( image ); rootActor.SetProperty( Actor::Property::SIZE, Vector2( 10.0f, 10.0f ) ); Stage::GetCurrent().Add( rootActor ); @@ -2555,7 +2556,7 @@ int UtcDaliRenderTaskFinishInvisibleSourceActor(void) Stage::GetCurrent().Add( offscreenCameraActor ); - BufferImage image = BufferImage::New( 10, 10 ); + Texture image = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 10, 10 ); Actor rootActor = CreateRenderableActor( image ); rootActor.SetProperty( Actor::Property::SIZE, Vector2( 10.0f, 10.0f ) ); rootActor.SetProperty( Actor::Property::VISIBLE,false); @@ -2636,7 +2637,7 @@ int UtcDaliRenderTaskFinishMissingImage(void) Stage stage = Stage::GetCurrent(); - BufferImage image = BufferImage::New( 10, 10 ); + Texture image = Texture::New( TextureType::TEXTURE_2D, Pixel::RGBA8888, 10, 10 ); Actor rootActor = CreateRenderableActor( image ); rootActor.SetProperty( Actor::Property::SIZE, Vector2( 10.0f, 10.0f ) ); stage.Add( rootActor ); diff --git a/automated-tests/src/dali/utc-Dali-Renderer.cpp b/automated-tests/src/dali/utc-Dali-Renderer.cpp index 3d70c11..b948e89 100644 --- a/automated-tests/src/dali/utc-Dali-Renderer.cpp +++ b/automated-tests/src/dali/utc-Dali-Renderer.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. @@ -837,7 +837,7 @@ int UtcDaliRendererSetBlendMode05(void) tet_infoline("Test setting the blend mode to auto with an opaque color and an image with an alpha channel renders with blending enabled"); Geometry geometry = CreateQuadGeometry(); - BufferImage image = BufferImage::New( 40, 40, Pixel::RGBA8888 ); + Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 40, 40); Shader shader = CreateShader(); TextureSet textureSet = CreateTextureSet( image ); @@ -904,7 +904,7 @@ int UtcDaliRendererSetBlendMode07(void) Geometry geometry = CreateQuadGeometry(); Shader shader = Shader::New( "vertexSrc", "fragmentSrc" ); - BufferImage image = BufferImage::New( 50, 50, Pixel::RGB888 ); + Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGB888, 50, 50); TextureSet textureSet = CreateTextureSet( image ); Renderer renderer = Renderer::New( geometry, shader ); renderer.SetTextures( textureSet ); @@ -964,8 +964,8 @@ int UtcDaliRendererSetBlendColor(void) Geometry geometry = CreateQuadGeometry(); Shader shader = Shader::New( "vertexSrc", "fragmentSrc" ); TextureSet textureSet = TextureSet::New(); - BufferImage image = BufferImage::New( 50, 50, Pixel::RGBA8888 ); - TextureSetImage( textureSet, 0u, image ); + Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 50, 50); + textureSet.SetTexture(0u, image); Renderer renderer = Renderer::New( geometry, shader ); renderer.SetTextures( textureSet ); @@ -1319,7 +1319,7 @@ int UtcDaliRendererUniformMapPrecendence01(void) tet_infoline("Test the uniform map precedence is applied properly"); - Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 ); + Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64); Shader shader = Shader::New("VertexSource", "FragmentSource"); TextureSet textureSet = CreateTextureSet( image ); @@ -1376,7 +1376,7 @@ int UtcDaliRendererUniformMapPrecendence02(void) tet_infoline("Test the uniform map precedence is applied properly"); - Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 ); + Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64); Shader shader = Shader::New("VertexSource", "FragmentSource"); TextureSet textureSet = CreateTextureSet( image ); @@ -1434,7 +1434,7 @@ int UtcDaliRendererUniformMapPrecendence03(void) tet_infoline("Test the uniform map precedence is applied properly"); - Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 ); + Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64); Shader shader = Shader::New("VertexSource", "FragmentSource"); TextureSet textureSet = CreateTextureSet( image ); @@ -1472,7 +1472,7 @@ int UtcDaliRendererUniformMapMultipleUniforms01(void) tet_infoline("Test the uniform maps are collected from all objects (same type)"); - Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 ); + Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64); Shader shader = Shader::New("VertexSource", "FragmentSource"); TextureSet textureSet = CreateTextureSet( image ); @@ -1519,7 +1519,7 @@ int UtcDaliRendererUniformMapMultipleUniforms02(void) tet_infoline("Test the uniform maps are collected from all objects (different types)"); - Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 ); + Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64); Shader shader = Shader::New("VertexSource", "FragmentSource"); TextureSet textureSet = CreateTextureSet( image ); @@ -1568,7 +1568,7 @@ int UtcDaliRendererUniformMapMultipleUniforms02(void) Renderer CreateRenderer( Actor actor, Geometry geometry, Shader shader, int depthIndex ) { - Image image0 = BufferImage::New( 64, 64, Pixel::RGB888 ); + Texture image0 = Texture::New(TextureType::TEXTURE_2D, Pixel::RGB888, 64, 64); TextureSet textureSet0 = CreateTextureSet( image0 ); Renderer renderer0 = Renderer::New( geometry, shader ); renderer0.SetTextures( textureSet0 ); diff --git a/automated-tests/src/dali/utc-Dali-Sampler.cpp b/automated-tests/src/dali/utc-Dali-Sampler.cpp index b8797b3..d1c1d10 100644 --- a/automated-tests/src/dali/utc-Dali-Sampler.cpp +++ b/automated-tests/src/dali/utc-Dali-Sampler.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -120,11 +120,11 @@ int UtcSamplerSetFilterMode(void) { TestApplication application; - Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 ); + Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64); Sampler sampler = Sampler::New(); TextureSet textureSet = CreateTextureSet(); - TextureSetImage( textureSet, 0u, image ); + textureSet.SetTexture(0u, image); textureSet.SetSampler( 0u, sampler ); Shader shader = CreateShader(); @@ -251,10 +251,10 @@ int UtcSamplerSetWrapMode1(void) { TestApplication application; - Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 ); + Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64); TextureSet textureSet = CreateTextureSet(); Sampler sampler = Sampler::New(); - TextureSetImage( textureSet, 0u, image ); + textureSet.SetTexture(0u, image); textureSet.SetSampler( 0u, sampler ); Shader shader = CreateShader(); diff --git a/automated-tests/src/dali/utc-Dali-Scripting.cpp b/automated-tests/src/dali/utc-Dali-Scripting.cpp index a911567..1b895cd 100644 --- a/automated-tests/src/dali/utc-Dali-Scripting.cpp +++ b/automated-tests/src/dali/utc-Dali-Scripting.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. @@ -793,17 +793,6 @@ int UtcDaliScriptingCreatePropertyMapImage(void) DALI_TEST_EQUALS( map.Find( "height" )->Get< int >(), 400, TEST_LOCATION ); } - // BufferImage - { - Image image = BufferImage::New( 200, 300, Pixel::A8 ); - Property::Map map; - CreatePropertyMap( image, map ); - DALI_TEST_CHECK( NULL != map.Find( "type" ) ); - DALI_TEST_EQUALS( map.Find( "type" )->Get< std::string >(), "BufferImage", TEST_LOCATION ); - DALI_TEST_CHECK( NULL != map.Find( "pixelFormat") ); - DALI_TEST_EQUALS( map.Find( "pixelFormat" )->Get< std::string >(), "A8", TEST_LOCATION ); - } - // FrameBufferImage { Image image = FrameBufferImage::New( 200, 300, Pixel::RGBA8888 ); diff --git a/automated-tests/src/dali/utc-Dali-TextureSet.cpp b/automated-tests/src/dali/utc-Dali-TextureSet.cpp index e0af59b..56a164d 100644 --- a/automated-tests/src/dali/utc-Dali-TextureSet.cpp +++ b/automated-tests/src/dali/utc-Dali-TextureSet.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -96,9 +96,9 @@ int UtcDaliTextureSetCopyConstructor(void) { TestApplication application; - Image image = BufferImage::New(32, 32, Pixel::RGBA8888); + Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 32, 32); TextureSet textureSet = TextureSet::New(); - TextureSetImage( textureSet, 0u, image ); + textureSet.SetTexture( 0u, image ); TextureSet textureSetCopy(textureSet); @@ -242,7 +242,7 @@ int UtcDaliTextureSetSetSampler(void) { TestApplication application; - Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 ); + Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64); Shader shader = CreateShader(); TextureSet textureSet = CreateTextureSet( image ); @@ -378,11 +378,11 @@ int UtcDaliTextureSetGetTextureCount0(void) TextureSet textureSet = CreateTextureSet(); DALI_TEST_EQUALS( textureSet.GetTextureCount(), 0u, TEST_LOCATION ); - Image image = BufferImage::New( 64, 64, Pixel::RGBA8888 ); - TextureSetImage( textureSet, 0u, image ); + Texture image = Texture::New(TextureType::TEXTURE_2D, Pixel::RGBA8888, 64, 64); + textureSet.SetTexture( 0u, image ); DALI_TEST_EQUALS( textureSet.GetTextureCount(), 1u, TEST_LOCATION ); - TextureSetImage( textureSet, 1u, image ); + textureSet.SetTexture( 1u, image ); DALI_TEST_EQUALS( textureSet.GetTextureCount(), 2u, TEST_LOCATION ); Sampler sampler = Sampler::New(); @@ -390,7 +390,7 @@ int UtcDaliTextureSetGetTextureCount0(void) textureSet.SetSampler( 2u, sampler ); DALI_TEST_EQUALS( textureSet.GetTextureCount(), 2u, TEST_LOCATION ); - TextureSetImage( textureSet, 2u, image ); + textureSet.SetTexture( 2u, image ); DALI_TEST_EQUALS( textureSet.GetTextureCount(), 3u, TEST_LOCATION ); DALI_TEST_EQUALS( textureSet.GetSampler(2u), sampler, TEST_LOCATION ); diff --git a/automated-tests/src/dali/utc-Dali-TouchDataProcessing.cpp b/automated-tests/src/dali/utc-Dali-TouchDataProcessing.cpp index 76cb868..5471181 100755 --- a/automated-tests/src/dali/utc-Dali-TouchDataProcessing.cpp +++ b/automated-tests/src/dali/utc-Dali-TouchDataProcessing.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 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. @@ -1192,10 +1192,10 @@ int UtcDaliTouchDataOffscreenRenderTasks(void) Vector2 stageSize ( stage.GetSize() ); // FrameBufferImage for offscreen RenderTask - FrameBufferImage frameBufferImage( FrameBufferImage::New( stageSize.width, stageSize.height, Pixel::RGBA8888 ) ); + FrameBuffer frameBuffer = FrameBuffer::New(stageSize.width, stageSize.height); // Create a renderable actor to display the FrameBufferImage - Actor renderableActor = CreateRenderableActor( frameBufferImage ); + Actor renderableActor = CreateRenderableActor(frameBuffer.GetColorTexture()); renderableActor.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER); renderableActor.SetProperty( Actor::Property::SIZE, Vector2( stageSize.x, stageSize.y ) ); renderableActor.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // FIXME @@ -1212,7 +1212,7 @@ int UtcDaliTouchDataOffscreenRenderTasks(void) // Create a RenderTask RenderTask renderTask = stage.GetRenderTaskList().CreateTask(); renderTask.SetSourceActor( actor ); - renderTask.SetTargetFrameBuffer( frameBufferImage ); + renderTask.SetFrameBuffer(frameBuffer); renderTask.SetInputEnabled( true ); // Create another RenderTask diff --git a/automated-tests/src/dali/utc-Dali-TouchProcessing.cpp b/automated-tests/src/dali/utc-Dali-TouchProcessing.cpp index 89eff0e..2bc6636 100755 --- a/automated-tests/src/dali/utc-Dali-TouchProcessing.cpp +++ b/automated-tests/src/dali/utc-Dali-TouchProcessing.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. @@ -960,11 +960,11 @@ int UtcDaliTouchOffscreenRenderTasks(void) Stage stage ( Stage::GetCurrent() ); Vector2 stageSize ( stage.GetSize() ); - // FrameBufferImage for offscreen RenderTask - FrameBufferImage frameBufferImage( FrameBufferImage::New( stageSize.width, stageSize.height, Pixel::RGBA8888 ) ); + // FrameBuffer for offscreen RenderTask + FrameBuffer frameBuffer = FrameBuffer::New( stageSize.width, stageSize.height ); // Create a renderable actor to display the FrameBufferImage - Actor renderableActor = CreateRenderableActor( frameBufferImage ); + Actor renderableActor = CreateRenderableActor(frameBuffer.GetColorTexture()); renderableActor.SetProperty( Actor::Property::PARENT_ORIGIN,ParentOrigin::CENTER); renderableActor.SetProperty( Actor::Property::SIZE, Vector2( stageSize.x, stageSize.y ) ); renderableActor.ScaleBy( Vector3(1.0f, -1.0f, 1.0f) ); // FIXME @@ -981,7 +981,7 @@ int UtcDaliTouchOffscreenRenderTasks(void) // Create a RenderTask RenderTask renderTask = stage.GetRenderTaskList().CreateTask(); renderTask.SetSourceActor( actor ); - renderTask.SetTargetFrameBuffer( frameBufferImage ); + renderTask.SetFrameBuffer( frameBuffer ); renderTask.SetInputEnabled( true ); // Create another RenderTask -- 2.7.4