Commit 4daf5275230c4122ebff9aa6567fd105eba80d95

Authored by Victor Cebollada
2 parents a30d584d d989ffd2

[dali_1.2.45] Merge branch 'devel/master'

Change-Id: I6e00f9c848b395a5428fb021c60b46dc1439ff07
com.samsung.dali-demo.xml
... ... @@ -194,6 +194,9 @@
194 194 <ui-application appid="clipping.example" exec="/usr/apps/com.samsung.dali-demo/bin/clipping.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
195 195 <label>Clipping</label>
196 196 </ui-application>
  197 + <ui-application appid="clipping-draw-order.example" exec="/usr/apps/com.samsung.dali-demo/bin/clipping-draw-order.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
  198 + <label>Clipping Draw Order</label>
  199 + </ui-application>
197 200 <ui-application appid="pivot.example" exec="/usr/apps/com.samsung.dali-demo/bin/pivot.example" nodisplay="true" multiple="false" type="c++app" taskmanage="true">
198 201 <label>Clipping</label>
199 202 </ui-application>
... ...
examples-reel/dali-examples-reel.cpp
... ... @@ -42,6 +42,7 @@ int DALI_EXPORT_API main(int argc, char **argv)
42 42 demo.AddExample(Example("builder.example", DALI_DEMO_STR_TITLE_SCRIPT_BASED_UI));
43 43 demo.AddExample(Example("buttons.example", DALI_DEMO_STR_TITLE_BUTTONS));
44 44 demo.AddExample(Example("clipping.example", DALI_DEMO_STR_TITLE_CLIPPING));
  45 + demo.AddExample(Example("clipping-draw-order.example", DALI_DEMO_STR_TITLE_CLIPPING_DRAW_ORDER));
