../dali-toolkit/dali-toolkit-test-utils/toolkit-tts-player.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-vector-animation-renderer.cpp
../dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/dali-toolkit-test-suite-utils.cpp
../dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp
../dali-toolkit/dali-toolkit-test-utils/mesh-builder.cpp
../dali-toolkit/dali-toolkit-test-utils/test-actor-utils.cpp
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
void TestDebugVisual( Visual::Base& visual, Visual::Type actualType, Vector2 expectedNaturalSize )
{
- DALI_TEST_CHECK( &typeid( Toolkit::Internal::WireframeVisual ) == &typeid( GetImplementation(visual) ) );
+ {
+ auto& impl = GetImplementation( visual );
+ DALI_TEST_CHECK( &typeid( Toolkit::Internal::WireframeVisual ) == &typeid( impl ) );
+ }
Vector2 naturalSize;
visual.GetNaturalSize( naturalSize );
Visual::Base textVisual = factory.CreateVisual( propertyMap7 );
DALI_TEST_CHECK( textVisual );
- DALI_TEST_CHECK( &typeid( Toolkit::Internal::WireframeVisual ) == &typeid( GetImplementation(textVisual) ) );
+ {
+ auto&& impl = GetImplementation( textVisual );
+ DALI_TEST_CHECK( &typeid( Toolkit::Internal::WireframeVisual ) == &typeid( impl ) );
+ }
Vector2 naturalSize;
textVisual.GetNaturalSize( naturalSize );
DALI_TEST_EQUALS( naturalSize, Vector2( 80.f, 20.f ), Math::MACHINE_EPSILON_1000, TEST_LOCATION );
const float height = textVisual.GetHeightForWidth( 40.f );
- DALI_TEST_EQUALS( height, 40.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
+ DALI_TEST_EQUALS( height, 38.f, Math::MACHINE_EPSILON_1000, TEST_LOCATION );
// Test that NPatchVisual is replaced with debug visual
// TEST_NPATCH_FILE_NAME: image_01.9.jpg
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
namespace
{
-const char* const OPTION_SELECT_WORD("option-select_word"); // "Select Word" popup option.
const char* const OPTION_SELECT_ALL("option-select_all"); // "Select All" popup option.
const char* const OPTION_CUT("optionCut"); // "Cut" popup option.
const char* const OPTION_COPY("optionCopy"); // "Copy" popup option.
// single line, line spacing = 0px
{
const float EXPECTED_SPACING = 0.0f;
- const Vector2 EXPECTED_LAYOUT_SIZE( 326.0f, 19.0f);
- const Vector3 EXPECTED_NATURAL_SIZE( 326.0f, 20.0f, 0.0f );
+ const Vector2 EXPECTED_LAYOUT_SIZE( 343.0f, 19.0f);
+ const Vector3 EXPECTED_NATURAL_SIZE( 344.0f, 20.0f, 0.0f );
controller->SetText(textSingle);
controller->Relayout(size);
// single line, line spacing = 20px
{
const float EXPECTED_SPACING = 20.0f;
- const Vector2 EXPECTED_LAYOUT_SIZE( 326.0f, 19.0f );
- const Vector3 EXPECTED_NATURAL_SIZE( 326.0f, 40.0f, 0.0f );
+ const Vector2 EXPECTED_LAYOUT_SIZE( 343.0f, 19.0f );
+ const Vector3 EXPECTED_NATURAL_SIZE( 344.0f, 40.0f, 0.0f );
controller->SetText(textSingle);
controller->Relayout(size);
// multi-line, line spacing = 0px
{
const float EXPECTED_SPACING = 0.0f;
- const Vector2 EXPECTED_LAYOUT_SIZE( 318.0f, 39.0f );
- const Vector3 EXPECTED_NATURAL_SIZE( 116.0f, 58.0f, 0.0f );
+ const Vector2 EXPECTED_LAYOUT_SIZE( 333.0f, 39.0f );
+ const Vector3 EXPECTED_NATURAL_SIZE( 120.0f, 58.0f, 0.0f );
controller->SetText(textMulti);
controller->Relayout(size);
// multi-line, line spacing = 20px
{
const float EXPECTED_SPACING = 20.0f;
- const Vector2 EXPECTED_LAYOUT_SIZE( 115.0f, 57.0f );
- const Vector3 EXPECTED_NATURAL_SIZE( 116.0f, 118.0f, 0.0f );
+ const Vector2 EXPECTED_LAYOUT_SIZE( 119.0f, 57.0f );
+ const Vector3 EXPECTED_NATURAL_SIZE( 120.0f, 118.0f, 0.0f );
controller->SetText(textMulti);
controller->Relayout(size);
// multi-line, line spacing = 30px
{
const float EXPECTED_SPACING = 30.0f;
- const Vector2 EXPECTED_LAYOUT_SIZE( 115.0f, 117.0f );
- const Vector3 EXPECTED_NATURAL_SIZE( 116.0f, 148.0f, 0.0f );
+ const Vector2 EXPECTED_LAYOUT_SIZE( 119.0f, 117.0f );
+ const Vector3 EXPECTED_NATURAL_SIZE( 120.0f, 148.0f, 0.0f );
controller->SetText(textMulti);
controller->Relayout(size);
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
Vector<FontDescriptionRun> fontDescriptionRuns;
fontDescriptionRuns.PushBack( fontDescriptionRun );
Size textArea(1.f, 1.f);
- Size layoutSize(80.f, 20.f);
+ Size layoutSize(80.f, 19.f);
float positions[] = { 1.f, -12.f, 11.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 51.f, -9.f, 61.f, -9.f, 67.f, -13.f, 70.f, -13.f };
struct LineRun line =
{
{ 0u, 11u },
80.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
fontDescriptionRuns.PushBack( fontDescriptionRun1 );
fontDescriptionRuns.PushBack( fontDescriptionRun2 );
Size textArea(100.f, 300.f);
- Size layoutSize(95.f, 97.f);
+ Size layoutSize(95.f, 95.f);
float positions[] =
{
1.f, -12.f, 11.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 51.f, -9.f, 61.f, -9.f, 67.f, -13.f, 70.f, -13.f, 79.f, -0.f,
{ 0u, 12u },
80.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 12u, 6u },
43.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
fontDescriptionRuns.PushBack( fontDescriptionRun4 );
fontDescriptionRuns.PushBack( fontDescriptionRun5 );
Size textArea(100.f, 300.f);
- Size layoutSize(80.f, 120.f);
+ Size layoutSize(80.f, 114.f);
float positions[] =
{
1.f, -12.f, 11.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 51.f, -9.f, 61.f, -9.f, 67.f, -13.f, 70.f, -13.f, 79.f, -0.f,
{ 0u, 12u },
80.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 12u, 10u },
76.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 22u, 6u },
34.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 28u, 10u },
67.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 38u, 12u },
78.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 50u, 5u },
43.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
Vector<FontDescriptionRun> fontDescriptionRuns;
fontDescriptionRuns.PushBack( fontDescriptionRun );
Size textArea(100.f, 300.f);
- Size layoutSize(96.f, 60.f);
+ Size layoutSize(96.f, 57.f);
float positions[] =
{
1.f, -12.f, 11.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -9.f, 47.f, -9.f, 57.f, -9.f, 63.f, -13.f, 66.f, -13.f, 75.f, -13.f, 84.f, -9.f,
{ 0u, 12u },
93.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 12u, 12u },
96.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 24u, 5u },
43.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
Vector<FontDescriptionRun> fontDescriptionRuns;
fontDescriptionRuns.PushBack( fontDescriptionRun );
Size textArea(100.f, 300.f);
- Size layoutSize(83.f, 40.f);
+ Size layoutSize(83.f, 38.f);
float positions[] =
{
1.f, -12.f, 11.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 51.f, -9.f, 61.f, -9.f, 67.f, -13.f, 70.f, -13.f, 79.f, -2.f, 82.f, -12.f
{ 0u, 13u },
83.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
false,
{ 13u, 0u },
0.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
fontDescriptionRuns.PushBack( fontDescriptionRun2 );
fontDescriptionRuns.PushBack( fontDescriptionRun3 );
Size textArea(100.f, 300.f);
- Size layoutSize(88.f, 53.f);
+ Size layoutSize(89.f, 51.f);
float positions[] =
{
- 1.f, -12.f, 11.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -14.f, 59.f, -9.f, 69.f, -9.f, 75.f, -13.f, 78.f, -13.f, 87.f, -0.f,
+ 1.f, -12.f, 11.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -14.f, 60.f, -9.f, 70.f, -9.f, 76.f, -13.f, 79.f, -13.f, 88.f, -0.f,
0.f, -13.f, 9.f, -9.f, 18.f, -9.f, 30.f, -9.f, 39.f, -2.f
};
struct LineRun line0 =
{
{ 0u, 12u },
{ 0u, 12u },
- 88.f,
+ 89.f,
25.f,
- -8.f,
+ -7.f,
4.f,
0.f,
0.f,
{ 12u, 5u },
43.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
fontDescriptionRuns.PushBack( fontDescriptionRun16 );
fontDescriptionRuns.PushBack( fontDescriptionRun17 );
Size textArea(100.f, 300.f);
- Size layoutSize(92.f, 380.f);
+ Size layoutSize(92.f, 361.f);
float positions[] =
{
1.f, -12.f, 11.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 51.f, -9.f, 61.f, -9.f, 67.f, -13.f, 70.f, -13.f, 79.f, -0.f,
{ 0u, 12u },
80.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 12u, 10u },
76.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 22u, 6u },
34.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 28u, 20u },
92.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 48u, 11u },
76.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 59u, 5u },
31.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 64u, 10u },
67.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 74u, 12u },
78.f,
15.f,
- -5.f,
+ -4.f,
4.f,
1.f,
0.f,
{ 86u, 6u },
43.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 92u, 12u },
78.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 104u, 19u },
90.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 123u, 5u },
31.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 128u, 12u },
80.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 140u, 10u },
76.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 150u, 6u },
34.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 156u, 10u },
67.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 166u, 12u },
79.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 178u, 14u },
55.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 192u, 0u },
0.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
fontDescriptionRuns.PushBack( fontDescriptionRun16 );
fontDescriptionRuns.PushBack( fontDescriptionRun17 );
Size textArea(100.f, 300.f);
- Size layoutSize(92.f, 380.f);
+ Size layoutSize(92.f, 361.f);
float positions[] =
{
1.f, -12.f, 11.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 51.f, -9.f, 61.f, -9.f, 67.f, -13.f, 70.f, -13.f, 79.f, -0.f,
{ 0u, 12u },
80.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 12u, 10u },
76.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 22u, 6u },
34.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 28u, 20u },
92.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 48u, 11u },
76.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 59u, 5u },
31.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 64u, 10u },
67.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 74u, 12u },
78.f,
15.f,
- -5.f,
+ -4.f,
4.f,
1.f,
0.f,
{ 86u, 6u },
43.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 92u, 12u },
78.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 104u, 19u },
90.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 123u, 5u },
31.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 128u, 12u },
80.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 140u, 10u },
76.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 150u, 6u },
34.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 156u, 10u },
67.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 166u, 12u },
79.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 178u, 14u },
55.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 192u, 0u },
0.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
fontDescriptionRuns.PushBack( fontDescriptionRun16 );
fontDescriptionRuns.PushBack( fontDescriptionRun17 );
Size textArea(100.f, 300.f);
- Size layoutSize(92.f, 380.f);
+ Size layoutSize(92.f, 361.f);
float positions[] =
{
1.f, -12.f, 11.f, -9.f, 20.f, -13.f, 24.f, -13.f, 27.f, -9.f, 36.f, -0.f, 40.f, -9.f, 51.f, -9.f, 61.f, -9.f, 67.f, -13.f, 70.f, -13.f, 79.f, -0.f,
{ 0u, 12u },
80.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 12u, 10u },
76.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 22u, 6u },
34.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 28u, 20u },
92.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 48u, 11u },
76.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 59u, 5u },
31.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 64u, 10u },
67.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 74u, 12u },
78.f,
15.f,
- -5.f,
+ -4.f,
4.f,
1.f,
0.f,
{ 86u, 6u },
43.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 92u, 12u },
78.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 104u, 19u },
90.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 123u, 5u },
31.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 128u, 12u },
80.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 140u, 10u },
76.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 150u, 6u },
34.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 156u, 10u },
67.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 166u, 12u },
79.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 178u, 14u },
55.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 192u, 0u },
0.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
{ 0u, 13u },
93.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
};
Size textArea( 100.f, 50.f );
- Size layoutSize( 100.f, 20.f );
+ Size layoutSize( 100.f, 19.f );
LayoutTextData data =
{
{ 0u, 12u },
80.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
{ 12u, 12u },
93.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
};
Size textArea( 100.f, 50.f );
- Size layoutSize( 100.f, 40.f );
+ Size layoutSize( 100.f, 38.f );
LayoutTextData data =
{
{ 0u, 16u },
95.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
};
Size textArea( 100.f, 50.f );
- Size layoutSize( 100.f, 20.f );
+ Size layoutSize( 100.f, 19.f );
LayoutTextData data =
{
{ 0u, 16u },
96.f,
15.f,
- -5.f,
+ -4.f,
3.f,
0.f,
0.f,
{ 16u, 18u },
97.f,
15.f,
- -5.f,
+ -4.f,
4.f,
0.f,
0.f,
};
Size textArea( 100.f, 50.f );
- Size layoutSize( 100.f, 40.f );
+ Size layoutSize( 100.f, 38.f );
LayoutTextData data =
{
{ 0u, 11u },
80.f,
15.f,
- -5.f,
+ -4.f,
0.f,
0.f,
0.f,
false,
- true
+ false
};
Vector<LineRun> lines;
lines.PushBack( line01 );
};
Size textArea( 100.f, 19.f );
- Size layoutSize( 100.f, 20.f );
+ Size layoutSize( 80.f, 19.f );
LayoutTextData data =
{
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
struct GlyphInfoData glyphs04[] =
{
- { 2u, 160u, 0.f, 0.f, 0.f, 0.f, 5.f, 0.f },
- { 2u, 123u, 0.f, 0.f, 0.f, 0.f, 9.f, 0.f },
- { 2u, 153u, 0.f, 0.f, 0.f, 0.f, 5.f, 0.f },
- { 2u, 160u, 0.f, 0.f, 0.f, 0.f, 5.f, 0.f },
- { 2u, 150u, 0.f, 0.f, 0.f, 0.f, 14.f, 0.f },
- { 2u, 153u, 0.f, 0.f, 0.f, 0.f, 5.f, 0.f },
- { 2u, 160u, 0.f, 0.f, 0.f, 0.f, 5.f, 0.f },
- { 2u, 151u, 0.f, 0.f, 0.f, 0.f, 12.f, 0.f },
- { 2u, 153u, 0.f, 0.f, 0.f, 0.f, 5.f, 0.f },
- { 2u, 160u, 0.f, 0.f, 0.f, 0.f, 5.f, 0.f },
- { 2u, 147u, 0.f, 0.f, 0.f, 0.f, 9.f, 0.f },
- { 2u, 153u, 0.f, 0.f, 0.f, 0.f, 5.f, 0.f },
+ { 2u, 1733u, 0.f, 0.f, 0.f, 0.f, 8.f, 0.f },
+ { 2u, 1693u, 0.f, 0.f, 0.f, 0.f, 13.f, 0.f },
+ { 2u, 1725u, 0.f, 0.f, 0.f, 0.f, 8.f, 0.f },
+ { 2u, 1733u, 0.f, 0.f, 0.f, 0.f, 8.f, 0.f },
+ { 2u, 1721u, 0.f, 0.f, 0.f, 0.f, 20.f, 0.f },
+ { 2u, 1725u, 0.f, 0.f, 0.f, 0.f, 8.f, 0.f },
+ { 2u, 1733u, 0.f, 0.f, 0.f, 0.f, 8.f, 0.f },
+ { 2u, 1722u, 0.f, 0.f, 0.f, 0.f, 18.f, 0.f },
+ { 2u, 1725u, 0.f, 0.f, 0.f, 0.f, 8.f, 0.f },
+ { 2u, 1733u, 0.f, 0.f, 0.f, 0.f, 8.f, 0.f },
+ { 2u, 1718u, 0.f, 0.f, 0.f, 0.f, 14.f, 0.f },
+ { 2u, 1725u, 0.f, 0.f, 0.f, 0.f, 8.f, 0.f },
};
CharacterIndex characterIndices04[] = { 0u, 0u, 0u, 2u, 2u, 2u, 4u, 4u, 4u, 6u, 6u, 6u };
{ 1u, 3u, 0.f, 0.f, 0.f, 0.f, 5.f, 0.f },
{ 1u, 71u, 0.f, 0.f, 0.f, 0.f, 10.f, 0.f },
{ 1u, 72u, 0.f, 0.f, 0.f, 0.f, 9.f, 0.f },
- { 1u, 5034u, 0.f, 0.f, 0.f, 0.f, 10.f, 0.f },
+ { 1u, 5039u, 0.f, 0.f, 0.f, 0.f, 10.f, 0.f },
{ 1u, 81u, 0.f, 0.f, 0.f, 0.f, 10.f, 0.f },
{ 1u, 76u, 0.f, 0.f, 0.f, 0.f, 4.f, 0.f },
{ 1u, 72u, 0.f, 0.f, 0.f, 0.f, 9.f, 0.f },
struct GlyphInfoData glyphs01[] =
{
- { 2u, 14750u, 0.f, 0.f, 0.f, 0.f, 16.f, 0.f, true, true },
- { 2u, 9802u, 0.f, 0.f, 0.f, 0.f, 16.f, 0.f, true, true },
- { 2u, 12811u, 0.f, 0.f, 0.f, 0.f, 16.f, 0.f, true, true },
+ { 2u, 4857u, 0.f, 0.f, 0.f, 0.f, 15.f, 0.f, true, false },
+ { 2u, 7316u, 0.f, 0.f, 0.f, 0.f, 15.f, 0.f, true, false },
+ { 2u, 4364u, 0.f, 0.f, 0.f, 0.f, 15.f, 0.f, true, false },
};
struct GlyphInfoData glyphs02[] =
{
- { 2u, 14750u, 0.f, 0.f, 0.f, 0.f, 16.f, 0.f, false, false },
- { 2u, 9802u, 0.f, 0.f, 0.f, 0.f, 16.f, 0.f, false, true },
- { 2u, 12811u, 0.f, 0.f, 0.f, 0.f, 16.f, 0.f, true, false },
+ { 2u, 4857u, 0.f, 0.f, 0.f, 0.f, 15.f, 0.f, false, false },
+ { 2u, 7316u, 0.f, 0.f, 0.f, 0.f, 15.f, 0.f, false, false },
+ { 2u, 4364u, 0.f, 0.f, 0.f, 0.f, 15.f, 0.f, true, false },
};
CharacterIndex characterIndices[] = { 0u, 1u, 2u };
tet_result(TET_PASS);
END_TEST;
-}
\ No newline at end of file
+}
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
"Aliquip sanctůs delicáta quí ěá, et natum aliquam est?\n"
"Asšúm sapěret usu ůť.\n"
"Síť ut apeirián laboramúš percipitur, sůas hařum ín éos?\n";
-const Vector2 LOREM_SCROLL_POSITION( 0.f, -208.f );
-const Length LOREM_NUMBER_OF_LINES = 32u;
+const Vector2 LOREM_SCROLL_POSITION( 0.f, -265.f );
+const Length LOREM_NUMBER_OF_LINES = 35u;
const Length LOREM_NUMBER_OF_LINES_ELIDED = 21u;
const Length LOREM_NUMBER_OF_GLYPHS = 632;
-const Length LOREM_NUMBER_OF_GLYPHS_ELIDED = 397u;
+const Length LOREM_NUMBER_OF_GLYPHS_ELIDED = 395u;
// The expected layout size for UtcDaliTextViewModelGetLayoutSize
-const Size LAYOUT_SIZE( 190.f, 48.f );
+const Size LAYOUT_SIZE( 197.f, 45.f );
// The expected color indices for UtcDaliTextViewModelGetColors
const ColorIndex COLOR_INDICES[] = { 0u, 0u, 0u, 0u, 0u, 0u, 1u, 1u, 1u, 2u, 2u, 2u, 2u, 2u, 1u, 1u, 1u, 1u, 1u, 3u, 1u, 1u, 1u, 0u, 0u, 0u, 0u };
Size textSize00( 100.f, 100.f );
Size textSize01( 80.f, 100.f );
- float positions01[] = { 0.f, 9.f, 17.f, 27.f, 35.f, 37.f, 46.f, 56.f };
+ float positions01[] = { 0.f, 8.f, 16.f, 26.f, 33.f, 41.f, 45.f, 54.f, 64.0f };
Size textSize02( 80.f, 100.f );
- float positions02[] = { 72.f, 63.f, 54.f, 50.f, 43.f, 38.f, 30.f, 11.f };
+ float positions02[] = { 72.f, 63.f, 54.f, 50.f, 43.f, 38.f, 30.f, 9.0f };
Size textSize03( 80.f, 100.f );
- float positions03[] = { 77.f, 76.f, 71.f, 62.f, 59.f, 52.f, 47.f, 42.f, 39.f, 35.f, 32.f, 13.f };
+ float positions03[] = { 78.f, 73.f, 70.f, 65.f, 57.f, 55.f, 51.f, 50.f, 45.f, 35.f, 32.f, 24.f, 7.f };
Size textSize04( 80.f, 10.f );
float positions04[] = { 2.f };
"<font family='TizenSans'>Lorem ipsum dolor sit amet, aeque definiebas ea mei, posse iracundia ne cum.</font>",
textSize01,
5u,
- 42u,
+ 37u,
positions01
},
{
"<font family='TizenSansArabic'>عل النفط ديسمبر الإمداد بال, بين وترك شعار هو. لمّ من المبرمة النفط بالسيطرة, أم يتم تحرّك وبغطاء, عدم في لإعادة وإقامة رجوعهم.</font>",
textSize03,
5u,
- 79u,
+ 74u,
positions03
},
{
using namespace Dali::Toolkit::Internal;
+
+void utc_dali_toolkit_texture_manager_startup(void)
+{
+ setenv( "LOG_TEXTURE_MANAGER", "3", 1 );
+ test_return_value = TET_UNDEF;
+}
+
+void utc_dali_toolkit_texture_manager_cleanup(void)
+{
+ test_return_value = TET_PASS;
+}
+
class TestObserver : public Dali::Toolkit::TextureUploadObserver
{
public:
../dali-toolkit/dali-toolkit-test-utils/toolkit-virtual-keyboard.cpp
../dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp
../dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/dali-toolkit-test-suite-utils.cpp
../dali-toolkit/dali-toolkit-test-utils/test-animation-data.cpp
../dali-toolkit/dali-toolkit-test-utils/test-button.cpp
../dali-toolkit/dali-toolkit-test-utils/test-application.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-timer.cpp
../dali-toolkit/dali-toolkit-test-utils/toolkit-tts-player.cpp
../dali-toolkit/dali-toolkit-test-utils/dali-test-suite-utils.cpp
+ ../dali-toolkit/dali-toolkit-test-utils/dali-toolkit-test-suite-utils.cpp
../dali-toolkit/dali-toolkit-test-utils/dummy-control.cpp
../dali-toolkit/dali-toolkit-test-utils/mesh-builder.cpp
../dali-toolkit/dali-toolkit-test-utils/test-actor-utils.cpp
dali-toolkit-test-utils/toolkit-web-engine.cpp
dali-toolkit-test-utils/toolkit-trigger-event-factory.cpp
dali-toolkit-test-utils/dali-test-suite-utils.cpp
+ dali-toolkit-test-utils/dali-toolkit-test-suite-utils.cpp
dali-toolkit-test-utils/dummy-control.cpp
dali-toolkit-test-utils/layout-utils.cpp
dali-toolkit-test-utils/mesh-builder.cpp
#define TEST_INTERNAL_CUSTOM_LAYOUT_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
*/
void MeasureChildren( Dali::Toolkit::Internal::LayoutItemPtr childLayout, MeasureSpec widthMeasureSpec, MeasureSpec heightMeasureSpec, LayoutLength resultingWidth, LayoutLength resultingHeight );
+ using Dali::Toolkit::Internal::LayoutGroup::MeasureChildren; ///< To tell the compiler that we really do want to overload MeasureChildren in this class & were not trying to override it
+
private:
int mBehaviourFlags; // flags to alter behaviour of this custom layout
--- /dev/null
+/*
+ * Copyright (c) 2019 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "dali-toolkit-test-suite-utils.h"
+
+
+std::ostream& operator<<( std::ostream& ostream, Dali::Toolkit::Visual::ResourceStatus status )
+{
+ switch(status)
+ {
+ case Dali::Toolkit::Visual::ResourceStatus::PREPARING:
+ {
+ ostream << "PREPARING";
+ break;
+ }
+ case Dali::Toolkit::Visual::ResourceStatus::READY:
+ {
+ ostream << "READY";
+ break;
+ }
+ case Dali::Toolkit::Visual::ResourceStatus::FAILED:
+ {
+ ostream << "FAILED";
+ break;
+ }
+ }
+ return ostream;
+}
#define __DALI_TOOLKIT_TEST_SUITE_UTILS_H__
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
*
*/
+#include <iostream>
+#include <dali-toolkit/public-api/visuals/visual-properties.h>
+
+// Put any toolkit specific operators for DALI_TEST_CHECK template here, before dali-test-suite-utils.h.
+
+std::ostream& operator<<( std::ostream& ostream, Dali::Toolkit::Visual::ResourceStatus status );
+
// INTERNAL INCLUDES
#include <dali-test-suite-utils.h>
struct timespec now;
clock_gettime( CLOCK_REALTIME, &now );
if( now.tv_nsec < 999900000 ) // 999, 900, 000
- now.tv_nsec += 100000;
+ now.tv_nsec += 1000;
else
{
now.tv_sec += 1;
Dali::CallbackBase::Execute( *callback );
triggerCount--;
}
+ if( triggerCount <= 0 )
+ {
+ break;
+ }
}
}
clock_gettime( CLOCK_REALTIME, &now );
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
#include <dali/public-api/object/base-object.h>
#include <dali/devel-api/common/map-wrapper.h>
#include <dali/public-api/signals/dali-signal.h>
+#include <dali/integration-api/processor-interface.h>
namespace Dali
{
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
{
public:
FontClient()
- : mDpiHorizontal( 0 ),
- mDpiVertical( 0 )
+ : mGlyphInfo()
{
}
const GlyphInfo& GetEllipsisGlyph( PointSize26Dot6 pointSize ){return mGlyphInfo;}
bool IsColorGlyph( FontId fontId, GlyphIndex glyphIndex ){return false;}
private:
- unsigned int mDpiHorizontal;
- unsigned int mDpiVertical;
GlyphInfo mGlyphInfo;
}; // class FontClient
class Shaping : public BaseObject
{
public:
- Shaping() : mText(NULL)
- {}
+ Shaping()
+ : mText( NULL ),
+ mNumChars( 0 )
+ {
+ }
~Shaping()
{
return static_cast<TextAbstraction::Internal::FontClient&>(handle);
}
-inline static const TextAbstraction::Internal::FontClient& GetImplementation(const TextAbstraction::FontClient& fontClient)
-{
- DALI_ASSERT_ALWAYS( fontClient && "fontClient handle is empty" );
- const BaseObject& handle = fontClient.GetBaseObject();
- return static_cast<const TextAbstraction::Internal::FontClient&>(handle);
-}
-
inline static TextAbstraction::Internal::Shaping& GetImplementation(TextAbstraction::Shaping& shaping)
{
DALI_ASSERT_ALWAYS( shaping && "shaping handle is empty" );
return static_cast<TextAbstraction::Internal::Shaping&>(handle);
}
-inline static const TextAbstraction::Internal::Shaping& GetImplementation(const TextAbstraction::Shaping& shaping)
-{
- DALI_ASSERT_ALWAYS( shaping && "shaping handle is empty" );
- const BaseObject& handle = shaping.GetBaseObject();
- return static_cast<const TextAbstraction::Internal::Shaping&>(handle);
-}
-
////////////////////////////////////////////////////////////////////////////////
/******************************************************************************/
{
public:
- VectorAnimationRenderer( const std::string& url, Dali::Renderer renderer, uint32_t width, uint32_t height )
+ VectorAnimationRenderer( const std::string& url )
: mUrl( url ),
- mRenderer( renderer ),
- mWidth( width ),
- mHeight( height )
+ mRenderer(),
+ mWidth( 0 ),
+ mHeight( 0 )
{
}
+ void SetRenderer( Dali::Renderer renderer )
+ {
+ mRenderer = renderer;
+ }
+
void SetSize( uint32_t width, uint32_t height )
{
mWidth = width;
/********************************* PUBLIC CLASS *******************************/
/********************************************************************************/
-VectorAnimationRenderer VectorAnimationRenderer::New( const std::string& url, Renderer renderer, uint32_t width, uint32_t height )
+VectorAnimationRenderer VectorAnimationRenderer::New( const std::string& url )
{
- Internal::Adaptor::VectorAnimationRenderer* animationRenderer = new Internal::Adaptor::VectorAnimationRenderer( url, renderer, width, height );
+ Internal::Adaptor::VectorAnimationRenderer* animationRenderer = new Internal::Adaptor::VectorAnimationRenderer( url );
return VectorAnimationRenderer( animationRenderer );
}
return *this;
}
+void VectorAnimationRenderer::SetRenderer( Renderer renderer )
+{
+ Internal::Adaptor::GetImplementation( *this ).SetRenderer( renderer );
+}
+
void VectorAnimationRenderer::SetSize( uint32_t width, uint32_t height )
{
Internal::Adaptor::GetImplementation( *this ).SetSize( width, height );
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
public:
VideoPlayer()
+ : mUrl(),
+ mVolumeLeft( 0.0f ),
+ mVolumeRight( 0.0f ),
+ mFinishedSignal(),
+ mMuted( false ),
+ mLooping( false),
+ mPlayPosition( 0 ),
+ mDisplyMode( Dali::VideoPlayerPlugin::DisplayMode::DST_ROI )
{
- mMuted = false;
- mLooping = false;
- mPlayPosition = 0;
- mDisplyMode = Dali::VideoPlayerPlugin::DisplayMode::DST_ROI;
}
void SetMuted( bool muted )
return mDisplyMode;
}
- void SetDisplayMode( Dali::VideoPlayerPlugin::DisplayMode::Type mDisplyMode )
+ void SetDisplayMode( Dali::VideoPlayerPlugin::DisplayMode::Type mode )
{
- mDisplyMode = mDisplyMode;
+ mDisplyMode = mode;
}
value = map.Find( DevelImageVisual::Property::PLAY_STATE );
DALI_TEST_CHECK( value->Get< int >() == static_cast< int >( DevelImageVisual::PlayState::PLAYING ) );
+ tet_infoline( "Off stage" );
+ dummyControl.Unparent();
+
+ application.SendNotification();
+ application.Render(16);
+
+ map = dummyControl.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
+ value = map.Find( DevelImageVisual::Property::PLAY_STATE );
+ DALI_TEST_CHECK( value->Get< int >() == static_cast< int >( DevelImageVisual::PlayState::PAUSED ) );
+
+ tet_infoline( "On stage again" );
+ Stage::GetCurrent().Add( dummyControl );
+
+ application.SendNotification();
+ application.Render(16);
+
+ map = dummyControl.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
+ value = map.Find( DevelImageVisual::Property::PLAY_STATE );
+ DALI_TEST_CHECK( value->Get< int >() == static_cast< int >( DevelImageVisual::PlayState::PAUSED ) );
+
+ tet_infoline( "Test Play action" );
+ DevelControl::DoAction( dummyControl, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::PLAY, attributes );
+
+ application.SendNotification();
+ application.Render(16);
+
+ map = dummyControl.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
+ value = map.Find( DevelImageVisual::Property::PLAY_STATE );
+ DALI_TEST_CHECK( value->Get< int >() == static_cast< int >( DevelImageVisual::PlayState::PLAYING ) );
+
// Change Size
Vector3 newSize( 100.0f, 100.0f, 0.0f );
dummyControl.SetSize( newSize );
Renderer renderer = actor.GetRendererAt( 0u );
DALI_TEST_CHECK( renderer );
+ Property::Map map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
+ Property::Value* value = map.Find( DevelImageVisual::Property::PLAY_RANGE );
+ DALI_TEST_EQUALS( value->Get< Vector2 >(), playRange, TEST_LOCATION );
+
END_TEST;
}
END_TEST;
}
+
+int UtcDaliAnimatedVectorImageVisualJumpToCurrentProgress(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliAnimatedVectorImageVisualJumpToCurrentProgress" );
+
+ Property::Map propertyMap;
+ propertyMap.Add( Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE )
+ .Add( ImageVisual::Property::URL, TEST_VECTOR_IMAGE_FILE_NAME );
+
+ Visual::Base visual = VisualFactory::Get().CreateVisual( propertyMap );
+ DALI_TEST_CHECK( visual );
+
+ DummyControl actor = DummyControl::New( true );
+ DummyControlImpl& dummyImpl = static_cast< DummyControlImpl& >( actor.GetImplementation() );
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
+
+ Vector2 controlSize( 20.f, 30.f );
+ actor.SetSize( controlSize );
+
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+ DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::JUMP_TO, 0.6f );
+
+ application.SendNotification();
+ application.Render();
+
+ Property::Map map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
+ Property::Value* value = map.Find( DevelImageVisual::Property::CURRENT_PROGRESS );
+ DALI_TEST_EQUALS( value->Get< float >(), 0.6f, TEST_LOCATION );
+
+ Vector2 playRange( 0.0f, 0.4f );
+
+ Property::Map attributes;
+ attributes.Add( DevelImageVisual::Property::PLAY_RANGE, playRange );
+ DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::UPDATE_PROPERTY, attributes );
+
+ DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::JUMP_TO, 0.8f );
+
+ application.SendNotification();
+ application.Render();
+
+ map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
+ value = map.Find( DevelImageVisual::Property::CURRENT_PROGRESS );
+ DALI_TEST_EQUALS( value->Get< float >(), 0.4f, TEST_LOCATION );
+
+ END_TEST;
+}
+
+int UtcDaliAnimatedVectorImageVisualUpdateProperty(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliAnimatedVectorImageVisualJumpToCurrentProgress" );
+
+ Vector2 playRange( 0.2f, 0.8f );
+
+ Property::Map propertyMap;
+ propertyMap.Add( Toolkit::Visual::Property::TYPE, DevelVisual::ANIMATED_VECTOR_IMAGE )
+ .Add( ImageVisual::Property::URL, TEST_VECTOR_IMAGE_FILE_NAME )
+ .Add( DevelImageVisual::Property::LOOP_COUNT, 3 )
+ .Add( DevelImageVisual::Property::PLAY_RANGE, playRange );
+
+ Visual::Base visual = VisualFactory::Get().CreateVisual( propertyMap );
+ DALI_TEST_CHECK( visual );
+
+ DummyControl actor = DummyControl::New( true );
+ DummyControlImpl& dummyImpl = static_cast< DummyControlImpl& >( actor.GetImplementation() );
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, visual );
+
+ Vector2 controlSize( 20.f, 30.f );
+ actor.SetSize( controlSize );
+
+ Stage::GetCurrent().Add( actor );
+
+ application.SendNotification();
+ application.Render();
+
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
+ Property::Map map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
+ Property::Value* value = map.Find( DevelImageVisual::Property::LOOP_COUNT );
+ DALI_TEST_EQUALS( value->Get< int >(), 3, TEST_LOCATION );
+
+ value = map.Find( DevelImageVisual::Property::PLAY_RANGE );
+ DALI_TEST_EQUALS( value->Get< Vector2 >(), playRange, TEST_LOCATION );
+
+ Vector2 newPlayRange( 0.4f, 1.0f );
+
+ Property::Map attributes;
+ attributes.Add( DevelImageVisual::Property::PLAY_RANGE, newPlayRange );
+ attributes.Add( DevelImageVisual::Property::LOOP_COUNT, 5 );
+
+ DevelControl::DoAction( actor, DummyControl::Property::TEST_VISUAL, Dali::Toolkit::DevelAnimatedVectorImageVisual::Action::UPDATE_PROPERTY, attributes );
+
+ application.SendNotification();
+ application.Render();
+
+ map = actor.GetProperty< Property::Map >( DummyControl::Property::TEST_VISUAL );
+ value = map.Find( DevelImageVisual::Property::LOOP_COUNT );
+ DALI_TEST_EQUALS( value->Get< int >(), 5, TEST_LOCATION );
+
+ value = map.Find( DevelImageVisual::Property::PLAY_RANGE );
+ DALI_TEST_EQUALS( value->Get< Vector2 >(), newPlayRange, TEST_LOCATION );
+
+ END_TEST;
+}
#include <dali-toolkit/dali-toolkit.h>
#include <test-button.h>
#include <test-animation-data.h>
+#include <dummy-control.h>
#define STRINGIFY(A)#A
END_TEST;
}
+int UtcDaliBuilderCustomControl(void)
+{
+ ToolkitTestApplication application;
+
+ std::string json(
+ "{"
+ "\"stage\":"
+ "[{"
+ "\"type\": \"DummyControl\","
+ "\"name\": \"I can haz custom Control\""
+ "}]"
+ "}"
+ );
+
+ Actor rootActor = Actor::New();
+ Stage::GetCurrent().Add( rootActor );
+
+ Builder builder = Builder::New();
+ builder.LoadFromString( json );
+ builder.AddActors( rootActor );
+
+ application.SendNotification();
+ application.Render();
+
+ Actor customControl = rootActor.FindChildByName( "I can haz custom Control" );
+
+ // Test that we have the correct type of custom control
+ DummyControl dummyControl = DummyControl::DownCast( customControl );
+ DALI_TEST_CHECK( dummyControl );
+ if( dummyControl )
+ {
+ DALI_TEST_CHECK( typeid(dummyControl.GetImplementation()) == typeid(DummyControlImpl) );
+ }
+
+ END_TEST;
+}
+
int UtcDaliBuilderActionsWithParams(void)
{
ToolkitTestApplication application;
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
static bool gIsCalledButtonCallback = false;
static bool gIsCalledChildButtonCallback = false;
-const int RENDER_FRAME_INTERVAL = 16;
-
static bool ButtonCallback( Button button )
{
gIsCalledButtonCallback = true;
DALI_TEST_EQUALS( gIsCalledButtonCallback, true, TEST_LOCATION );
END_TEST;
-}
\ No newline at end of file
+}
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
mDaliProperty( Property::INVALID_INDEX ),
mSizeSet( Vector3::ZERO ),
mTargetSize( Vector3::ZERO ),
- mNego( nego )
+ mNego( nego ),
+ mDepth( 0u )
{
}
+
/**
* Destructor
*/
OnInitialize( name );
}
+ using Control::OnInitialize; ///< To tell the compiler that we really do want to overload OnInitialize in this class & were not trying to override it
virtual void OnInitialize( const char* name ) {}
// From Toolkit::Internal::ControlWrapper
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
application.SendNotification();
application.Render();
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+
Renderer renderer = imageView.GetRendererAt( 0 );
Shader shader2 = renderer.GetShader();
Property::Value value = shader2.GetProperty( Shader::Property::PROGRAM );
application.SendNotification();
application.Render();
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
Renderer renderer = imageView.GetRendererAt( 0 );
Shader shader2 = renderer.GetShader();
application.SendNotification();
application.Render();
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
Renderer renderer = imageView.GetRendererAt( 0 );
Shader shader2 = renderer.GetShader();
application.SendNotification();
application.Render();
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
Renderer renderer = imageView.GetRendererAt( 0 );
Shader shader2 = renderer.GetShader();
END_TEST;
}
+
+
+namespace
+{
+static int gFailCounter = 0;
+const int MAX_RETRIES(3);
+
+void ReloadImage(ImageView imageView)
+{
+ Property::Map imageImmediateLoadingMap;
+ imageImmediateLoadingMap[ ImageVisual::Property::URL ] = "Non-existant-image.jpg";
+ imageImmediateLoadingMap[ ImageVisual::Property::LOAD_POLICY ] = ImageVisual::LoadPolicy::IMMEDIATE;
+
+ tet_infoline("Immediate load an image");
+ imageView.SetProperty( ImageView::Property::IMAGE, imageImmediateLoadingMap );
+}
+
+void ResourceFailedReload( Control control )
+{
+ gFailCounter++;
+ if( gFailCounter < MAX_RETRIES )
+ {
+ ReloadImage(ImageView::DownCast(control));
+ }
+}
+}
+
+int UtcDaliImageViewReloadFailedOnResourceReadySignal(void)
+{
+ tet_infoline("Test reloading failed image from within signal handler.");
+
+ ToolkitTestApplication application;
+
+ gFailCounter = 0;
+
+ ImageView imageView = ImageView::New();
+ imageView.ResourceReadySignal().Connect( &ResourceFailedReload );
+ DALI_TEST_EQUALS( gFailCounter, 0, TEST_LOCATION );
+ ReloadImage(imageView);
+
+ // loading started, this waits for the loader thread to complete
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( gFailCounter, 1, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+ application.SendNotification();
+
+ DALI_TEST_EQUALS( gFailCounter, 2, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+ application.SendNotification();
+ DALI_TEST_EQUALS( gFailCounter, 3, TEST_LOCATION );
+
+ END_TEST;
+}
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
#include <iostream>
#include <stdlib.h>
+#include <vector>
#include <dali-toolkit-test-suite-utils.h>
#include <toolkit-timer.h>
#include <toolkit-event-thread-callback.h>
namespace
{
const char* TEST_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/gallery-small-1.jpg";
+const char* TEST_BROKEN_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/a-random-nonimage.jpg";
const char* TEST_LARGE_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/tbcol.png";
const char* TEST_SMALL_IMAGE_FILE_NAME = TEST_RESOURCE_DIR "/icon-edit.png";
const char* TEST_REMOTE_IMAGE_FILE_NAME = "https://www.tizen.org/sites/all/themes/tizen_theme/logo.png";
bool gResourceReadySignalFired = false;
-
+std::vector<int> gReadyIds = {};
void ResourceReadySignal( Control control )
{
gResourceReadySignalFired = true;
+ gReadyIds.push_back(control.GetId());
+}
+void ClearReadyIds()
+{
+ gReadyIds.clear();
}
Actor CreateActorWithImageVisual(const Property::Map& map)
END_TEST;
}
+
+
+void ResourceReadyLoadNext( Control control )
+{
+ static int callNumber = 0;
+
+ gResourceReadySignalFired = true;
+ gReadyIds.push_back(control.GetId());
+
+ if( callNumber == 0 )
+ {
+ DALI_TEST_EQUALS( control.GetVisualResourceStatus(DummyControl::Property::TEST_VISUAL), Toolkit::Visual::ResourceStatus::FAILED, TEST_LOCATION );
+
+ tet_infoline( "Create visual with loaded image from within the signal handler" );
+ VisualFactory factory = VisualFactory::Get();
+ Visual::Base imageVisual = factory.CreateVisual( TEST_IMAGE_FILE_NAME, ImageDimensions{20,30} );
+
+ Impl::DummyControl& controlImpl = static_cast<Impl::DummyControl&>(control.GetImplementation());
+ controlImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, imageVisual ); // This should trigger another signal.
+ callNumber = 1;
+ }
+ else
+ {
+ tet_infoline( "3rd signal called" );
+ DALI_TEST_CHECK(true);
+ }
+}
+
+int UtcDaliImageVisualLoadReady01(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline( "UtcDaliImageVisualLoadReady01");
+ tet_infoline( "First part: Load an image visual for one resource, then another image visual for a second resource.");
+ tet_infoline( "Second part, In the ready signal for the second image visual, add a 3rd visual with the first URL" );
+ tet_infoline( "Should get a ready signal for all three visuals");
+
+ ClearReadyIds();
+
+ tet_infoline( "Create a control and connect to resource ready signal" );
+ DummyControl actor = DummyControl::New(true);
+ int actor1Id = actor.GetId();
+ actor.ResourceReadySignal().Connect( &ResourceReadySignal);
+ Impl::DummyControl& dummyImpl = static_cast<Impl::DummyControl&>(actor.GetImplementation());
+ actor.SetSize(200.f, 200.f);
+ Stage::GetCurrent().Add(actor);
+
+ tet_infoline( "Create visual with IMMEDIATE load policy" );
+ Visual::Base imageVisual1 = CreateVisualWithPolicy( TEST_IMAGE_FILE_NAME, ImageVisual::Property::LOAD_POLICY, ImageVisual::LoadPolicy::IMMEDIATE );
+
+ tet_infoline( "Registering visual allows control to get a signal once loaded even if visual not enabled( staged )" );
+ dummyImpl.RegisterVisual( DummyControl::Property::TEST_VISUAL, imageVisual1 );
+
+
+ tet_infoline( "Allow image time to load" );
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+ application.SendNotification();
+ application.Render();
+
+ tet_infoline( "Testing texture is loaded and resource ready signal fired" );
+ DALI_TEST_EQUALS( gResourceReadySignalFired, true, TEST_LOCATION );
+ DALI_TEST_EQUALS( gReadyIds[0], actor1Id, TEST_LOCATION );
+
+
+ tet_infoline( "Original control correctly signalled, now testing failing image" );
+
+ gResourceReadySignalFired = false; // Reset signal check ready for testing next Control
+ ClearReadyIds();
+
+ Visual::Base imageVisual2 = CreateVisualWithPolicy( TEST_BROKEN_IMAGE_FILE_NAME, ImageVisual::Property::LOAD_POLICY, ImageVisual::LoadPolicy::IMMEDIATE );
+
+ DummyControl actor2 = DummyControl::New(true);
+ int actor2Id = actor2.GetId();
+ Impl::DummyControl& dummyImpl2 = static_cast<Impl::DummyControl&>(actor2.GetImplementation());
+ actor2.ResourceReadySignal().Connect( &ResourceReadyLoadNext);
+
+ tet_infoline( "Registering visual this should trigger the ready signal when the image fails to load" );
+ dummyImpl2.RegisterVisual( DummyControl::Property::TEST_VISUAL, imageVisual2 );
+
+ actor2.SetSize(200.f, 200.f);
+ Stage::GetCurrent().Add(actor2);
+
+ tet_infoline( "Wait for loading thread to finish");
+ DALI_TEST_EQUALS( Test::WaitForEventThreadTrigger( 1 ), true, TEST_LOCATION );
+ DALI_TEST_EQUALS( gResourceReadySignalFired, true, TEST_LOCATION );
+
+ DALI_TEST_EQUALS( gReadyIds[0], actor2Id, TEST_LOCATION);
+
+ tet_infoline( "Check for 3rd signal");
+ application.SendNotification();
+ DALI_TEST_EQUALS( gReadyIds.size(), 2, TEST_LOCATION );
+ DALI_TEST_EQUALS( gReadyIds[1], actor2Id, TEST_LOCATION);
+
+ END_TEST;
+}
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
{
public:
- TestPageFactory(ToolkitTestApplication& application, bool returnValidTexture = true )
- : mApplication( application ),
- mValidTexture( returnValidTexture )
+ TestPageFactory( bool returnValidTexture = true )
+ : mValidTexture( returnValidTexture )
{
mTotalPageNumber = TOTAL_PAGE_NUMBER;
}
}
private:
- ToolkitTestApplication& mApplication;
unsigned int mTotalPageNumber;
bool mValidTexture;
};
DALI_TEST_CHECK( !portraitView );
// Test object creation
- TestPageFactory factory(application);
+ TestPageFactory factory;
portraitView = PageTurnPortraitView::New( factory, PAGE_SIZE );
DALI_TEST_CHECK( portraitView );
gObjectCreatedCallBackCalled = false;
registry.ObjectCreatedSignal().Connect( &TestCallback );
{
- TestPageFactory factory(application);
+ TestPageFactory factory;
PageTurnView portraitView = PageTurnPortraitView::New( factory, PAGE_SIZE );
}
DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
DALI_TEST_CHECK( !landscapeView );
// Test object creation
- TestPageFactory factory(application);
+ TestPageFactory factory;
landscapeView = PageTurnLandscapeView::New( factory, PAGE_SIZE );
DALI_TEST_CHECK( landscapeView );
gObjectCreatedCallBackCalled = false;
registry.ObjectCreatedSignal().Connect( &TestCallback );
{
- TestPageFactory factory(application);
+ TestPageFactory factory;
PageTurnView landscapeView = PageTurnLandscapeView::New( factory, PAGE_SIZE );
}
DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
DALI_TEST_CHECK( !portraitView );
// Test object creation
- TestPageFactory factory(application);
+ TestPageFactory factory;
portraitView = PageTurnPortraitView::New( factory, PAGE_SIZE );
DALI_TEST_CHECK( portraitView );
DALI_TEST_CHECK( !landscapeView );
// Test object creation
- TestPageFactory factory(application);
+ TestPageFactory factory;
landscapeView = PageTurnLandscapeView::New( factory, PAGE_SIZE );
DALI_TEST_CHECK( landscapeView );
tet_infoline(" UtcDaliPageTurnViewSetGetProperty ");
- TestPageFactory factory(application);
+ TestPageFactory factory;
PageTurnView landscapeView = PageTurnLandscapeView::New( factory, PAGE_SIZE );
DALI_TEST_CHECK( landscapeView );
application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
- TestPageFactory factory(application);
+ TestPageFactory factory;
Vector2 size = Stage::GetCurrent().GetSize();
PageTurnView portraitView = PageTurnPortraitView::New( factory, size );
portraitView.SetParentOrigin( ParentOrigin::CENTER );
* ----------------
*/
- TestPageFactory factory(application);
+ TestPageFactory factory;
Vector2 stageSize = Stage::GetCurrent().GetSize();
PageTurnView landscapeView = PageTurnLandscapeView::New( factory, Vector2(stageSize.x*0.5f, stageSize.x*0.8f) );
landscapeView.SetParentOrigin( ParentOrigin::CENTER );
int UtcDaliPageImageFactoryGetExtention(void)
{
ToolkitTestApplication application;
- TestPageFactory factory(application);
+ TestPageFactory factory;
DALI_TEST_CHECK( factory.GetExtension() == NULL );
END_TEST;
}
application.GetGlAbstraction().SetCheckFramebufferStatusResult(GL_FRAMEBUFFER_COMPLETE );
- TestPageFactory factory(application, false); // returns empty handles
+ TestPageFactory factory( false /* returns empty handles */ );
Vector2 size = Stage::GetCurrent().GetSize();
try
{
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
bool* mCallbackFlag;
};
-const int MILLISECONDS_PER_SECOND = 1000;
const int RENDER_FRAME_INTERVAL = 16; ///< Duration of each frame in ms. (at approx 60FPS)
-const int RENDER_ANIMATION_TEST_DURATION_MS = 1000; ///< 1000ms to test animation
const int RENDER_DELAY_SCROLL = 1000; ///< duration to wait for any scroll to complete.
// For Clamp Signal testing...
const float CLAMP_EXCESS_WIDTH = 200.0f; ///< Amount of width that can be panned outside scrollview
const float CLAMP_EXCESS_HEIGHT = 200.0f; ///< Amount of height that can be panned outside scrollview
-const int CLAMP_STEP_0_CHECK_NOTCLAMPED = 0; ///< FSM: "First check that scrollview isn't clamped"
-const int CLAMP_STEP_1_CHECK_CLAMPED_WEST = 1; ///< FSM: "Next check that scrollview clamps against left side"
-const int CLAMP_STEP_2_CHECK_CLAMPED_SOUTH_WEST = 2; ///< FSM: "Then check that scrollview clamps against bottom-left side"
-const int CLAMP_STEP_3_SUCCESS = 3; ///< FSM: "Finished (Success)"
const Vector2 CLAMP_START_SCROLL_POSITION(30.0f, 100.0f); ///< Scroll start position for the Clamping tests.
const Vector2 CLAMP_TOUCH_START( 100.0f, 100.0f ); ///< Start point to touch from for the Clamping tests.
const Vector2 CLAMP_TOUCH_MOVEMENT( 5.0f, -5.0f ); ///< Amount to move touch for each frame for the Clamping tests.
const int CLAMP_GESTURE_FRAMES = 100; ///< Number of Frames to synthesize a gesture for the Clamping tests.
const Vector3 TEST_ACTOR_POSITION(100.0f, 100.0f, 0.0f); ///< A Test actor position offset (arbitrary value)
const Vector3 TEST_CONSTRAINT_OFFSET(1.0f, 2.0f, 0.0f); ///< A Test constraint offset (arbitrary value to test effects)
-const float TEST_RATIO_TOLERANCE = 0.05; ///< +/-5% tolerance for ratio comparisons.
const float DEFAULT_SNAP_OVERSHOOT_DURATION(0.5f); ///< Default overshoot snapping animation time.
const float DEFAULT_MAX_OVERSHOOT(100.0f); ///< Default maximum allowed overshoot in pixels
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
const char* const PROPERTY_NAME_MATCH_SYSTEM_LANGUAGE_DIRECTION = "matchSystemLanguageDirection";
-const int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
-
const Vector4 PLACEHOLDER_TEXT_COLOR( 0.8f, 0.8f, 0.8f, 0.8f );
const Dali::Vector4 LIGHT_BLUE( 0.75f, 0.96f, 1.f, 1.f ); // The text highlight color.
-const unsigned int CURSOR_BLINK_INTERVAL = 500u; // Cursor blink interval
-const float TO_MILLISECONDS = 1000.f;
-const float TO_SECONDS = 1.f / TO_MILLISECONDS;
const float RENDER_FRAME_INTERVAL = 16.66f;
-const float SCROLL_THRESHOLD = 10.f;
-const float SCROLL_SPEED = 300.f;
-
const unsigned int DEFAULT_FONT_SIZE = 1152u;
const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
const char* const PROPERTY_NAME_ENABLE_GRAB_HANDLE = "enableGrabHandle";
const char* const PROPERTY_NAME_MATCH_SYSTEM_LANGUAGE_DIRECTION = "matchSystemLanguageDirection";
-const int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
-
const Vector4 PLACEHOLDER_TEXT_COLOR( 0.8f, 0.8f, 0.8f, 0.8f );
const Dali::Vector4 LIGHT_BLUE( 0.75f, 0.96f, 1.f, 1.f ); // The text highlight color.
-const unsigned int CURSOR_BLINK_INTERVAL = 500u; // Cursor blink interval
const float RENDER_FRAME_INTERVAL = 16.66f;
-const float TO_MILLISECONDS = 1000.f;
-const float TO_SECONDS = 1.f / TO_MILLISECONDS;
-
-const float SCROLL_THRESHOLD = 10.f;
-const float SCROLL_SPEED = 300.f;
-
const unsigned int DEFAULT_FONT_SIZE = 1152u;
const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
const char* const PROPERTY_NAME_ELLIPSIS = "ellipsis";
const char* const PROPERTY_NAME_AUTO_SCROLL_LOOP_DELAY = "autoScrollLoopDelay";
-const int DEFAULT_RENDERING_BACKEND = Dali::Toolkit::Text::DEFAULT_RENDERING_BACKEND;
const std::string DEFAULT_FONT_DIR( "/resources/fonts" );
const unsigned int EMOJI_FONT_SIZE = 3840u; // 60 * 64
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
namespace
{
-
} // namespace
END_TEST;
}
-
-
-
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
DALI_TEST_CHECK( gObjectCreatedCallBackCalled );
Actor actor = toolbar;
- toolbar == ToolBar::DownCast( actor );
+ toolbar = ToolBar::DownCast( actor );
DALI_TEST_CHECK( toolbar );
END_TEST;
ALIASES += SINCE_1_3_9="@since 1.3.9"
ALIASES += SINCE_1_3_15="@since 1.3.15"
+#Extra tags for Tizen 5.5
+ALIASES += SINCE_1_3_31="@since 1.3.31"
+
ALIASES += DEPRECATED_1_0="@deprecated Deprecated since 1.0"
ALIASES += DEPRECATED_1_1="@deprecated Deprecated since 1.1"
ALIASES += DEPRECATED_1_2_8="@deprecated Deprecated since 1.2.8"
ALIASES += DEPRECATED_1_2_10="@deprecated Deprecated since 1.2.10"
ALIASES += DEPRECATED_1_2="@deprecated Deprecated since 1.2"
ALIASES += DEPRECATED_1_3="@deprecated Deprecated since 1.3"
+ALIASES += DEPRECATED_1_3_39="@deprecated Deprecated since 1.3.39"
+ALIASES += DEPRECATED_1_3_51="@deprecated Deprecated since 1.3.51"
ALIASES += DEPRECATED_1_4="@deprecated Deprecated since 1.4"
ALIASES += PLATFORM=""
#ALIASES += SINCE_1_1="\par Since:\n 3.0, DALi version 1.1"
#ALIASES += SINCE_1_2="\par Since:\n 4.0, DALi version 1.2"
#ALIASES += SINCE_1_3="\par Since:\n 5.0, DALi version 1.3"
-#ALIASES += SINCE_1_4="\par Since:\n 6.0, DALi version 1.4"
+#ALIASES += SINCE_1_4="\par Since:\n 5.5, DALi version 1.4"
## Extra tags for Tizen 3.0
#ALIASES += SINCE_1_2_2="\par Since:\n 3.0, DALi version 1.2.2"
#ALIASES += SINCE_1_3_9="\par Since:\n 4.0, DALi version 1.3.9"
#ALIASES += SINCE_1_3_15="\par Since:\n 4.0, DALi version 1.3.15"
+#Extra tags for Tizen 5.5
+#ALIASES += SINCE_1_3_31="\par Since:\n 5.5, DALi version 1.3.31"
+
## DALi has no deprecated API in Tizen 2.4 because it's DALi's first release.
## Thus deprecated APIs in DALi 1.0.xx will be deprecated in Tizen 3.0.
#ALIASES += DEPRECATED_1_0="@deprecated Deprecated since 3.0, DALi version 1.0"
#ALIASES += DEPRECATED_1_2_10="@deprecated Deprecated since 3.0, DALi version 1.2.10"
#ALIASES += DEPRECATED_1_2="@deprecated Deprecated since 4.0, DALi version 1.2"
#ALIASES += DEPRECATED_1_3="@deprecated Deprecated since 5.0, DALi version 1.3"
-#ALIASES += DEPRECATED_1_4="@deprecated Deprecated since 6.0, DALi version 1.4"
+#ALIASES += DEPRECATED_1_3_39="@deprecated Deprecated since 5.5, DALi version 1.3.39"
+#ALIASES += DEPRECATED_1_3_51="@deprecated Deprecated since 5.5, DALi version 1.3.51"
+#ALIASES += DEPRECATED_1_4="@deprecated Deprecated since 5.5, DALi version 1.4"
#ALIASES += PLATFORM="@platform"
#ALIASES += PRIVLEVEL_PLATFORM="\par Privilege Level:\n platform"
#ifndef DALI_TOOLKIT_LAYOUTING_LAYOUT_GROUP_H
#define DALI_TOOLKIT_LAYOUTING_LAYOUT_GROUP_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
using LayoutId = unsigned int;
static const unsigned int UNKNOWN_ID = 0;
- struct ChildProperty
- {
- enum
- {
- };
- };
-
-
/**
* @brief Creates an uninitialized LayoutGroup handle.
*
-#ifndef DALI_TOOLKIT_SHADER_EFFECT_DISSOLVE_H_
+#ifndef DALI_TOOLKIT_SHADER_EFFECT_DISSOLVE_H
#define DALI_TOOLKIT_SHADER_EFFECT_DISSOLVE_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
#define DALI_TOOLKIT_VISUAL_FACTORY_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
namespace Dali
{
class Image;
-class Vector4;
+struct Vector4;
namespace Toolkit
{
*/
enum Type
{
- PLAY, ///< Play the animated vector image.
- PAUSE, ///< Pause the animated vector image.
- STOP ///< Stop the animated vector image. This is also Default playback mode.
+ PLAY, ///< Play the animated vector image.
+ PAUSE, ///< Pause the animated vector image.
+ STOP, ///< Stop the animated vector image. This is also Default playback mode.
+ JUMP_TO, ///< Jump to the specified frame. Property::FLOAT value should be passed.
+ UPDATE_PROPERTY ///< Update the properties of the animated vector image.
};
} // namespace Action
* @details Name "playState", type PlayState (Property::INTEGER)
* @note This property is read-only.
*/
- PLAY_STATE = ORIENTATION_CORRECTION + 5
+ PLAY_STATE = ORIENTATION_CORRECTION + 5,
+ /**
+ * @brief The animation progress the AnimatedVectorImageVisual will use.
+ * @details Name "currentProgress", Type Property::FLOAT, between [0, 1] or between the play range if specified
+ * @note This property is read-only.
+ */
+ CURRENT_PROGRESS = ORIENTATION_CORRECTION + 6
};
} //namespace Property
#define DALI_TOOLKIT_INTERNAL_COLOR_CONVERSION_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
namespace Dali
{
-class Vector4;
+struct Vector4;
namespace Toolkit
{
#define DALI_TOOLKIT_INTERNAL_LAYOUT_CONTROLLER_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
*/
#include <list>
#include <dali/public-api/object/base-object.h>
-#include <dali/integration-api/core.h>
+#include <dali/integration-api/processor-interface.h>
#include <dali-toolkit/public-api/controls/control.h>
#include <dali-toolkit/devel-api/layouting/layout-controller.h>
#include <dali-toolkit/devel-api/layouting/layout-item-impl.h>
#define DALI_TOOLKIT_TEXT_MODEL_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
/**
* @copydoc ModelInterface::GetControlSize()
*/
- virtual const Size& GetControlSize() const;
+ virtual const Size& GetControlSize() const override;
/**
* @copydoc ModelInterface::GetLayoutSize()
*/
- virtual const Size& GetLayoutSize() const;
+ virtual const Size& GetLayoutSize() const override;
/**
* @copydoc ModelInterface::GetScrollPosition()
*/
- virtual const Vector2& GetScrollPosition() const;
+ virtual const Vector2& GetScrollPosition() const override;
/**
* @copydoc ModelInterface::GetHorizontalAlignment()
*/
- virtual HorizontalAlignment::Type GetHorizontalAlignment() const;
+ virtual HorizontalAlignment::Type GetHorizontalAlignment() const override;
/**
* @copydoc ModelInterface::GetVerticalAlignment()
*/
- virtual VerticalAlignment::Type GetVerticalAlignment() const;
+ virtual VerticalAlignment::Type GetVerticalAlignment() const override;
/**
* @copydoc ModelInterface::GetVerticalLineAlignment()
/**
* @copydoc ModelInterface::IsTextElideEnabled()
*/
- virtual bool IsTextElideEnabled() const;
+ virtual bool IsTextElideEnabled() const override;
/**
* @copydoc ModelInterface::GetNumberOfLines()
*/
- virtual Length GetNumberOfLines() const;
+ virtual Length GetNumberOfLines() const override;
/**
* @copydoc ModelInterface::GetLines()
*/
- virtual const LineRun* const GetLines() const;
+ virtual const LineRun* const GetLines() const override;
/**
* @copydoc ModelInterface::GetNumberOfScripts()
*/
- virtual Length GetNumberOfScripts() const;
+ virtual Length GetNumberOfScripts() const override;
/**
* @copydoc ModelInterface::GetScriptRuns()
*/
- virtual const ScriptRun* const GetScriptRuns() const;
+ virtual const ScriptRun* const GetScriptRuns() const override;
/**
* @copydoc ModelInterface::GetNumberOfGlyphs()
*/
- virtual Length GetNumberOfGlyphs() const;
+ virtual Length GetNumberOfGlyphs() const override;
/**
* @copydoc ModelInterface::GetGlyphs()
*/
- virtual const GlyphInfo* const GetGlyphs() const;
+ virtual const GlyphInfo* const GetGlyphs() const override;
/**
* @copydoc ModelInterface::GetLayout()
*/
- virtual const Vector2* const GetLayout() const;
+ virtual const Vector2* const GetLayout() const override;
/**
* @copydoc ModelInterface::GetColors()
*/
- virtual const Vector4* const GetColors() const;
+ virtual const Vector4* const GetColors() const override;
/**
* @copydoc ModelInterface::GetColorIndices()
*/
- virtual const ColorIndex* const GetColorIndices() const;
+ virtual const ColorIndex* const GetColorIndices() const override;
/**
* @copydoc ModelInterface::GetDefaultColor()
*/
- virtual const Vector4& GetDefaultColor() const;
+ virtual const Vector4& GetDefaultColor() const override;
/**
* @copydoc ModelInterface::GetShadowOffset()
*/
- virtual const Vector2& GetShadowOffset() const;
+ virtual const Vector2& GetShadowOffset() const override;
/**
* @copydoc ModelInterface::GetShadowColor()
*/
- virtual const Vector4& GetShadowColor() const;
+ virtual const Vector4& GetShadowColor() const override;
/**
* @copydoc ModelInterface::GetShadowBlurRadius()
*/
- virtual const float& GetShadowBlurRadius() const;
+ virtual const float& GetShadowBlurRadius() const override;
/**
* @copydoc ModelInterface::GetUnderlineColor()
*/
- virtual const Vector4& GetUnderlineColor() const;
+ virtual const Vector4& GetUnderlineColor() const override;
/**
* @copydoc ModelInterface::IsUnderlineEnabled()
*/
- virtual bool IsUnderlineEnabled() const;
+ virtual bool IsUnderlineEnabled() const override;
/**
* @copydoc ModelInterface::GetUnderlineHeight()
*/
- virtual float GetUnderlineHeight() const;
+ virtual float GetUnderlineHeight() const override;
/**
* @copydoc ModelInterface::GetNumberOfUnderlineRuns()
*/
- virtual Length GetNumberOfUnderlineRuns() const;
+ virtual Length GetNumberOfUnderlineRuns() const override;
/**
* @copydoc ModelInterface::GetUnderlineRuns()
*/
- virtual void GetUnderlineRuns( GlyphRun* underlineRuns, UnderlineRunIndex index, Length numberOfRuns ) const;
+ virtual void GetUnderlineRuns( GlyphRun* underlineRuns, UnderlineRunIndex index, Length numberOfRuns ) const override;
/**
* @copydoc ModelInterface::GetOutlineColor()
*/
- virtual const Vector4& GetOutlineColor() const;
+ virtual const Vector4& GetOutlineColor() const override;
/**
* @copydoc ModelInterface::GetOutlineWidth()
*/
- virtual float GetOutlineWidth() const;
+ virtual float GetOutlineWidth() const override;
/**
* @copydoc ModelInterface::GetBackgroundColor()
*/
- virtual const Vector4& GetBackgroundColor() const;
+ virtual const Vector4& GetBackgroundColor() const override;
/**
* @copydoc ModelInterface::IsBackgroundEnabled()
*/
- virtual bool IsBackgroundEnabled() const;
+ virtual bool IsBackgroundEnabled() const override;
private: // Private contructors & copy operator.
#define DALI_TOOLKIT_INTERNAL_ANIMATED_GRADIENT_VISUAL_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
/**
* @copydoc Visual::Base::CreatePropertyMap
*/
- virtual void DoCreatePropertyMap( Property::Map& map ) const;
+ void DoCreatePropertyMap( Property::Map& map ) const override;
/**
* @copydoc Visual::Base::CreateInstancePropertyMap
*/
- virtual void DoCreateInstancePropertyMap( Property::Map& map ) const;
+ void DoCreateInstancePropertyMap( Property::Map& map ) const override;
protected:
/**
* @copydoc Visual::Base::DoSetProperties
*/
- virtual void DoSetProperties( const Property::Map& propertyMap );
+ void DoSetProperties( const Property::Map& propertyMap ) override;
/**
* @copydoc Visual::Base::OnSetTransform
*/
- virtual void OnSetTransform();
+ void OnSetTransform() override;
/**
* @copydoc Visual::Base::DoSetOnStage
*/
- virtual void DoSetOnStage( Actor& actor );
+ void DoSetOnStage( Actor& actor ) override;
/**
* @copydoc Visual::Base::DoSetOffStage
*/
- virtual void DoSetOffStage( Actor& actor );
+ void DoSetOffStage( Actor& actor ) override;
private:
#define DALI_TOOLKIT_INTERNAL_ANIMATED_IMAGE_VISUAL_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
/**
* @copydoc Visual::Base::GetNaturalSize
*/
- virtual void GetNaturalSize( Vector2& naturalSize );
+ void GetNaturalSize( Vector2& naturalSize ) override;
/**
* @copydoc Visual::Base::CreatePropertyMap
*/
- virtual void DoCreatePropertyMap( Property::Map& map ) const;
+ void DoCreatePropertyMap( Property::Map& map ) const override;
/**
* @copydoc Visual::Base::CreateInstancePropertyMap
*/
- virtual void DoCreateInstancePropertyMap( Property::Map& map ) const;
+ void DoCreateInstancePropertyMap( Property::Map& map ) const override;
/**
* @copydoc Visual::Base::OnDoAction
*/
- virtual void OnDoAction( const Dali::Property::Index actionName, const Dali::Property::Value& attributes ) override;
+ void OnDoAction( const Dali::Property::Index actionName, const Dali::Property::Value& attributes ) override;
protected:
/**
* @copydoc Visual::Base::DoSetProperties
*/
- virtual void DoSetProperties( const Property::Map& propertyMap );
+ void DoSetProperties( const Property::Map& propertyMap ) override;
/**
* Helper method to set individual values by index key.
/**
* @copydoc Visual::Base::DoSetOnStage
*/
- virtual void DoSetOnStage( Actor& actor );
+ void DoSetOnStage( Actor& actor ) override;
/**
* @copydoc Visual::Base::DoSetOffStage
*/
- virtual void DoSetOffStage( Actor& actor );
+ void DoSetOffStage( Actor& actor ) override;
/**
* @copydoc Visual::Base::OnSetTransform
*/
- virtual void OnSetTransform();
+ void OnSetTransform() override;
private:
/**
#define DALI_TOOLKIT_INTERNAL_FIXED_IMAGE_CACHE_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
* Get the first frame. If it's not ready, this will trigger the
* sending of FrameReady() when the image becomes ready.
*/
- virtual TextureSet FirstFrame();
+ TextureSet FirstFrame() override;
/**
* Get the next frame. If it's not ready, this will trigger the
* sending of FrameReady() when the image becomes ready.
* This will trigger the loading of the next batch.
*/
- virtual TextureSet NextFrame();
+ TextureSet NextFrame() override;
private:
/**
void CheckFrontFrame( bool wasReady );
protected:
- virtual void UploadComplete(
+ void UploadComplete(
bool loadSuccess,
int32_t textureId,
TextureSet textureSet,
#define DALI_TOOLKIT_INTERNAL_IMAGE_CACHE_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
virtual TextureSet NextFrame() = 0;
private:
+
/**
* Called before the texture manager is destroyed.
*/
- virtual void TextureManagerDestroyed() override final;
+ void TextureManagerDestroyed() final;
protected:
TextureManager& mTextureManager;
#define DALI_TOOLKIT_INTERNAL_ROLLING_GIF_IMAGE_CACHE_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
* Get the first frame. If it's not ready, this will trigger the
* sending of FrameReady() when the image becomes ready.
*/
- virtual TextureSet FirstFrame();
+ TextureSet FirstFrame() override;
/**
* Get the next frame. If it's not ready, this will trigger the
* sending of FrameReady() when the image becomes ready.
* This will trigger the loading of the next batch.
*/
- virtual TextureSet NextFrame();
+ TextureSet NextFrame() override;
private:
/**
#define DALI_TOOLKIT_INTERNAL_ROLLING_IMAGE_CACHE_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
* Get the first frame. If it's not ready, this will trigger the
* sending of FrameReady() when the image becomes ready.
*/
- virtual TextureSet FirstFrame();
+ TextureSet FirstFrame() override;
/**
* Get the next frame. If it's not ready, this will trigger the
* sending of FrameReady() when the image becomes ready.
* This will trigger the loading of the next batch.
*/
- virtual TextureSet NextFrame();
+ TextureSet NextFrame() override;
private:
/**
void CheckFrontFrame( bool wasReady );
protected:
- virtual void UploadComplete(
+ void UploadComplete(
bool loadSuccess,
int32_t textureId,
TextureSet textureSet,
// EXTERNAL INCLUDES
#include <dali/public-api/common/stage.h>
-#include <dali/devel-api/common/stage-devel.h>
+#include <dali/devel-api/rendering/renderer-devel.h>
#include <dali/integration-api/debug.h>
// INTERNAL INCLUDES
#include <dali-toolkit/internal/visuals/visual-factory-cache.h>
#include <dali-toolkit/internal/visuals/visual-string-constants.h>
#include <dali-toolkit/internal/visuals/visual-base-data-impl.h>
-#include <dali-toolkit/internal/visuals/animated-vector-image/vector-rasterize-thread.h>
namespace Dali
{
namespace
{
-const Dali::Vector4 FULL_TEXTURE_RECT( 0.f, 0.f, 1.f, 1.f );
constexpr auto LOOP_FOREVER = -1;
+const Dali::Vector4 FULL_TEXTURE_RECT( 0.f, 0.f, 1.f, 1.f );
+
+// Flags for re-sending data to the rasterize thread
+enum Flags
+{
+ RESEND_PLAY_RANGE = 1 << 0,
+ RESEND_LOOP_COUNT = 1 << 1
+};
+
} // unnamed namespace
AnimatedVectorImageVisualPtr AnimatedVectorImageVisual::New( VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl, const Property::Map& properties )
: Visual::Base( factoryCache, Visual::FittingMode::FILL ),
mImageVisualShaderFactory( shaderFactory ),
mUrl( imageUrl ),
+ mVectorRasterizeThread( imageUrl.GetUrl() ),
mVisualSize(),
mPlayRange( 0.0f, 1.0f ),
mPlacementActor(),
- mVectorRasterizeThread(),
mLoopCount( LOOP_FOREVER ),
+ mResendFlag( 0 ),
mActionStatus( DevelAnimatedVectorImageVisual::Action::STOP )
{
// the rasterized image is with pre-multiplied alpha format
mImpl->mFlags |= Impl::IS_PREMULTIPLIED_ALPHA;
+
+ mVectorRasterizeThread.SetResourceReadyCallback( new EventThreadCallback( MakeCallback( this, &AnimatedVectorImageVisual::OnResourceReady ) ) );
+ mVectorRasterizeThread.SetAnimationFinishedCallback( new EventThreadCallback( MakeCallback( this, &AnimatedVectorImageVisual::OnAnimationFinished ) ) );
+
+ mVectorRasterizeThread.Start();
}
AnimatedVectorImageVisual::~AnimatedVectorImageVisual()
{
map.Insert( Toolkit::ImageVisual::Property::URL, mUrl.GetUrl() );
}
- map.Insert( Toolkit::DevelImageVisual::Property::LOOP_COUNT, static_cast< int >( mLoopCount ) );
- map.Insert( Toolkit::DevelImageVisual::Property::PLAY_RANGE, static_cast< Vector2 >( mPlayRange ) );
-
- if( mVectorRasterizeThread )
- {
- map.Insert( Toolkit::DevelImageVisual::Property::PLAY_STATE, static_cast< int >( mVectorRasterizeThread->GetPlayState() ) );
- }
- else
- {
- map.Insert( Toolkit::DevelImageVisual::Property::PLAY_STATE, static_cast< int >( DevelImageVisual::PlayState::STOPPED ) );
- }
+ map.Insert( Toolkit::DevelImageVisual::Property::LOOP_COUNT, mLoopCount );
+ map.Insert( Toolkit::DevelImageVisual::Property::PLAY_RANGE, mPlayRange );
+ map.Insert( Toolkit::DevelImageVisual::Property::PLAY_STATE, static_cast< int >( mVectorRasterizeThread.GetPlayState() ) );
+ map.Insert( Toolkit::DevelImageVisual::Property::CURRENT_PROGRESS, mVectorRasterizeThread.GetCurrentProgress() );
}
void AnimatedVectorImageVisual::DoCreateInstancePropertyMap( Property::Map& map ) const
if( value.Get( loopCount ) )
{
mLoopCount = loopCount;
- if( mVectorRasterizeThread )
- {
- mVectorRasterizeThread->SetLoopCount( loopCount );
- }
+ mResendFlag |= RESEND_LOOP_COUNT;
}
break;
}
Vector2 range;
if( value.Get( range ) )
{
- // Make sure the range specified is between 0.0 and 1.0
- if( range.x >= 0.0f && range.x <= 1.0f && range.y >= 0.0f && range.y <= 1.0f )
- {
- Vector2 orderedRange( range );
- // If the range is not in order swap values
- if( range.x > range.y )
- {
- orderedRange = Vector2( range.y, range.x );
- }
-
- mPlayRange = orderedRange;
-
- if( mVectorRasterizeThread )
- {
- mVectorRasterizeThread->SetPlayRange( mPlayRange );
- }
- }
+ mPlayRange = range;
+ mResendFlag |= RESEND_PLAY_RANGE;
}
break;
}
// Hold the weak handle of the placement actor and delay the adding of renderer until the rasterization is finished.
mPlacementActor = actor;
- // This visual needs it's size set before it can be rasterized hence set ResourceReady once on stage
- ResourceReady( Toolkit::Visual::ResourceStatus::READY );
+ mVectorRasterizeThread.SetRenderer( mImpl->mRenderer );
}
void AnimatedVectorImageVisual::DoSetOffStage( Actor& actor )
{
- if( mVectorRasterizeThread )
- {
- mVectorRasterizeThread->PauseAnimation();
- DevelStage::SetRenderingBehavior( Stage::GetCurrent(), DevelStage::Rendering::IF_REQUIRED );
- mActionStatus = DevelAnimatedVectorImageVisual::Action::PAUSE;
- }
+ mVectorRasterizeThread.PauseAnimation();
+
+ mActionStatus = DevelAnimatedVectorImageVisual::Action::PAUSE;
if( mImpl->mRenderer )
{
+ mImpl->mRenderer.SetProperty( DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::IF_REQUIRED );
+
actor.RemoveRenderer( mImpl->mRenderer );
mImpl->mRenderer.Reset();
}
{
mVisualSize = visualSize;
- if( !mVectorRasterizeThread )
+ uint32_t width = static_cast< uint32_t >( visualSize.width );
+ uint32_t height = static_cast< uint32_t >( visualSize.height );
+
+ mVectorRasterizeThread.SetSize( width, height );
+ }
+
+ SendAnimationData();
+
+ if( mActionStatus == DevelAnimatedVectorImageVisual::Action::PLAY )
+ {
+ mVectorRasterizeThread.PlayAnimation();
+
+ mImpl->mRenderer.SetProperty( DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::CONTINUOUSLY );
+ }
+ else
+ {
+ // Render one frame
+ mVectorRasterizeThread.RenderFrame();
+ }
+
+ if( mVectorRasterizeThread.IsResourceReady() )
+ {
+ Actor actor = mPlacementActor.GetHandle();
+ if( actor )
{
- uint32_t width = static_cast< uint32_t >( visualSize.width );
- uint32_t height = static_cast< uint32_t >( visualSize.height );
-
- mVectorRasterizeThread = std::unique_ptr< VectorRasterizeThread >( new VectorRasterizeThread( mUrl.GetUrl(), mImpl->mRenderer, width, height ) );
-
- mVectorRasterizeThread->SetResourceReadyCallback( new EventThreadCallback( MakeCallback( this, &AnimatedVectorImageVisual::OnResourceReady ) ) );
- mVectorRasterizeThread->SetAnimationFinishedCallback( new EventThreadCallback( MakeCallback( this, &AnimatedVectorImageVisual::OnAnimationFinished ) ) );
- mVectorRasterizeThread->SetLoopCount( mLoopCount );
- mVectorRasterizeThread->SetPlayRange( mPlayRange );
-
- mVectorRasterizeThread->Start();
-
- if( mActionStatus == DevelAnimatedVectorImageVisual::Action::PLAY )
- {
- mVectorRasterizeThread->StartAnimation();
- DevelStage::SetRenderingBehavior( Stage::GetCurrent(), DevelStage::Rendering::CONTINUOUSLY );
- }
- else
- {
- // Render one frame
- mVectorRasterizeThread->RenderFrame();
- }
+ actor.AddRenderer( mImpl->mRenderer );
+ mPlacementActor.Reset();
}
- else
- {
- uint32_t width = static_cast< uint32_t >( visualSize.width );
- uint32_t height = static_cast< uint32_t >( visualSize.height );
- mVectorRasterizeThread->SetSize( width, height );
- }
+ ResourceReady( Toolkit::Visual::ResourceStatus::READY );
}
}
}
{
case DevelAnimatedVectorImageVisual::Action::PLAY:
{
- if( IsOnStage())
+ if( IsOnStage() )
{
- if( mVectorRasterizeThread )
- {
- mVectorRasterizeThread->StartAnimation();
- DevelStage::SetRenderingBehavior( Stage::GetCurrent(), DevelStage::Rendering::CONTINUOUSLY ); //TODO: Should manage this globally
- }
+ mVectorRasterizeThread.PlayAnimation();
+
+ mImpl->mRenderer.SetProperty( DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::CONTINUOUSLY );
}
mActionStatus = DevelAnimatedVectorImageVisual::Action::PLAY;
break;
}
case DevelAnimatedVectorImageVisual::Action::PAUSE:
{
- if( mVectorRasterizeThread )
+ mVectorRasterizeThread.PauseAnimation();
+
+ if( mImpl->mRenderer )
{
- mVectorRasterizeThread->PauseAnimation();
- DevelStage::SetRenderingBehavior( Stage::GetCurrent(), DevelStage::Rendering::IF_REQUIRED );
+ mImpl->mRenderer.SetProperty( DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::IF_REQUIRED );
}
+
mActionStatus = DevelAnimatedVectorImageVisual::Action::PAUSE;
break;
}
case DevelAnimatedVectorImageVisual::Action::STOP:
{
- if( mVectorRasterizeThread )
+ if( mVectorRasterizeThread.GetPlayState() != DevelImageVisual::PlayState::STOPPED )
{
- bool emitSignal = false;
- if( mVectorRasterizeThread->GetPlayState() != DevelImageVisual::PlayState::STOPPED )
- {
- emitSignal = true;
- }
-
- mVectorRasterizeThread->StopAnimation();
- DevelStage::SetRenderingBehavior( Stage::GetCurrent(), DevelStage::Rendering::IF_REQUIRED );
-
- if( emitSignal )
- {
- OnAnimationFinished();
- }
+ mVectorRasterizeThread.StopAnimation();
+
+ OnAnimationFinished();
}
mActionStatus = DevelAnimatedVectorImageVisual::Action::STOP;
break;
}
+ case DevelAnimatedVectorImageVisual::Action::JUMP_TO:
+ {
+ float progress;
+ if( attributes.Get( progress ) )
+ {
+ mVectorRasterizeThread.SetCurrentProgress( progress );
+ }
+ break;
+ }
+ case DevelAnimatedVectorImageVisual::Action::UPDATE_PROPERTY:
+ {
+ Property::Map* map = attributes.GetMap();
+ if( map )
+ {
+ DoSetProperties( *map );
+
+ SendAnimationData();
+ }
+ break;
+ }
}
}
// reset the weak handle so that the renderer only get added to actor once
mPlacementActor.Reset();
- Stage::GetCurrent().KeepRendering( 0.0f );
+ ResourceReady( Toolkit::Visual::ResourceStatus::READY );
}
}
{
mImpl->mEventObserver->NotifyVisualEvent( *this, DevelAnimatedVectorImageVisual::Signal::ANIMATION_FINISHED );
}
+
+ mActionStatus = DevelAnimatedVectorImageVisual::Action::STOP;
+
+ if( mImpl->mRenderer )
+ {
+ mImpl->mRenderer.SetProperty( DevelRenderer::Property::RENDERING_BEHAVIOR, DevelRenderer::Rendering::IF_REQUIRED );
+ }
+}
+
+void AnimatedVectorImageVisual::SendAnimationData()
+{
+ if( mResendFlag )
+ {
+ bool isPlaying = false;
+ if( mVectorRasterizeThread.GetPlayState() == DevelImageVisual::PlayState::PLAYING )
+ {
+ mVectorRasterizeThread.PauseAnimation();
+ isPlaying = true;
+ }
+
+ if( mResendFlag & RESEND_LOOP_COUNT )
+ {
+ mVectorRasterizeThread.SetLoopCount( mLoopCount );
+ }
+
+ if( mResendFlag & RESEND_PLAY_RANGE )
+ {
+ mVectorRasterizeThread.SetPlayRange( mPlayRange );
+ }
+
+ if( isPlaying )
+ {
+ mVectorRasterizeThread.PlayAnimation();
+ }
+ else
+ {
+ mVectorRasterizeThread.RenderFrame();
+ Stage::GetCurrent().KeepRendering( 0.0f );
+ }
+
+ mResendFlag = 0;
+ }
}
} // namespace Internal
#define DALI_TOOLKIT_INTERNAL_ANIMATED_VECTOR_IMAGE_VISUAL_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
#include <dali-toolkit/internal/visuals/visual-base-impl.h>
#include <dali-toolkit/internal/visuals/visual-url.h>
#include <dali-toolkit/devel-api/visuals/animated-vector-image-visual-actions-devel.h>
+#include <dali-toolkit/internal/visuals/animated-vector-image/vector-rasterize-thread.h>
namespace Dali
{
/**
* @copydoc Visual::Base::GetNaturalSize
*/
- virtual void GetNaturalSize( Vector2& naturalSize ) override;
+ void GetNaturalSize( Vector2& naturalSize ) override;
/**
* @copydoc Visual::Base::CreatePropertyMap
*/
- virtual void DoCreatePropertyMap( Property::Map& map ) const override;
+ void DoCreatePropertyMap( Property::Map& map ) const override;
/**
* @copydoc Visual::Base::CreateInstancePropertyMap
*/
- virtual void DoCreateInstancePropertyMap( Property::Map& map ) const override;
+ void DoCreateInstancePropertyMap( Property::Map& map ) const override;
protected:
/**
* @copydoc Visual::Base::DoSetProperties
*/
- virtual void DoSetProperties( const Property::Map& propertyMap ) override;
+ void DoSetProperties( const Property::Map& propertyMap ) override;
/**
* @copydoc Visual::Base::DoSetOnStage
*/
- virtual void DoSetOnStage( Actor& actor ) override;
+ void DoSetOnStage( Actor& actor ) override;
/**
* @copydoc Visual::Base::DoSetOffStage
*/
- virtual void DoSetOffStage( Actor& actor ) override;
+ void DoSetOffStage( Actor& actor ) override;
/**
* @copydoc Visual::Base::OnSetTransform
*/
- virtual void OnSetTransform() override;
+ void OnSetTransform() override;
/**
* @copydoc Visual::Base::OnDoAction
*/
- virtual void OnDoAction( const Property::Index actionId, const Property::Value& attributes ) override;
+ void OnDoAction( const Property::Index actionId, const Property::Value& attributes ) override;
private:
*/
void OnAnimationFinished();
+ /**
+ * @brief Send animation data to the rasterize thread.
+ */
+ void SendAnimationData();
+
// Undefined
AnimatedVectorImageVisual( const AnimatedVectorImageVisual& visual ) = delete;
private:
ImageVisualShaderFactory& mImageVisualShaderFactory;
VisualUrl mUrl;
+ VectorRasterizeThread mVectorRasterizeThread;
Vector2 mVisualSize;
Vector2 mPlayRange;
WeakHandle< Actor > mPlacementActor;
- std::unique_ptr< VectorRasterizeThread > mVectorRasterizeThread;
-
int32_t mLoopCount;
+ uint32_t mResendFlag;
DevelAnimatedVectorImageVisual::Action::Type mActionStatus;
};
} // unnamed namespace
-VectorRasterizeThread::VectorRasterizeThread( const std::string& url, Renderer renderer, uint32_t width, uint32_t height )
+VectorRasterizeThread::VectorRasterizeThread( const std::string& url )
: mUrl( url ),
mVectorRenderer(),
mConditionalWait(),
mAnimationFinishedTrigger(),
mPlayRange( 0.0f, 1.0f ),
mPlayState( DevelImageVisual::PlayState::STOPPED ),
+ mProgress( 0.0f ),
mCurrentFrame( 0 ),
mTotalFrame( 0 ),
mStartFrame( 0 ),
mEndFrame( 0 ),
- mWidth( width ),
- mHeight( height ),
+ mWidth( 0 ),
+ mHeight( 0 ),
mLoopCount( LOOP_FOREVER ),
mCurrentLoop( 0 ),
mNeedRender( false ),
mResourceReady( false ),
mLogFactory( Dali::Adaptor::Get().GetLogFactory() )
{
- mVectorRenderer = VectorAnimationRenderer::New( mUrl, renderer, width, height );
+ mVectorRenderer = VectorAnimationRenderer::New( mUrl );
}
VectorRasterizeThread::~VectorRasterizeThread()
}
}
-void VectorRasterizeThread::SetSize( uint32_t width, uint32_t height )
+void VectorRasterizeThread::SetRenderer( Renderer renderer )
{
ConditionalWait::ScopedLock lock( mConditionalWait );
- mVectorRenderer.SetSize( width, height );
- DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::SetSize: width = %d, height = %d\n", width, height );
+ mVectorRenderer.SetRenderer( renderer );
+
+ DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::SetRenderer\n" );
}
-void VectorRasterizeThread::StartAnimation()
+void VectorRasterizeThread::SetSize( uint32_t width, uint32_t height )
+{
+ if( mWidth != width || mHeight != height )
+ {
+ ConditionalWait::ScopedLock lock( mConditionalWait );
+ mVectorRenderer.SetSize( width, height );
+
+ mWidth = width;
+ mHeight = height;
+
+ mResourceReady = false;
+
+ DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::SetSize: width = %d, height = %d\n", width, height );
+ }
+}
+
+void VectorRasterizeThread::PlayAnimation()
{
ConditionalWait::ScopedLock lock( mConditionalWait );
if( mPlayState != DevelImageVisual::PlayState::PLAYING )
{
- if( mPlayState == DevelImageVisual::PlayState::STOPPED )
- {
- // Reset the current frame and the current loop
- mCurrentFrame = mStartFrame;
- mCurrentLoop = 0;
- }
-
mPlayState = DevelImageVisual::PlayState::PLAYING;
mConditionalWait.Notify( lock );
- DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::StartAnimation: Start\n" );
+ DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::PlayAnimation: Start\n" );
}
}
{
mPlayState = DevelImageVisual::PlayState::STOPPED;
+ // Reset the current frame and the current loop
+ mCurrentFrame = mStartFrame;
+ mCurrentLoop = 0;
+
DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::StopAnimation: Stop\n" );
}
}
void VectorRasterizeThread::RenderFrame()
{
ConditionalWait::ScopedLock lock( mConditionalWait );
- mNeedRender = true;
- mConditionalWait.Notify( lock );
- DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::RenderFrame: Render\n" );
+ if( !mResourceReady )
+ {
+ mNeedRender = true;
+ mConditionalWait.Notify( lock );
+
+ DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::RenderFrame: Render\n" );
+ }
}
void VectorRasterizeThread::SetResourceReadyCallback( EventThreadCallback* callback )
mAnimationFinishedTrigger = std::unique_ptr< EventThreadCallback >( callback );
}
-void VectorRasterizeThread::SetLoopCount( int16_t count )
+void VectorRasterizeThread::SetLoopCount( int32_t count )
{
- ConditionalWait::ScopedLock lock( mConditionalWait );
+ if( mLoopCount != count )
+ {
+ ConditionalWait::ScopedLock lock( mConditionalWait );
- mLoopCount = count;
+ mLoopCount = count;
- // Reset progress
- mCurrentLoop = 0;
- mCurrentFrame = mStartFrame;
+ // Reset progress
+ mCurrentLoop = 0;
+ }
+}
+
+int32_t VectorRasterizeThread::GetLoopCount() const
+{
+ return mLoopCount;
}
void VectorRasterizeThread::SetPlayRange( Vector2 range )
{
- ConditionalWait::ScopedLock lock( mConditionalWait );
+ // Make sure the range specified is between 0.0 and 1.0
+ if( range.x >= 0.0f && range.x <= 1.0f && range.y >= 0.0f && range.y <= 1.0f )
+ {
+ Vector2 orderedRange( range );
+ // If the range is not in order swap values
+ if( range.x > range.y )
+ {
+ orderedRange = Vector2( range.y, range.x );
+ }
+
+ if( mPlayRange != orderedRange )
+ {
+ ConditionalWait::ScopedLock lock( mConditionalWait );
- mPlayRange = range;
+ mPlayRange = orderedRange;
- if( mTotalFrame != 0 )
+ if( mTotalFrame != 0 )
+ {
+ mStartFrame = static_cast< uint32_t >( mPlayRange.x * mTotalFrame + 0.5f );
+ mEndFrame = static_cast< uint32_t >( mPlayRange.y * mTotalFrame + 0.5f );
+
+ // If the current frame is out of the range, change the current frame also.
+ if( mStartFrame > mCurrentFrame )
+ {
+ mCurrentFrame = mStartFrame;
+
+ mResourceReady = false;
+ }
+ else if( mEndFrame < mCurrentFrame )
+ {
+ mCurrentFrame = mEndFrame;
+
+ mResourceReady = false;
+ }
+ }
+ }
+ }
+}
+
+Vector2 VectorRasterizeThread::GetPlayRange() const
+{
+ return mPlayRange;
+}
+
+void VectorRasterizeThread::SetCurrentProgress( float progress )
+{
+ ConditionalWait::ScopedLock lock( mConditionalWait );
+
+ if( progress >= mPlayRange.x && progress <= mPlayRange.y )
{
- mStartFrame = static_cast< uint32_t >( mPlayRange.x * mTotalFrame + 0.5f );
- mEndFrame = static_cast< uint32_t >( mPlayRange.y * mTotalFrame + 0.5f );
+ mProgress = progress;
+
+ if( mTotalFrame != 0 )
+ {
+ mCurrentFrame = static_cast< uint32_t >( mTotalFrame * progress + 0.5f );
+ }
+
+ mResourceReady = false;
+
+ DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::SetCurrentProgress: progress = %f (%d)\n", progress, mCurrentFrame );
}
}
-DevelImageVisual::PlayState VectorRasterizeThread::GetPlayState()
+float VectorRasterizeThread::GetCurrentProgress() const
+{
+ return ( static_cast< float >( mCurrentFrame ) / static_cast< float >( mTotalFrame ) );
+}
+
+DevelImageVisual::PlayState VectorRasterizeThread::GetPlayState() const
{
return mPlayState;
}
+bool VectorRasterizeThread::IsResourceReady() const
+{
+ return mResourceReady;
+}
+
bool VectorRasterizeThread::IsThreadReady()
{
ConditionalWait::ScopedLock lock( mConditionalWait );
mStartFrame = static_cast< uint32_t >( mPlayRange.x * mTotalFrame + 0.5f );
mEndFrame = static_cast< uint32_t >( mPlayRange.y * mTotalFrame + 0.5f );
- mCurrentFrame = mStartFrame;
+ mCurrentFrame = std::max( static_cast< uint32_t >( mTotalFrame * mProgress + 0.5f ), mStartFrame );
DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::StartRender: Renderer is started [%d (%d, %d)]\n", mTotalFrame, mStartFrame, mEndFrame );
{
DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::Rasterize: [%d]\n", mCurrentFrame );
+ bool needRender, resourceReady;
+
+ {
+ ConditionalWait::ScopedLock lock( mConditionalWait );
+ needRender = mNeedRender;
+ resourceReady = mResourceReady;
+ }
+
// Rasterize
mVectorRenderer.Render( mCurrentFrame );
// Animation is finished
mPlayState = DevelImageVisual::PlayState::STOPPED;
+ // Reset the current frame and the current loop
+ mCurrentFrame = mStartFrame;
+ mCurrentLoop = 0;
+
mAnimationFinishedTrigger->Trigger();
DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::Rasterize: Animation is finished\n" );
}
}
- mNeedRender = false;
+ if( needRender )
+ {
+ mNeedRender = false;
+ }
- if( !mResourceReady )
+ if( !resourceReady )
{
DALI_LOG_INFO( gVectorAnimationLogFilter, Debug::Verbose, "VectorRasterizeThread::Rasterize: Resource ready trigger\n" );
* @brief Constructor.
*
* @param[in] url The url of the vector animation file
- * @param[in] renderer The renderer used to render the image
- * @param[in] width The width of the content
- * @param[in] height The height of the content
*/
- VectorRasterizeThread( const std::string& url, Renderer renderer, uint32_t width, uint32_t height );
+ VectorRasterizeThread( const std::string& url );
/**
* @brief Destructor.
virtual ~VectorRasterizeThread();
/**
+ * @brief Sets the renderer used to display the result image.
+ *
+ * @param[in] renderer The renderer used to display the result image
+ */
+ void SetRenderer( Renderer renderer );
+
+ /**
* @brief Sets the target image size.
*
* @param[in] width The target image width
/**
* @brief Play the vector animation.
*/
- void StartAnimation();
+ void PlayAnimation();
/**
* @brief Stop the vector animation.
* @brief Enable looping for 'count' repeats. -1 means to repeat forever.
* @param[in] count The number of times to loop
*/
- void SetLoopCount( int16_t count );
+ void SetLoopCount( int32_t count );
+
+ /**
+ * @brief Gets the loop count. -1 means to repeat forever.
+ * @return The number of times to loop
+ */
+ int32_t GetLoopCount() const;
/**
* @brief Set the playing range.
void SetPlayRange( Vector2 range );
/**
+ * @brief Gets the playing range.
+ * @return The play range defined for the animation
+ */
+ Vector2 GetPlayRange() const;
+
+ /**
* @brief Get the play state
* @return The play state
*/
- DevelImageVisual::PlayState GetPlayState();
+ DevelImageVisual::PlayState GetPlayState() const;
+
+ /**
+ * @brief Queries whether the resource is ready.
+ * @return true if ready, false otherwise
+ */
+ bool IsResourceReady() const;
+
+ /**
+ * @brief Sets the progress of the animation.
+ * @param[in] progress The new progress as a normalized value between [0,1] or between the play range if specified.
+ */
+ void SetCurrentProgress( float progress );
+
+ /**
+ * @brief Retrieves the current progress of the animation.
+ * @return The current progress as a normalized value between [0,1]
+ */
+ float GetCurrentProgress() const;
protected:
std::unique_ptr< EventThreadCallback > mAnimationFinishedTrigger;
Vector2 mPlayRange;
DevelImageVisual::PlayState mPlayState;
+ float mProgress;
uint32_t mCurrentFrame;
uint32_t mTotalFrame;
uint32_t mStartFrame;
uint32_t mEndFrame;
uint32_t mWidth;
uint32_t mHeight;
- int16_t mLoopCount;
- int16_t mCurrentLoop;
+ int32_t mLoopCount;
+ int32_t mCurrentLoop;
bool mNeedRender;
bool mDestroyThread; ///< Whether the thread be destroyed
bool mResourceReady;
#define DALI_TOOLKIT_INTERNAL_BORDER_VISUAL_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
/**
* @copydoc Visual::Base::DoSetProperties
*/
- virtual void DoSetProperties( const Property::Map& propertyMap );
+ void DoSetProperties( const Property::Map& propertyMap ) override;
/**
* @copydoc Visual::Base::DoSetOnStage
*/
- virtual void DoSetOnStage( Actor& actor );
+ void DoSetOnStage( Actor& actor ) override;
/**
* @copydoc Visual::Base::CreatePropertyMap
*/
- virtual void DoCreatePropertyMap( Property::Map& map ) const;
+ void DoCreatePropertyMap( Property::Map& map ) const override;
/**
* @copydoc Visual::Base::CreateInstancePropertyMap
*/
- virtual void DoCreateInstancePropertyMap( Property::Map& map ) const;
+ void DoCreateInstancePropertyMap( Property::Map& map ) const override;
/**
* @copydoc Visual::Base::OnSetTransform
*/
- virtual void OnSetTransform();
+ void OnSetTransform() override;
public:
#define DALI_TOOLKIT_INTERNAL_COLOR_VISUAL_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
/**
* @copydoc Visual::Base::CreatePropertyMap
*/
- virtual void DoCreatePropertyMap( Property::Map& map ) const;
+ void DoCreatePropertyMap( Property::Map& map ) const override;
/**
* @copydoc Visual::Base::CreateInstancePropertyMap
*/
- virtual void DoCreateInstancePropertyMap( Property::Map& map ) const;
+ void DoCreateInstancePropertyMap( Property::Map& map ) const override;
protected:
/**
* @copydoc Visual::Base::DoSetProperties
*/
- virtual void DoSetProperties( const Property::Map& propertyMap );
+ void DoSetProperties( const Property::Map& propertyMap ) override;
/**
* @copydoc Visual::Base::DoSetOnStage
*/
- virtual void DoSetOnStage( Actor& actor );
+ void DoSetOnStage( Actor& actor ) override;
/**
* @copydoc Visual::Base::OnSetTransform
*/
- virtual void OnSetTransform();
+ void OnSetTransform() override;
private:
/**
#define DALI_TOOLKIT_INTERNAL_GRADIENT_VISUAL_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
/**
* @copydoc Visual::Base::CreatePropertyMap
*/
- virtual void DoCreatePropertyMap( Property::Map& map ) const;
+ void DoCreatePropertyMap( Property::Map& map ) const override;
/**
* @copydoc Visual::Base::CreateInstancePropertyMap
*/
- virtual void DoCreateInstancePropertyMap( Property::Map& map ) const;
+ void DoCreateInstancePropertyMap( Property::Map& map ) const override;
protected:
/**
* @copydoc Visual::Base::DoSetProperties
*/
- virtual void DoSetProperties( const Property::Map& propertyMap );
+ void DoSetProperties( const Property::Map& propertyMap ) override;
/**
* @copydoc Visual::Base::OnSetTransform
*/
- virtual void OnSetTransform();
+ void OnSetTransform() override;
/**
* @copydoc Visual::Base::DoSetOnStage
*/
- virtual void DoSetOnStage( Actor& actor );
+ void DoSetOnStage( Actor& actor ) override;
private:
if( mReleasePolicy == Toolkit::ImageVisual::ReleasePolicy::DETACHED )
{
RemoveTexture(); // If INVALID_TEXTURE_ID then removal will be attempted on atlas
+ mImpl->mResourceStatus = Toolkit::Visual::ResourceStatus::PREPARING;
}
if( mImageUrl.IsValid() )
#define DALI_TOOLKIT_INTERNAL_IMAGE_VISUAL_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
/**
* @copydoc Visual::Base::GetNaturalSize
*/
- virtual void GetNaturalSize( Vector2& naturalSize );
+ void GetNaturalSize( Vector2& naturalSize ) override;
/**
* @copydoc Visual::Base::CreatePropertyMap
*/
- virtual void DoCreatePropertyMap( Property::Map& map ) const;
+ void DoCreatePropertyMap( Property::Map& map ) const override;
/**
* @copydoc Visual::Base::CreateInstancePropertyMap
*/
- virtual void DoCreateInstancePropertyMap( Property::Map& map ) const;
+ void DoCreateInstancePropertyMap( Property::Map& map ) const override;
/**
* @copydoc Visual::Base::OnDoAction
*/
- virtual void OnDoAction( const Dali::Property::Index actionName, const Dali::Property::Value& attributes ) override;
+ void OnDoAction( const Dali::Property::Index actionName, const Dali::Property::Value& attributes ) override;
protected:
/**
* @copydoc Visual::Base::DoSetProperties
*/
- virtual void DoSetProperties( const Property::Map& propertyMap );
+ void DoSetProperties( const Property::Map& propertyMap ) override;
/**
* @copydoc Visual::Base::DoSetOnStage
*/
- virtual void DoSetOnStage( Actor& actor );
+ void DoSetOnStage( Actor& actor ) override;
/**
* @copydoc Visual::Base::DoSetOffStage
*/
- virtual void DoSetOffStage( Actor& actor ) ;
+ void DoSetOffStage( Actor& actor ) override;
/**
* @copydoc Visual::Base::OnSetTransform
*/
- virtual void OnSetTransform() ;
+ void OnSetTransform() override;
/**
* @copydoc Visual::Base::IsResourceReady
*/
- virtual bool IsResourceReady() const;
+ bool IsResourceReady() const override;
public:
* To avoid rendering garbage pixels, renderer should be added to actor after the resources are ready.
* This callback is the place to add the renderer as it would be called once the loading is finished.
*/
- virtual void UploadCompleted() override;
+ void UploadCompleted() override;
/**
* @copydoc TextureUploadObserver::UploadCompleted
* To avoid rendering garbage pixels, renderer should be added to actor after the resources are ready.
* This callback is the place to add the renderer as it would be called once the loading is finished.
*/
- virtual void UploadComplete( bool success, int32_t textureId, TextureSet textureSet,
- bool usingAtlas, const Vector4& atlasRectangle, bool preMultiplied ) override;
+ void UploadComplete( bool success, int32_t textureId, TextureSet textureSet,
+ bool usingAtlas, const Vector4& atlasRectangle, bool preMultiplied ) override;
private:
#define DALI_TOOLKIT_INTERNAL_MESH_VISUAL_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
/**
* @copydoc Visual::Base::CreatePropertyMap
*/
- virtual void DoCreatePropertyMap( Property::Map& map ) const;
+ void DoCreatePropertyMap( Property::Map& map ) const override;
/**
* @copydoc Visual::Base::CreateInstancePropertyMap
*/
- virtual void DoCreateInstancePropertyMap( Property::Map& map ) const;
+ void DoCreateInstancePropertyMap( Property::Map& map ) const override;
protected:
/**
* @copydoc Visual::Base::DoSetProperties
*/
- virtual void DoSetProperties( const Property::Map& propertyMap );
+ void DoSetProperties( const Property::Map& propertyMap ) override;
/**
* @copydoc Visual::Base::OnSetTransform
*/
- virtual void OnSetTransform();
+ void OnSetTransform() override;
/**
* @copydoc Visual::Base::DoSetOnStage
*/
- virtual void DoSetOnStage( Actor& actor );
+ void DoSetOnStage( Actor& actor ) override;
public:
#define DALI_TOOLKIT_INTERNAL_N_PATCH_VISUAL_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
/**
* @copydoc Visual::Base::GetNaturalSize
*/
- virtual void GetNaturalSize( Vector2& naturalSize );
+ void GetNaturalSize( Vector2& naturalSize ) override;
/**
* @copydoc Visual::Base::CreatePropertyMap
*/
- virtual void DoCreatePropertyMap( Property::Map& map ) const;
+ void DoCreatePropertyMap( Property::Map& map ) const override;
/**
* @copydoc Visual::Base::CreateInstancePropertyMap
*/
- virtual void DoCreateInstancePropertyMap( Property::Map& map ) const;
+ void DoCreateInstancePropertyMap( Property::Map& map ) const override;
protected:
/**
* @copydoc Visual::Base::DoSetProperties
*/
- virtual void DoSetProperties( const Property::Map& propertyMap );
+ void DoSetProperties( const Property::Map& propertyMap ) override;
/**
* @copydoc Visual::Base::DoSetOnStage
*/
- virtual void DoSetOnStage( Actor& actor );
+ void DoSetOnStage( Actor& actor ) override;
/**
* @copydoc Visual::Base::DoSetOffStage
*/
- virtual void DoSetOffStage( Actor& actor );
+ void DoSetOffStage( Actor& actor ) override;
/**
* @copydoc Visual::Base::OnSetTransform
*/
- virtual void OnSetTransform();
+ void OnSetTransform() override;
private:
#define DALI_TOOLKIT_INTERNAL_PRIMITIVE_VISUAL_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
/**
* @copydoc Visual::Base::GetNaturalSize
*/
- virtual void GetNaturalSize( Vector2& naturalSize );
+ void GetNaturalSize( Vector2& naturalSize ) override;
/**
* @copydoc Visual::Base::CreatePropertyMap
*/
- virtual void DoCreatePropertyMap( Property::Map& map ) const;
+ void DoCreatePropertyMap( Property::Map& map ) const override;
/**
* @copydoc Visual::Base::CreateInstancePropertyMap
*/
- virtual void DoCreateInstancePropertyMap( Property::Map& map ) const;
+ void DoCreateInstancePropertyMap( Property::Map& map ) const override;
protected:
/**
* @copydoc Visual::Base::DoSetProperties
*/
- virtual void DoSetProperties( const Property::Map& propertyMap );
+ void DoSetProperties( const Property::Map& propertyMap ) override;
/**
* @copydoc Visual::Base::DoSetOnStage
*/
- virtual void DoSetOnStage( Actor& actor );
+ void DoSetOnStage( Actor& actor ) override;
/**
* @copydoc Visual::Base::OnSetTransform
*/
- virtual void OnSetTransform();
+ void OnSetTransform() override;
private:
#define DALI_TOOLKIT_SVG_RASTERIZE_THREAD_H
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
* The entry function of the worker thread.
* It fetches task from the Queue, rasterizes the image and apply to the renderer.
*/
- virtual void Run();
+ void Run() override;
private:
#define DALI_TOOLKIT_INTERNAL_SVG_VISUAL_H
/*
- * Copyright (c) 2017 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
/**
* @copydoc Visual::Base::GetNaturalSize
*/
- virtual void GetNaturalSize( Vector2& naturalSize );
+ void GetNaturalSize( Vector2& naturalSize ) override;
/**
* @copydoc Visual::Base::CreatePropertyMap
*/
- virtual void DoCreatePropertyMap( Property::Map& map ) const;
+ void DoCreatePropertyMap( Property::Map& map ) const override;
/**
* @copydoc Visual::Base::CreateInstancePropertyMap
*/
- virtual void DoCreateInstancePropertyMap( Property::Map& map ) const;
+ void DoCreateInstancePropertyMap( Property::Map& map ) const override;
protected:
/**
* @copydoc Visual::Base::DoSetProperties
*/
- virtual void DoSetProperties( const Property::Map& propertyMap );
+ void DoSetProperties( const Property::Map& propertyMap ) override;
/**
* @copydoc Visual::Base::DoSetOnStage
*/
- virtual void DoSetOnStage( Actor& actor );
+ void DoSetOnStage( Actor& actor ) override;
/**
* @copydoc Visual::Base::DoSetOffStage
*/
- virtual void DoSetOffStage( Actor& actor );
+ void DoSetOffStage( Actor& actor ) override;
/**
* @copydoc Visual::Base::OnSetTransform
*/
- virtual void OnSetTransform();
+ void OnSetTransform() override;
public:
#define DALI_TOOLKIT_INTERNAL_TEXT_VISUAL_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
/**
* @copydoc Visual::Base::GetHeightForWidth()
*/
- virtual float GetHeightForWidth( float width );
+ float GetHeightForWidth( float width ) override;
/**
* @copydoc Visual::Base::GetNaturalSize()
*/
- virtual void GetNaturalSize( Vector2& naturalSize );
+ void GetNaturalSize( Vector2& naturalSize ) override;
/**
* @copydoc Visual::Base::CreatePropertyMap()
*/
- virtual void DoCreatePropertyMap( Property::Map& map ) const;
+ void DoCreatePropertyMap( Property::Map& map ) const override;
/**
* @copydoc Visual::Base::CreateInstancePropertyMap
*/
- virtual void DoCreateInstancePropertyMap( Property::Map& map ) const;
+ void DoCreateInstancePropertyMap( Property::Map& map ) const override;
protected:
/**
* @copydoc Visual::Base::DoSetProperties()
*/
- virtual void DoSetProperties( const Property::Map& propertyMap );
+ void DoSetProperties( const Property::Map& propertyMap ) override;
/**
* @copydoc Visual::Base::DoSetOnStage()
*/
- virtual void DoSetOnStage( Actor& actor );
+ void DoSetOnStage( Actor& actor ) override;
/**
* @copydoc Visual::Base::DoSetOffStage()
*/
- virtual void DoSetOffStage( Actor& actor );
+ void DoSetOffStage( Actor& actor ) override;
/**
* @copydoc Visual::Base::OnSetTransform
*/
- virtual void OnSetTransform();
+ void OnSetTransform() override;
private:
/**
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
#ifdef DEBUG_ENABLED
Debug::Filter* gTextureManagerLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_TEXTURE_MANAGER" );
+
+#define GET_LOAD_STATE_STRING( loadState ) \
+ loadState == TextureManager::NOT_STARTED ? "NOT_STARTED" : \
+ loadState == TextureManager::LOADING ? "LOADING" : \
+ loadState == TextureManager::LOAD_FINISHED ? "LOAD_FINISHED" : \
+ loadState == TextureManager::WAITING_FOR_MASK ? "WAITING_FOR_MASK" : \
+ loadState == TextureManager::UPLOADED ? "UPLOADED" : \
+ loadState == TextureManager::CANCELLED ? "CANCELLED" : \
+ loadState == TextureManager::LOAD_FAILED ? "LOAD_FAILED" : "Unknown"
+
#endif
const uint32_t DEFAULT_ATLAS_SIZE( 1024u ); ///< This size can fit 8 by 8 images of average size 128 * 128
mAsyncRemoteLoaders( GetNumberOfRemoteLoaderThreads(), [&]() { return AsyncLoadingHelper(*this); } ),
mExternalTextures(),
mLifecycleObservers(),
+ mLoadQueue(),
mBrokenImageUrl(""),
- mCurrentTextureId( 0 )
+ mCurrentTextureId( 0 ),
+ mQueueLoadFlag(false)
{
}
}
TextureManager::LoadState loadState = GetTextureStateInternal( textureId );
- loadingStatus = ( loadState == TextureManager::LOADING );
-
if( loadState == TextureManager::UPLOADED )
{
// UploadComplete has already been called - keep the same texture set
textureSet = GetTextureSet( textureId );
}
+
+ // If we are loading the texture, or waiting for the ready signal handler to complete, inform
+ // caller that they need to wait.
+ loadingStatus = ( loadState == TextureManager::LOADING ||
+ loadState == TextureManager::NOT_STARTED ||
+ mQueueLoadFlag );
+
}
else
{
++( mTextureInfoContainer[ cacheIndex ].referenceCount );
}
textureId = mTextureInfoContainer[ cacheIndex ].textureId;
- DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, "TextureManager::RequestLoad( url=%s observer=%p ) Using cached texture id@%d, textureId=%d\n",
+ DALI_LOG_INFO( gTextureManagerLogFilter, Debug::General, "TextureManager::RequestLoad( url=%s observer=%p ) Using cached texture id@%d, textureId=%d\n",
url.GetUrl().c_str(), observer, cacheIndex, textureId );
}
preMultiply ) );
cacheIndex = mTextureInfoContainer.size() - 1u;
- DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, "TextureManager::RequestLoad( url=%s observer=%p ) New texture, cacheIndex:%d, textureId=%d\n",
+ DALI_LOG_INFO( gTextureManagerLogFilter, Debug::General, "TextureManager::RequestLoad( url=%s observer=%p ) New texture, cacheIndex:%d, textureId=%d\n",
url.GetUrl().c_str(), observer, cacheIndex, textureId );
}
textureInfo.storageType = storageType;
textureInfo.orientationCorrection = orientationCorrection;
- DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, "TextureInfo loadState:%s\n",
- textureInfo.loadState == TextureManager::NOT_STARTED ? "NOT_STARTED" :
- textureInfo.loadState == TextureManager::LOADING ? "LOADING" :
- textureInfo.loadState == TextureManager::UPLOADED ? "UPLOADED" :
- textureInfo.loadState == TextureManager::CANCELLED ? "CANCELLED" : "Unknown" );
+ DALI_LOG_INFO( gTextureManagerLogFilter, Debug::General, "TextureInfo loadState:%s\n",
+ GET_LOAD_STATE_STRING(textureInfo.loadState ) );
// Force reloading of texture by setting loadState unless already loading or cancelled.
if ( TextureManager::ReloadPolicy::FORCED == reloadPolicy && TextureManager::LOADING != textureInfo.loadState &&
case TextureManager::LOAD_FAILED: // Failed notifies observer which then stops observing.
case TextureManager::NOT_STARTED:
{
- LoadTexture( textureInfo );
- ObserveTexture( textureInfo, observer );
+ LoadOrQueueTexture( textureInfo, observer ); // If called inside NotifyObservers, queues until afterwards
break;
}
case TextureManager::LOADING:
{
if( observer )
{
- // The Texture has already loaded. The other observers have already been notified.
- // We need to send a "late" loaded notification for this observer.
- observer->UploadComplete( true, textureInfo.textureId, textureInfo.textureSet,
- textureInfo.useAtlas, textureInfo.atlasRect,
- textureInfo.preMultiplied );
+ LoadOrQueueTexture( textureInfo, observer );
}
break;
}
{
TextureInfo& textureInfo( mTextureInfoContainer[ textureInfoIndex ] );
- DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, "TextureManager::Remove(%d) cacheIdx:%d loadState:%s\n",
- textureId, textureInfoIndex,
- textureInfo.loadState == TextureManager::NOT_STARTED ? "NOT_STARTED" :
- textureInfo.loadState == TextureManager::LOADING ? "LOADING" :
- textureInfo.loadState == TextureManager::UPLOADED ? "UPLOADED" :
- textureInfo.loadState == TextureManager::CANCELLED ? "CANCELLED" : "Unknown" );
+ DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise,
+ "TextureManager::Remove(%d) url:%s\n cacheIdx:%d loadState:%s\n",
+ textureId, textureInfo.url.GetUrl().c_str(),
+ textureInfoIndex, GET_LOAD_STATE_STRING( textureInfo.loadState ) );
// Decrement the reference count and check if this is the last user of this Texture.
if( --textureInfo.referenceCount <= 0 )
DALI_ASSERT_DEBUG(endIter != mLifecycleObservers.End());
}
+void TextureManager::LoadOrQueueTexture( TextureInfo& textureInfo, TextureUploadObserver* observer )
+{
+ switch( textureInfo.loadState )
+ {
+ case NOT_STARTED:
+ case LOAD_FAILED:
+ {
+ if( mQueueLoadFlag )
+ {
+ QueueLoadTexture( textureInfo, observer );
+ }
+ else
+ {
+ LoadTexture( textureInfo, observer );
+ }
+ break;
+ }
+ case LOADING:
+ case UPLOADED:
+ {
+ if( mQueueLoadFlag )
+ {
+ QueueLoadTexture( textureInfo, observer );
+ }
+ else
+ {
+ // The Texture has already loaded. The other observers have already been notified.
+ // We need to send a "late" loaded notification for this observer.
+ observer->UploadComplete( true, textureInfo.textureId, textureInfo.textureSet,
+ textureInfo.useAtlas, textureInfo.atlasRect,
+ textureInfo.preMultiplied );
+ }
+ }
+ case CANCELLED:
+ case LOAD_FINISHED:
+ case WAITING_FOR_MASK:
+ {
+ break;
+ }
+ }
+}
+
+void TextureManager::QueueLoadTexture( TextureInfo& textureInfo, TextureUploadObserver* observer )
+{
+ auto textureId = textureInfo.textureId;
+ mLoadQueue.PushBack( LoadQueueElement( textureId, observer) );
+}
-bool TextureManager::LoadTexture( TextureInfo& textureInfo )
+void TextureManager::LoadTexture( TextureInfo& textureInfo, TextureUploadObserver* observer )
{
- bool success = true;
+ DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, "TextureManager::LoadTexture(): url:%s sync:%s\n",
+ textureInfo.url.GetUrl().c_str(), textureInfo.loadSynchronously?"T":"F" );
- if( textureInfo.loadState == NOT_STARTED )
+ textureInfo.loadState = LOADING;
+ if( !textureInfo.loadSynchronously )
{
- textureInfo.loadState = LOADING;
+ auto& loadersContainer = textureInfo.url.IsLocalResource() ? mAsyncLocalLoaders : mAsyncRemoteLoaders;
+ auto loadingHelperIt = loadersContainer.GetNext();
+ DALI_ASSERT_ALWAYS(loadingHelperIt != loadersContainer.End());
+ loadingHelperIt->Load(textureInfo.textureId, textureInfo.url,
+ textureInfo.desiredSize, textureInfo.fittingMode,
+ textureInfo.samplingMode, textureInfo.orientationCorrection );
+ }
+ ObserveTexture( textureInfo, observer );
+}
- if( !textureInfo.loadSynchronously )
+void TextureManager::ProcessQueuedTextures()
+{
+ for( auto&& element : mLoadQueue )
+ {
+ int cacheIndex = GetCacheIndexFromId( element.mTextureId );
+ if( cacheIndex != INVALID_CACHE_INDEX )
{
- auto& loadersContainer = textureInfo.url.IsLocalResource() ? mAsyncLocalLoaders : mAsyncRemoteLoaders;
- auto loadingHelperIt = loadersContainer.GetNext();
- DALI_ASSERT_ALWAYS(loadingHelperIt != loadersContainer.End());
- loadingHelperIt->Load(textureInfo.textureId, textureInfo.url,
- textureInfo.desiredSize, textureInfo.fittingMode,
- textureInfo.samplingMode, textureInfo.orientationCorrection );
+ TextureInfo& textureInfo( mTextureInfoContainer[cacheIndex] );
+ if( textureInfo.loadState == UPLOADED )
+ {
+ element.mObserver->UploadComplete( true, textureInfo.textureId, textureInfo.textureSet,
+ textureInfo.useAtlas, textureInfo.atlasRect,
+ textureInfo.preMultiplied );
+ }
+ else
+ {
+ LoadTexture( textureInfo, element.mObserver );
+ }
}
}
-
- return success;
+ mLoadQueue.Clear();
}
void TextureManager::ObserveTexture( TextureInfo& textureInfo,
TextureUploadObserver* observer )
{
+ DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, "TextureManager::ObserveTexture(): url:%s observer:%p\n",
+ textureInfo.url.GetUrl().c_str(), observer );
+
if( observer )
{
textureInfo.observerList.PushBack( observer );
{
TextureInfo& textureInfo( mTextureInfoContainer[cacheIndex] );
- DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, " CacheIndex:%d LoadState: %d\n", cacheIndex, textureInfo.loadState );
+ DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise,
+ " textureId:%d Url:%s CacheIndex:%d LoadState: %d\n",
+ textureInfo.textureId, textureInfo.url.GetUrl().c_str(), cacheIndex, textureInfo.loadState );
if( textureInfo.loadState != CANCELLED )
{
}
}
-
void TextureManager::UploadTexture( Devel::PixelBuffer& pixelBuffer, TextureInfo& textureInfo )
{
if( textureInfo.useAtlas != USE_ATLAS )
{
- DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, " TextureManager::UploadTexture() New Texture for textureId:%d\n", textureInfo.textureId );
+ DALI_LOG_INFO( gTextureManagerLogFilter, Debug::General, " TextureManager::UploadTexture() New Texture for textureId:%d\n", textureInfo.textureId );
// If the texture doesn't have an alpha channel, can't pre-multiply it.
// Ensure that we don't change the load parameter (it's used for hashing), and instead set
// If there is an observer: Notify the load is complete, whether successful or not,
// and erase it from the list
- unsigned int observerCount = textureInfo.observerList.Count();
TextureInfo* info = &textureInfo;
- while( observerCount )
+ mQueueLoadFlag = true;
+
+ while( info->observerList.Count() )
{
TextureUploadObserver* observer = info->observerList[0];
// During UploadComplete() a Control ResourceReady() signal is emitted.
// During that signal the app may add remove /add Textures (e.g. via
- // ImageViews). At this point no more observers can be added to the
- // observerList, because textureInfo.loadState = UPLOADED. However it is
- // possible for observers to be removed, hence we check the observer list
- // count every iteration.
-
- // The reference to the textureInfo struct can also become invalidated,
- // because new load requests can modify the mTextureInfoContainer list
- // (e.g. if more requests are pushed back it can cause the list to be
- // resized invalidating the reference to the TextureInfo ).
+ // ImageViews).
+ // It is possible for observers to be removed from the observer list,
+ // and it is also possible for the mTextureInfoContainer to be modified,
+ // invalidating the reference to the textureInfo struct.
+ // Texture load requests for the same URL are deferred until the end of this
+ // method.
+ DALI_LOG_INFO( gTextureManagerLogFilter, Debug::Concise, "NotifyObservers() url:%s loadState:%s\n",
+ textureInfo.url.GetUrl().c_str(), GET_LOAD_STATE_STRING(textureInfo.loadState ) );
+
observer->UploadComplete( success, info->textureId, info->textureSet, info->useAtlas, info->atlasRect,
info->preMultiplied );
observer->DestructionSignal().Disconnect( this, &TextureManager::ObserverDestroyed );
- // Get the textureInfo from the container again as it may have been
- // invalidated,
-
+ // Get the textureInfo from the container again as it may have been invalidated.
int textureInfoIndex = GetCacheIndexFromId( textureId );
if( textureInfoIndex == INVALID_CACHE_INDEX)
{
- return; // texture has been removed - can stop.
+ break; // texture has been removed - can stop.
}
-
info = &mTextureInfoContainer[ textureInfoIndex ];
- observerCount = info->observerList.Count();
- if ( observerCount > 0 )
+
+ // remove the observer that was just triggered if it's still in the list
+ for( TextureInfo::ObserverListType::Iterator j = info->observerList.Begin(); j != info->observerList.End(); ++j )
{
- // remove the observer that was just triggered if it's still in the list
- for( TextureInfo::ObserverListType::Iterator j = info->observerList.Begin(); j != info->observerList.End(); ++j )
+ if( *j == observer )
{
- if( *j == observer )
- {
- info->observerList.Erase( j );
- observerCount--;
- break;
- }
+ info->observerList.Erase( j );
+ break;
}
}
}
+
+ mQueueLoadFlag = false;
+ ProcessQueuedTextures();
}
TextureManager::TextureId TextureManager::GenerateUniqueTextureId()
typedef size_t TextureHash; ///< The type used to store the hash used for Texture caching.
+ // Structs:
+
/**
* @brief This struct is used to manage the life-cycle of Texture loading and caching.
*/
bool preMultiplied:1; ///< true if the image's color was multiplied by it's alpha
};
- // Structs:
+ /**
+ * Structure to hold info about a texture load queued during NotifyObservers
+ */
+ struct LoadQueueElement
+ {
+ LoadQueueElement( TextureId textureId, TextureUploadObserver* observer )
+ : mTextureId( textureId ),
+ mObserver( observer )
+ {
+ }
+
+ TextureId mTextureId; ///< The texture id of the requested load.
+ TextureUploadObserver* mObserver; ///< Observer of texture load.
+ };
/**
* Struct to hold information about a requested Async load.
typedef std::vector<TextureInfo> TextureInfoContainerType; ///< The container type used to manage the life-cycle and caching of Textures
/**
+ * @brief Initiate a load or queue load if NotifyObservers is invoking callbacks
+ * @param[in] textureInfo The TextureInfo struct associated with the Texture
+ * @param[in] observer The observer wishing to observe the texture upload
+ */
+ void LoadOrQueueTexture( TextureInfo& textureInfo, TextureUploadObserver* observer );
+
+ /**
+ * @brief Queue a texture load to be subsequently handled by ProcessQueuedTextures.
+ * @param[in] textureInfo The TextureInfo struct associated with the Texture
+ * @param[in] observer The observer wishing to observe the texture upload
+ */
+ void QueueLoadTexture( TextureInfo& textureInfo, TextureUploadObserver* observer );
+
+ /**
* @brief Used internally to initiate a load.
* @param[in] textureInfo The TextureInfo struct associated with the Texture
- * @return True if the load was initiated
+ * @param[in] observer The observer wishing to observe the texture upload
+ */
+ void LoadTexture( TextureInfo& textureInfo, TextureUploadObserver* observer );
+
+ /**
+ * @brief Initiate load of textures queued whilst NotifyObservers invoking callbacks.
*/
- bool LoadTexture( TextureInfo& textureInfo );
+ void ProcessQueuedTextures();
/**
* Add the observer to the observer list
* @param[in] textureInfo The TextureInfo struct associated with the texture
- * observer The observer wishing to observe the texture upload
+ * @param[in] observer The observer wishing to observe the texture upload
*/
void ObserveTexture( TextureInfo & textureInfo, TextureUploadObserver* observer );
RoundRobinContainerView< AsyncLoadingHelper > mAsyncRemoteLoaders; ///< The Asynchronous image loaders used to provide all remote async loads
std::vector< ExternalTextureInfo > mExternalTextures; ///< Externally provided textures
Dali::Vector<LifecycleObserver*> mLifecycleObservers; ///< Lifecycle observers of texture manager
+ Dali::Vector<LoadQueueElement> mLoadQueue; ///< Queue of textures to load after NotifyObservers
std::string mBrokenImageUrl; ///< Broken image url
TextureId mCurrentTextureId; ///< The current value used for the unique Texture Id generation
+ bool mQueueLoadFlag; ///< Flag that causes Load Textures to be queued.
};
namespace
{
+#if defined(DEBUG_ENABLED)
+Debug::Filter* gLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_CONTROL_VISUALS");
+#endif
+
BaseHandle Create()
{
BaseHandle handle = Toolkit::VisualFactory::Get();
}
}
+ DALI_LOG_INFO( gLogFilter, Debug::Concise, "VisualFactory::CreateVisual( VisualType:%s %s%s)\n",
+ Scripting::GetEnumerationName<Toolkit::DevelVisual::Type>( visualType,
+ VISUAL_TYPE_TABLE,
+ VISUAL_TYPE_TABLE_COUNT ),
+ visualType==Toolkit::DevelVisual::IMAGE?"url:":"",
+ visualType==Toolkit::DevelVisual::IMAGE ?
+ propertyMap.Find( Toolkit::ImageVisual::Property::URL, IMAGE_URL_NAME)->Get<std::string>().c_str()
+ :"" );
+
+
if( !visualPtr )
{
- DALI_LOG_ERROR( "Renderer type unknown\n" );
+ DALI_LOG_ERROR( "VisualType unknown\n" );
}
if( mDebugEnabled && visualType != Toolkit::DevelVisual::WIREFRAME )
const char * const ORIENTATION_CORRECTION_NAME("orientationCorrection");
const char * const AUXILIARY_IMAGE_NAME("auxiliaryImage");
const char * const AUXILIARY_IMAGE_ALPHA_NAME("auxiliaryImageAlpha");
-const char * const PLAY_RANGE_NAME("playRange");
+const char * const PLAY_RANGE_NAME( "playRange" );
+const char * const PLAY_STATE_NAME( "playState" );
+const char * const CURRENT_PROGRESS_NAME( "currentProgress" );
// Text visual
const char * const TEXT_PROPERTY( "text" );
extern const char * const AUXILLARY_IMAGE_NAME;
extern const char * const AUXILLARY_IMAGE_ALPHA_NAME;
extern const char * const PLAY_RANGE_NAME;
+extern const char * const PLAY_STATE_NAME;
+extern const char * const CURRENT_PROGRESS_NAME;
// Text visual
extern const char * const TEXT_PROPERTY;
#define DALI_TOOLKIT_INTERNAL_WIREFRAME_VISUAL_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2019 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.
/**
* @copydoc Visual::Base::GetHeightForWidth()
*/
- virtual float GetHeightForWidth( float width );
+ float GetHeightForWidth( float width ) override;
/**
* @copydoc Visual::Base::GetNaturalSize()
*/
- virtual void GetNaturalSize( Vector2& naturalSize );
+ void GetNaturalSize( Vector2& naturalSize ) override;
/**
* @copydoc Visual::Base::CreatePropertyMap()
*/
- virtual void DoCreatePropertyMap( Property::Map& map ) const;
+ void DoCreatePropertyMap( Property::Map& map ) const override;
/**
* @copydoc Visual::Base::CreateInstancePropertyMap
*/
- virtual void DoCreateInstancePropertyMap( Property::Map& map ) const;
+ void DoCreateInstancePropertyMap( Property::Map& map ) const override;
/**
* @copydoc Visual::Base::DoSetProperties()
*/
- virtual void DoSetProperties( const Property::Map& propertyMap );
+ void DoSetProperties( const Property::Map& propertyMap ) override;
/**
* @copydoc Visual::Base::DoSetOnStage
*/
- virtual void DoSetOnStage( Actor& actor );
+ void DoSetOnStage( Actor& actor ) override;
/**
* @copydoc Visual::Base::OnSetTransform
*/
- virtual void OnSetTransform();
+ void OnSetTransform() override;
/**
* @copydoc Visual::Base::GetVisualObject
*
* Overriding as this visual can sometimes act as a proxy to the actual visual, i.e. when using debug rendering.
*/
- virtual Base& GetVisualObject() override;
+ Base& GetVisualObject() override;
private:
/**
const unsigned int TOOLKIT_MAJOR_VERSION = 1;
const unsigned int TOOLKIT_MINOR_VERSION = 4;
-const unsigned int TOOLKIT_MICRO_VERSION = 4;
+const unsigned int TOOLKIT_MICRO_VERSION = 6;
const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
Name: dali-toolkit
Summary: Dali 3D engine Toolkit
-Version: 1.4.4
+Version: 1.4.6
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT