From 37b2e018472bc9c0bd7576f10387de62c6377a2d Mon Sep 17 00:00:00 2001 From: David Steele Date: Mon, 6 Feb 2017 20:22:11 +0000 Subject: [PATCH] Reduced size of control depth index ranges The control depth index ranges, used for setting the depth index of visuals, needs to stay within the sibling order range, which is defined as 1000. The existing values for background (used by button) overlapped with sibling order and caused incorrect ordering in the svg demo. Of note is the Layer::TREE_DEPTH_MULTIPLIER is different from the DevelLayer::TREE_DEPTH_MULTIPLIER value, and should be removed. Change-Id: I176f277286840f5b57840661f285dc9261795769 Signed-off-by: David Steele --- .../controls/control-depth-index-ranges.h | 26 +++++++++++++++++----- .../controls/text-controls/text-editor-impl.cpp | 2 +- .../controls/text-controls/text-field-impl.cpp | 2 +- .../controls/text-controls/text-label-impl.cpp | 2 +- .../text/rendering/atlas/text-atlas-renderer.cpp | 1 + dali-toolkit/internal/visuals/text/text-visual.cpp | 2 +- 6 files changed, 26 insertions(+), 9 deletions(-) diff --git a/dali-toolkit/devel-api/controls/control-depth-index-ranges.h b/dali-toolkit/devel-api/controls/control-depth-index-ranges.h index d010c11..088fb7a 100644 --- a/dali-toolkit/devel-api/controls/control-depth-index-ranges.h +++ b/dali-toolkit/devel-api/controls/control-depth-index-ranges.h @@ -19,7 +19,8 @@ */ // EXTERNAL INCLUDES -#include +#include +#include namespace Dali { @@ -30,14 +31,29 @@ namespace Toolkit namespace DepthIndex { +// The negative value for background effect and background has been +// chosen so that newer controls can have content without setting +// depth index, and go in front of native controls with a background. +// This backround negative value means that the highest possible value +// is SIBLING_ORDER_MULTIPLIER-BACKGROUND_EFFECT-1. The divisor of +// 100 ensures the range fits within the sibling order range, and has +// enough gaps to allow Control Authors to use other intermediate depths. + enum Ranges { - BACKGROUND = -Dali::Layer::TREE_DEPTH_MULTIPLIER / 10, - CONTENT = 0, - TEXT = Dali::Layer::TREE_DEPTH_MULTIPLIER / 100, - DECORATION = Dali::Layer::TREE_DEPTH_MULTIPLIER / 10 + BACKGROUND_EFFECT = -2 * DevelLayer::SIBLING_ORDER_MULTIPLIER/100, + BACKGROUND = -1 * DevelLayer::SIBLING_ORDER_MULTIPLIER/100, + CONTENT = 0, + DECORATION = 1 * DevelLayer::SIBLING_ORDER_MULTIPLIER/100, + FOREGROUND_EFFECT = 2 * DevelLayer::SIBLING_ORDER_MULTIPLIER/100 }; +DALI_COMPILE_TIME_ASSERT( (unsigned int)DevelLayer::ACTOR_DEPTH_MULTIPLIER > (unsigned int)DevelLayer::SIBLING_ORDER_MULTIPLIER ); +DALI_COMPILE_TIME_ASSERT( BACKGROUND_EFFECT < BACKGROUND ); +DALI_COMPILE_TIME_ASSERT( BACKGROUND < CONTENT ); +DALI_COMPILE_TIME_ASSERT( CONTENT < DECORATION ); +DALI_COMPILE_TIME_ASSERT( DECORATION < FOREGROUND_EFFECT ); + } // namespace DepthIndex } // namespace Toolkit diff --git a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp index aab4f95..12d160e 100644 --- a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp @@ -1094,7 +1094,7 @@ void TextEditor::RenderText( Text::Controller::UpdateTextType updateTextType ) { renderableActor = mRenderer->Render( mController->GetView(), mAlignmentOffset, - DepthIndex::TEXT ); + DepthIndex::CONTENT ); } if( renderableActor != mRenderableActor ) diff --git a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp index 63568e6..6a846e4 100644 --- a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp @@ -1272,7 +1272,7 @@ void TextField::RenderText( Text::Controller::UpdateTextType updateTextType ) { renderableActor = mRenderer->Render( mController->GetView(), mAlignmentOffset, - DepthIndex::TEXT ); + DepthIndex::CONTENT ); } if( renderableActor != mRenderableActor ) diff --git a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp index 9f7863f..b6b5db0 100644 --- a/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-label-impl.cpp @@ -731,7 +731,7 @@ void TextLabel::RenderText() { renderableActor = mRenderer->Render( mController->GetView(), alignmentOffset, - DepthIndex::TEXT ); + DepthIndex::CONTENT ); } if( renderableActor != mRenderableActor ) diff --git a/dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp b/dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp index de437fb..2332c7a 100644 --- a/dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp +++ b/dali-toolkit/internal/text/rendering/atlas/text-atlas-renderer.cpp @@ -21,6 +21,7 @@ // EXTERNAL INCLUDES #include #include +#include #include #include diff --git a/dali-toolkit/internal/visuals/text/text-visual.cpp b/dali-toolkit/internal/visuals/text/text-visual.cpp index f3b895b..280fac2 100644 --- a/dali-toolkit/internal/visuals/text/text-visual.cpp +++ b/dali-toolkit/internal/visuals/text/text-visual.cpp @@ -313,7 +313,7 @@ void TextVisual::DoSetOnStage( Actor& actor ) } mImpl->mRenderer = Renderer::New( geometry, shader ); - mImpl->mRenderer.SetProperty( Dali::Renderer::Property::DEPTH_INDEX, Toolkit::DepthIndex::TEXT ); + mImpl->mRenderer.SetProperty( Dali::Renderer::Property::DEPTH_INDEX, Toolkit::DepthIndex::CONTENT ); UpdateRenderer( true ); // Renderer needs textures and to be added to control } -- 2.7.4