45 46 demo.AddExample(Example("dissolve-effect.example", DALI_DEMO_STR_TITLE_DISSOLVE_TRANSITION));
46 47 demo.AddExample(Example("effects-view.example", DALI_DEMO_STR_TITLE_EFFECTS_VIEW));
47 48 demo.AddExample(Example("flex-container.example", DALI_DEMO_STR_TITLE_FLEXBOX_PLAYGROUND));
... ...
examples/clipping-draw-order/clipping-draw-order.cpp 0 → 100644
  1 +/*
  2 + * Copyright (c) 2017 Samsung Electronics Co., Ltd.
  3 + *
  4 + * Licensed under the Apache License, Version 2.0 (the "License");
  5 + * you may not use this file except in compliance with the License.
  6 + * You may obtain a copy of the License at
  7 + *
  8 + * http://www.apache.org/licenses/LICENSE-2.0
  9 + *
  10 + * Unless required by applicable law or agreed to in writing, software
  11 + * distributed under the License is distributed on an "AS IS" BASIS,
  12 + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13 + * See the License for the specific language governing permissions and
  14 + * limitations under the License.
  15 + *
  16 + */
  17 +
  18 +#include <dali-toolkit/dali-toolkit.h>
  19 +
  20 +using namespace Dali;
  21 +using namespace Dali::Toolkit;
  22 +
  23 +const char* images[] = {
  24 + DEMO_IMAGE_DIR "gallery-small-1.jpg",
  25 + DEMO_IMAGE_DIR "gallery-small-2.jpg",
  26 + DEMO_IMAGE_DIR "gallery-small-3.jpg",
  27 + DEMO_IMAGE_DIR "gallery-small-4.jpg",
  28 + DEMO_IMAGE_DIR "gallery-small-5.jpg"
  29 +};
  30 +
  31 +// This verification example confirms drawing order is the same, with or without clipping enabled.
  32 +class ClippingDrawOrderVerification : public ConnectionTracker
  33 +{
  34 +public:
  35 +
  36 + ClippingDrawOrderVerification( Application& application )
  37 + : mApplication( application )
  38 + {
  39 + // Connect to the Application's Init signal.
  40 + mApplication.InitSignal().Connect( this, &ClippingDrawOrderVerification::Create );
  41 + }
  42 +
  43 + ~ClippingDrawOrderVerification()
  44 + {
  45 + // Nothing to do here.
  46 + }
  47 +
  48 + // The Init signal is received once (only) during the Application lifetime.
  49 + void Create( Application& application )
  50 + {
  51 + // Get a handle to the stage
  52 + Stage stage = Stage::GetCurrent();
  53 + stage.SetBackgroundColor( Color::WHITE );
  54 +
  55 + // Create the title label.
  56 + TextLabel title = TextLabel::New( "Clipping draw order verification" );
  57 + title.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
  58 + title.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "CENTER" );
  59 + title.SetAnchorPoint( AnchorPoint::CENTER );
  60 + title.SetParentOrigin( ParentOrigin::CENTER );
  61 +
  62 + // Create the description label.
  63 + TextLabel description = TextLabel::New( "The bottom tree should have the same draw order as the top tree.\nThey should look identical except \"C\" is clipped on the bottom tree." );
  64 + description.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
  65 + description.SetProperty( TextLabel::Property::MULTI_LINE, true );
  66 + description.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
  67 + description.SetParentOrigin( Vector3( 0.5f, 1.0f, 0.5f ) );
  68 + stage.Add( description );
  69 +
  70 + /*
  71 + * Create a 4-row TableView.
  72 + * It will be segmented as follows:
  73 + *
  74 + * +---------------+
  75 + * | Title |
  76 + * +---------------+
  77 + * | Tree |
  78 + * | Without |
  79 + * | Clipping |
  80 + * +---------------+
  81 + * | Tree |
  82 + * | With |
  83 + * | Clipping |
  84 + * +---------------+
  85 + * | Explanation |
  86 + * +---------------+
  87 + */
  88 + TableView view = TableView::New( 4, 1 );
  89 + view.SetAnchorPoint( AnchorPoint::CENTER );
  90 + view.SetParentOrigin( ParentOrigin::CENTER );
  91 + view.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
  92 +
  93 + view.SetCellAlignment( Toolkit::TableView::CellPosition( 0, 0 ), HorizontalAlignment::CENTER, VerticalAlignment::CENTER );
  94 + view.SetCellAlignment( Toolkit::TableView::CellPosition( 1, 0 ), HorizontalAlignment::CENTER, VerticalAlignment::CENTER );
  95 + view.SetCellAlignment( Toolkit::TableView::CellPosition( 2, 0 ), HorizontalAlignment::CENTER, VerticalAlignment::CENTER );
  96 + view.SetCellAlignment( Toolkit::TableView::CellPosition( 3, 0 ), HorizontalAlignment::CENTER, VerticalAlignment::CENTER );
  97 +
  98 + view.SetCellPadding( Vector2( 14.0f, 7.0f ) );
  99 +
  100 + view.SetRelativeWidth( 0u, 1.0f );
  101 +
  102 + view.SetFitHeight( 0u );
  103 + view.SetRelativeHeight( 1u, 0.5f );
  104 + view.SetRelativeHeight( 2u, 0.5f );
  105 + view.SetFitHeight( 3u );
  106 +
  107 + // Add the title and description to the TableView.
  108 + view.AddChild( title, TableView::CellPosition( 0u, 0u ) );
  109 + view.AddChild( description, TableView::CellPosition( 3u, 0u ) );
  110 +
  111 + /*
  112 + For each of the 2 tree views, we create a small tree of actors as follows:
  113 + ( Note: Clipping is only enabled for B on the bottom tree ).
  114 +
  115 + A
  116 + / \
  117 + Clipping enabled -> B D
  118 + | |
  119 + C E
  120 +
  121 + The correct draw order is "ABCDE" (the same as if clipping was not enabled).
  122 + */
  123 + const float treeYStart = 0.12f;
  124 + const float depthGap = 0.35f;
  125 +
  126 + for( int tree = 0; tree < 2; ++tree )
  127 + {
  128 + Control container = Control::New();
  129 + container.SetAnchorPoint( AnchorPoint::TOP_CENTER );
  130 + container.SetParentOrigin( ParentOrigin::TOP_CENTER );
  131 + container.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
  132 + Vector4 backgroundColor = tree == 0 ? Vector4( 0.77f, 1.0f, 0.77f, 1.0f ) : Vector4( 0.8f, 0.8f, 1.0f, 1.0f );
  133 + container.SetProperty( Control::Property::BACKGROUND, backgroundColor );
  134 + ImageView image[5];
  135 +
  136 + // Loop for each of the 5 images & labels.
  137 + for( int i = 0; i < 5; ++i )
  138 + {
  139 + std::stringstream labelStream;
  140 + labelStream << static_cast<char>( static_cast<char>( i ) + 'A' );
  141 + TextLabel textLabel = TextLabel::New( labelStream.str() );
  142 + textLabel.SetAnchorPoint( AnchorPoint::TOP_CENTER );
  143 +
  144 + image[i] = ImageView::New( images[i] );
  145 + image[i].SetAnchorPoint( AnchorPoint::TOP_CENTER );
  146 +
  147 + // Calculate the relative positioning for the images and labels.
  148 + float depth = static_cast<float>( i == 0 ? 0 : ( ( i - 1 ) % 2 ) + 1 );
  149 +
  150 + if( i == 0 )
  151 + {
  152 + image[i].SetParentOrigin( Vector3( 0.5f, treeYStart, 0.5f ) );
  153 + textLabel.SetParentOrigin( Vector3( 1.0f, 0.05f * depth, 0.5f ) );
  154 + }
  155 + else
  156 + {
  157 + float b = i > 2 ? 1.0f : -1.0f;
  158 + image[i].SetParentOrigin( Vector3( 0.5f + ( 0.2f * b ), depthGap, 0.5f ) );
  159 + textLabel.SetParentOrigin( Vector3( 0.98f + 0.215f * b + ( 0.04f * b * depth ), treeYStart + 0.02f + ( 0.16f * depth ), 0.5f ) );
  160 + }
  161 +
  162 + container.Add( textLabel );
  163 + }
  164 +
  165 + // Create the title label.
  166 + std::string treeText = tree == 0 ? "Without Clipping" : "With Clipping";
  167 + TextLabel treeLabel = TextLabel::New( treeText );
  168 + treeLabel.SetProperty( TextLabel::Property::HORIZONTAL_ALIGNMENT, "CENTER" );
  169 + treeLabel.SetProperty( TextLabel::Property::VERTICAL_ALIGNMENT, "BOTTOM" );
  170 + treeLabel.SetAnchorPoint( AnchorPoint::BOTTOM_CENTER );
  171 + treeLabel.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
  172 + container.Add( treeLabel );
  173 +
  174 + // Enable clipping for the 2nd tree.
  175 + if( tree == 1 )
  176 + {
  177 + image[1].SetProperty( Actor::Property::CLIPPING_MODE, ClippingMode::CLIP_CHILDREN );
  178 + }
  179 +
  180 + // Build the tree structure.
  181 + container.Add( image[0] );
  182 +
  183 + image[0].Add( image[1] );
  184 + image[1].Add( image[2] );
  185 +
  186 + image[0].Add( image[3] );
  187 + image[3].Add( image[4] );
  188 +
  189 + // Add the finished tree to the TableView.
  190 + view.AddChild( container, TableView::CellPosition( 1u + tree, 0u ) );
  191 + }
  192 +
  193 + // Add the finished TableView to the stage.
  194 + stage.Add( view );
  195 +
  196 + // Respond to a click anywhere on the stage
  197 + stage.GetRootLayer().TouchSignal().Connect( this, &ClippingDrawOrderVerification::OnTouch );
  198 + }
  199 +
  200 + bool OnTouch( Actor actor, const TouchData& touch )
  201 + {
  202 + // Quit the application.
  203 + mApplication.Quit();
  204 + return true;
  205 + }
  206 +
  207 +private:
  208 + Application& mApplication;
  209 +};
  210 +
  211 +void RunVerification( Application& application )
  212 +{
  213 + ClippingDrawOrderVerification verification( application );
  214 +
  215 + application.MainLoop();
  216 +}
  217 +
  218 +// Entry point for Linux & Tizen applications.
  219 +int DALI_EXPORT_API main( int argc, char **argv )
  220 +{
  221 + Application application = Application::New( &argc, &argv );
  222 +
  223 + RunVerification( application );
  224 +
  225 + return 0;
  226 +}
