From 89fde9f1e91910fb1bc7963519158459690b2dcf Mon Sep 17 00:00:00 2001 From: Yoonsang Lee Date: Mon, 11 May 2015 21:23:49 +0900 Subject: [PATCH] Reduce ImageActor & RenderableActor APIs - Remove ImageActor::IsPixelAreaSet(), ClearPixelArea() - Remove RenderableActor::SetBlendFunc(), SetBlendEquation(), GetBlendEquation(), SetBlendColor(), GetBlendColor() Change-Id: I979f8c2ddf3af0716844568d62cc7caf9eb07433 --- automated-tests/src/dali/utc-Dali-ImageActor.cpp | 31 +-------- .../src/dali/utc-Dali-RenderableActor.cpp | 79 +--------------------- dali/public-api/actors/image-actor.cpp | 10 --- dali/public-api/actors/image-actor.h | 17 ----- dali/public-api/actors/renderable-actor.cpp | 30 -------- dali/public-api/actors/renderable-actor.h | 54 --------------- 6 files changed, 4 insertions(+), 217 deletions(-) diff --git a/automated-tests/src/dali/utc-Dali-ImageActor.cpp b/automated-tests/src/dali/utc-Dali-ImageActor.cpp index 95b5d9a..c344af0 100644 --- a/automated-tests/src/dali/utc-Dali-ImageActor.cpp +++ b/automated-tests/src/dali/utc-Dali-ImageActor.cpp @@ -153,20 +153,15 @@ int UtcDaliImageActorPixelArea(void) BufferImage img = BufferImage::New( 10, 10 ); ImageActor actor = ImageActor::New( img ); - DALI_TEST_CHECK( actor.IsPixelAreaSet() == false ); - ImageActor::PixelArea area( 1, 2, 3, 4 ); actor.SetPixelArea( area ); - DALI_TEST_CHECK( actor.IsPixelAreaSet() == true ); - DALI_TEST_EQUALS( 1, actor.GetPixelArea().x, TEST_LOCATION ); DALI_TEST_EQUALS( 2, actor.GetPixelArea().y, TEST_LOCATION ); DALI_TEST_EQUALS( 3, actor.GetPixelArea().width, TEST_LOCATION ); DALI_TEST_EQUALS( 4, actor.GetPixelArea().height, TEST_LOCATION ); ImageActor actor2 = ImageActor::New( img, ImageActor::PixelArea( 5, 6, 7, 8 ) ); - DALI_TEST_CHECK( actor2.IsPixelAreaSet() == true ); DALI_TEST_EQUALS( 5, actor2.GetPixelArea().x, TEST_LOCATION ); DALI_TEST_EQUALS( 6, actor2.GetPixelArea().y, TEST_LOCATION ); @@ -524,7 +519,7 @@ int UtcDaliImageActorNaturalPixelAreaSize01(void) DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), Vector2(100, 100), TEST_LOCATION ); // Clear the pixel area. Expect the whole image to be shown, filling the set size. - actor.ClearPixelArea(); + actor.SetPixelArea( ImageActor::PixelArea( 0, 0, image.GetWidth(), image.GetHeight()) ); application.SendNotification(); // Process event messages application.Render(); // Process LoadComplete DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), Vector2(100, 100), TEST_LOCATION ); @@ -578,7 +573,7 @@ int UtcDaliImageActorNaturalPixelAreaSize02(void) DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), Vector2(30, 30), TEST_LOCATION ); // Clear the pixel area. Expect the whole image to be shown, changing actor size - actor.ClearPixelArea(); + actor.SetPixelArea( ImageActor::PixelArea( 0, 0, image.GetWidth(), image.GetHeight()) ); application.SendNotification(); // Process event messages application.Render(); // Process LoadComplete DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), requestedSize, TEST_LOCATION ); @@ -597,7 +592,7 @@ int UtcDaliImageActorNaturalPixelAreaSize02(void) // Clearing pixel area should change actor size to image size actor.SetResizePolicy( ResizePolicy::USE_NATURAL_SIZE, Dimension::ALL_DIMENSIONS ); - actor.ClearPixelArea(); + actor.SetPixelArea( ImageActor::PixelArea( 0, 0, image.GetWidth(), image.GetHeight()) ); application.SendNotification(); // Process event messages application.Render(); // Process LoadComplete DALI_TEST_EQUALS( Vector2(actor.GetCurrentSize()), requestedSize, TEST_LOCATION ); @@ -768,26 +763,6 @@ int UtcDaliImageActorUseImageAlpha05(void) END_TEST; } -int UtcDaliImageActorClearPixelArea(void) -{ - TestApplication application; - - BufferImage img = BufferImage::New( 10, 10 ); - ImageActor actor = ImageActor::New( img ); - - DALI_TEST_CHECK( actor.IsPixelAreaSet() == false ); - - ImageActor::PixelArea area( 1, 2, 3, 4 ); - actor.SetPixelArea( area ); - - DALI_TEST_CHECK( actor.IsPixelAreaSet() == true ); - - actor.ClearPixelArea(); - - DALI_TEST_CHECK( actor.IsPixelAreaSet() == false ); - END_TEST; -} - int UtcDaliImageGetStyle(void) { TestApplication application; diff --git a/automated-tests/src/dali/utc-Dali-RenderableActor.cpp b/automated-tests/src/dali/utc-Dali-RenderableActor.cpp index a08e032..bb1e4db 100644 --- a/automated-tests/src/dali/utc-Dali-RenderableActor.cpp +++ b/automated-tests/src/dali/utc-Dali-RenderableActor.cpp @@ -336,7 +336,7 @@ int UtcDaliRenderableActorSetGetBlendFunc(void) } // Set to non-default values - actor.SetBlendFunc( BlendingFactor::ONE_MINUS_SRC_COLOR, BlendingFactor::SRC_ALPHA_SATURATE ); + actor.SetBlendFunc( BlendingFactor::ONE_MINUS_SRC_COLOR, BlendingFactor::SRC_ALPHA_SATURATE, BlendingFactor::ONE_MINUS_SRC_COLOR, BlendingFactor::SRC_ALPHA_SATURATE ); // Test that Set was successful { @@ -386,83 +386,6 @@ int UtcDaliRenderableActorSetGetBlendFunc(void) END_TEST; } -int UtcDaliRenderableActorSetGetBlendEquation(void) -{ - TestApplication application; - TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - - tet_infoline("Testing Dali::RenderableActor::SetBlendEquation()"); - - BufferImage img = BufferImage::New( 1,1 ); - ImageActor actor = ImageActor::New( img ); - Stage::GetCurrent().Add( actor ); - application.SendNotification(); - application.Render(); - - // Test the defaults as documented int blending.h - { - BlendingEquation::Type equationRgb( BlendingEquation::SUBTRACT ); - BlendingEquation::Type equationAlpha( BlendingEquation::SUBTRACT ); - actor.GetBlendEquation( equationRgb, equationAlpha ); - DALI_TEST_EQUALS( BlendingEquation::ADD, equationRgb, TEST_LOCATION ); - DALI_TEST_EQUALS( BlendingEquation::ADD, equationAlpha, TEST_LOCATION ); - } - - // Test the single blending equation setting - { - actor.SetBlendEquation( BlendingEquation::REVERSE_SUBTRACT ); - BlendingEquation::Type equationRgba( BlendingEquation::SUBTRACT ); - actor.GetBlendEquation( equationRgba, equationRgba ); - DALI_TEST_EQUALS( BlendingEquation::REVERSE_SUBTRACT, equationRgba, TEST_LOCATION ); - } - - actor.SetBlendEquation( BlendingEquation::REVERSE_SUBTRACT, BlendingEquation::REVERSE_SUBTRACT ); - - // Test that Set was successful - { - BlendingEquation::Type equationRgb( BlendingEquation::SUBTRACT ); - BlendingEquation::Type equationAlpha( BlendingEquation::SUBTRACT ); - actor.GetBlendEquation( equationRgb, equationAlpha ); - DALI_TEST_EQUALS( BlendingEquation::REVERSE_SUBTRACT, equationRgb, TEST_LOCATION ); - DALI_TEST_EQUALS( BlendingEquation::REVERSE_SUBTRACT, equationAlpha, TEST_LOCATION ); - } - - // Render & check GL commands - application.SendNotification(); - application.Render(); - DALI_TEST_EQUALS( (GLenum)GL_FUNC_REVERSE_SUBTRACT, glAbstraction.GetLastBlendEquationRgb(), TEST_LOCATION ); - DALI_TEST_EQUALS( (GLenum)GL_FUNC_REVERSE_SUBTRACT, glAbstraction.GetLastBlendEquationAlpha(), TEST_LOCATION ); - END_TEST; -} - -int UtcDaliRenderableActorSetGetBlendColor(void) -{ - TestApplication application; - TestGlAbstraction& glAbstraction = application.GetGlAbstraction(); - - tet_infoline("Testing Dali::RenderableActor::SetBlendColor()"); - - BufferImage img = BufferImage::New( 1,1 ); - ImageActor actor = ImageActor::New( img ); - Stage::GetCurrent().Add( actor ); - application.SendNotification(); - application.Render(); - - // Test the defaults as documented int blending.h - DALI_TEST_EQUALS( Vector4::ZERO, actor.GetBlendColor(), TEST_LOCATION ); - - actor.SetBlendColor( Color::RED ); - - // Test that Set was successful - DALI_TEST_EQUALS( Color::RED, actor.GetBlendColor(), TEST_LOCATION ); - - // Render & check GL commands - application.SendNotification(); - application.Render(); - DALI_TEST_EQUALS( Color::RED, glAbstraction.GetLastBlendColor(), TEST_LOCATION ); - END_TEST; -} - int UtcDaliRenderableActorSetGetAlpha(void) { TestApplication application; diff --git a/dali/public-api/actors/image-actor.cpp b/dali/public-api/actors/image-actor.cpp index e51e681d..b67fe75 100644 --- a/dali/public-api/actors/image-actor.cpp +++ b/dali/public-api/actors/image-actor.cpp @@ -99,16 +99,6 @@ ImageActor::PixelArea ImageActor::GetPixelArea() const return GetImplementation(*this).GetPixelArea(); } -bool ImageActor::IsPixelAreaSet() const -{ - return GetImplementation(*this).IsPixelAreaSet(); -} - -void ImageActor::ClearPixelArea() -{ - GetImplementation(*this).ClearPixelArea(); -} - void ImageActor::SetStyle(Style style) { GetImplementation(*this).SetStyle(style); diff --git a/dali/public-api/actors/image-actor.h b/dali/public-api/actors/image-actor.h index 764fe3e..767570f 100644 --- a/dali/public-api/actors/image-actor.h +++ b/dali/public-api/actors/image-actor.h @@ -267,23 +267,6 @@ public: PixelArea GetPixelArea() const; /** - * @brief Query whether a pixel area has been set. - * - * @pre image must be initialized. - * @return True if a pixel area has been set. - */ - bool IsPixelAreaSet() const; - - /** - * @brief Remove any pixel areas specified with SetPixelArea; the entire image will be displayed. - * - * The actor size will change to that of the Image unless a custom size was set, e.g. via - * Actor::SetSize(). - * @pre image must be initialized. - */ - void ClearPixelArea(); - - /** * @brief Set how the image is rendered; the default is STYLE_QUAD. * * @pre image must be initialized. diff --git a/dali/public-api/actors/renderable-actor.cpp b/dali/public-api/actors/renderable-actor.cpp index 609e61a..5dec5b4 100644 --- a/dali/public-api/actors/renderable-actor.cpp +++ b/dali/public-api/actors/renderable-actor.cpp @@ -81,11 +81,6 @@ BlendingMode::Type RenderableActor::GetBlendMode() const return GetImplementation(*this).GetBlendMode(); } -void RenderableActor::SetBlendFunc( BlendingFactor::Type srcFactorRgba, BlendingFactor::Type destFactorRgba ) -{ - GetImplementation(*this).SetBlendFunc( srcFactorRgba, destFactorRgba ); -} - void RenderableActor::SetBlendFunc( BlendingFactor::Type srcFactorRgb, BlendingFactor::Type destFactorRgb, BlendingFactor::Type srcFactorAlpha, BlendingFactor::Type destFactorAlpha ) { @@ -98,31 +93,6 @@ void RenderableActor::GetBlendFunc( BlendingFactor::Type& srcFactorRgb, Blendi GetImplementation(*this).GetBlendFunc( srcFactorRgb, destFactorRgb, srcFactorAlpha, destFactorAlpha ); } -void RenderableActor::SetBlendEquation( BlendingEquation::Type equationRgba ) -{ - GetImplementation(*this).SetBlendEquation( equationRgba ); -} - -void RenderableActor::SetBlendEquation( BlendingEquation::Type equationRgb, BlendingEquation::Type equationAlpha ) -{ - GetImplementation(*this).SetBlendEquation( equationRgb, equationAlpha ); -} - -void RenderableActor::GetBlendEquation( BlendingEquation::Type& equationRgb, BlendingEquation::Type& equationAlpha ) const -{ - GetImplementation(*this).GetBlendEquation( equationRgb, equationAlpha ); -} - -void RenderableActor::SetBlendColor( const Vector4& color ) -{ - GetImplementation(*this).SetBlendColor( color ); -} - -const Vector4& RenderableActor::GetBlendColor() const -{ - return GetImplementation(*this).GetBlendColor(); -} - void RenderableActor::SetFilterMode( FilterMode::Type minFilter, FilterMode::Type magFilter ) { GetImplementation(*this).SetFilterMode( minFilter, magFilter ); diff --git a/dali/public-api/actors/renderable-actor.h b/dali/public-api/actors/renderable-actor.h index ce6bcb1..0dc4990 100644 --- a/dali/public-api/actors/renderable-actor.h +++ b/dali/public-api/actors/renderable-actor.h @@ -150,21 +150,6 @@ public: /** * @brief Specify the pixel arithmetic used when the actor is blended. * - * @param[in] srcFactorRgba Specifies how the red, green, blue, and alpha source blending factors are computed. - * The options are BlendingFactor::ZERO, ONE, SRC_COLOR, ONE_MINUS_SRC_COLOR, DST_COLOR, ONE_MINUS_DST_COLOR, - * SRC_ALPHA, ONE_MINUS_SRC_ALPHA, DST_ALPHA, ONE_MINUS_DST_ALPHA, CONSTANT_COLOR, ONE_MINUS_CONSTANT_COLOR, - * GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA, and GL_SRC_ALPHA_SATURATE. - * - * @param[in] destFactorRgba Specifies how the red, green, blue, and alpha destination blending factors are computed. - * The options are BlendingFactor::ZERO, ONE, SRC_COLOR, ONE_MINUS_SRC_COLOR, DST_COLOR, ONE_MINUS_DST_COLOR, - * SRC_ALPHA, ONE_MINUS_SRC_ALPHA, DST_ALPHA, ONE_MINUS_DST_ALPHA, CONSTANT_COLOR, ONE_MINUS_CONSTANT_COLOR, - * GL_CONSTANT_ALPHA, and GL_ONE_MINUS_CONSTANT_ALPHA. - */ - void SetBlendFunc( BlendingFactor::Type srcFactorRgba, BlendingFactor::Type destFactorRgba ); - - /** - * @brief Specify the pixel arithmetic used when the actor is blended. - * * @param[in] srcFactorRgb Specifies how the red, green, and blue source blending factors are computed. * The options are BlendingFactor::ZERO, ONE, SRC_COLOR, ONE_MINUS_SRC_COLOR, DST_COLOR, ONE_MINUS_DST_COLOR, * SRC_ALPHA, ONE_MINUS_SRC_ALPHA, DST_ALPHA, ONE_MINUS_DST_ALPHA, CONSTANT_COLOR, ONE_MINUS_CONSTANT_COLOR, @@ -196,45 +181,6 @@ public: BlendingFactor::Type& srcFactorAlpha, BlendingFactor::Type& destFactorAlpha ) const; /** - * @brief Specify the equation used when the actor is blended. - * - * The options are BlendingEquation::ADD, SUBTRACT, or REVERSE_SUBTRACT. - * @param[in] equationRgba The equation used for combining red, green, blue, and alpha components. - */ - void SetBlendEquation( BlendingEquation::Type equationRgba ); - - /** - * @brief Specify the equation used when the actor is blended. - * - * @param[in] equationRgb The equation used for combining red, green, and blue components. - * @param[in] equationAlpha The equation used for combining the alpha component. - * The options are BlendingEquation::ADD, SUBTRACT, or REVERSE_SUBTRACT. - */ - void SetBlendEquation( BlendingEquation::Type equationRgb, BlendingEquation::Type equationAlpha ); - - /** - * @brief Query the equation used when the actor is blended. - * - * @param[out] equationRgb The equation used for combining red, green, and blue components. - * @param[out] equationAlpha The equation used for combining the alpha component. - */ - void GetBlendEquation( BlendingEquation::Type& equationRgb, BlendingEquation::Type& equationAlpha ) const; - - /** - * @brief Specify the color used when the actor is blended; the default is Vector4::ZERO. - * - * @param[in] color The blend color. - */ - void SetBlendColor( const Vector4& color ); - - /** - * @brief Query the color used when the actor is blended. - * - * @return The blend color. - */ - const Vector4& GetBlendColor() const; - - /** * @brief Sets the filtering mode. * * Possible values are: FilterMode::NEAREST and FilterMode::LINEAR. Default is FilterMode::LINEAR. -- 2.7.4