From: Adeel Kazmi Date: Tue, 16 Aug 2016 14:12:14 +0000 (+0100) Subject: Rename DebugVisual to WireframeVisual X-Git-Tag: dali_1.2.2~3 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=1894ecb2c5bdcb91549d9da9d8301d0a753c5492 Rename DebugVisual to WireframeVisual Change-Id: I3f35a00dbe2ba2153dca9e96849f0f1e7909ea35 --- diff --git a/automated-tests/src/dali-toolkit/CMakeLists.txt b/automated-tests/src/dali-toolkit/CMakeLists.txt index 8d01fa3..c3723e0 100644 --- a/automated-tests/src/dali-toolkit/CMakeLists.txt +++ b/automated-tests/src/dali-toolkit/CMakeLists.txt @@ -50,7 +50,7 @@ SET(TC_SOURCES utc-Dali-Model3dView.cpp utc-Dali-Visual.cpp utc-Dali-VisualFactory.cpp - utc-Dali-DebugVisual.cpp + utc-Dali-DebugRendering.cpp utc-Dali-ImageAtlas.cpp utc-Dali-VideoView.cpp ) diff --git a/automated-tests/src/dali-toolkit/utc-Dali-DebugVisual.cpp b/automated-tests/src/dali-toolkit/utc-Dali-DebugRendering.cpp similarity index 92% rename from automated-tests/src/dali-toolkit/utc-Dali-DebugVisual.cpp rename to automated-tests/src/dali-toolkit/utc-Dali-DebugRendering.cpp index f93f2e2..b2cb02c 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-DebugVisual.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-DebugRendering.cpp @@ -42,7 +42,7 @@ bool IsDebugVisual( Visual::Base& visual ) Property::Value* typeValue = propertyMap.Find( Visual::Property::TYPE, Property::INTEGER ); if ( typeValue ) { - isDebugVisualType = ( typeValue->Get() == Visual::DEBUG ); + isDebugVisualType = ( typeValue->Get() == Visual::WIREFRAME ); // Debug Rendering uses the WireframeVisual } Actor actor = Actor::New(); @@ -54,21 +54,21 @@ bool IsDebugVisual( Visual::Base& visual ) } } -void dali_debug_renderer_startup(void) +void dali_debug_rendering_startup(void) { test_return_value = TET_UNDEF; } -void dali_debug_renderer_cleanup(void) +void dali_debug_rendering_cleanup(void) { test_return_value = TET_PASS; } -int UtcDaliDebugVisualGetVisual1(void) +int UtcDaliDebugRenderingGetVisual1(void) { EnvironmentVariable::SetTestingEnvironmentVariable(true); ToolkitTestApplication application; - tet_infoline( "UtcDaliDebugVisualGetVisual1: Request visual with a Property::Map" ); + tet_infoline( "UtcDaliDebugRenderingGetVisual1: Request visual with a Property::Map" ); VisualFactory factory = VisualFactory::Get(); DALI_TEST_CHECK( factory ); @@ -130,11 +130,11 @@ int UtcDaliDebugVisualGetVisual1(void) END_TEST; } -int UtcDaliDebugVisualGetVisual2(void) +int UtcDaliDebugRenderingGetVisual2(void) { EnvironmentVariable::SetTestingEnvironmentVariable(true); ToolkitTestApplication application; - tet_infoline( "UtcDaliDebugVisualGetVisual2: Request visual with various parameters" ); + tet_infoline( "UtcDaliDebugRenderingGetVisual2: Request visual with various parameters" ); VisualFactory factory = VisualFactory::Get(); DALI_TEST_CHECK( factory ); diff --git a/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp b/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp index 7bc228d..b061cf1 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-Visual.cpp @@ -1067,3 +1067,26 @@ int UtcDaliVisualAnimatePrimitiveVisual(void) END_TEST; } + +int UtcDaliVisualWireframeVisual(void) +{ + ToolkitTestApplication application; + + VisualFactory factory = VisualFactory::Get(); + Property::Map propertyMap; + propertyMap.Insert( Visual::Property::TYPE, Visual::WIREFRAME ); + + // Create the visual. + Visual::Base visual = factory.CreateVisual( propertyMap ); + + DALI_TEST_CHECK( visual ); + + Property::Map resultMap; + visual.CreatePropertyMap( resultMap ); + + // Check the property values from the returned map from visual + Property::Value* value = resultMap.Find( Visual::Property::TYPE, Property::INTEGER ); + DALI_TEST_CHECK( value ); + DALI_TEST_CHECK( value->Get() == Visual::WIREFRAME ); + END_TEST; +} diff --git a/dali-toolkit/internal/file.list b/dali-toolkit/internal/file.list index 1954782..e644d65 100644 --- a/dali-toolkit/internal/file.list +++ b/dali-toolkit/internal/file.list @@ -18,18 +18,18 @@ toolkit_src_files = \ $(toolkit_src_dir)/visuals/visual-string-constants.cpp \ $(toolkit_src_dir)/visuals/border/border-visual.cpp \ $(toolkit_src_dir)/visuals/color/color-visual.cpp \ - $(toolkit_src_dir)/visuals/debug/debug-visual.cpp \ - $(toolkit_src_dir)/visuals/image/image-visual.cpp \ - $(toolkit_src_dir)/visuals/npatch/npatch-visual.cpp \ $(toolkit_src_dir)/visuals/gradient/gradient.cpp \ $(toolkit_src_dir)/visuals/gradient/linear-gradient.cpp \ $(toolkit_src_dir)/visuals/gradient/radial-gradient.cpp \ $(toolkit_src_dir)/visuals/gradient/gradient-visual.cpp \ - $(toolkit_src_dir)/visuals/svg/svg-rasterize-thread.cpp \ - $(toolkit_src_dir)/visuals/svg/svg-visual.cpp \ + $(toolkit_src_dir)/visuals/image/batch-image-visual.cpp \ + $(toolkit_src_dir)/visuals/image/image-visual.cpp \ $(toolkit_src_dir)/visuals/mesh/mesh-visual.cpp \ + $(toolkit_src_dir)/visuals/npatch/npatch-visual.cpp \ $(toolkit_src_dir)/visuals/primitive/primitive-visual.cpp \ - $(toolkit_src_dir)/visuals/image/batch-image-visual.cpp \ + $(toolkit_src_dir)/visuals/svg/svg-rasterize-thread.cpp \ + $(toolkit_src_dir)/visuals/svg/svg-visual.cpp \ + $(toolkit_src_dir)/visuals/wireframe/wireframe-visual.cpp \ $(toolkit_src_dir)/controls/alignment/alignment-impl.cpp \ $(toolkit_src_dir)/controls/bloom-view/bloom-view-impl.cpp \ $(toolkit_src_dir)/controls/bubble-effect/bubble-emitter-impl.cpp \ diff --git a/dali-toolkit/internal/visuals/visual-factory-cache.cpp b/dali-toolkit/internal/visuals/visual-factory-cache.cpp index da86201..248270b 100644 --- a/dali-toolkit/internal/visuals/visual-factory-cache.cpp +++ b/dali-toolkit/internal/visuals/visual-factory-cache.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -150,14 +150,14 @@ bool VisualFactoryCache::CleanRendererCache( const std::string& key ) return false; } -void VisualFactoryCache::CacheDebugRenderer( Renderer& renderer ) +void VisualFactoryCache::CacheWireframeRenderer( Renderer& renderer ) { - mDebugRenderer = renderer; + mWireframeRenderer = renderer; } -Renderer VisualFactoryCache::GetDebugRenderer() +Renderer VisualFactoryCache::GetWireframeRenderer() { - return mDebugRenderer; + return mWireframeRenderer; } Geometry VisualFactoryCache::CreateQuadGeometry() diff --git a/dali-toolkit/internal/visuals/visual-factory-cache.h b/dali-toolkit/internal/visuals/visual-factory-cache.h index 6f67a66..cb1b890 100644 --- a/dali-toolkit/internal/visuals/visual-factory-cache.h +++ b/dali-toolkit/internal/visuals/visual-factory-cache.h @@ -171,14 +171,14 @@ public: bool CleanRendererCache( const std::string& key ); /** - * @brief Cache the debug renderer + * @brief Cache the wireframe renderer */ - void CacheDebugRenderer( Renderer& renderer ); + void CacheWireframeRenderer( Renderer& renderer ); /** - * @brief Request the debug renderer; + * @brief Request the wireframe renderer; */ - Renderer GetDebugRenderer(); + Renderer GetWireframeRenderer(); /** * Get the image atlas manager. @@ -245,7 +245,7 @@ private: HashVector mRendererHashes; CachedRenderers mRenderers; - Renderer mDebugRenderer; + Renderer mWireframeRenderer; ImageAtlasManagerPtr mAtlasManager; SvgRasterizeThread* mSvgRasterizeThread; diff --git a/dali-toolkit/internal/visuals/visual-factory-impl.cpp b/dali-toolkit/internal/visuals/visual-factory-impl.cpp index 80f4420..e35c98b 100644 --- a/dali-toolkit/internal/visuals/visual-factory-impl.cpp +++ b/dali-toolkit/internal/visuals/visual-factory-impl.cpp @@ -31,16 +31,16 @@ #include #include #include -#include #include -#include +#include #include -#include #include +#include #include +#include +#include #include #include -#include namespace Dali { @@ -61,7 +61,7 @@ DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, GRADIENT ) DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, IMAGE ) DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, MESH ) DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, PRIMITIVE ) -DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, DEBUG ) +DALI_ENUM_TO_STRING_WITH_SCOPE( Toolkit::Visual, WIREFRAME ) DALI_ENUM_TO_STRING_TABLE_END( VISUAL_TYPE ) const char * const VISUAL_TYPE( "visualType" ); @@ -95,10 +95,10 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const Property::Map& property mFactoryCache = new VisualFactoryCache(); } - // Return a new DebugVisual if we have debug enabled + // Return a new WireframeVisual if we have debug enabled if( mDebugEnabled ) { - return Toolkit::Visual::Base( new DebugVisual( *( mFactoryCache.Get() ) ) ); + return Toolkit::Visual::Base( new WireframeVisual( *( mFactoryCache.Get() ) ) ); } Visual::Base* visualPtr = NULL; @@ -176,9 +176,9 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const Property::Map& property break; } - case Toolkit::Visual::DEBUG: + case Toolkit::Visual::WIREFRAME: { - visualPtr = new DebugVisual( *( mFactoryCache.Get() ) ); + visualPtr = new WireframeVisual( *( mFactoryCache.Get() ) ); break; } @@ -206,7 +206,7 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const Image& image ) if( mDebugEnabled ) { - return Toolkit::Visual::Base( new DebugVisual( *( mFactoryCache.Get() ) ) ); + return Toolkit::Visual::Base( new WireframeVisual( *( mFactoryCache.Get() ) ) ); } NinePatchImage npatchImage = NinePatchImage::DownCast( image ); @@ -236,7 +236,7 @@ Toolkit::Visual::Base VisualFactory::CreateVisual( const std::string& url, Image if( mDebugEnabled ) { - return Toolkit::Visual::Base( new DebugVisual( *( mFactoryCache.Get() ) ) ); + return Toolkit::Visual::Base( new WireframeVisual( *( mFactoryCache.Get() ) ) ); } if( NinePatchImage::IsNinePatchUrl( url ) ) diff --git a/dali-toolkit/internal/visuals/debug/debug-visual.cpp b/dali-toolkit/internal/visuals/wireframe/wireframe-visual.cpp similarity index 85% rename from dali-toolkit/internal/visuals/debug/debug-visual.cpp rename to dali-toolkit/internal/visuals/wireframe/wireframe-visual.cpp index d3af3ca..47474a6 100644 --- a/dali-toolkit/internal/visuals/debug/debug-visual.cpp +++ b/dali-toolkit/internal/visuals/wireframe/wireframe-visual.cpp @@ -17,7 +17,7 @@ // CLASS HEADER -#include "debug-visual.h" +#include "wireframe-visual.h" // INTERNAL INCLUDES #include @@ -65,39 +65,39 @@ void main()\n } -DebugVisual::DebugVisual( VisualFactoryCache& factoryCache ) +WireframeVisual::WireframeVisual( VisualFactoryCache& factoryCache ) : Visual::Base( factoryCache ) { } -DebugVisual::~DebugVisual() +WireframeVisual::~WireframeVisual() {} -void DebugVisual::DoSetOnStage( Actor& actor ) +void WireframeVisual::DoSetOnStage( Actor& actor ) { InitializeRenderer(); } -void DebugVisual::DoCreatePropertyMap( Property::Map& map ) const +void WireframeVisual::DoCreatePropertyMap( Property::Map& map ) const { map.Clear(); - map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::DEBUG ); + map.Insert( Toolkit::Visual::Property::TYPE, Toolkit::Visual::WIREFRAME ); } -void DebugVisual::InitializeRenderer() +void WireframeVisual::InitializeRenderer() { - mImpl->mRenderer = mFactoryCache.GetDebugRenderer(); + mImpl->mRenderer = mFactoryCache.GetWireframeRenderer(); if( !mImpl->mRenderer ) { Geometry geometry = CreateQuadWireframeGeometry(); Shader shader = Shader::New( VERTEX_SHADER, FRAGMENT_SHADER ); mImpl->mRenderer = Renderer::New( geometry, shader); - mFactoryCache.CacheDebugRenderer( mImpl->mRenderer ); + mFactoryCache.CacheWireframeRenderer( mImpl->mRenderer ); } } -Geometry DebugVisual::CreateQuadWireframeGeometry() +Geometry WireframeVisual::CreateQuadWireframeGeometry() { const float halfWidth = 0.5f; const float halfHeight = 0.5f; diff --git a/dali-toolkit/internal/visuals/debug/debug-visual.h b/dali-toolkit/internal/visuals/wireframe/wireframe-visual.h similarity index 78% rename from dali-toolkit/internal/visuals/debug/debug-visual.h rename to dali-toolkit/internal/visuals/wireframe/wireframe-visual.h index c4c6248..b14452a 100644 --- a/dali-toolkit/internal/visuals/debug/debug-visual.h +++ b/dali-toolkit/internal/visuals/wireframe/wireframe-visual.h @@ -1,8 +1,8 @@ -#ifndef DALI_TOOLKIT_INTERNAL_DEBUG_VISUAL_H -#define DALI_TOOLKIT_INTERNAL_DEBUG_VISUAL_H +#ifndef DALI_TOOLKIT_INTERNAL_WIREFRAME_VISUAL_H +#define DALI_TOOLKIT_INTERNAL_WIREFRAME_VISUAL_H /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2016 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,10 +31,10 @@ namespace Internal { /** - * The visual which renders a wireframe outline to the control's quad for debugging + * The visual which renders a wireframe outline to the control's quad. * */ -class DebugVisual: public Visual::Base +class WireframeVisual: public Visual::Base { public: @@ -43,12 +43,12 @@ public: * * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object */ - DebugVisual( VisualFactoryCache& factoryCache ); + WireframeVisual( VisualFactoryCache& factoryCache ); /** * @brief A reference counted object may only be deleted by calling Unreference(). */ - virtual ~DebugVisual(); + virtual ~WireframeVisual(); protected: @@ -78,10 +78,10 @@ private: private: // Undefined - DebugVisual( const DebugVisual& debugVisual); + WireframeVisual( const WireframeVisual& visual); // Undefined - DebugVisual& operator=( const DebugVisual& debugVisual ); + WireframeVisual& operator=( const WireframeVisual& visual ); }; @@ -91,4 +91,4 @@ private: } // namespace Dali -#endif /* DALI_TOOLKIT_INTERNAL_DEBUG_VISUAL_H */ +#endif // DALI_TOOLKIT_INTERNAL_WIREFRAME_VISUAL_H diff --git a/dali-toolkit/public-api/visuals/visual-properties.h b/dali-toolkit/public-api/visuals/visual-properties.h index 4c1ff57..cab8986 100644 --- a/dali-toolkit/public-api/visuals/visual-properties.h +++ b/dali-toolkit/public-api/visuals/visual-properties.h @@ -42,7 +42,7 @@ enum Type IMAGE, ///< Renders an image into the control's quad. @SINCE_1_1.45 MESH, ///< Renders a mesh using an "obj" file, optionally with textures provided by an "mtl" file. @SINCE_1_1.45 PRIMITIVE, ///< Renders a simple 3D shape, such as a cube or sphere. @SINCE_1_1.45 - DEBUG, ///< Renders a simple wire-frame outlining a quad. @SINCE_1_1.45 + WIREFRAME, ///< Renders a simple wire-frame outlining a quad. @SINCE_1_2.2 }; namespace Property diff --git a/docs/content/images/debug-visual/debug-blocks.png b/docs/content/images/debug-rendering/debug-blocks.png similarity index 100% rename from docs/content/images/debug-visual/debug-blocks.png rename to docs/content/images/debug-rendering/debug-blocks.png diff --git a/docs/content/images/visuals/wireframe-visual.png b/docs/content/images/visuals/wireframe-visual.png new file mode 100644 index 0000000..b22bd94 Binary files /dev/null and b/docs/content/images/visuals/wireframe-visual.png differ diff --git a/docs/content/main.md b/docs/content/main.md index e2ff92e..f6eeb25 100644 --- a/docs/content/main.md +++ b/docs/content/main.md @@ -77,7 +77,7 @@ + Environment Variables + [Resource Tracking](@ref resourcetracking) + Logging - + [Debug Visual](@ref debugvisual) + + [Visual Debug Rendering](@ref debugrendering) + [Stagehand - DALi Visual Debugger](@ref stagehand) ### Viewing Modes diff --git a/docs/content/shared-javascript-and-cpp-documentation/debug-rendering.md b/docs/content/shared-javascript-and-cpp-documentation/debug-rendering.md new file mode 100644 index 0000000..f71eec2 --- /dev/null +++ b/docs/content/shared-javascript-and-cpp-documentation/debug-rendering.md @@ -0,0 +1,19 @@ + + +# Debug rendering {#debugrendering} + +Setting DALI_DEBUG_RENDERING environment variable will enable the visual debugging. + +Then, every concrete visual ( ColorVisual, BorderVisual, ImageVisual, GradientVisual, etc. ) is replaced with a wireframe visual. +The wireframe visual renders a simple quad wireframe, so that the control layout and scene structure is clearly displayed. + +## Example: +~~~{.bash} +sh-4.1$ DALI_DEBUG_RENDERING=1 /usr/apps/com.samsung.dali-demo/bin/blocks.example +~~~ + +![ ](../assets/img/debug-rendering/debug-blocks.png) +![ ](debug-blocks.png) + + diff --git a/docs/content/shared-javascript-and-cpp-documentation/debug-visual.md b/docs/content/shared-javascript-and-cpp-documentation/debug-visual.md deleted file mode 100644 index 588f046..0000000 --- a/docs/content/shared-javascript-and-cpp-documentation/debug-visual.md +++ /dev/null @@ -1,21 +0,0 @@ - - -# Debug Visual {#debugvisual} - -## Enable debug rendering - -Setting DALI_DEBUG_RENDERING environment variable will enable the visual debugging. - -Then, every concrete visual ( ColorVisual, BorderVisual, ImageVisual, GradientVisual, etc. ) is replaced with a DebugVisual object. -Debug visual renders a simple quad wireframe, so that the control layout and scene structure is clearly displayed. - -### Example: -~~~{.bash} -sh-4.1$ DALI_DEBUG_RENDERING=1 /usr/apps/com.samsung.dali-demo/bin/blocks.example -~~~ - -![ ](../assets/img/debug-visual/debug-blocks.png) -![ ](debug-blocks.png) - - diff --git a/docs/content/shared-javascript-and-cpp-documentation/visuals.md b/docs/content/shared-javascript-and-cpp-documentation/visuals.md index 95a40c3..728f080 100644 --- a/docs/content/shared-javascript-and-cpp-documentation/visuals.md +++ b/docs/content/shared-javascript-and-cpp-documentation/visuals.md @@ -16,6 +16,7 @@ DALi provides the following visuals: + [Border](@ref border-visual) + [Mesh](@ref mesh-visual) + [Primitive](@ref primitive-visual) + + [Wireframe](@ref wireframe-visual) Controls can provide properties that allow users to specify the visual type ( visualType ). Setting visual properties are done via a property map. @@ -606,6 +607,42 @@ map[ PrimitiveVisual::Property::BEVEL_PERCENTAGE ] = 0.4f; control.SetProperty( Control::Property::BACKGROUND, map ); ~~~ +___________________________________________________________________________________________________ + +## Wireframe Visual {#wireframe-visual} + +Renders a wireframe around a control's quad. +Is mainly used for debugging and is the visual that replaces all other visuals when [Visual Debug Rendering](@ref debugrendering) is turned on. + +![ ](../assets/img/visuals/wireframe-visual.png) +![ ](visuals/wireframe-visual.png) + +### Properties + +**VisualType:** Dali::Toolkit::Visual::WIREFRAME, "WIREFRAME" + +### Usage + +~~~{.cpp} +// C++ +Dali::Toolkit::Control control = Dali::Toolkit::Control::New(); + +Dali::Property::Map map; +map[ Visual::Property::TYPE ] = Dali::Toolkit::Visual::WIREFRAME; + +control.SetProperty( Control::Property::BACKGROUND, map ); +~~~ + +~~~{.js} +// JavaScript +var control = new dali.Control( "Control" ); + +control.background = +{ + visualType : "WIREFRAME" +}; +~~~ + @class _Guide_Control_Visuals