... ...
examples/image-scaling-irregular-grid/image-scaling-irregular-grid-example.cpp
... ... @@ -47,6 +47,7 @@
47 47 #include <dali-toolkit/dali-toolkit.h>
48 48 #include <dali-toolkit/devel-api/controls/buttons/button-devel.h>
49 49 #include <iostream>
  50 +#include <dali-toolkit/devel-api/controls/control-devel.h>
50 51  
51 52 // INTERNAL INCLUDES
52 53 #include "grid-flags.h"
... ... @@ -166,7 +167,7 @@ const char* IMAGE_PATHS[] = {
166 167 NULL
167 168 };
168 169 const unsigned NUM_IMAGE_PATHS = sizeof(IMAGE_PATHS) / sizeof(IMAGE_PATHS[0]) - 1u;
169   -
  170 +const unsigned int INITIAL_IMAGES_TO_LOAD = 10;
170 171  
171 172  
172 173 /**
... ... @@ -260,7 +261,8 @@ public:
260 261  
261 262 ImageScalingIrregularGridController( Application& application )
262 263 : mApplication( application ),
263   - mScrolling( false )
  264 + mScrolling( false ),
  265 + mImagesLoaded( 0 )
264 266 {
265 267 std::cout << "ImageScalingIrregularGridController::ImageScalingIrregularGridController" << std::endl;
266 268  
... ... @@ -274,6 +276,21 @@ public:
274 276 }
275 277  
276 278 /**
  279 + * Called everytime an ImageView has loaded it's image
  280 + */
  281 + void ResourceReadySignal( Toolkit::Control control )
  282 + {
  283 + mImagesLoaded++;
  284 + // To allow fast startup, we only place a small number of ImageViews on stage first
  285 + if ( mImagesLoaded == INITIAL_IMAGES_TO_LOAD )
  286 + {
  287 + // Adding the ImageViews to the stage will trigger loading of the Images
  288 + mGridActor.Add( mOffStageImageViews );
  289 + }
  290 + }
  291 +
  292 +
  293 + /**
277 294 * One-time setup in response to Application InitSignal.
278 295 */
279 296 void Create( Application& application )
... ... @@ -306,6 +323,11 @@ public:
306 323  
307 324 SetTitle( APPLICATION_TITLE );
308 325  
  326 + mOffStageImageViews = Actor::New();
  327 + mOffStageImageViews.SetAnchorPoint( AnchorPoint::CENTER );
  328 + mOffStageImageViews.SetParentOrigin(ParentOrigin::CENTER);
  329 + mOffStageImageViews.SetResizePolicy( ResizePolicy::FILL_TO_PARENT, Dimension::ALL_DIMENSIONS );
  330 +
309 331 // Build the main content of the widow:
310 332 PopulateContentLayer( DEFAULT_SCALING_MODE );
311 333 }
... ... @@ -442,8 +464,9 @@ public:
442 464 outFieldHeight = actualGridHeight * cellHeight;
443 465 const Vector2 gridOrigin = Vector2( -fieldWidth * 0.5f, -outFieldHeight * 0.5 );
444 466  
  467 + unsigned int count = 0;
445 468 // Build the image actors in their right locations in their parent's frame:
446   - for( std::vector<PositionedImage>::const_iterator i = placedImages.begin(), end = placedImages.end(); i != end; ++i )
  469 + for( std::vector<PositionedImage>::const_iterator i = placedImages.begin(), end = placedImages.end(); i != end; ++i, ++count )
447 470 {
448 471 const PositionedImage& imageSource = *i;
449 472 const Vector2 imageSize = imageSource.imageGridDims * cellSize - Vector2( GRID_CELL_PADDING * 2, GRID_CELL_PADDING * 2 );
... ... @@ -454,11 +477,20 @@ public:
454 477 image.SetPosition( Vector3( imagePosition.x, imagePosition.y, 0 ) );
455 478 image.SetSize( imageSize );
456 479 image.TouchSignal().Connect( this, &ImageScalingIrregularGridController::OnTouchImage );
  480 + Toolkit::DevelControl::ResourceReadySignal( image).Connect( this, &ImageScalingIrregularGridController::ResourceReadySignal);
457 481 mFittingModes[image.GetId()] = fittingMode;
458 482 mResourceUrls[image.GetId()] = imageSource.configuration.path;
459 483 mSizes[image.GetId()] = imageSize;
460   -
461   - gridActor.Add( image );
  484 + if ( count < INITIAL_IMAGES_TO_LOAD )
  485 + {
  486 + gridActor.Add( image );
  487 + }
  488 + else
  489 + {
  490 + // Store the ImageView in an offstage actor until the inital batch of ImageViews have finished loading their images
  491 + // Required
  492 + mOffStageImageViews.Add( image );
  493 + }
462 494 }
463 495  
464 496 return gridActor;
... ... @@ -601,6 +633,7 @@ private:
601 633 Toolkit::ToolBar mToolBar; ///< The View's Toolbar.
602 634 TextLabel mTitleActor; ///< The Toolbar's Title.
603 635 Actor mGridActor; ///< The container for the grid of images
  636 + Actor mOffStageImageViews; ///< ImageViews held off stage until the inital batch have loaded their images
604 637 ScrollView mScrollView; ///< ScrollView UI Component
605 638 ScrollBar mScrollBarVertical;
606 639 ScrollBar mScrollBarHorizontal;
... ... @@ -608,6 +641,7 @@ private:
608 641 std::map<unsigned, Dali::FittingMode::Type> mFittingModes; ///< Stores the current scaling mode of each image, keyed by image actor id.
609 642 std::map<unsigned, std::string> mResourceUrls; ///< Stores the url of each image, keyed by image actor id.
610 643 std::map<unsigned, Vector2> mSizes; ///< Stores the current size of each image, keyed by image actor id.
  644 + unsigned int mImagesLoaded; ///< How many images have been loaded
611 645 };
612 646  
613 647 void RunTest( Application& application )
... ...
packaging/com.samsung.dali-demo.spec
... ... @@ -2,7 +2,7 @@
2 2  
3 3 Name: com.samsung.dali-demo
4 4 Summary: The OpenGLES Canvas Core Demo
5   -Version: 1.2.44
  5 +Version: 1.2.45
6 6 Release: 1
7 7 Group: System/Libraries
8 8 License: Apache-2.0
... ...
resources/po/en_GB.po
... ... @@ -22,6 +22,9 @@ msgstr &quot;Buttons&quot;
22 22 msgid "DALI_DEMO_STR_TITLE_CLIPPING"
23 23 msgstr "Clipping"
24 24  
  25 +msgid "DALI_DEMO_STR_TITLE_CLIPPING_DRAW_ORDER"
  26 +msgstr "Clipping Draw Order"
  27 +
25 28 msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT"
26 29 msgstr "Colour Gradient"
27 30  
... ...
resources/po/en_US.po
... ... @@ -22,6 +22,9 @@ msgstr &quot;Buttons&quot;
22 22 msgid "DALI_DEMO_STR_TITLE_CLIPPING"
23 23 msgstr "Clipping"
24 24  
  25 +msgid "DALI_DEMO_STR_TITLE_CLIPPING_DRAW_ORDER"
  26 +msgstr "Clipping Draw Order"
  27 +
25 28 msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT"
26 29 msgstr "Color Gradient"
27 30  
... ...
resources/po/ko.po
... ... @@ -19,6 +19,9 @@ msgstr &quot;버튼&quot;
19 19 msgid "DALI_DEMO_STR_TITLE_CLIPPING"
20 20 msgstr "깎는"
21 21  
  22 +msgid "DALI_DEMO_STR_TITLE_CLIPPING_DRAW_ORDER"
  23 +msgstr "드로잉 순서를 클리핑"
  24 +
22 25 msgid "DALI_DEMO_STR_TITLE_COLOR_GRADIENT"
23 26 msgstr "색상 그라디언트"
24 27  
... ...
shared/dali-demo-strings.h
... ... @@ -40,6 +40,7 @@ extern &quot;C&quot;
40 40 #define DALI_DEMO_STR_TITLE_BUBBLES dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_BUBBLES")
41 41 #define DALI_DEMO_STR_TITLE_BUTTONS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_BUTTONS")
42 42 #define DALI_DEMO_STR_TITLE_CLIPPING dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CLIPPING")
  43 +#define DALI_DEMO_STR_TITLE_CLIPPING_DRAW_ORDER dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CLIPPING_DRAW_ORDER")
43 44 #define DALI_DEMO_STR_TITLE_COLOR_GRADIENT dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_COLOR_GRADIENT")
44 45 #define DALI_DEMO_STR_TITLE_CONTACT_CARDS dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CONTACT_CARDS")
45 46 #define DALI_DEMO_STR_TITLE_CUBE_TRANSITION dgettext(DALI_DEMO_DOMAIN_LOCAL, "DALI_DEMO_STR_TITLE_CUBE_TRANSITION")
... ... @@ -107,6 +108,7 @@ extern &quot;C&quot;
107 108 #define DALI_DEMO_STR_TITLE_BUBBLES "Bubbles"
108 109 #define DALI_DEMO_STR_TITLE_BUTTONS "Buttons"
109 110 #define DALI_DEMO_STR_TITLE_CLIPPING "Clipping"
  111 +#define DALI_DEMO_STR_TITLE_CLIPPING_DRAW_ORDER "Clipping Draw Order"
110 112 #define DALI_DEMO_STR_TITLE_COLOR_GRADIENT "Color Gradient"
111 113 #define DALI_DEMO_STR_TITLE_CONTACT_CARDS "Contact Cards"
112 114 #define DALI_DEMO_STR_TITLE_CUBE_TRANSITION "Cube Effect"
... ...
shared/multi-language-strings.h
... ... @@ -207,13 +207,23 @@ namespace MultiLanguageStrings
207 207 "Molo Lizwe"
208 208 },
209 209 {
210   - "Amharic",
211   - "(አማርኛ)",
  210 + "አማርኛ",
  211 + "(Amharic)",
212 212 "ያስገቡት PIN ትክክለኛ አይደለም። እባክዎ እንደገና ይሞክሩ።"
  213 + },
  214 + {
  215 + "ᱚᱞ ᱪᱤᱠᱤ",
  216 + "(Ol Chiki)",
  217 + "ᱥᱟᱱᱛᱟᱞᱤ ᱵᱟᱝᱞᱟᱫᱮᱥ ᱵᱷᱩᱴᱟᱱ ᱱᱮᱯᱟᱲ"
  218 + },
  219 + {
  220 + "ꯃꯤꯇꯩ ꯃꯌꯦꯛ",
  221 + "(Meitei)",
  222 + "ꯅꯡ ꯀꯗꯥꯏꯗꯒꯤꯅꯣ ꯁꯣꯝꯒ ꯎꯟꯅꯖꯕ ꯁꯦ ꯌꯥꯝ ꯅꯨꯉꯥꯏꯖꯩ ꯎꯗꯕ ꯀꯨꯏꯔꯦ"
213 223 }
214 224 };
215 225  
216   - const unsigned int NUMBER_OF_LANGUAGES = 36u;
  226 + const unsigned int NUMBER_OF_LANGUAGES = 38u;
217 227  
218 228 } // MultiLanguageStrings
219 229  
... ...