layoutParameters.startLineIndex = 0u;
layoutParameters.estimatedNumberOfLines = logicalModel->mParagraphInfo.Count();
- bool isAutoScroll = false;
+ bool isAutoScroll = false;
+ bool isAutoScrollMaxTextureExceeded = false;
layoutEngine.LayoutText(layoutParameters,
layoutSize,
false,
isAutoScroll,
+ isAutoScrollMaxTextureExceeded,
ellipsisPosition);
if(options.align)
layoutSize = Vector2::ZERO;
- bool isAutoScroll = false;
- const bool updated = engine.LayoutText(layoutParameters,
+ bool isAutoScroll = false;
+ bool isAutoScrollMaxTextureExceeded = false;
+ const bool updated = engine.LayoutText(layoutParameters,
layoutSize,
data.ellipsis,
isAutoScroll,
+ isAutoScrollMaxTextureExceeded,
DevelText::EllipsisPosition::END);
// 4) Compare the results.
ControllerPtr controller = Controller::New();
// Tests the rendering controller has been created.
- TypesetterPtr typesetter = Typesetter::New( controller->GetTextModel() );
+ TypesetterPtr typesetter = Typesetter::New(controller->GetTextModel());
DALI_TEST_CHECK(typesetter);
// Tests the view model has been created.
controller->SetLineWrapMode( (Text::LineWrap::Mode)(data.lineWrapMode) );
controller->SetEllipsisPosition( data.ellipsisPosition );
- controller->SetText( data.text );
+ controller->SetText(data.text);
controller->Relayout( data.size );
// Elide the glyphs.
Size textSize36( 120.0f, 30.0f );
float positions36[] = { 0.0f, 10.0f, 21.0f, 25.0f, 28.0f, 38.0f, 44.0f, 55.0f };
+ Size textSize37(145.0f, 30.0f);
+ float positions37[] = {131.0f, 126.0f, 121.0f, 116.0f, 108.0f, 103.0f, 93.0f, 88.0f, 20.0f, 29.0f, 34.0f, 42.0f, 48.0f, 57.0f, 67.0f};
+
+ Size textSize38(145.0f, 30.0f);
+ float positions38[] = {51.0f, 66.0f, 71.0f, 79.0f, 85.0f, 94.0f, 103.0f, 109.0f, 119.0f, 51.0f, 37.0f, 32.0f, 27.0f, 23.0f, 14.0f, 10.0f, 0.0f};
+
struct ElideData data[] =
- {
{
- "void text",
- "",
- false,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::END,
- false,
- textSize00,
- 0u,
- 0u,
- nullptr
- },
+ {"void text",
+ "",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize00,
+ 0u,
+ 0u,
+ nullptr},
+
+ {"void text",
+ "",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize00,
+ 0u,
+ 0u,
+ nullptr},
+
+ {"void text",
+ "",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize00,
+ 0u,
+ 0u,
+ nullptr},
+
+ //END LTR cases
+ {
+ "EllipsisPosition: TextLabel: Basic case SingleLine LTR END",
+ "A0123456789 B0123456789 C0123456789 D0123456789 ",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize01,
+ 1u,
+ 10u,
+ positions01},
+
+ {"EllipsisPosition: TextLabel: Basic case Mulitlines LineWrap-WORD LTR END",
+ "A0123456789 B0123456789 C0123456789 D0123456789 ",
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize02,
+ 2u,
+ 22u,
+ positions02},
+
+ {"EllipsisPosition: TextLabel: Mulitlines LineWrap-WORD LTR END",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome",
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize03,
+ 3u,
+ 29u,
+ positions03},
+
+ {"EllipsisPosition: TextLabel: Mulitlines LineWrap-CHARACTER LTR END",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome",
+ true,
+ DevelText::LineWrap::CHARACTER,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize04,
+ 3u,
+ 40u,
+ positions04},
+
+ {"EllipsisPosition: TextLabel: Mulitlines LineWrap-HYPHAN LTR END",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome",
+ true,
+ DevelText::LineWrap::HYPHENATION,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize05,
+ 3u,
+ 32u,
+ positions05},
+
+ {"EllipsisPosition: TextLabel: Mulitlines LineWrap-MIXED LTR END",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome",
+ true,
+ DevelText::LineWrap::MIXED,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize06,
+ 3u,
+ 28u,
+ positions06},
+
+ //START LTR cases
+ {
+ "EllipsisPosition: TextLabel: Basic case SingleLine LTR START",
+ "A0123456789 B0123456789 C0123456789 D0123456789 ",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize07,
+ 1u,
+ 11u,
+ positions07,
+
+ },
+
+ {"EllipsisPosition: TextLabel: Basic case Mulitlines LineWrap-WORD LTR START",
+ "A0123456789 B0123456789 C0123456789 D0123456789 ",
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize08,
+ 2u,
+ 23u,
+ positions08},
+
+ {"EllipsisPosition: TextLabel: Mulitlines LineWrap-WORD LTR START",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome",
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize09,
+ 3u,
+ 33u,
+ positions09},
+
+ {"EllipsisPosition: TextLabel: Mulitlines LineWrap-CHARACTER LTR START",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome",
+ true,
+ DevelText::LineWrap::CHARACTER,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize10,
+ 3u,
+ 37u,
+ positions10},
+
+ {"EllipsisPosition: TextLabel: Mulitlines LineWrap-HYPHAN LTR START",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome",
+ true,
+ DevelText::LineWrap::HYPHENATION,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize11,
+ 3u,
+ 25u,
+ positions11},
+
+ {"EllipsisPosition: TextLabel: Mulitlines LineWrap-MIXED LTR START",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome",
+ true,
+ DevelText::LineWrap::MIXED,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize12,
+ 3u,
+ 25u,
+ positions12},
+
+ //END RTL cases
+ {
+ "EllipsisPosition: TextLabel: SingleLine RTL END",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize13,
+ 1u,
+ 14u,
+ positions13},
+
+ {"EllipsisPosition: TextLabel: Mulitlines LineWrap-WORD RTL END",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize14,
+ 3u,
+ 42u,
+ positions14},
+
+ {"EllipsisPosition: TextLabel: Mulitlines LineWrap-CHARACTER RTL END",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::CHARACTER,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize15,
+ 3u,
+ 44u,
+ positions15},
+
+ {"EllipsisPosition: TextLabel: Mulitlines LineWrap-HYPHENATION RTL END",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::HYPHENATION,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize16,
+ 3u,
+ 39u,
+ positions16},
+
+ {"EllipsisPosition: TextLabel: Mulitlines LineWrap-MIXED RTL END",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::MIXED,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize17,
+ 3u,
+ 39u,
+ positions17},
+
+ //START RTL cases
+ {
+ "EllipsisPosition: TextLabel: SingleLine RTL START",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize18,
+ 1u,
+ 13u,
+ positions18},
+
+ {"EllipsisPosition: TextLabel: Mulitlines LineWrap-WORD RTL START",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize19,
+ 3u,
+ 33u,
+ positions19},
+
+ {"EllipsisPosition: TextLabel: Mulitlines LineWrap-CHARACTER RTL START",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::CHARACTER,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize20,
+ 3u,
+ 30u,
+ positions20},
+
+ {"EllipsisPosition: TextLabel: Mulitlines LineWrap-HYPHENATION RTL START",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::HYPHENATION,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize21,
+ 3u,
+ 33u,
+ positions21},
+
+ {"EllipsisPosition: TextLabel: Mulitlines LineWrap-MIXED RTL START",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::MIXED,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize22,
+ 3u,
+ 33u,
+ positions22},
+
+ //MIDDLE LTR cases
+ {
+ "EllipsisPosition: TextLabel: Basic case SingleLine LTR MIDDLE",
+ "ABCDEFGHIJKLMNPQRSTUVWXYZ abcdefghijklmnpqrstuvwxyz",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize23,
+ 1u,
+ 10u,
+ positions23},
+
+ {"EllipsisPosition: TextLabel: Basic case Mulitlines LineWrap-WORD LTR MIDDLE",
+ "A0123456789 B0123456789 C0123456789 D0123456789 ",
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize24,
+ 2u,
+ 22u,
+ positions24},
+
+ {"EllipsisPosition: TextLabel: Mulitlines LineWrap-WORD LTR MIDDLE",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Goodbye",
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize25,
+ 3u,
+ 24u,
+ positions25},
+
+ {"EllipsisPosition: TextLabel: Mulitlines LineWrap-CHARACTER LTR MIDDLE",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Goodbye",
+ true,
+ DevelText::LineWrap::CHARACTER,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize26,
+ 3u,
+ 36u,
+ positions26},
+
+ {"EllipsisPosition: TextLabel: Mulitlines LineWrap-HYPHAN LTR MIDDLE",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Goodbye",
+ true,
+ DevelText::LineWrap::HYPHENATION,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize27,
+ 3u,
+ 27u,
+ positions27},
+
+ {"EllipsisPosition: TextLabel: Mulitlines LineWrap-MIXED LTR MIDDLE",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Goodbye",
+ true,
+ DevelText::LineWrap::MIXED,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize28,
+ 3u,
+ 24u,
+ positions28},
+
+ //MIDDLE RTL cases
+ {
+ "EllipsisPosition: TextLabel: SingleLine RTL MIDDLE",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize29,
+ 1u,
+ 13u,
+ positions29},
+
+ {"EllipsisPosition: TextLabel: Mulitlines LineWrap-WORD RTL MIDDLE",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize30,
+ 3u,
+ 31u,
+ positions30},
+
+ {"EllipsisPosition: TextLabel: Mulitlines LineWrap-CHARACTER RTL MIDDLE",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::CHARACTER,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize31,
+ 3u,
+ 29u,
+ positions31},
+
+ {"EllipsisPosition: TextLabel: Mulitlines LineWrap-HYPHENATION RTL MIDDLE",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::HYPHENATION,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize32,
+ 3u,
+ 31u,
+ positions32},
+
+ {"EllipsisPosition: TextLabel: Mulitlines LineWrap-MIXED RTL MIDDLE",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ true,
+ DevelText::LineWrap::MIXED,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize33,
+ 3u,
+ 31u,
+ positions33},
+
+ {"EllipsisPosition: TextLabel: One-Line for Mulitlines LineWrap-WORD LTR END",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome",
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize34,
+ 1u,
+ 13u,
+ positions34},
+
+ {"EllipsisPosition: TextLabel: One-Line for Mulitlines LineWrap-WORD LTR START",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome",
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize35,
+ 1u,
+ 11u,
+ positions35},
+
+ {"EllipsisPosition: TextLabel: One-Line for Mulitlines LineWrap-WORD LTR MIDDLE",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome",
+ true,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize36,
+ 1u,
+ 12u,
+ positions36},
+
+ {"EllipsisPosition: TextLabel: Mixed Directions Languages END",
+ "سیٹنگیں Projector سیٹنگیں",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize37,
+ 1u,
+ 16u,
+ positions37},
+
+ {"EllipsisPosition: TextLabel: Mixed Directions Languages START",
+ "سیٹنگیں Projector سیٹنگیں",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize38,
+ 1u,
+ 17u,
+ positions38},
+
+ };
+ const unsigned int numberOfTests = 41u;
+ for( unsigned int index = 0u; index < numberOfTests; ++index )
+ {
+ ToolkitTestApplication application;
+ if( !ElideTestViewModel( data[index] ) )
{
- "void text",
- "",
- false,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::START,
- false,
- textSize00,
- 0u,
- 0u,
- nullptr
- },
+ tet_result(TET_FAIL);
+ }
+ }
- {
- "void text",
- "",
- false,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::MIDDLE,
- false,
- textSize00,
- 0u,
- 0u,
- nullptr
- },
+ tet_result(TET_PASS);
+ END_TEST;
+}
- //END LTR cases
- {
- "EllipsisPosition: TextLabel: Basic case SingleLine LTR END",
- "A0123456789 B0123456789 C0123456789 D0123456789 ",
- false,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::END,
- false,
- textSize01,
- 1u,
- 10u,
- positions01
- },
- {
- "EllipsisPosition: TextLabel: Basic case Mulitlines LineWrap-WORD LTR END",
- "A0123456789 B0123456789 C0123456789 D0123456789 ",
- true,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::END,
- false,
- textSize02,
- 2u,
- 22u,
- positions02
- },
+int UtcDaliTextFieldlElideTextLocation(void)
+{
+ tet_infoline(" UtcDaliTextFieldlElideTextLocation ");
- {
- "EllipsisPosition: TextLabel: Mulitlines LineWrap-WORD LTR END",
- "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
- true,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::END,
- false,
- textSize03,
- 3u,
- 29u,
- positions03
- },
+ Size textSize00( 100.f, 100.f );
- {
- "EllipsisPosition: TextLabel: Mulitlines LineWrap-CHARACTER LTR END",
- "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
- true,
- DevelText::LineWrap::CHARACTER,
- DevelText::EllipsisPosition::END,
- false,
- textSize04,
- 3u,
- 40u,
- positions04
- },
+ Size textSize01( 120.0f, 50.0f );
+ float positions01[] = { 0.0f, 11.0f, 21.0f, 31.0f, 41.0f, 50.0f, 60.0f, 70.0f, 80.0f, 91.0f };
- {
- "EllipsisPosition: TextLabel: Mulitlines LineWrap-HYPHAN LTR END",
- "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
- true,
- DevelText::LineWrap::HYPHENATION,
- DevelText::EllipsisPosition::END,
- false,
- textSize05,
- 3u,
- 32u,
- positions05
- },
+ Size textSize02( 120.0f, 50.0f );
+ float positions02[] = { 0.0f, 10.0f, 21.0f, 25.0f, 28.0f, 38.0f, 44.0f, 55.0f, 59.0f, 65.0f, 73.0f, 84.0f, 93.0f };
- {
- "EllipsisPosition: TextLabel: Mulitlines LineWrap-MIXED LTR END",
- "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
- true,
- DevelText::LineWrap::MIXED,
- DevelText::EllipsisPosition::END,
- false,
- textSize06,
- 3u,
- 28u,
- positions06
- },
+ Size textSize03( 120.0f, 50.0f );
+ float positions03[] = { 117.0f, 111.0f, 97.0f, 88.0f, 80.0f, 74.0f, 64.0f, 59.0f, 54.0f, 45.0f, 37.0f, 31.0f, 22.0f, 7.0f };
- //START LTR cases
- {
- "EllipsisPosition: TextLabel: Basic case SingleLine LTR START",
- "A0123456789 B0123456789 C0123456789 D0123456789 ",
- false,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::START,
- false,
- textSize07,
- 1u,
- 11u,
- positions07
- },
+ Size textSize04( 120.0f, 50.0f );
+ float positions04[] = { 5.0f, 21.0f, 31.0f, 41.0f, 50.0f, 61.0f, 71.0f, 80.0f, 90.0f, 100.0f, 109.0f };
- {
- "EllipsisPosition: TextLabel: Basic case Mulitlines LineWrap-WORD LTR START",
- "A0123456789 B0123456789 C0123456789 D0123456789 ",
- true,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::START,
- false,
- textSize08,
- 2u,
- 23u,
- positions08
- },
+ Size textSize05( 120.0f, 50.0f );
+ float positions05[] = { 8.0f, 24.0f, 35.0f, 44.0f, 49.0f, 63.0f, 74.0f, 77.0f, 85.0f, 96.0f, 110.0f };
- {
- "EllipsisPosition: TextLabel: Mulitlines LineWrap-WORD LTR START",
- "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
- true,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::START,
- false,
- textSize09,
- 3u,
- 33u,
- positions09
- },
+ Size textSize06( 120.0f, 50.0f );
+ float positions06[] = { 90.0f, 79.0f, 70.0f, 68.0f, 62.0f, 56.0f, 51.0f, 42.0f, 29.0f, 26.0f, 15.0f, 7.0f, 0.0f };
- {
- "EllipsisPosition: TextLabel: Mulitlines LineWrap-CHARACTER LTR START",
- "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
- true,
- DevelText::LineWrap::CHARACTER,
- DevelText::EllipsisPosition::START,
- false,
- textSize10,
- 3u,
- 37u,
- positions10
- },
+ Size textSize07( 120.0f, 50.0f );
+ float positions07[] = { 0.0f, 11.0f, 21.0f, 31.0f, 41.0f, 53.0f };
- {
- "EllipsisPosition: TextLabel: Mulitlines LineWrap-HYPHAN LTR START",
- "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
- true,
- DevelText::LineWrap::HYPHENATION,
- DevelText::EllipsisPosition::START,
- false,
- textSize11,
- 3u,
- 25u,
- positions11
- },
+ Size textSize08( 120.0f, 50.0f );
+ float positions08[] = { 0.0f, 10.0f, 21.0f, 25.0f, 28.0f, 38.0f, 44.0f, 55.0f };
- {
- "EllipsisPosition: TextLabel: Mulitlines LineWrap-MIXED LTR START",
- "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
- true,
- DevelText::LineWrap::MIXED,
- DevelText::EllipsisPosition::START,
- false,
- textSize12,
- 3u,
- 25u,
- positions12
- },
+ Size textSize09( 120.0f, 50.0f );
+ float positions09[] = { 116.0f, 109.0f, 96.0f, 87.0f, 79.0f, 73.0f, 63.0f };
- //END RTL cases
- {
- "EllipsisPosition: TextLabel: SingleLine RTL END",
- "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
- false,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::END,
- false,
- textSize13,
- 1u,
- 14u,
- positions13
- },
+ Size textSize10( 120.0f, 50.0f );
+ float positions10[] = { 121.0f, 116.0f, 111.0f, 106.0f, 101.0f, 96.0f, 92.0f, 87.0f, 83.0f, 77.0f, 63.0f, 55.0f, 46.0f, 40.0f, 30.0f, 16.0f };
- {
- "EllipsisPosition: TextLabel: Mulitlines LineWrap-WORD RTL END",
- "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
- true,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::END,
- false,
- textSize14,
- 3u,
- 42u,
- positions14
- },
+ Size textSize11( 120.0f, 50.0f );
+ float positions11[] = { 93.0f, 77.0f, 74.0f, 63.0f, 56.0f, 49.0f, 44.0f, 39.0f, 34.0f, 29.0f, 24.0f, 19.0f, 14.0f, 9.0f, 5.0f };
- {
- "EllipsisPosition: TextLabel: Mulitlines LineWrap-CHARACTER RTL END",
- "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
- true,
- DevelText::LineWrap::CHARACTER,
- DevelText::EllipsisPosition::END,
- false,
- textSize15,
- 3u,
- 44u,
- positions15
- },
+ Size textSize12( 120.0f, 50.0f );
+ float positions12[] = { 117.0f, 112.0f, 107.0f, 102.0f, 97.0f, 92.0f, 87.0f, 82.0f, 79.0f, 72.0f };
+ Size textSize13(145.0f, 30.0f);
+ float positions13[] = {131.0f, 126.0f, 121.0f, 117.0f, 108.0f, 104.0f, 94.0f, 88.0f, 20.0f, 29.0f, 34.0f, 42.0f, 48.0f, 57.0f, 67.0f};
+
+ Size textSize14(145.0f, 30.0f);
+ float positions14[] = {51.0f, 66.0f, 71.0f, 80.0f, 85.0f, 94.0f, 103.0f, 109.0f, 119.0f, 51.0f, 37.0f, 32.0f, 28.0f, 23.0f, 14.0f, 10.0f, 0.0f};
+
+ struct ElideData data[] =
{
- "EllipsisPosition: TextLabel: Mulitlines LineWrap-HYPHENATION RTL END",
- "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
- true,
- DevelText::LineWrap::HYPHENATION,
- DevelText::EllipsisPosition::END,
- false,
- textSize16,
- 3u,
- 39u,
- positions16
- },
-
- {
- "EllipsisPosition: TextLabel: Mulitlines LineWrap-MIXED RTL END",
- "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
- true,
- DevelText::LineWrap::MIXED,
- DevelText::EllipsisPosition::END,
- false,
- textSize17,
- 3u,
- 39u,
- positions17
- },
-
- //START RTL cases
- {
- "EllipsisPosition: TextLabel: SingleLine RTL START",
- "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
- false,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::START,
- false,
- textSize18,
- 1u,
- 13u,
- positions18
- },
-
- {
- "EllipsisPosition: TextLabel: Mulitlines LineWrap-WORD RTL START",
- "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
- true,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::START,
- false,
- textSize19,
- 3u,
- 33u,
- positions19
- },
-
- {
- "EllipsisPosition: TextLabel: Mulitlines LineWrap-CHARACTER RTL START",
- "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
- true,
- DevelText::LineWrap::CHARACTER,
- DevelText::EllipsisPosition::START,
- false,
- textSize20,
- 3u,
- 30u,
- positions20
- },
-
- {
- "EllipsisPosition: TextLabel: Mulitlines LineWrap-HYPHENATION RTL START",
- "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
- true,
- DevelText::LineWrap::HYPHENATION,
- DevelText::EllipsisPosition::START,
- false,
- textSize21,
- 3u,
- 33u,
- positions21
- },
-
- {
- "EllipsisPosition: TextLabel: Mulitlines LineWrap-MIXED RTL START",
- "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
- true,
- DevelText::LineWrap::MIXED,
- DevelText::EllipsisPosition::START,
- false,
- textSize22,
- 3u,
- 33u,
- positions22
- },
-
- //MIDDLE LTR cases
- {
- "EllipsisPosition: TextLabel: Basic case SingleLine LTR MIDDLE",
- "ABCDEFGHIJKLMNPQRSTUVWXYZ abcdefghijklmnpqrstuvwxyz",
- false,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::MIDDLE,
- false,
- textSize23,
- 1u,
- 10u,
- positions23
- },
-
- {
- "EllipsisPosition: TextLabel: Basic case Mulitlines LineWrap-WORD LTR MIDDLE",
- "A0123456789 B0123456789 C0123456789 D0123456789 ",
- true,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::MIDDLE,
- false,
- textSize24,
- 2u,
- 22u,
- positions24
- },
-
- {
- "EllipsisPosition: TextLabel: Mulitlines LineWrap-WORD LTR MIDDLE",
- "Hello Hi Experimen Welcome Hello Hi Experimen Goodbye" ,
- true,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::MIDDLE,
- false,
- textSize25,
- 3u,
- 24u,
- positions25
- },
-
- {
- "EllipsisPosition: TextLabel: Mulitlines LineWrap-CHARACTER LTR MIDDLE",
- "Hello Hi Experimen Welcome Hello Hi Experimen Goodbye" ,
- true,
- DevelText::LineWrap::CHARACTER,
- DevelText::EllipsisPosition::MIDDLE,
- false,
- textSize26,
- 3u,
- 36u,
- positions26
- },
-
- {
- "EllipsisPosition: TextLabel: Mulitlines LineWrap-HYPHAN LTR MIDDLE",
- "Hello Hi Experimen Welcome Hello Hi Experimen Goodbye" ,
- true,
- DevelText::LineWrap::HYPHENATION,
- DevelText::EllipsisPosition::MIDDLE,
- false,
- textSize27,
- 3u,
- 27u,
- positions27
- },
-
- {
- "EllipsisPosition: TextLabel: Mulitlines LineWrap-MIXED LTR MIDDLE",
- "Hello Hi Experimen Welcome Hello Hi Experimen Goodbye" ,
- true,
- DevelText::LineWrap::MIXED,
- DevelText::EllipsisPosition::MIDDLE,
- false,
- textSize28,
- 3u,
- 24u,
- positions28
- },
-
-//MIDDLE RTL cases
- {
- "EllipsisPosition: TextLabel: SingleLine RTL MIDDLE",
- "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
- false,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::MIDDLE,
- false,
- textSize29,
- 1u,
- 13u,
- positions29
- },
-
- {
- "EllipsisPosition: TextLabel: Mulitlines LineWrap-WORD RTL MIDDLE",
- "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
- true,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::MIDDLE,
- false,
- textSize30,
- 3u,
- 31u,
- positions30
- },
-
- {
- "EllipsisPosition: TextLabel: Mulitlines LineWrap-CHARACTER RTL MIDDLE",
- "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
- true,
- DevelText::LineWrap::CHARACTER,
- DevelText::EllipsisPosition::MIDDLE,
- false,
- textSize31,
- 3u,
- 29u,
- positions31
- },
-
- {
- "EllipsisPosition: TextLabel: Mulitlines LineWrap-HYPHENATION RTL MIDDLE",
- "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
- true,
- DevelText::LineWrap::HYPHENATION,
- DevelText::EllipsisPosition::MIDDLE,
- false,
- textSize32,
- 3u,
- 31u,
- positions32
- },
-
- {
- "EllipsisPosition: TextLabel: Mulitlines LineWrap-MIXED RTL MIDDLE",
- "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
- true,
- DevelText::LineWrap::MIXED,
- DevelText::EllipsisPosition::MIDDLE,
- false,
- textSize33,
- 3u,
- 31u,
- positions33
- },
-
- {
- "EllipsisPosition: TextLabel: One-Line for Mulitlines LineWrap-WORD LTR END",
- "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
- true,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::END,
- false,
- textSize34,
- 1u,
- 13u,
- positions34
- },
-
- {
- "EllipsisPosition: TextLabel: One-Line for Mulitlines LineWrap-WORD LTR START",
- "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
- true,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::START,
- false,
- textSize35,
- 1u,
- 11u,
- positions35
- },
-
- {
- "EllipsisPosition: TextLabel: One-Line for Mulitlines LineWrap-WORD LTR MIDDLE",
- "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
- true,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::MIDDLE,
- false,
- textSize36,
- 1u,
- 12u,
- positions36
- },
-
- };
- const unsigned int numberOfTests = 39u;
-
- for( unsigned int index = 0u; index < numberOfTests; ++index )
- {
- ToolkitTestApplication application;
- if( !ElideTestViewModel( data[index] ) )
- {
- tet_result(TET_FAIL);
- }
- }
-
- tet_result(TET_PASS);
- END_TEST;
-}
-
-
-int UtcDaliTextFieldlElideTextLocation(void)
-{
- tet_infoline(" UtcDaliTextFieldlElideTextLocation ");
-
- Size textSize00( 100.f, 100.f );
-
- Size textSize01( 120.0f, 50.0f );
- float positions01[] = { 0.0f, 11.0f, 21.0f, 31.0f, 41.0f, 50.0f, 60.0f, 70.0f, 80.0f, 91.0f };
-
- Size textSize02( 120.0f, 50.0f );
- float positions02[] = { 0.0f, 10.0f, 21.0f, 25.0f, 28.0f, 38.0f, 44.0f, 55.0f, 59.0f, 65.0f, 73.0f, 84.0f, 93.0f };
-
- Size textSize03( 120.0f, 50.0f );
- float positions03[] = { 117.0f, 111.0f, 97.0f, 88.0f, 80.0f, 74.0f, 64.0f, 59.0f, 54.0f, 45.0f, 37.0f, 31.0f, 22.0f, 7.0f };
-
- Size textSize04( 120.0f, 50.0f );
- float positions04[] = { 5.0f, 21.0f, 31.0f, 41.0f, 50.0f, 61.0f, 71.0f, 80.0f, 90.0f, 100.0f, 109.0f };
-
- Size textSize05( 120.0f, 50.0f );
- float positions05[] = { 8.0f, 24.0f, 35.0f, 44.0f, 49.0f, 63.0f, 74.0f, 77.0f, 85.0f, 96.0f, 110.0f };
-
- Size textSize06( 120.0f, 50.0f );
- float positions06[] = { 90.0f, 79.0f, 70.0f, 68.0f, 62.0f, 56.0f, 51.0f, 42.0f, 29.0f, 26.0f, 15.0f, 7.0f, 0.0f };
-
- Size textSize07( 120.0f, 50.0f );
- float positions07[] = { 0.0f, 11.0f, 21.0f, 31.0f, 41.0f, 53.0f };
-
- Size textSize08( 120.0f, 50.0f );
- float positions08[] = { 0.0f, 10.0f, 21.0f, 25.0f, 28.0f, 38.0f, 44.0f, 55.0f };
-
- Size textSize09( 120.0f, 50.0f );
- float positions09[] = { 116.0f, 109.0f, 96.0f, 87.0f, 79.0f, 73.0f, 63.0f };
-
- Size textSize10( 120.0f, 50.0f );
- float positions10[] = { 121.0f, 116.0f, 111.0f, 106.0f, 101.0f, 96.0f, 92.0f, 87.0f, 83.0f, 77.0f, 63.0f, 55.0f, 46.0f, 40.0f, 30.0f, 16.0f };
-
- Size textSize11( 120.0f, 50.0f );
- float positions11[] = { 93.0f, 77.0f, 74.0f, 63.0f, 56.0f, 49.0f, 44.0f, 39.0f, 34.0f, 29.0f, 24.0f, 19.0f, 14.0f, 9.0f, 5.0f };
-
- Size textSize12( 120.0f, 50.0f );
- float positions12[] = { 117.0f, 112.0f, 107.0f, 102.0f, 97.0f, 92.0f, 87.0f, 82.0f, 79.0f, 72.0f };
-
- struct ElideData data[] =
- {
- {
- "void text",
- "",
- false,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::END,
- false,
- textSize00,
- 0u,
- 0u,
- nullptr
- },
-
- {
- "void text",
- "",
- false,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::START,
- false,
- textSize00,
- 0u,
- 0u,
- nullptr
- },
-
- {
- "void text",
- "",
- false,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::MIDDLE,
- false,
- textSize00,
- 0u,
- 0u,
- nullptr
- },
-
- {
- "EllipsisPosition: TextField: Basic case SingleLine LTR END",
- "A0123456789 B0123456789 C0123456789 D0123456789 ",
- false,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::END,
- false,
- textSize01,
- 1u,
- 10u,
- positions01
- },
-
- {
- "EllipsisPosition: TextField: SingleLine LTR END",
- "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
- false,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::END,
- false,
- textSize02,
- 1u,
- 13u,
- positions02
- },
-
- {
- "EllipsisPosition: TextField: SingleLine RTL END",
- "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
- false,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::END,
- false,
- textSize03,
- 1u,
- 14u,
- positions03
- },
-
- {
- "EllipsisPosition: TextField: Basic case SingleLine LTR START",
- "A0123456789 B0123456789 C0123456789 D0123456789 ",
- false,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::START,
- false,
- textSize04,
- 1u,
- 11u,
- positions04
- },
-
- {
- "EllipsisPosition: TextField: SingleLine LTR START",
- "Hello Hi Experimen Welcome Hello Hi Experimen Welcome" ,
- false,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::START,
- false,
- textSize05,
- 1u,
- 11u,
- positions05
- },
-
- {
- "EllipsisPosition: TextField: SingleLine RTL START",
- "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
- false,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::START,
- false,
- textSize06,
- 1u,
- 13u,
- positions06
- },
-
- {
- "EllipsisPosition: TextField: Basic case SingleLine LTR MIDDLE",
- "A0123456789 B0123456789 C0123456789 D0123456789 ",
- false,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::MIDDLE,
- false,
- textSize07,
- 1u,
- 11u,
- positions07
- },
-
- {
- "EllipsisPosition: TextField: SingleLine LTR MIDDLE",
- "Hello Hi Experimen Welcome Hello Hi Experimen Goodbye" ,
- false,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::MIDDLE,
- false,
- textSize08,
- 1u,
- 13u,
- positions08
- },
-
- {
- "EllipsisPosition: TextField: SingleLine RTL MIDDLE",
- "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
- false,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::MIDDLE,
- false,
- textSize09,
- 1u,
- 13u,
- positions09
- },
-
- {
- "EllipsisPosition: TextField: Head and Tail whitespaces RTL END",
- " السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة ",
- false,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::END,
- false,
- textSize10,
- 1u,
- 16u,
- positions10
- },
-
- {
- "EllipsisPosition: TextField: Head and Tail whitespaces RTL START",
- " السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة ",
- false,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::START,
- false,
- textSize11,
- 1u,
- 15u,
- positions11
- },
-
- {
- "EllipsisPosition: TextField: Head and Tail whitespaces RTL MIDDLE",
- " السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة ",
- false,
- DevelText::LineWrap::WORD,
- DevelText::EllipsisPosition::MIDDLE,
- false,
- textSize12,
- 1u,
- 20u,
- positions12
- },
-
- };
-
- const unsigned int numberOfTests = 15u;
+ {"void text",
+ "",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize00,
+ 0u,
+ 0u,
+ nullptr},
+
+ {"void text",
+ "",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize00,
+ 0u,
+ 0u,
+ nullptr},
+
+ {"void text",
+ "",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize00,
+ 0u,
+ 0u,
+ nullptr},
+
+ {"EllipsisPosition: TextField: Basic case SingleLine LTR END",
+ "A0123456789 B0123456789 C0123456789 D0123456789 ",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize01,
+ 1u,
+ 10u,
+ positions01},
+
+ {"EllipsisPosition: TextField: SingleLine LTR END",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize02,
+ 1u,
+ 13u,
+ positions02},
+
+ {"EllipsisPosition: TextField: SingleLine RTL END",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize03,
+ 1u,
+ 14u,
+ positions03},
+
+ {"EllipsisPosition: TextField: Basic case SingleLine LTR START",
+ "A0123456789 B0123456789 C0123456789 D0123456789 ",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize04,
+ 1u,
+ 11u,
+ positions04},
+
+ {"EllipsisPosition: TextField: SingleLine LTR START",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Welcome",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize05,
+ 1u,
+ 11u,
+ positions05},
+
+ {"EllipsisPosition: TextField: SingleLine RTL START",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize06,
+ 1u,
+ 13u,
+ positions06},
+
+ {"EllipsisPosition: TextField: Basic case SingleLine LTR MIDDLE",
+ "A0123456789 B0123456789 C0123456789 D0123456789 ",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize07,
+ 1u,
+ 11u,
+ positions07},
+
+ {"EllipsisPosition: TextField: SingleLine LTR MIDDLE",
+ "Hello Hi Experimen Welcome Hello Hi Experimen Goodbye",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize08,
+ 1u,
+ 13u,
+ positions08},
+
+ {"EllipsisPosition: TextField: SingleLine RTL MIDDLE",
+ "السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize09,
+ 1u,
+ 13u,
+ positions09},
+
+ {"EllipsisPosition: TextField: Head and Tail whitespaces RTL END",
+ " السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة ",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize10,
+ 1u,
+ 16u,
+ positions10},
+
+ {"EllipsisPosition: TextField: Head and Tail whitespaces RTL START",
+ " السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة ",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize11,
+ 1u,
+ 15u,
+ positions11},
+
+ {"EllipsisPosition: TextField: Head and Tail whitespaces RTL MIDDLE",
+ " السلام عليكم مرØبا اهلا هذا اختبار شكرا للمساعدة ",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::MIDDLE,
+ false,
+ textSize12,
+ 1u,
+ 20u,
+ positions12},
+
+ {"EllipsisPosition: TextField: Mixed Directions Languages END",
+ "سیٹنگیں Projector سیٹنگیں",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::END,
+ false,
+ textSize13,
+ 1u,
+ 16,
+ positions13},
+
+ {"EllipsisPosition: TextField: Mixed Directions Languages START",
+ "سیٹنگیں Projector سیٹنگیں",
+ false,
+ DevelText::LineWrap::WORD,
+ DevelText::EllipsisPosition::START,
+ false,
+ textSize14,
+ 1u,
+ 17,
+ positions14},
+
+ };
+
+ const unsigned int numberOfTests = 17u;
for( unsigned int index = 0u; index < numberOfTests; ++index )
{
layoutSize = Vector2::ZERO;
- bool isAutoScroll = false;
- const bool updated = engine.LayoutText(layoutParameters,
+ bool isAutoScroll = false;
+ bool isAutoScrollMaxTextureExceeded = false;
+ const bool updated = engine.LayoutText(layoutParameters,
layoutSize,
data.ellipsis,
isAutoScroll,
+ isAutoScrollMaxTextureExceeded,
data.ellipsisPosition);
// 4) Compare the results.
{
return false;
}
- if(fabsf(glyphData.advance - floor(glyph.advance)) > Math::MACHINE_EPSILON_1000)
+ if(glyphData.advance >= 0.0f && fabsf(glyphData.advance - floor(glyph.advance)) > Math::MACHINE_EPSILON_1000)
{
return false;
}
bool sizeDefined = false;
// variation selector 16 (Emoji)
+ // Note : Non-scalable font's advance value is undefined. See https://github.com/harfbuzz/harfbuzz/discussions/3023. 2022-06-03 updated.
struct GlyphInfoData glyphsVS16[] =
{
- {2u, 74u, 0.f, 0.f, 0.f, 0.f, 39.0f, 0.f, false, false},
+ {2u, 74u, 0.f, 0.f, 0.f, 0.f, -1.0f /* Special value that we don't check it */, 0.f, false, false},
};
CharacterIndex characterIndicesVS16[] = {0u, 1u};
Length charactersPerGlyphVS16[] = {2u};
#include <dali-toolkit/public-api/transition/transition-set.h>
#include <dali-toolkit/public-api/transition/transition.h>
#include <dali/devel-api/actors/actor-devel.h>
+#include <dali/public-api/rendering/decorated-visual-renderer.h> // for Renderer Property Index.
#include <stdlib.h>
#include <iostream>
DALI_TEST_NOT_EQUALS(destinationPosition, control2.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.00001f, TEST_LOCATION);
DALI_TEST_EQUALS(1, control2.GetRendererCount(), TEST_LOCATION);
- Dali::Renderer renderer = control2.GetRendererAt(0);
- Property::Index index = renderer.GetPropertyIndex(DevelVisual::Property::CORNER_RADIUS);
- cornerRadius = renderer.GetCurrentProperty<Vector4>(index);
+ Dali::Renderer renderer = control2.GetRendererAt(0);
+ cornerRadius = renderer.GetCurrentProperty<Vector4>(DecoratedVisualRenderer::Property::CORNER_RADIUS);
DALI_TEST_NOT_EQUALS(destinationRadiusV4, cornerRadius, 0.00001f, TEST_LOCATION);
- index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_WIDTH);
- borderlineWidth = renderer.GetCurrentProperty<float>(index);
+ borderlineWidth = renderer.GetCurrentProperty<float>(DecoratedVisualRenderer::Property::BORDERLINE_WIDTH);
DALI_TEST_NOT_EQUALS(destinationBorderlineWidth, borderlineWidth, 0.00001f, TEST_LOCATION);
- index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_COLOR);
- borderlineColor = renderer.GetCurrentProperty<Vector4>(index);
+ borderlineColor = renderer.GetCurrentProperty<Vector4>(DecoratedVisualRenderer::Property::BORDERLINE_COLOR);
DALI_TEST_NOT_EQUALS(destinationBorderlineColor, borderlineColor, 0.00001f, TEST_LOCATION);
- index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_OFFSET);
- borderlineOffset = renderer.GetCurrentProperty<float>(index);
+ borderlineOffset = renderer.GetCurrentProperty<float>(DecoratedVisualRenderer::Property::BORDERLINE_OFFSET);
DALI_TEST_NOT_EQUALS(destinationBorderlineOffset, borderlineOffset, 0.00001f, TEST_LOCATION);
application.SendNotification();
DALI_TEST_EQUALS(destinationOpacity, control2.GetCurrentProperty<float>(Actor::Property::OPACITY), TEST_LOCATION);
DALI_TEST_EQUALS(1, control2.GetRendererCount(), TEST_LOCATION);
renderer = control2.GetRendererAt(0);
- index = renderer.GetPropertyIndex(DevelVisual::Property::CORNER_RADIUS);
- cornerRadius = renderer.GetCurrentProperty<Vector4>(index);
+ cornerRadius = renderer.GetCurrentProperty<Vector4>(DecoratedVisualRenderer::Property::CORNER_RADIUS);
DALI_TEST_EQUALS(destinationRadiusV4, cornerRadius, TEST_LOCATION);
- index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_WIDTH);
- borderlineWidth = renderer.GetCurrentProperty<float>(index);
+ borderlineWidth = renderer.GetCurrentProperty<float>(DecoratedVisualRenderer::Property::BORDERLINE_WIDTH);
DALI_TEST_EQUALS(destinationBorderlineWidth, borderlineWidth, TEST_LOCATION);
- index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_COLOR);
- borderlineColor = renderer.GetCurrentProperty<Vector4>(index);
+ borderlineColor = renderer.GetCurrentProperty<Vector4>(DecoratedVisualRenderer::Property::BORDERLINE_COLOR);
DALI_TEST_EQUALS(destinationBorderlineColor, borderlineColor, TEST_LOCATION);
- index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_OFFSET);
- borderlineOffset = renderer.GetCurrentProperty<float>(index);
+ borderlineOffset = renderer.GetCurrentProperty<float>(DecoratedVisualRenderer::Property::BORDERLINE_OFFSET);
DALI_TEST_EQUALS(destinationBorderlineOffset, borderlineOffset, TEST_LOCATION);
END_TEST;
DALI_TEST_NOT_EQUALS(destinationPosition, control1.GetCurrentProperty<Vector3>(Actor::Property::POSITION), 0.00001f, TEST_LOCATION);
DALI_TEST_EQUALS(1, control1.GetRendererCount(), TEST_LOCATION);
- Dali::Renderer renderer = control1.GetRendererAt(0);
- Property::Index index = renderer.GetPropertyIndex(DevelVisual::Property::CORNER_RADIUS);
- cornerRadius = renderer.GetCurrentProperty<Vector4>(index);
+ Dali::Renderer renderer = control1.GetRendererAt(0);
+ cornerRadius = renderer.GetCurrentProperty<Vector4>(DecoratedVisualRenderer::Property::CORNER_RADIUS);
DALI_TEST_NOT_EQUALS(destinationRadiusV4, cornerRadius, 0.00001f, TEST_LOCATION);
- index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_WIDTH);
- borderlineWidth = renderer.GetCurrentProperty<float>(index);
+ borderlineWidth = renderer.GetCurrentProperty<float>(DecoratedVisualRenderer::Property::BORDERLINE_WIDTH);
DALI_TEST_NOT_EQUALS(destinationBorderlineWidth, borderlineWidth, 0.00001f, TEST_LOCATION);
- index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_COLOR);
- borderlineColor = renderer.GetCurrentProperty<Vector4>(index);
+ borderlineColor = renderer.GetCurrentProperty<Vector4>(DecoratedVisualRenderer::Property::BORDERLINE_COLOR);
DALI_TEST_NOT_EQUALS(destinationBorderlineColor, borderlineColor, 0.00001f, TEST_LOCATION);
- index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_OFFSET);
- borderlineOffset = renderer.GetCurrentProperty<float>(index);
+ borderlineOffset = renderer.GetCurrentProperty<float>(DecoratedVisualRenderer::Property::BORDERLINE_OFFSET);
DALI_TEST_NOT_EQUALS(destinationBorderlineOffset, borderlineOffset, 0.00001f, TEST_LOCATION);
application.SendNotification();
DALI_TEST_EQUALS(1, control1.GetRendererCount(), TEST_LOCATION);
renderer = control1.GetRendererAt(0);
- index = renderer.GetPropertyIndex(DevelVisual::Property::CORNER_RADIUS);
- cornerRadius = renderer.GetCurrentProperty<Vector4>(index);
+ cornerRadius = renderer.GetCurrentProperty<Vector4>(DecoratedVisualRenderer::Property::CORNER_RADIUS);
DALI_TEST_EQUALS(destinationRadiusV4, cornerRadius, TEST_LOCATION);
- index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_WIDTH);
- borderlineWidth = renderer.GetCurrentProperty<float>(index);
+ borderlineWidth = renderer.GetCurrentProperty<float>(DecoratedVisualRenderer::Property::BORDERLINE_WIDTH);
DALI_TEST_EQUALS(destinationBorderlineWidth, borderlineWidth, TEST_LOCATION);
- index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_COLOR);
- borderlineColor = renderer.GetCurrentProperty<Vector4>(index);
+ borderlineColor = renderer.GetCurrentProperty<Vector4>(DecoratedVisualRenderer::Property::BORDERLINE_COLOR);
DALI_TEST_EQUALS(destinationBorderlineColor, borderlineColor, TEST_LOCATION);
- index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_OFFSET);
- borderlineOffset = renderer.GetCurrentProperty<float>(index);
+ borderlineOffset = renderer.GetCurrentProperty<float>(DecoratedVisualRenderer::Property::BORDERLINE_OFFSET);
DALI_TEST_EQUALS(destinationBorderlineOffset, borderlineOffset, TEST_LOCATION);
// every actor properties of control1 are returned to the source properties.
// after next update, renderer properties are returned to the source properties.
DALI_TEST_EQUALS(1, control1.GetRendererCount(), TEST_LOCATION);
renderer = control1.GetRendererAt(0);
- index = renderer.GetPropertyIndex(DevelVisual::Property::CORNER_RADIUS);
- cornerRadius = renderer.GetCurrentProperty<Vector4>(index);
+ cornerRadius = renderer.GetCurrentProperty<Vector4>(DecoratedVisualRenderer::Property::CORNER_RADIUS);
DALI_TEST_EQUALS(sourceRadiusV4, cornerRadius, TEST_LOCATION);
- index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_WIDTH);
- borderlineWidth = renderer.GetCurrentProperty<float>(index);
+ borderlineWidth = renderer.GetCurrentProperty<float>(DecoratedVisualRenderer::Property::BORDERLINE_WIDTH);
DALI_TEST_EQUALS(sourceBorderlineWidth, borderlineWidth, TEST_LOCATION);
- index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_COLOR);
- borderlineColor = renderer.GetCurrentProperty<Vector4>(index);
+ borderlineColor = renderer.GetCurrentProperty<Vector4>(DecoratedVisualRenderer::Property::BORDERLINE_COLOR);
DALI_TEST_EQUALS(sourceBorderlineColor, borderlineColor, TEST_LOCATION);
- index = renderer.GetPropertyIndex(DevelVisual::Property::BORDERLINE_OFFSET);
- borderlineOffset = renderer.GetCurrentProperty<float>(index);
+ borderlineOffset = renderer.GetCurrentProperty<float>(DecoratedVisualRenderer::Property::BORDERLINE_OFFSET);
DALI_TEST_EQUALS(sourceBorderlineOffset, borderlineOffset, TEST_LOCATION);
END_TEST;
return true;
}
+void TestShaderCodeContainSubstrings(Control control, std::vector<std::pair<std::string, bool>> substringCheckList, const char* location)
+{
+ Renderer renderer = control.GetRendererAt(0);
+ Shader shader = renderer.GetShader();
+ Property::Value value = shader.GetProperty(Shader::Property::PROGRAM);
+ Property::Map* map = value.GetMap();
+ DALI_TEST_CHECK(map);
+
+ Property::Value* fragment = map->Find("fragment"); // fragment key name from shader-impl.cpp
+ DALI_TEST_CHECK(fragment);
+ std::string fragmentShader;
+ DALI_TEST_CHECK(fragment->Get(fragmentShader));
+ for(const auto& checkPair : substringCheckList)
+ {
+ const auto& keyword = checkPair.first;
+ const auto& expect = checkPair.second;
+ tet_printf("check [%s] %s exist in fragment shader\n", keyword.c_str(), expect ? "is" : "is not");
+ DALI_TEST_EQUALS((fragmentShader.find(keyword.c_str()) != std::string::npos), expect, location);
+ }
+
+ Property::Value* vertex = map->Find("vertex"); // vertex key name from shader-impl.cpp
+ std::string vertexShader;
+ DALI_TEST_CHECK(vertex->Get(vertexShader));
+ for(const auto& checkPair : substringCheckList)
+ {
+ const auto& keyword = checkPair.first;
+ const auto& expect = checkPair.second;
+ tet_printf("check [%s] %s exist in vertex shader\n", keyword.c_str(), expect ? "is" : "is not");
+ DALI_TEST_EQUALS((vertexShader.find(keyword.c_str()) != std::string::npos), expect, location);
+ }
+}
+
} //namespace
void dali_visual_startup(void)
value = resultMap.Find(ImageVisual::Property::BORDER, Property::RECTANGLE);
DALI_TEST_CHECK(value);
- DALI_TEST_CHECK(value->Get<Rect<int> >() == border);
+ DALI_TEST_CHECK(value->Get<Rect<int>>() == border);
value = resultMap.Find(DevelImageVisual::Property::AUXILIARY_IMAGE, Property::STRING);
DALI_TEST_CHECK(value);
value = resultMap.Find(ImageVisual::Property::BORDER, Property::RECTANGLE);
DALI_TEST_CHECK(value);
- DALI_TEST_CHECK(value->Get<Rect<int> >() == border);
+ DALI_TEST_CHECK(value->Get<Rect<int>>() == border);
END_TEST;
}
application.SendNotification();
application.Render();
- // Get shader
- {
- Renderer renderer = dummyControl.GetRendererAt(0);
- Shader shader = renderer.GetShader();
- Property::Value value = shader.GetProperty(Shader::Property::PROGRAM);
- Property::Map* map = value.GetMap();
- DALI_TEST_CHECK(map);
-
- Property::Value* fragment = map->Find("fragment"); // fragment key name from shader-impl.cpp
- DALI_TEST_CHECK(fragment);
- std::string fragmentShader;
- DALI_TEST_CHECK(fragment->Get(fragmentShader));
- DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
- DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") == std::string::npos);
-
- Property::Value* vertex = map->Find("vertex"); // vertex key name from shader-impl.cpp
- std::string vertexShader;
- DALI_TEST_CHECK(vertex->Get(vertexShader));
- DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
- DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") == std::string::npos);
- }
+ TestShaderCodeContainSubstrings(
+ dummyControl,
+ {
+ {"#define IS_REQUIRED_BORDERLINE", false},
+ {"#define IS_REQUIRED_ROUNDED_CORNER", false},
+ },
+ TEST_LOCATION);
+
callStack.Reset();
callStack.Enable(true);
DALI_TEST_CHECK(cornerRadiusPolicyValue);
DALI_TEST_EQUALS(cornerRadiusPolicyValue->Get<int>(), static_cast<int>(Toolkit::Visual::Transform::Policy::RELATIVE), TEST_LOCATION);
- // Get shader
- {
- Renderer renderer = dummyControl.GetRendererAt(0);
- Shader shader = renderer.GetShader();
- Property::Value value = shader.GetProperty(Shader::Property::PROGRAM);
- Property::Map* map = value.GetMap();
- DALI_TEST_CHECK(map);
-
- Property::Value* fragment = map->Find("fragment"); // fragment key name from shader-impl.cpp
- DALI_TEST_CHECK(fragment);
- std::string fragmentShader;
- DALI_TEST_CHECK(fragment->Get(fragmentShader));
- DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
- DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") != std::string::npos);
-
- Property::Value* vertex = map->Find("vertex"); // vertex key name from shader-impl.cpp
- std::string vertexShader;
- DALI_TEST_CHECK(vertex->Get(vertexShader));
- DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
- DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") != std::string::npos);
- }
+ TestShaderCodeContainSubstrings(
+ dummyControl,
+ {
+ {"#define IS_REQUIRED_BORDERLINE", false},
+ {"#define IS_REQUIRED_ROUNDED_CORNER", true},
+ },
+ TEST_LOCATION);
// Send shader compile signal
application.SendNotification();
DALI_TEST_CHECK(borderlineOffsetValue);
DALI_TEST_EQUALS(borderlineOffsetValue->Get<float>(), targetBorderlineOffset, TEST_LOCATION);
- // Get shader
- {
- Renderer renderer = dummyControl.GetRendererAt(0);
- Shader shader = renderer.GetShader();
- Property::Value value = shader.GetProperty(Shader::Property::PROGRAM);
- Property::Map* map = value.GetMap();
- DALI_TEST_CHECK(map);
-
- Property::Value* fragment = map->Find("fragment"); // fragment key name from shader-impl.cpp
- DALI_TEST_CHECK(fragment);
- std::string fragmentShader;
- DALI_TEST_CHECK(fragment->Get(fragmentShader));
- DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_BORDERLINE 1") != std::string::npos);
- // Note : mAlwaysUsingCornerRadius is true.
- DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") != std::string::npos);
-
- Property::Value* vertex = map->Find("vertex"); // vertex key name from shader-impl.cpp
- std::string vertexShader;
- DALI_TEST_CHECK(vertex->Get(vertexShader));
- DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_BORDERLINE 1") != std::string::npos);
- // Note : mAlwaysUsingCornerRadius is true.
- DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") != std::string::npos);
- }
+ TestShaderCodeContainSubstrings(
+ dummyControl,
+ {
+ {"#define IS_REQUIRED_BORDERLINE", true},
+ {"#define IS_REQUIRED_ROUNDED_CORNER", true}, // Note : mAlwaysUsingCornerRadius is true.
+ },
+ TEST_LOCATION);
// Send shader compile signal
application.SendNotification();
DALI_TEST_CHECK(borderlineOffsetValue);
DALI_TEST_EQUALS(borderlineOffsetValue->Get<float>(), 0.0f, TEST_LOCATION);
- // Get shader
- {
- Renderer renderer = dummyControl.GetRendererAt(0);
- Shader shader = renderer.GetShader();
- Property::Value value = shader.GetProperty(Shader::Property::PROGRAM);
- Property::Map* map = value.GetMap();
- DALI_TEST_CHECK(map);
-
- Property::Value* fragment = map->Find("fragment"); // fragment key name from shader-impl.cpp
- DALI_TEST_CHECK(fragment);
- std::string fragmentShader;
- DALI_TEST_CHECK(fragment->Get(fragmentShader));
- // Note : mAlwaysUsingBorderline and mAlwaysUsingCornerRadius is true.
- DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_BORDERLINE 1") != std::string::npos);
- DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") != std::string::npos);
-
- Property::Value* vertex = map->Find("vertex"); // vertex key name from shader-impl.cpp
- std::string vertexShader;
- DALI_TEST_CHECK(vertex->Get(vertexShader));
- // Note : mAlwaysUsingBorderline and mAlwaysUsingCornerRadius is true.
- DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_BORDERLINE 1") != std::string::npos);
- DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") != std::string::npos);
- }
+ TestShaderCodeContainSubstrings(
+ dummyControl,
+ {
+ {"#define IS_REQUIRED_BORDERLINE", true}, // Note : mAlwaysUsingBorderline is true.
+ {"#define IS_REQUIRED_ROUNDED_CORNER", true}, // Note : mAlwaysUsingCornerRadius is true.
+ },
+ TEST_LOCATION);
// Send shader compile signal
application.SendNotification();
application.SendNotification();
application.Render();
- // Get shader
- {
- Renderer renderer = dummyControl.GetRendererAt(0);
- Shader shader = renderer.GetShader();
- Property::Value value = shader.GetProperty(Shader::Property::PROGRAM);
- Property::Map* map = value.GetMap();
- DALI_TEST_CHECK(map);
-
- Property::Value* fragment = map->Find("fragment"); // fragment key name from shader-impl.cpp
- DALI_TEST_CHECK(fragment);
- std::string fragmentShader;
- DALI_TEST_CHECK(fragment->Get(fragmentShader));
- DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
- DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") == std::string::npos);
-
- Property::Value* vertex = map->Find("vertex"); // vertex key name from shader-impl.cpp
- std::string vertexShader;
- DALI_TEST_CHECK(vertex->Get(vertexShader));
- DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
- DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") == std::string::npos);
- }
+ TestShaderCodeContainSubstrings(
+ dummyControl,
+ {
+ {"#define IS_REQUIRED_BORDERLINE", false},
+ {"#define IS_REQUIRED_ROUNDED_CORNER", false},
+ },
+ TEST_LOCATION);
Vector4 targetCornerRadius = Vector4(0.0f, 0.0f, 0.0f, 0.0f);
DALI_TEST_CHECK(cornerRadiusValue);
DALI_TEST_EQUALS(cornerRadiusValue->Get<Vector4>(), targetCornerRadius, TEST_LOCATION);
- // Get shader
- {
- Renderer renderer = dummyControl.GetRendererAt(0);
- Shader shader = renderer.GetShader();
- Property::Value value = shader.GetProperty(Shader::Property::PROGRAM);
- Property::Map* map = value.GetMap();
- DALI_TEST_CHECK(map);
-
- Property::Value* fragment = map->Find("fragment"); // fragment key name from shader-impl.cpp
- DALI_TEST_CHECK(fragment);
- std::string fragmentShader;
- DALI_TEST_CHECK(fragment->Get(fragmentShader));
- DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
- // Note : corner radius is zero. so we don't change shader!
- DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") == std::string::npos);
-
- Property::Value* vertex = map->Find("vertex"); // vertex key name from shader-impl.cpp
- std::string vertexShader;
- DALI_TEST_CHECK(vertex->Get(vertexShader));
- DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
- // Note : corner radius is zero. so we don't change shader!
- DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") == std::string::npos);
- }
+ TestShaderCodeContainSubstrings(
+ dummyControl,
+ {
+ {"#define IS_REQUIRED_BORDERLINE", false},
+ {"#define IS_REQUIRED_ROUNDED_CORNER", false}, // Note : corner radius is zero. so we don't change shader!
+ },
+ TEST_LOCATION);
// Send shader compile signal
application.SendNotification();
DALI_TEST_CHECK(borderlineOffsetValue);
DALI_TEST_EQUALS(borderlineOffsetValue->Get<float>(), targetBorderlineOffset, TEST_LOCATION);
- // Get shader
- {
- Renderer renderer = dummyControl.GetRendererAt(0);
- Shader shader = renderer.GetShader();
- Property::Value value = shader.GetProperty(Shader::Property::PROGRAM);
- Property::Map* map = value.GetMap();
- DALI_TEST_CHECK(map);
-
- Property::Value* fragment = map->Find("fragment"); // fragment key name from shader-impl.cpp
- DALI_TEST_CHECK(fragment);
- std::string fragmentShader;
- DALI_TEST_CHECK(fragment->Get(fragmentShader));
- // Note : borderline width is zero. so we don't change shader!
- DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
- DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") == std::string::npos);
-
- Property::Value* vertex = map->Find("vertex"); // vertex key name from shader-impl.cpp
- std::string vertexShader;
- DALI_TEST_CHECK(vertex->Get(vertexShader));
- // Note : borderline width is zero. so we don't change shader!
- DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
- DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") == std::string::npos);
- }
+ TestShaderCodeContainSubstrings(
+ dummyControl,
+ {
+ {"#define IS_REQUIRED_BORDERLINE", false}, // Note : borderline width is zero. so we don't change shader!
+ {"#define IS_REQUIRED_ROUNDED_CORNER", false},
+ },
+ TEST_LOCATION);
// Send shader compile signal
application.SendNotification();
application.SendNotification();
application.Render();
- // Get shader
- {
- Renderer renderer = dummyControl.GetRendererAt(0);
- Shader shader = renderer.GetShader();
- Property::Value value = shader.GetProperty(Shader::Property::PROGRAM);
- Property::Map* map = value.GetMap();
- DALI_TEST_CHECK(map);
-
- Property::Value* fragment = map->Find("fragment"); // fragment key name from shader-impl.cpp
- DALI_TEST_CHECK(fragment);
- std::string fragmentShader;
- DALI_TEST_CHECK(fragment->Get(fragmentShader));
- DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_BLUR 1") == std::string::npos);
- DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
- DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") == std::string::npos);
-
- Property::Value* vertex = map->Find("vertex"); // vertex key name from shader-impl.cpp
- std::string vertexShader;
- DALI_TEST_CHECK(vertex->Get(vertexShader));
- DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_BLUR 1") == std::string::npos);
- DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
- DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") == std::string::npos);
- }
+ TestShaderCodeContainSubstrings(
+ dummyControl,
+ {
+ {"#define IS_REQUIRED_BLUR", false},
+ {"#define IS_REQUIRED_BORDERLINE", false},
+ {"#define IS_REQUIRED_ROUNDED_CORNER", false},
+ },
+ TEST_LOCATION);
float targetBlurRadius = 15.0f;
Vector4 targetCornerRadius = Vector4(1.0f, 0.1f, 1.1f, 0.0f);
DALI_TEST_CHECK(cornerRadiusValue);
DALI_TEST_EQUALS(cornerRadiusValue->Get<Vector4>(), targetCornerRadius, TEST_LOCATION);
- // Get shader
- {
- Renderer renderer = dummyControl.GetRendererAt(0);
- Shader shader = renderer.GetShader();
- Property::Value value = shader.GetProperty(Shader::Property::PROGRAM);
- Property::Map* map = value.GetMap();
- DALI_TEST_CHECK(map);
-
- Property::Value* fragment = map->Find("fragment"); // fragment key name from shader-impl.cpp
- DALI_TEST_CHECK(fragment);
- std::string fragmentShader;
- DALI_TEST_CHECK(fragment->Get(fragmentShader));
- DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_BLUR 1") != std::string::npos);
- // Note : We ignore borderline when blur radius occured
- DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
- DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") != std::string::npos);
-
- Property::Value* vertex = map->Find("vertex"); // vertex key name from shader-impl.cpp
- std::string vertexShader;
- DALI_TEST_CHECK(vertex->Get(vertexShader));
- DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_BLUR 1") != std::string::npos);
- // Note : We ignore borderline when blur radius occured
- DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
- DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") != std::string::npos);
- }
+ TestShaderCodeContainSubstrings(
+ dummyControl,
+ {
+ {"#define IS_REQUIRED_BLUR", true},
+ {"#define IS_REQUIRED_BORDERLINE", false}, // Note : We ignore borderline when blur radius occured
+ {"#define IS_REQUIRED_ROUNDED_CORNER", true},
+ },
+ TEST_LOCATION);
// Send shader compile signal
application.SendNotification();
DALI_TEST_CHECK(cornerRadiusValue);
DALI_TEST_EQUALS(cornerRadiusValue->Get<Vector4>(), Vector4::ZERO, TEST_LOCATION);
- // Get shader
- {
- Renderer renderer = dummyControl.GetRendererAt(0);
- Shader shader = renderer.GetShader();
- Property::Value value = shader.GetProperty(Shader::Property::PROGRAM);
- Property::Map* map = value.GetMap();
- DALI_TEST_CHECK(map);
-
- Property::Value* fragment = map->Find("fragment"); // fragment key name from shader-impl.cpp
- DALI_TEST_CHECK(fragment);
- std::string fragmentShader;
- DALI_TEST_CHECK(fragment->Get(fragmentShader));
- // Note : mAlwaysUsingBlurRadius and mAlwaysUsingCornerRadius is true.
- DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_BLUR 1") != std::string::npos);
- // Note : We ignore borderline when blur radius occured
- DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
- DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") != std::string::npos);
-
- Property::Value* vertex = map->Find("vertex"); // vertex key name from shader-impl.cpp
- std::string vertexShader;
- DALI_TEST_CHECK(vertex->Get(vertexShader));
- // Note : mAlwaysUsingBlurRadius and mAlwaysUsingCornerRadius is true.
- DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_BLUR 1") != std::string::npos);
- // Note : We ignore borderline when blur radius occured
- DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
- DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") != std::string::npos);
- }
+ TestShaderCodeContainSubstrings(
+ dummyControl,
+ {
+ {"#define IS_REQUIRED_BLUR", true}, // Note : mAlwaysUsingBlurRadius is true.
+ {"#define IS_REQUIRED_BORDERLINE", false}, // Note : We ignore borderline when blur radius occured
+ {"#define IS_REQUIRED_ROUNDED_CORNER", true}, // Note : mAlwaysUsingCornerRadius is true.
+ },
+ TEST_LOCATION);
// Send shader compile signal
application.SendNotification();
application.SendNotification();
application.Render();
- // Get shader
- {
- Renderer renderer = dummyControl.GetRendererAt(0);
- Shader shader = renderer.GetShader();
- Property::Value value = shader.GetProperty(Shader::Property::PROGRAM);
- Property::Map* map = value.GetMap();
- DALI_TEST_CHECK(map);
-
- Property::Value* fragment = map->Find("fragment"); // fragment key name from shader-impl.cpp
- DALI_TEST_CHECK(fragment);
- std::string fragmentShader;
- DALI_TEST_CHECK(fragment->Get(fragmentShader));
- DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
- DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") != std::string::npos);
-
- Property::Value* vertex = map->Find("vertex"); // vertex key name from shader-impl.cpp
- std::string vertexShader;
- DALI_TEST_CHECK(vertex->Get(vertexShader));
- DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
- DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") != std::string::npos);
- }
+ TestShaderCodeContainSubstrings(
+ dummyControl,
+ {
+ {"#define IS_REQUIRED_BORDERLINE", false},
+ {"#define IS_REQUIRED_ROUNDED_CORNER", true},
+ },
+ TEST_LOCATION);
+
callStack.Reset();
callStack.Enable(true);
application.Render();
application.Render(1001u); // End of animation
- // Get shader
- {
- Renderer renderer = dummyControl.GetRendererAt(0);
- Shader shader = renderer.GetShader();
- Property::Value value = shader.GetProperty(Shader::Property::PROGRAM);
- Property::Map* map = value.GetMap();
- DALI_TEST_CHECK(map);
-
- Property::Value* fragment = map->Find("fragment"); // fragment key name from shader-impl.cpp
- DALI_TEST_CHECK(fragment);
- std::string fragmentShader;
- DALI_TEST_CHECK(fragment->Get(fragmentShader));
- DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
- // Note : mAlwaysUsingCornerRadius is true.
- DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") != std::string::npos);
-
- Property::Value* vertex = map->Find("vertex"); // vertex key name from shader-impl.cpp
- std::string vertexShader;
- DALI_TEST_CHECK(vertex->Get(vertexShader));
- DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_BORDERLINE 1") == std::string::npos);
- // Note : mAlwaysUsingCornerRadius is true.
- DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") != std::string::npos);
- }
+ TestShaderCodeContainSubstrings(
+ dummyControl,
+ {
+ {"#define IS_REQUIRED_BORDERLINE", false},
+ {"#define IS_REQUIRED_ROUNDED_CORNER", true}, // Note : mAlwaysUsingCornerRadius is true.
+ },
+ TEST_LOCATION);
+
callStack.Enable(false);
// Shader not changed
DALI_TEST_CHECK(!callStack.FindMethod("CreateShader"));
DALI_TEST_CHECK(borderlineWidthValue);
DALI_TEST_EQUALS(borderlineWidthValue->Get<float>(), targetBorderlineWidth, TEST_LOCATION);
- // Get shader
- {
- Renderer renderer = dummyControl.GetRendererAt(0);
- Shader shader = renderer.GetShader();
- Property::Value value = shader.GetProperty(Shader::Property::PROGRAM);
- Property::Map* map = value.GetMap();
- DALI_TEST_CHECK(map);
-
- Property::Value* fragment = map->Find("fragment"); // fragment key name from shader-impl.cpp
- DALI_TEST_CHECK(fragment);
- std::string fragmentShader;
- DALI_TEST_CHECK(fragment->Get(fragmentShader));
- DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_BORDERLINE 1") != std::string::npos);
- // Note : mAlwaysUsingCornerRadius is true.
- DALI_TEST_CHECK(fragmentShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") != std::string::npos);
-
- Property::Value* vertex = map->Find("vertex"); // vertex key name from shader-impl.cpp
- std::string vertexShader;
- DALI_TEST_CHECK(vertex->Get(vertexShader));
- DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_BORDERLINE 1") != std::string::npos);
- // Note : mAlwaysUsingCornerRadius is true.
- DALI_TEST_CHECK(vertexShader.find("#define IS_REQUIRED_ROUNDED_CORNER 1") != std::string::npos);
- }
+ TestShaderCodeContainSubstrings(
+ dummyControl,
+ {
+ {"#define IS_REQUIRED_BORDERLINE", true},
+ {"#define IS_REQUIRED_ROUNDED_CORNER", true}, // Note : mAlwaysUsingCornerRadius is true.
+ },
+ TEST_LOCATION);
// Send shader compile signal
application.SendNotification();
set(PREFIX ${prefix})
set(EXEC_PREFIX ${CMAKE_INSTALL_PREFIX})
- set(DEV_INCLUDE_PATH ${repo_root_dir})
+ set(DEV_INCLUDE_PATH ${INCLUDE_DIR})
set(core_pkg_cfg_file dali2-scene-loader.pc)
configure_file(${CMAKE_CURRENT_LIST_DIR}/${core_pkg_cfg_file}.in ${core_pkg_cfg_file} @ONLY)
auto& extras = nodeDef.mExtras;
extras.reserve(eExtras->Size());
- NodeDefinition::Extra e;
for(auto i0 = eExtras->CBegin(), i1 = eExtras->CEnd(); i0 != i1; ++i0)
{
+ NodeDefinition::Extra e;
+
auto eExtra = *i0;
e.mKey = eExtra.first;
if(e.mKey.empty())
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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 DevelStyleManager
{
-const Property::Map GetConfigurations(StyleManager styleManager)
+const Property::Map& GetConfigurations(StyleManager styleManager)
{
return GetImpl(styleManager).GetConfigurations();
}
#define DALI_TOOLKIT_STYLE_MANAGER_DEVEL_H
/*
- * Copyright (c) 2020 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
* @param[in] styleManager The instance of StyleManager
* @return A property map to the currently defined configurations
**/
-DALI_TOOLKIT_API const Property::Map GetConfigurations(StyleManager styleManager);
+DALI_TOOLKIT_API const Property::Map& GetConfigurations(StyleManager styleManager);
/**
* @brief Sets an image to be used when a visual has failed to correctly render
// Update the visual model.
Size newLayoutSize;
- bool isAutoScrollEnabled = false;
+ bool isAutoScrollEnabled = false;
+ bool isAutoScrollMaxTextureExceeded = false;
+
layoutEngine.LayoutText(layoutParameters,
newLayoutSize,
textParameters.ellipsisEnabled,
isAutoScrollEnabled,
+ isAutoScrollMaxTextureExceeded,
ellipsisPosition);
return newLayoutSize;
if(textNaturalSize.width > maxTextureSize)
{
mController->SetTextElideEnabled(true);
+ mController->SetAutoScrollMaxTextureExceeded(true);
}
GetHeightForWidth(maxTextureSize);
wrapGap = std::max(maxTextureSize - textNaturalSize.width, 0.0f);
Renderer renderer = static_cast<Internal::Visual::Base&>(GetImplementation(mVisual)).GetRenderer();
mTextScroller->SetParameters(Self(), renderer, textureSet, controlSize, verifiedSize, wrapGap, direction, mController->GetHorizontalAlignment(), mController->GetVerticalAlignment());
mController->SetTextElideEnabled(actualellipsis);
+ mController->SetAutoScrollMaxTextureExceeded(false);
}
void TextLabel::ScrollingFinished()
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
if(styleManager)
{
- Property::Map config = Toolkit::DevelStyleManager::GetConfigurations(styleManager);
- mAlwaysShowIndicator = config["alwaysShowFocus"].Get<bool>() ? ALWAYS_SHOW : NONE;
+ const Property::Map& config = Toolkit::DevelStyleManager::GetConfigurations(styleManager);
+ const auto alwaysShowFocusValue = config.Find("alwaysShowFocus", Property::Type::BOOLEAN);
+
+ mAlwaysShowIndicator = (alwaysShowFocusValue && alwaysShowFocusValue->Get<bool>()) ? ALWAYS_SHOW : NONE;
mIsFocusIndicatorShown = (mAlwaysShowIndicator == ALWAYS_SHOW) ? SHOW : HIDE;
mClearFocusOnTouch = (mIsFocusIndicatorShown == SHOW) ? false : true;
}
nextFocusableActor = mPreFocusChangeSignal.Emit(currentFocusActor, Actor(), direction);
mIsWaitingKeyboardFocusChangeCommit = false;
}
- else if (mEnableDefaultAlgorithm)
+ else if(mEnableDefaultAlgorithm)
{
Actor rootActor = mFocusFinderRootActor.GetHandle();
if(!rootActor)
{
- if (currentFocusActor)
+ if(currentFocusActor)
{
// Find the window of the focused actor.
Integration::SceneHolder window = Integration::SceneHolder::Get(currentFocusActor);
- if (window)
+ if(window)
{
rootActor = window.GetRootLayer();
}
void KeyboardFocusManager::OnKeyEvent(const KeyEvent& event)
{
- const std::string& keyName = event.GetKeyName();
+ const std::string& keyName = event.GetKeyName();
const std::string& deviceName = event.GetDeviceName();
if(mIsFocusIndicatorShown == UNKNOWN)
bool KeyboardFocusManager::OnCustomWheelEvent(const WheelEvent& event)
{
- bool consumed = false;
- Actor actor = GetCurrentFocusActor();
+ bool consumed = false;
+ Actor actor = GetCurrentFocusActor();
if(actor)
{
// Notify the actor about the wheel event
vec4 ComputeVertexPosition()
{
- vec2 visualSize = mix( uSize.xy*size, size, offsetSizeMode.zw );
- vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy );
- return vec4( (aPosition + anchorPoint)*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );
+ vec2 visualSize = mix(size * uSize.xy, size, offsetSizeMode.zw );
+ vec2 visualOffset = mix(offset * uSize.xy, offset, offsetSizeMode.xy );
+ return vec4( (aPosition + anchorPoint)*visualSize + visualOffset + origin * uSize.xy, 0.0, 1.0 );
}
void main()
vec4 ComputeVertexPosition()
{
- vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );
- vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);
+ vec2 visualSize = mix(size * uSize.xy, size, offsetSizeMode.zw );
+ vec2 visualOffset = mix(offset * uSize.xy, offset, offsetSizeMode.xy);
vPosition = aPosition* visualSize;
- return vec4( vPosition + anchorPoint*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );
+ return vec4( vPosition + anchorPoint*visualSize + visualOffset + origin * uSize.xy, 0.0, 1.0 );
}
void main()
vec2 ComputeVertexPosition()
{
- vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );
- vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);
- return (aPosition + anchorPoint)*visualSize + (visualOffset + origin)*uSize.xy;
+ vec2 visualSize = mix(size * uSize.xy, size, offsetSizeMode.zw );
+ vec2 visualOffset = mix(offset * uSize.xy, offset, offsetSizeMode.xy);
+ return (aPosition + anchorPoint)*visualSize + visualOffset + origin * uSize.xy;
}
void main()
-#ifndef IS_REQUIRED_ROUNDED_CORNER
-#define IS_REQUIRED_ROUNDED_CORNER 0
-#endif
-#ifndef IS_REQUIRED_BORDERLINE
-#define IS_REQUIRED_BORDERLINE 0
-#endif
-#ifndef IS_REQUIRED_BLUR
-#define IS_REQUIRED_BLUR 0
-#endif
-
-#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE || IS_REQUIRED_BLUR
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE) || defined(IS_REQUIRED_BLUR)
INPUT mediump vec2 vPosition;
INPUT mediump vec2 vRectSize;
INPUT mediump vec2 vOptRectSize;
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
INPUT mediump vec4 vCornerRadius;
#endif
#endif
uniform lowp vec4 uColor;
uniform lowp vec3 mixColor;
-#if !IS_REQUIRED_BLUR && IS_REQUIRED_BORDERLINE
+#if !defined(IS_REQUIRED_BLUR) && defined(IS_REQUIRED_BORDERLINE)
uniform mediump float borderlineWidth;
uniform mediump float borderlineOffset;
uniform lowp vec4 borderlineColor;
uniform lowp vec4 uActorColor;
#endif
-#if IS_REQUIRED_BLUR
+#ifdef IS_REQUIRED_BLUR
uniform mediump float blurRadius;
#endif
-#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE || IS_REQUIRED_BLUR
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE) || defined(IS_REQUIRED_BLUR)
// Global values both rounded corner and borderline use
// radius of rounded corner on this quadrant
void calculateCornerRadius()
{
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
gRadius =
mix(
mix(vCornerRadius.x, vCornerRadius.y, sign(vPosition.x) * 0.5 + 0.5),
{
gFragmentPosition = abs(vPosition) - vRectSize;
gCenterPosition = -gRadius;
-#if !IS_REQUIRED_BLUR && IS_REQUIRED_BORDERLINE
+#if !defined(IS_REQUIRED_BLUR) && defined(IS_REQUIRED_BORDERLINE)
gCenterPosition += borderlineWidth * (clamp(borderlineOffset, -1.0, 1.0) + 1.0) * 0.5;
#endif
gDiff = gFragmentPosition - gCenterPosition;
gMaxOutlinePotential = gRadius + gPotentialRange;
gMinOutlinePotential = gRadius - gPotentialRange;
-#if !IS_REQUIRED_BLUR && IS_REQUIRED_BORDERLINE
+#if !defined(IS_REQUIRED_BLUR) && defined(IS_REQUIRED_BORDERLINE)
gMaxInlinePotential = gMaxOutlinePotential - borderlineWidth;
gMinInlinePotential = gMinOutlinePotential - borderlineWidth;
#else
}
#endif
-#if !IS_REQUIRED_BLUR && IS_REQUIRED_BORDERLINE
+#if !defined(IS_REQUIRED_BLUR) && defined(IS_REQUIRED_BORDERLINE)
lowp vec4 convertBorderlineColor(lowp vec4 textureColor)
{
mediump float potential = gPotential;
}
#endif
-#if !IS_REQUIRED_BLUR && IS_REQUIRED_ROUNDED_CORNER
+#if !defined(IS_REQUIRED_BLUR) && defined(IS_REQUIRED_ROUNDED_CORNER)
mediump float calculateCornerOpacity()
{
mediump float potential = gPotential;
}
#endif
-#if IS_REQUIRED_BLUR
+#ifdef IS_REQUIRED_BLUR
mediump float calculateBlurOpacity()
{
// Don't use borderline!
mediump float cy = gRadius + blurRadius;
mediump float cr = gRadius + blurRadius;
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
// This routine make perfect circle. If corner radius is not exist, we don't consider prefect circle.
cy = min(cy, min(vRectSize.x, vRectSize.y) - gRadius);
#endif
// highest point of that circle is (x, x + r) and potential is x + r
// solve (v.x - x)^2 + (v.y - x)^2 = (cr / cy * x)^2
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
// Note : lowspec HW cannot calculate here. need to reduce numeric error
highp float A = (cr * cr - 2.0 * cy * cy);
highp float B = cy * (v.x + v.y);
{
lowp vec4 targetColor = vec4(mixColor, 1.0) * uColor;
-#if IS_REQUIRED_BLUR || IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE
+#if defined(IS_REQUIRED_BLUR) || defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE)
// skip most potential calculate for performance
if(abs(vPosition.x) < vOptRectSize.x && abs(vPosition.y) < vOptRectSize.y)
{
PreprocessPotential();
#endif
-#if !IS_REQUIRED_BLUR && IS_REQUIRED_BORDERLINE
+#if !defined(IS_REQUIRED_BLUR) && defined(IS_REQUIRED_BORDERLINE)
targetColor = convertBorderlineColor(targetColor);
#endif
OUT_COLOR = targetColor;
-#if IS_REQUIRED_BLUR
+#ifdef IS_REQUIRED_BLUR
mediump float opacity = calculateBlurOpacity();
OUT_COLOR.a *= opacity;
-#elif IS_REQUIRED_ROUNDED_CORNER
+#elif defined(IS_REQUIRED_ROUNDED_CORNER)
mediump float opacity = calculateCornerOpacity();
OUT_COLOR.a *= opacity;
#endif
-#if IS_REQUIRED_BLUR || IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE
+#if defined(IS_REQUIRED_BLUR) || defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE)
}
#endif
}
-#ifndef IS_REQUIRED_ROUNDED_CORNER
-#define IS_REQUIRED_ROUNDED_CORNER 0
-#endif
-#ifndef IS_REQUIRED_BORDERLINE
-#define IS_REQUIRED_BORDERLINE 0
-#endif
-#ifndef IS_REQUIRED_BLUR
-#define IS_REQUIRED_BLUR 0
-#endif
-
INPUT mediump vec2 aPosition;
-#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE || IS_REQUIRED_BLUR
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE) || defined(IS_REQUIRED_BLUR)
OUTPUT mediump vec2 vPosition;
OUTPUT mediump vec2 vRectSize;
OUTPUT mediump vec2 vOptRectSize;
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
OUTPUT mediump vec4 vCornerRadius;
#endif
#endif
uniform mediump vec4 offsetSizeMode;
uniform mediump vec2 origin;
uniform mediump vec2 anchorPoint;
-#if !IS_REQUIRED_BLUR && IS_REQUIRED_BORDERLINE
+#if !defined(IS_REQUIRED_BLUR) && defined(IS_REQUIRED_BORDERLINE)
uniform mediump float borderlineWidth;
uniform mediump float borderlineOffset;
#endif
-#if IS_REQUIRED_BLUR
+#ifdef IS_REQUIRED_BLUR
uniform mediump float blurRadius;
#endif
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
uniform mediump vec4 cornerRadius;
uniform mediump float cornerRadiusPolicy;
#endif
vec4 ComputeVertexPosition()
{
- vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw ) + extraSize;
- vec2 visualOffset = mix(offset, offset/uSize.xy, offsetSizeMode.xy);
+ vec2 visualSize = mix(size * uSize.xy, size, offsetSizeMode.zw ) + extraSize;
+ vec2 visualOffset = mix(offset * uSize.xy, offset, offsetSizeMode.xy);
-#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE || IS_REQUIRED_BLUR
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE) || defined(IS_REQUIRED_BLUR)
vRectSize = visualSize * 0.5;
vOptRectSize = vRectSize;
#endif
-#if IS_REQUIRED_ROUNDED_CORNER
-#if !IS_REQUIRED_BLUR && IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_ROUNDED_CORNER
+#if !defined(IS_REQUIRED_BLUR) && defined(IS_REQUIRED_BORDERLINE)
mediump float minSize = min(visualSize.x, visualSize.y) + (1.0 + clamp(borderlineOffset, -1.0, 1.0)) * borderlineWidth;
#else
mediump float minSize = min(visualSize.x, visualSize.y);
vOptRectSize -= 0.2929 * maxRadius + 1.0;
#endif
-#if IS_REQUIRED_BLUR
+#ifdef IS_REQUIRED_BLUR
vPosition = aPosition * (visualSize + 2.0 * blurRadius);
vOptRectSize -= blurRadius + 1.0;
-#elif IS_REQUIRED_BORDERLINE
+#elif defined(IS_REQUIRED_BORDERLINE)
vPosition = aPosition * (visualSize + (1.0 + clamp(borderlineOffset, -1.0, 1.0))* borderlineWidth);
vOptRectSize -= (1.0 - clamp(borderlineOffset, -1.0, 1.0)) * 0.5 * borderlineWidth + 1.0;
-#elif IS_REQUIRED_ROUNDED_CORNER
+#elif defined(IS_REQUIRED_ROUNDED_CORNER)
vPosition = aPosition * visualSize;
#else
mediump vec2 vPosition = aPosition * visualSize;
#endif
- return vec4(vPosition + anchorPoint * visualSize + (visualOffset + origin) * uSize.xy, 0.0, 1.0);
+ return vec4(vPosition + anchorPoint * visualSize + visualOffset + origin * uSize.xy, 0.0, 1.0);
}
void main()
-#ifndef IS_REQUIRED_ROUNDED_CORNER
-#define IS_REQUIRED_ROUNDED_CORNER 0
-#endif
-#ifndef IS_REQUIRED_BORDERLINE
-#define IS_REQUIRED_BORDERLINE 0
-#endif
-#ifndef RADIAL
-#define RADIAL 0
-#endif
-
INPUT mediump vec2 vTexCoord;
-#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE)
INPUT mediump vec2 vPosition;
INPUT mediump vec2 vRectSize;
INPUT mediump vec2 vOptRectSize;
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
INPUT mediump vec4 vCornerRadius;
#endif
#endif
uniform sampler2D sTexture; // sampler1D?
uniform lowp vec4 uColor;
uniform lowp vec3 mixColor;
-#if IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_BORDERLINE
uniform mediump float borderlineWidth;
uniform mediump float borderlineOffset;
uniform lowp vec4 borderlineColor;
uniform lowp vec4 uActorColor;
#endif
-#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE)
// Global values both rounded corner and borderline use
// radius of rounded corner on this quadrant
void calculateCornerRadius()
{
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
gRadius =
mix(
mix(vCornerRadius.x, vCornerRadius.y, sign(vPosition.x) * 0.5 + 0.5),
{
gFragmentPosition = abs(vPosition) - vRectSize;
gCenterPosition = -gRadius;
-#if IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_BORDERLINE
gCenterPosition += borderlineWidth * (clamp(borderlineOffset, -1.0, 1.0) + 1.0) * 0.5;
#endif
gDiff = gFragmentPosition - gCenterPosition;
gMaxOutlinePotential = gRadius + gPotentialRange;
gMinOutlinePotential = gRadius - gPotentialRange;
-#if IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_BORDERLINE
gMaxInlinePotential = gMaxOutlinePotential - borderlineWidth;
gMinInlinePotential = gMinOutlinePotential - borderlineWidth;
#else
#endif
-#if IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_BORDERLINE
lowp vec4 convertBorderlineColor(lowp vec4 textureColor)
{
mediump float potential = gPotential;
}
#endif
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
mediump float calculateCornerOpacity()
{
mediump float potential = gPotential;
void main()
{
-#if RADIAL
+#ifdef RADIAL
lowp vec4 textureColor = TEXTURE(sTexture, vec2(length(vTexCoord), 0.5)) * vec4(mixColor, 1.0) * uColor;
#else
lowp vec4 textureColor = TEXTURE(sTexture, vec2(vTexCoord.y, 0.5)) * vec4(mixColor, 1.0) * uColor;
#endif
-#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE)
// skip most potential calculate for performance
if(abs(vPosition.x) < vOptRectSize.x && abs(vPosition.y) < vOptRectSize.y)
{
PreprocessPotential();
#endif
-#if IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_BORDERLINE
textureColor = convertBorderlineColor(textureColor);
#endif
OUT_COLOR = textureColor;
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
mediump float opacity = calculateCornerOpacity();
OUT_COLOR *= opacity;
#endif
-#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE)
}
#endif
}
-#ifndef IS_REQUIRED_ROUNDED_CORNER
-#define IS_REQUIRED_ROUNDED_CORNER 0
-#endif
-#ifndef IS_REQUIRED_BORDERLINE
-#define IS_REQUIRED_BORDERLINE 0
-#endif
-#ifndef USER_SPACE
-#define USER_SPACE 0
-#endif
-
INPUT mediump vec2 aPosition;
OUTPUT mediump vec2 vTexCoord;
-#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE)
OUTPUT mediump vec2 vPosition;
OUTPUT mediump vec2 vRectSize;
OUTPUT mediump vec2 vOptRectSize;
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
OUTPUT mediump vec4 vCornerRadius;
#endif
#endif
uniform mediump vec4 offsetSizeMode;
uniform mediump vec2 origin;
uniform mediump vec2 anchorPoint;
-#if IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_BORDERLINE
uniform mediump float borderlineWidth;
uniform mediump float borderlineOffset;
#endif
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
uniform mediump vec4 cornerRadius;
uniform mediump float cornerRadiusPolicy;
#endif
vec4 ComputeVertexPosition()
{
- vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );
- vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);
+ vec2 visualSize = mix(size * uSize.xy, size, offsetSizeMode.zw );
+ vec2 visualOffset = mix(offset * uSize.xy, offset, offsetSizeMode.xy);
-#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE)
vRectSize = visualSize * 0.5;
vOptRectSize = vRectSize;
#endif
-#if IS_REQUIRED_ROUNDED_CORNER
-#if IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_BORDERLINE
mediump float minSize = min(visualSize.x, visualSize.y) + (1.0 + clamp(borderlineOffset, -1.0, 1.0)) * borderlineWidth;
#else
mediump float minSize = min(visualSize.x, visualSize.y);
#endif
mediump vec4 vertexPosition = vec4(aPosition, 0.0, 1.0);
-#if IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_BORDERLINE
vPosition = aPosition * (visualSize + (1.0 + clamp(borderlineOffset, -1.0, 1.0)) * borderlineWidth);
vertexPosition.xy *= (1.0 + (1.0 + clamp(borderlineOffset, -1.0, 1.0)) * borderlineWidth / visualSize);
vOptRectSize -= (1.0 - clamp(borderlineOffset, -1.0, 1.0)) * 0.5 * borderlineWidth + 1.0;
-#elif IS_REQUIRED_ROUNDED_CORNER
+#elif defined(IS_REQUIRED_ROUNDED_CORNER)
vPosition = aPosition * visualSize;
#else
mediump vec2 vPosition = aPosition * visualSize;
#endif
-#if USER_SPACE
+#ifdef USER_SPACE
vertexPosition.xyz *= uSize;
#endif
vTexCoord = (uAlignmentMatrix*vertexPosition.xyw).xy;
- return vec4(vPosition + anchorPoint * visualSize + (visualOffset + origin) * uSize.xy, 0.0, 1.0);
+ return vec4(vPosition + anchorPoint * visualSize + visualOffset + origin * uSize.xy, 0.0, 1.0);
}
void main()
-#ifndef IS_REQUIRED_ROUNDED_CORNER
-#define IS_REQUIRED_ROUNDED_CORNER 0
-#endif
-#ifndef IS_REQUIRED_BORDERLINE
-#define IS_REQUIRED_BORDERLINE 0
-#endif
-#ifndef IS_REQUIRED_ALPHA_MASKING
-#define IS_REQUIRED_ALPHA_MASKING 0
-#endif
-#ifndef ATLAS_DEFAULT_WARP
-#define ATLAS_DEFAULT_WARP 0
-#endif
-#ifndef ATLAS_CUSTOM_WARP
-#define ATLAS_CUSTOM_WARP 0
-#endif
-
INPUT mediump vec2 vTexCoord;
-#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE)
INPUT mediump vec2 vPosition;
INPUT mediump vec2 vRectSize;
INPUT mediump vec2 vOptRectSize;
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
INPUT mediump vec4 vCornerRadius;
#endif
#endif
uniform sampler2D sTexture;
-#if IS_REQUIRED_ALPHA_MASKING
+#ifdef IS_REQUIRED_ALPHA_MASKING
uniform sampler2D sMaskTexture;
INPUT mediump vec2 vMaskTexCoord;
#endif
-#if ATLAS_DEFAULT_WARP
+#ifdef ATLAS_DEFAULT_WARP
uniform mediump vec4 uAtlasRect;
-#elif ATLAS_CUSTOM_WARP
+#elif defined(ATLAS_CUSTOM_WARP)
// WrapMode -- 0: CLAMP; 1: REPEAT; 2: REFLECT;
uniform lowp vec2 wrapMode;
#endif
uniform lowp vec4 uColor;
uniform lowp vec3 mixColor;
uniform lowp float preMultipliedAlpha;
-#if IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_BORDERLINE
uniform mediump float borderlineWidth;
uniform mediump float borderlineOffset;
uniform lowp vec4 borderlineColor;
uniform lowp vec4 uActorColor;
#endif
-#if ATLAS_CUSTOM_WARP
+#ifdef ATLAS_CUSTOM_WARP
mediump float wrapCoordinate( mediump vec2 range, mediump float coordinate, lowp float wrap )
{
mediump float coord;
}
#endif
-#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE)
// Global values both rounded corner and borderline use
// radius of rounded corner on this quadrant
void calculateCornerRadius()
{
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
gRadius =
mix(
mix(vCornerRadius.x, vCornerRadius.y, sign(vPosition.x) * 0.5 + 0.5),
{
gFragmentPosition = abs(vPosition) - vRectSize;
gCenterPosition = -gRadius;
-#if IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_BORDERLINE
gCenterPosition += borderlineWidth * (clamp(borderlineOffset, -1.0, 1.0) + 1.0) * 0.5;
#endif
gDiff = gFragmentPosition - gCenterPosition;
gMaxOutlinePotential = gRadius + gPotentialRange;
gMinOutlinePotential = gRadius - gPotentialRange;
-#if IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_BORDERLINE
gMaxInlinePotential = gMaxOutlinePotential - borderlineWidth;
gMinInlinePotential = gMinOutlinePotential - borderlineWidth;
#else
}
#endif
-#if IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_BORDERLINE
lowp vec4 convertBorderlineColor(lowp vec4 textureColor)
{
mediump float potential = gPotential;
}
#endif
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
mediump float calculateCornerOpacity()
{
mediump float potential = gPotential;
void main()
{
-#if ATLAS_DEFAULT_WARP
+#ifdef ATLAS_DEFAULT_WARP
mediump vec2 texCoord = clamp( mix( uAtlasRect.xy, uAtlasRect.zw, vTexCoord ), uAtlasRect.xy, uAtlasRect.zw );
-#elif ATLAS_CUSTOM_WARP
+#elif defined(ATLAS_CUSTOM_WARP)
mediump vec2 texCoord = vec2( wrapCoordinate( uAtlasRect.xz, vTexCoord.x, wrapMode.x ),
wrapCoordinate( uAtlasRect.yw, vTexCoord.y, wrapMode.y ) );
#else
lowp vec4 textureColor = TEXTURE( sTexture, texCoord ) * vec4( mixColor, 1.0 ) * uColor;
-#if IS_REQUIRED_ALPHA_MASKING
+#ifdef IS_REQUIRED_ALPHA_MASKING
mediump float maskAlpha = TEXTURE(sMaskTexture, vMaskTexCoord).a;
textureColor.a *= maskAlpha;
textureColor.rgb *= mix(1.0, maskAlpha, preMultipliedAlpha);
#endif
-#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE)
// skip most potential calculate for performance
if(abs(vPosition.x) < vOptRectSize.x && abs(vPosition.y) < vOptRectSize.y)
{
PreprocessPotential();
#endif
-#if IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_BORDERLINE
textureColor = convertBorderlineColor(textureColor);
#endif
OUT_COLOR = textureColor;
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
mediump float opacity = calculateCornerOpacity();
OUT_COLOR.a *= opacity;
OUT_COLOR.rgb *= mix(1.0, opacity, preMultipliedAlpha);
#endif
-#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE)
}
#endif
}
-#ifndef IS_REQUIRED_ROUNDED_CORNER
-#define IS_REQUIRED_ROUNDED_CORNER 0
-#endif
-#ifndef IS_REQUIRED_BORDERLINE
-#define IS_REQUIRED_BORDERLINE 0
-#endif
-#ifndef IS_REQUIRED_ALPHA_MASKING
-#define IS_REQUIRED_ALPHA_MASKING 0
-#endif
-
INPUT mediump vec2 aPosition;
OUTPUT mediump vec2 vTexCoord;
-#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE)
OUTPUT mediump vec2 vPosition;
OUTPUT mediump vec2 vRectSize;
OUTPUT mediump vec2 vOptRectSize;
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
OUTPUT mediump vec4 vCornerRadius;
#endif
#endif
uniform mediump vec4 offsetSizeMode;
uniform mediump vec2 origin;
uniform mediump vec2 anchorPoint;
-#if IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_BORDERLINE
uniform mediump float borderlineWidth;
uniform mediump float borderlineOffset;
#endif
-#if IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_ROUNDED_CORNER
uniform mediump vec4 cornerRadius;
uniform mediump float cornerRadiusPolicy;
#endif
-#if IS_REQUIRED_ALPHA_MASKING
+#ifdef IS_REQUIRED_ALPHA_MASKING
OUTPUT mediump vec2 vMaskTexCoord;
uniform lowp float cropToMask;
uniform mediump vec2 maskTextureRatio;
vec4 ComputeVertexPosition()
{
- vec2 visualSize = mix(uSize.xy * size, size, offsetSizeMode.zw) + extraSize;
- vec2 visualOffset = mix(offset, offset/uSize.xy, offsetSizeMode.xy);
+ vec2 visualSize = mix(size * uSize.xy, size, offsetSizeMode.zw) + extraSize;
+ vec2 visualOffset = mix(offset * uSize.xy, offset, offsetSizeMode.xy);
-#if IS_REQUIRED_ROUNDED_CORNER || IS_REQUIRED_BORDERLINE
+#if defined(IS_REQUIRED_ROUNDED_CORNER) || defined(IS_REQUIRED_BORDERLINE)
vRectSize = visualSize * 0.5;
vOptRectSize = vRectSize;
#endif
-#if IS_REQUIRED_ROUNDED_CORNER
-#if IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_ROUNDED_CORNER
+#ifdef IS_REQUIRED_BORDERLINE
mediump float minSize = min(visualSize.x, visualSize.y) + (1.0 + clamp(borderlineOffset, -1.0, 1.0)) * borderlineWidth;
#else
mediump float minSize = min(visualSize.x, visualSize.y);
vOptRectSize -= 0.2929 * maxRadius + 1.0;
#endif
-#if IS_REQUIRED_BORDERLINE
+#ifdef IS_REQUIRED_BORDERLINE
vPosition = aPosition * (visualSize + (1.0 + clamp(borderlineOffset, -1.0, 1.0)) * borderlineWidth);
vOptRectSize -= (1.0 - clamp(borderlineOffset, -1.0, 1.0)) * 0.5 * borderlineWidth + 1.0;
-#elif IS_REQUIRED_ROUNDED_CORNER
+#elif defined(IS_REQUIRED_ROUNDED_CORNER)
vPosition = aPosition * visualSize;
#else
mediump vec2 vPosition = aPosition * visualSize;
#endif
vec4 finalPixelArea = pixelArea;
-#if IS_REQUIRED_ALPHA_MASKING
+#ifdef IS_REQUIRED_ALPHA_MASKING
finalPixelArea = mix(pixelArea,
vec4(
vec2(0.5) + (pixelArea.xy - vec2(0.5)) * maskTextureRatio,
#endif
vTexCoord = finalPixelArea.xy + finalPixelArea.zw * (vPosition.xy / max(vec2(1.0), visualSize) + vec2(0.5));
- return vec4(vPosition + anchorPoint * visualSize + (visualOffset + origin) * uSize.xy, 0.0, 1.0);
+ return vec4(vPosition + anchorPoint * visualSize + visualOffset + origin * uSize.xy, 0.0, 1.0);
}
void main()
vec4 ComputeVertexPosition()
{
- vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );
+ vec2 visualSize = mix(size * uSize.xy, size, offsetSizeMode.zw );
float scaleFactor = min( visualSize.x, visualSize.y );
vec3 originFlipY =vec3(origin.x, -origin.y, 0.0);
vec3 anchorPointFlipY = vec3( anchorPoint.x, -anchorPoint.y, 0.0);
- vec3 offset = vec3( ( offset / uSize.xy ) * offsetSizeMode.xy + offset * (1.0-offsetSizeMode.xy), 0.0) * vec3(1.0,-1.0,1.0);
- return vec4( (aPosition + anchorPointFlipY)*scaleFactor + (offset + originFlipY)*uSize, 1.0 );
+ vec3 visualOffset = vec3( offset * offsetSizeMode.xy + offset * uSize.xy * (1.0 - offsetSizeMode.xy), 0.0) * vec3(1.0,-1.0,1.0);
+ return vec4( (aPosition + anchorPointFlipY)*scaleFactor + visualOffset + originFlipY * uSize, 1.0 );
}
void main()
float scaleFactor = min( visualSize.x, visualSize.y );
vec3 originFlipY =vec3(origin.x, -origin.y, 0.0);
vec3 anchorPointFlipY = vec3( anchorPoint.x, -anchorPoint.y, 0.0);
- vec3 offset = vec3( ( offset / uSize.xy ) * offsetSizeMode.xy + offset * (1.0-offsetSizeMode.xy), 0.0) * vec3(1.0,-1.0,1.0);
- return vec4( (aPosition + anchorPointFlipY)*scaleFactor + (offset + originFlipY)*uSize, 1.0 );
+ vec3 visualOffset = vec3( offset * offsetSizeMode.xy + offset * uSize.xy * (1.0-offsetSizeMode.xy), 0.0) * vec3(1.0,-1.0,1.0);
+ return vec4( (aPosition + anchorPointFlipY)*scaleFactor + visualOffset + originFlipY * uSize, 1.0 );
}
void main()
float scaleFactor = min( visualSize.x, visualSize.y );
vec3 originFlipY =vec3(origin.x, -origin.y, 0.0);
vec3 anchorPointFlipY = vec3( anchorPoint.x, -anchorPoint.y, 0.0);
- vec3 offset = vec3( ( offset / uSize.xy ) * offsetSizeMode.xy + offset * (1.0-offsetSizeMode.xy), 0.0) * vec3(1.0,-1.0,1.0);
- return vec4( (aPosition + anchorPointFlipY)*scaleFactor + (offset + originFlipY)*uSize, 1.0 );
+ vec3 visualOffset = vec3( offset * offsetSizeMode.xy + offset * uSize.xy * (1.0-offsetSizeMode.xy), 0.0) * vec3(1.0,-1.0,1.0);
+ return vec4( (aPosition + anchorPointFlipY)*scaleFactor + visualOffset + originFlipY * uSize, 1.0 );
}
void main()
void main()
{
- vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw ) + extraSize;
- vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);
+ vec2 visualSize = mix(size * uSize.xy, size, offsetSizeMode.zw ) + extraSize;
+ vec2 visualOffset = mix(offset * uSize.xy, offset, offsetSizeMode.xy);
mediump vec2 size = visualSize.xy;
mediump vec4 gridPosition = vec4( fixedFactor * fixedScaleDownRate + ( size - fixedTotal * fixedScaleDownRate ) * stretch, 0.0, 1.0 );
mediump vec4 vertexPosition = gridPosition;
vertexPosition.xy -= size * vec2( 0.5, 0.5 );
- vertexPosition.xy += anchorPoint*size + (visualOffset + origin)*uSize.xy;
+ vertexPosition.xy += anchorPoint*size + visualOffset + origin * uSize.xy;
vertexPosition = uMvpMatrix * vertexPosition;
mediump vec2 fixedTotal = vec2( uNinePatchFactorsX[ FACTOR_SIZE_X - 1 ].x, uNinePatchFactorsY[ FACTOR_SIZE_Y - 1 ].x );
mediump vec2 stretchTotal = vec2( uNinePatchFactorsX[ FACTOR_SIZE_X - 1 ].y, uNinePatchFactorsY[ FACTOR_SIZE_Y - 1 ].y );
- vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw ) + extraSize;
- vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);
+ vec2 visualSize = mix(size * uSize.xy, size, offsetSizeMode.zw ) + extraSize;
+ vec2 visualOffset = mix(offset * uSize.xy, offset, offsetSizeMode.xy);
// Scale down if fixedTotal is bigger than visualSize
mediump float fixedScaleDownRate = min(1.0, min(visualSize.x / fixedTotal.x, visualSize.y / fixedTotal.y));
mediump vec4 gridPosition = vec4( fixedFactor * fixedScaleDownRate + ( visualSize.xy - fixedTotal * fixedScaleDownRate ) * stretch / stretchTotal, 0.0, 1.0 );
mediump vec4 vertexPosition = gridPosition;
vertexPosition.xy -= visualSize.xy * vec2( 0.5, 0.5 );
- vertexPosition.xy += anchorPoint*visualSize + (visualOffset + origin)*uSize.xy;
+ vertexPosition.xy += anchorPoint*visualSize + visualOffset + origin * uSize.xy;
vertexPosition = uMvpMatrix * vertexPosition;
vTexCoord = ( fixedFactor + stretch ) / ( fixedTotal + stretchTotal );
float scaleFactor = min( visualSize.x / uObjectDimensions.x, visualSize.y / uObjectDimensions.y );
vec3 originFlipY =vec3(origin.x, -origin.y, 0.0);
vec3 anchorPointFlipY = vec3( anchorPoint.x, -anchorPoint.y, 0.0);
- vec3 offset = vec3( ( offset / uSize.xy ) * offsetSizeMode.xy + offset * (1.0-offsetSizeMode.xy), 0.0) * vec3(1.0,-1.0,1.0);
+ vec3 visualOffset = vec3( offset * offsetSizeMode.xy + offset * uSize.xy * (1.0-offsetSizeMode.xy), 0.0) * vec3(1.0,-1.0,1.0);
- return vec4( (aPosition + anchorPointFlipY)*scaleFactor + (offset + originFlipY)*uSize, 1.0 );
+ return vec4( (aPosition + anchorPointFlipY)*scaleFactor + visualOffset + originFlipY * uSize, 1.0 );
}
void main()
attribute mediump vec2 aPosition;
varying highp vec2 vTexCoord;
uniform highp vec3 uSize;
-uniform mediump float uDelta;
+uniform highp float uDelta;
uniform mediump vec2 uTextureSize;
-uniform mediump float uGap;
+uniform highp float uGap;
uniform mediump float uHorizontalAlign;
uniform mediump float uVerticalAlign;
void main()
{
- mediump vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy );
- mediump vec2 visualSize = mix( uSize.xy * size, size, offsetSizeMode.zw );
+ highp vec2 visualSize = mix(size * uSize.xy, size, offsetSizeMode.zw);
+ highp vec2 visualOffset = mix(offset * uSize.xy, offset, offsetSizeMode.xy);
- vTexCoord.x = ( uDelta + uHorizontalAlign * ( uTextureSize.x - visualSize.x - uGap ) + floor( aPosition.x * visualSize.x ) + 0.5 - uGap * 0.5 ) / uTextureSize.x + 0.5;
- vTexCoord.y = ( uVerticalAlign * ( uTextureSize.y - visualSize.y ) + floor( aPosition.y * visualSize.y ) + 0.5 ) / ( uTextureSize.y ) + 0.5;
+ vTexCoord.x = ( uDelta + uHorizontalAlign * ( uTextureSize.x - visualSize.x - uGap ) + aPosition.x * visualSize.x - uGap * 0.5 ) / uTextureSize.x + 0.5;
+ vTexCoord.y = ( uVerticalAlign * ( uTextureSize.y - visualSize.y ) + aPosition.y * visualSize.y ) / ( uTextureSize.y ) + 0.5;
- mediump vec4 vertexPosition = vec4( floor( ( aPosition + anchorPoint ) * visualSize + ( visualOffset + origin ) * uSize.xy ), 0.0, 1.0 );
+ highp vec4 vertexPosition = vec4( ( aPosition + anchorPoint ) * visualSize + visualOffset + origin * uSize.xy, 0.0, 1.0 );
gl_Position = uMvpMatrix * vertexPosition;
}
\ No newline at end of file
vec4 ComputeVertexPosition()
{
- vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );
- vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);
- return vec4( (aPosition + anchorPoint)*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );
+ vec2 visualSize = mix(size * uSize.xy, size, offsetSizeMode.zw );
+ vec2 visualOffset = mix(offset * uSize.xy, offset, offsetSizeMode.xy);
+ return vec4( (aPosition + anchorPoint) * visualSize + visualOffset + origin * uSize.xy, 0.0, 1.0 );
}
void main()
vec4 ComputeVertexPosition()
{
- vec2 visualSize = mix(uSize.xy*size, size, offsetSizeMode.zw );
- vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);
- return vec4( (aPosition + anchorPoint)*visualSize + (visualOffset + origin)*uSize.xy, 0.0, 1.0 );
+ vec2 visualSize = mix(size * uSize.xy, size, offsetSizeMode.zw );
+ vec2 visualOffset = mix(offset * uSize.xy, offset, offsetSizeMode.xy);
+ return vec4( (aPosition + anchorPoint)*visualSize + visualOffset + origin * uSize.xy, 0.0, 1.0 );
}
void main()
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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 Property::Map StyleManager::GetConfigurations()
+const Property::Map& StyleManager::GetConfigurations()
{
DALI_LOG_STREAM(gLogFilter, Debug::Concise, "GetConfigurations()\n On entry, mThemeBuilder: " << (bool(mThemeBuilder) ? "Created" : "Empty") << " mThemeFile: " << mThemeFile);
- Property::Map result;
- if(mThemeBuilder)
- {
- result = mThemeBuilder.GetConfigurations();
- }
- else
+ if(!mThemeBuilder)
{
DALI_LOG_STREAM(gLogFilter, Debug::Concise, "GetConfigurations() Loading default theme");
- bool themeLoaded = false;
-
mThemeBuilder = CreateBuilder(mThemeBuilderConstants);
// Load default theme because this is first try to load stylesheet.
- themeLoaded = LoadJSON(mThemeBuilder, mDefaultThemeFilePath);
- mThemeFile = mDefaultThemeFilePath;
-
- if(themeLoaded)
- {
- result = mThemeBuilder.GetConfigurations();
- }
+#if defined(DEBUG_ENABLED)
+ bool themeLoaded = LoadJSON(mThemeBuilder, mDefaultThemeFilePath);
DALI_LOG_STREAM(gLogFilter, Debug::Concise, " themeLoaded" << (themeLoaded ? "success" : "failure"));
+#else
+ LoadJSON(mThemeBuilder, mDefaultThemeFilePath);
+#endif
+
+ mThemeFile = mDefaultThemeFilePath;
}
+#if defined(DEBUG_ENABLED)
+ Property::Map result = mThemeBuilder.GetConfigurations();
DALI_LOG_STREAM(gLogFilter, Debug::Concise, "GetConfigurations()\n On exit, result Count: " << (result.Count() != 0));
DALI_LOG_STREAM(gLogFilter, Debug::Verbose, " result: " << result);
+#endif
- return result;
+ return mThemeBuilder.GetConfigurations();
}
void StyleManager::SetBrokenImageUrl(DevelStyleManager::BrokenImageType brokenImageType, const std::string& brokenImageUrl)
{
- int brokenType = static_cast<int>(brokenImageType);
- mBrokenImageUrls[brokenType] = brokenImageUrl;
+ int brokenType = static_cast<int>(brokenImageType);
+ mBrokenImageUrls[brokenType] = brokenImageUrl;
Toolkit::StyleManager styleManager = StyleManager::Get();
mBrokenImageChangedSignal.Emit(styleManager);
}
#define DALI_TOOLKIT_INTERNAL_STYLE_MANAGER_H
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/builder/builder.h>
+#include <dali-toolkit/devel-api/styling/style-manager-devel.h>
#include <dali-toolkit/internal/builder/style.h>
#include <dali-toolkit/public-api/styling/style-manager.h>
-#include <dali-toolkit/devel-api/styling/style-manager-devel.h>
namespace Dali
{
/**
* @copydoc Toolkit::StyleManager::GetConfigurations
*/
- const Property::Map GetConfigurations();
+ const Property::Map& GetConfigurations();
/**
* @copydoc Toolkit::DevelStyleManager::SetBrokenImageUrl
Toolkit::Internal::FeedbackStyle* mFeedbackStyle; ///< Feedback style
- std::vector<std::string> mBrokenImageUrls; ///< Broken Image Urls received from user
+ std::vector<std::string> mBrokenImageUrls; ///< Broken Image Urls received from user
// Signals
Toolkit::StyleManager::StyleChangedSignalType mControlStyleChangeSignal; ///< Emitted when the style( theme/font ) changes for the controls to style themselves
Length& numberOfLines,
float penY,
bool& isAutoScrollEnabled,
+ bool isAutoScrollMaxTextureExceeded,
DevelText::EllipsisPosition::Type ellipsisPosition,
bool enforceEllipsisInSingleLine)
{
- const bool ellipsis = enforceEllipsisInSingleLine || (isAutoScrollEnabled ? (penY - layout.descender > layoutParameters.boundingBox.height) : ((penY - layout.descender > layoutParameters.boundingBox.height) || ((mLayout == SINGLE_LINE_BOX) && (layout.length > layoutParameters.boundingBox.width))));
+ const bool ellipsis = enforceEllipsisInSingleLine || (isAutoScrollEnabled ? isAutoScrollMaxTextureExceeded : ((penY - layout.descender > layoutParameters.boundingBox.height) || ((mLayout == SINGLE_LINE_BOX) && (layout.length > layoutParameters.boundingBox.width))));
const bool isMultiline = !enforceEllipsisInSingleLine && (mLayout == MULTI_LINE_BOX);
if(ellipsis && (ellipsisPosition == DevelText::EllipsisPosition::END || !isMultiline))
{
- isAutoScrollEnabled = false;
- // Do not layout more lines if ellipsis is enabled.
+ if(penY - layout.descender > layoutParameters.boundingBox.height)
+ {
+ // Even if auto scroll is enabled and text is bigger than max texture size,
+ // if the the height is small, auto scroll should not work.
+ isAutoScrollEnabled = false;
+ }
+ // Do not layout more lines if ellipsis is enabled.
// The last line needs to be completely filled with characters.
// Part of a word may be used.
Size& layoutSize,
bool elideTextEnabled,
bool& isAutoScrollEnabled,
+ bool isAutoScrollMaxTextureExceeded,
DevelText::EllipsisPosition::Type ellipsisPosition)
{
DALI_LOG_INFO(gLogFilter, Debug::Verbose, "-->LayoutText\n");
CharacterIndex lastCharacterInParagraph = currentParagraphRun.characterRun.characterIndex + currentParagraphRun.characterRun.numberOfCharacters - 1;
//check if this is the last line in paragraph, if false we should use the default relative line size (the one set using the property)
- if(lastCharacterInParagraph >= layout.characterIndex && lastCharacterInParagraph < layout.characterIndex+layout.numberOfCharacters)
+ if(lastCharacterInParagraph >= layout.characterIndex && lastCharacterInParagraph < layout.characterIndex + layout.numberOfCharacters)
{
layout.relativeLineSize = mRelativeLineSize;
}
numberOfLines,
penY,
isAutoScrollEnabled,
+ isAutoScrollMaxTextureExceeded,
ellipsisPosition,
false);
}
numberOfLines,
penY,
isAutoScrollEnabled,
+ isAutoScrollMaxTextureExceeded,
ellipsisPosition,
true);
}
Size& layoutSize,
bool elideTextEnabled,
bool& isAutoScrollEnabled,
+ bool isAutoScrollMaxTextureExceeded,
DevelText::EllipsisPosition::Type ellipsisPosition)
{
return mImpl->LayoutText(layoutParameters,
layoutSize,
elideTextEnabled,
isAutoScrollEnabled,
+ isAutoScrollMaxTextureExceeded,
ellipsisPosition);
}
* @param[out] layoutSize The size of the text after it has been laid-out.
* @param[in] elideTextEnabled Whether the text elide is enabled.
* @param[in,out] isAutoScrollEnabled If the isAutoScrollEnabled is true and the height of the text exceeds the boundaries of the control the text is elided and the isAutoScrollEnabled is set to false to disable the autoscroll
+ * @param[in] isAutoScrollMaxTextureExceeded If isAutoScrollMaxTextureExceeded is true, enable ellipsis during auro scroll.
* @param[in] ellipsisPosition The location of the text ellipsis
*
* @return \e true if the text has been re-laid-out. \e false means the given width is too small to layout even a single character.
Size& layoutSize,
bool elideTextEnabled,
bool& isAutoScrollEnabled,
+ bool isAutoScrollMaxTextureExceeded,
DevelText::EllipsisPosition::Type ellipsisPosition);
/**
markupProcessData.characterSpacingCharacterRuns.Resize(characterSpacingCharacterRunIndex);
#ifdef DEBUG_ENABLED
- for(unsigned int i = 0; i < colorRunIndex; ++i)
+ for(uint32_t i = 0; gLogFilter->IsEnabledFor(Debug::Verbose) && i < colorRunIndex; ++i)
{
ColorRun& run = markupProcessData.colorRuns[i];
DALI_LOG_INFO(gLogFilter, Debug::Verbose, "run[%d] index: %d, length: %d, color %f,%f,%f,%f\n", i, run.characterRun.characterIndex, run.characterRun.numberOfCharacters, run.color.r, run.color.g, run.color.b, run.color.a);
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
scriptRunEndIt);
#ifdef DEBUG_ENABLED
+ if(gLogFilter->IsEnabledFor(Debug::Verbose))
{
Dali::TextAbstraction::FontDescription description;
fontClient.GetDescription(fontId, description);
}
#ifdef DEBUG_ENABLED
+ if(gLogFilter->IsEnabledFor(Debug::Verbose))
{
Dali::TextAbstraction::FontDescription description;
fontClient.GetDescription(fontId, description);
glyphBufferData.width,
glyphBufferData.height,
glyphBufferData.format,
- PixelData::DELETE_ARRAY);
+ PixelData::FREE);
if(bitmap)
{
DALI_LOG_INFO(gLogFilter, Debug::Verbose, "%s\n", metrics.mVerboseGlyphCounts.c_str());
- for(uint32_t i = 0; i < metrics.mAtlasMetrics.mAtlasCount; ++i)
+ for(uint32_t i = 0; gLogFilter->IsEnabledFor(Debug::Verbose) && i < metrics.mAtlasMetrics.mAtlasCount; ++i)
{
DALI_LOG_INFO(gLogFilter, Debug::Verbose, " Atlas [%i] %sPixels: %s Size: %ix%i, BlockSize: %ix%i, BlocksUsed: %i/%i\n", i + 1, i > 8 ? "" : " ", metrics.mAtlasMetrics.mAtlasMetrics[i].mPixelFormat == Pixel::L8 ? "L8 " : "BGRA", metrics.mAtlasMetrics.mAtlasMetrics[i].mSize.mWidth, metrics.mAtlasMetrics.mAtlasMetrics[i].mSize.mHeight, metrics.mAtlasMetrics.mAtlasMetrics[i].mSize.mBlockWidth, metrics.mAtlasMetrics.mAtlasMetrics[i].mSize.mBlockHeight, metrics.mAtlasMetrics.mAtlasMetrics[i].mBlocksUsed, metrics.mAtlasMetrics.mAtlasMetrics[i].mTotalBlocks);
}
const int32_t xOffset = data.horizontalOffset + position->x;
// Whether the given glyph is a color one.
- const bool isColorGlyph = data.glyphBitmap.isColorEmoji || data.glyphBitmap.isColorBitmap;
- const uint32_t glyphPixelSize = Pixel::GetBytesPerPixel(data.glyphBitmap.format);
- const uint32_t alphaIndex = glyphPixelSize - 1u;
+ const bool isColorGlyph = data.glyphBitmap.isColorEmoji || data.glyphBitmap.isColorBitmap;
+ const uint32_t glyphPixelSize = Pixel::GetBytesPerPixel(data.glyphBitmap.format);
+ const uint32_t glyphAlphaIndex = glyphPixelSize - 1u;
// Determinate iterator range.
const int32_t lineIndexRangeMin = std::max(0, -yOffset);
if(Pixel::RGBA8888 == pixelFormat)
{
- const bool swapChannelsBR = Pixel::BGRA8888 == data.glyphBitmap.format;
-
uint32_t* bitmapBuffer = reinterpret_cast<uint32_t*>(data.bitmapBuffer.GetBuffer());
+ // Skip basic line.
+ bitmapBuffer += (lineIndexRangeMin + yOffset) * static_cast<int32_t>(data.width);
// Fast-cut if style is MASK or OUTLINE. Outline not shown for color glyph.
// Just overwrite transparent color and return.
{
for(int32_t lineIndex = lineIndexRangeMin; lineIndex < lineIndexRangeMax; ++lineIndex)
{
- const int32_t yOffsetIndex = yOffset + lineIndex;
- const int32_t verticalOffset = yOffsetIndex * data.width;
-
// We can use memset here.
- memset(bitmapBuffer + verticalOffset + xOffset + indexRangeMin, 0, (indexRangeMax - indexRangeMin) * sizeof(uint32_t));
+ memset(bitmapBuffer + xOffset + indexRangeMin, 0, (indexRangeMax - indexRangeMin) * sizeof(uint32_t));
+ bitmapBuffer += data.width;
}
return;
}
+ const bool swapChannelsBR = Pixel::BGRA8888 == data.glyphBitmap.format;
+
// Pointer to the color glyph if there is one.
- const uint32_t* const colorGlyphBuffer = isColorGlyph ? reinterpret_cast<uint32_t*>(data.glyphBitmap.buffer) : NULL;
+ const uint8_t* glyphBuffer = data.glyphBitmap.buffer;
// Precalculate input color's packed result.
uint32_t packedInputColor = 0u;
*(packedInputColorBuffer + 1u) = static_cast<uint8_t>(color->g * 255);
*(packedInputColorBuffer) = static_cast<uint8_t>(color->r * 255);
+ // Skip basic line of glyph.
+ glyphBuffer += (lineIndexRangeMin) * static_cast<int32_t>(data.glyphBitmap.width) * glyphPixelSize;
+
// Traverse the pixels of the glyph line per line.
- for(int32_t lineIndex = lineIndexRangeMin; lineIndex < lineIndexRangeMax; ++lineIndex)
+ if(isColorGlyph)
{
- const int32_t yOffsetIndex = yOffset + lineIndex;
-
- const int32_t verticalOffset = yOffsetIndex * data.width;
- const int32_t glyphBufferOffset = lineIndex * static_cast<int32_t>(data.glyphBitmap.width);
- for(int32_t index = indexRangeMin; index < indexRangeMax; ++index)
+ for(int32_t lineIndex = lineIndexRangeMin; lineIndex < lineIndexRangeMax; ++lineIndex)
{
- const int32_t xOffsetIndex = xOffset + index;
-
- if(isColorGlyph)
+ for(int32_t index = indexRangeMin; index < indexRangeMax; ++index)
{
+ const int32_t xOffsetIndex = xOffset + index;
+
// Retrieves the color from the color glyph.
- uint32_t packedColorGlyph = *(colorGlyphBuffer + glyphBufferOffset + index);
+ uint32_t packedColorGlyph = *(reinterpret_cast<const uint32_t*>(glyphBuffer + (index << 2)));
uint8_t* packedColorGlyphBuffer = reinterpret_cast<uint8_t*>(&packedColorGlyph);
// Update the alpha channel.
}
// Set the color into the final pixel buffer.
- *(bitmapBuffer + verticalOffset + xOffsetIndex) = packedColorGlyph;
+ *(bitmapBuffer + xOffsetIndex) = packedColorGlyph;
}
- else
+ bitmapBuffer += data.width;
+ glyphBuffer += data.glyphBitmap.width * glyphPixelSize;
+ }
+ }
+ else
+ {
+ for(int32_t lineIndex = lineIndexRangeMin; lineIndex < lineIndexRangeMax; ++lineIndex)
+ {
+ for(int32_t index = indexRangeMin; index < indexRangeMax; ++index)
{
- // Pack the given color into a 32bit buffer. The alpha channel will be updated later for each pixel.
- // The format is RGBA8888.
- uint32_t packedColor = 0u;
- uint8_t* packedColorBuffer = reinterpret_cast<uint8_t*>(&packedColor);
-
// Update the alpha channel.
- const uint8_t alpha = *(data.glyphBitmap.buffer + glyphPixelSize * (glyphBufferOffset + index) + alphaIndex);
+ const uint8_t alpha = *(glyphBuffer + index * glyphPixelSize + glyphAlphaIndex);
// Copy non-transparent pixels only
if(alpha > 0u)
{
+ const int32_t xOffsetIndex = xOffset + index;
+
// Check alpha of overlapped pixels
- uint32_t& currentColor = *(bitmapBuffer + verticalOffset + xOffsetIndex);
+ uint32_t& currentColor = *(bitmapBuffer + xOffsetIndex);
uint8_t* packedCurrentColorBuffer = reinterpret_cast<uint8_t*>(¤tColor);
// For any pixel overlapped with the pixel in previous glyphs, make sure we don't
}
else
{
+ // Pack the given color into a 32bit buffer. The alpha channel will be updated later for each pixel.
+ // The format is RGBA8888.
+ uint32_t packedColor = 0u;
+ uint8_t* packedColorBuffer = reinterpret_cast<uint8_t*>(&packedColor);
+
// Color is pre-muliplied with its alpha.
*(packedColorBuffer + 3u) = MultiplyAndNormalizeColor(*(packedInputColorBuffer + 3u), currentAlpha);
*(packedColorBuffer + 2u) = MultiplyAndNormalizeColor(*(packedInputColorBuffer + 2u), currentAlpha);
}
}
}
+ bitmapBuffer += data.width;
+ glyphBuffer += data.glyphBitmap.width * glyphPixelSize;
}
}
}
- else
+ else // Pixel::L8
{
// Below codes required only if not color glyph.
if(!isColorGlyph)
{
- uint8_t* bitmapBuffer = reinterpret_cast<uint8_t*>(data.bitmapBuffer.GetBuffer());
+ uint8_t* bitmapBuffer = data.bitmapBuffer.GetBuffer();
+ const uint8_t* glyphBuffer = data.glyphBitmap.buffer;
+
+ // Skip basic line.
+ bitmapBuffer += (lineIndexRangeMin + yOffset) * static_cast<int32_t>(data.width);
+ glyphBuffer += (lineIndexRangeMin) * static_cast<int32_t>(data.glyphBitmap.width) * glyphPixelSize;
// Traverse the pixels of the glyph line per line.
for(int32_t lineIndex = lineIndexRangeMin; lineIndex < lineIndexRangeMax; ++lineIndex)
{
- const int32_t yOffsetIndex = yOffset + lineIndex;
-
- const int32_t verticalOffset = yOffsetIndex * data.width;
- const int32_t glyphBufferOffset = lineIndex * static_cast<int32_t>(data.glyphBitmap.width);
for(int32_t index = indexRangeMin; index < indexRangeMax; ++index)
{
const int32_t xOffsetIndex = xOffset + index;
// Update the alpha channel.
- const uint8_t alpha = *(data.glyphBitmap.buffer + glyphPixelSize * (glyphBufferOffset + index) + alphaIndex);
+ const uint8_t alpha = *(glyphBuffer + index * glyphPixelSize + glyphAlphaIndex);
// Copy non-transparent pixels only
if(alpha > 0u)
{
// Check alpha of overlapped pixels
- uint8_t& currentAlpha = *(bitmapBuffer + verticalOffset + xOffsetIndex);
+ uint8_t& currentAlpha = *(bitmapBuffer + xOffsetIndex);
// For any pixel overlapped with the pixel in previous glyphs, make sure we don't
// overwrite a previous bigger alpha with a smaller alpha (in order to avoid
currentAlpha = std::max(currentAlpha, alpha);
}
}
+
+ bitmapBuffer += data.width;
+ glyphBuffer += data.glyphBitmap.width * glyphPixelSize;
}
}
}
glyphData.verticalOffset += glyphData.glyphBitmap.outlineOffsetY;
}
- // delete the glyphBitmap.buffer as it is now copied into glyphData.bitmapBuffer
- delete[] glyphData.glyphBitmap.buffer;
+ // free the glyphBitmap.buffer as it is now copied into glyphData.bitmapBuffer
+ free(glyphData.glyphBitmap.buffer);
glyphData.glyphBitmap.buffer = NULL;
}
// Change the 'x' and 'y' position of the ellipsis glyph.
if(position.x > firstPenX)
{
- position.x = firstPenX + removedGlypsWidth - ellipsisGlyphWidth;
+ if(isTailMode)
+ {
+ // To handle case of the mixed languages (LTR then RTL) with
+ // EllipsisPosition::END and the LayoutDirection::RIGHT_TO_LEFT
+ float nextXPositions = ellipsisLine->width;
+ if(indexOfEllipsis + 1u < numberOfGlyphs)
+ {
+ Vector2& positionOfNextGlyph = *(elidedPositionsBuffer + indexOfEllipsis + 1u);
+ nextXPositions = positionOfNextGlyph.x;
+ }
+
+ if(position.x > nextXPositions) // RTL language
+ {
+ if((indexOfEllipsis > 0u) && ((position.x - nextXPositions) > removedGlypsWidth))
+ {
+ // To handle mixed directions
+ // Re-calculates the first penX which will be used if rtl text is elided.
+ firstPenX = position.x - glyphToRemove.xBearing;
+ if(firstPenX < -ellipsisGlyph.xBearing)
+ {
+ // Avoids to exceed the bounding box when rtl text is elided.
+ firstPenX = -ellipsisGlyph.xBearing;
+ }
+ //Reset the width of removed glyphs
+ removedGlypsWidth = std::min(calculatedAdvance, (glyphToRemove.xBearing + glyphToRemove.width)) - ellipsisGlyph.xBearing;
+
+ --indexOfEllipsis;
+ continue;
+ }
+ else
+ {
+ // To handle the case of RTL language with EllipsisPosition::END
+ position.x = firstPenX + removedGlypsWidth - ellipsisGlyphWidth;
+ }
+ }
+ }
+ else
+ {
+ // To handle the case of LTR language with EllipsisPosition::START
+ position.x = firstPenX + removedGlypsWidth - ellipsisGlyphWidth;
+ }
+ }
+ else
+ {
+ if(!isTailMode)
+ {
+ // To handle case of the mixed languages (RTL then LTR) with
+ // EllipsisPosition::START and the LayoutDirection::RIGHT_TO_LEFT
+ float nextXPositions = ellipsisLine->width;
+ if(indexOfEllipsis + 1u < numberOfGlyphs)
+ {
+ Vector2& positionOfNextGlyph = *(elidedPositionsBuffer + indexOfEllipsis + 1u);
+ nextXPositions = positionOfNextGlyph.x;
+ }
+
+ if(position.x < nextXPositions) // LTR language
+ {
+ position.x = firstPenX + removedGlypsWidth - ellipsisGlyphWidth;
+
+ if((position.x + ellipsisGlyphWidth + ellipsisGlyph.xBearing) > nextXPositions)
+ {
+ position.x -= (position.x + ellipsisGlyphWidth + ellipsisGlyph.xBearing) - nextXPositions;
+ }
+ }
+ }
}
position.x += ellipsisGlyph.xBearing;
{
namespace Text
{
-const float DEFAULT_TEXTFIT_MIN = 10.f;
-const float DEFAULT_TEXTFIT_MAX = 100.f;
-const float DEFAULT_TEXTFIT_STEP = 1.f;
-const float DEFAULT_FONT_SIZE_SCALE = 1.f;
+const float DEFAULT_TEXTFIT_MIN = 10.f;
+const float DEFAULT_TEXTFIT_MAX = 100.f;
+const float DEFAULT_TEXTFIT_STEP = 1.f;
+const float DEFAULT_FONT_SIZE_SCALE = 1.f;
const float DEFAULT_DISABLED_COLOR_OPACITY = 0.3f;
//Forward declarations
mMarkupProcessorEnabled(false),
mClipboardHideEnabled(true),
mIsAutoScrollEnabled(false),
+ mIsAutoScrollMaxTextureExceeded(false),
mUpdateTextDirection(true),
mIsTextDirectionRTL(false),
mUnderlineSetByString(false),
Toolkit::StyleManager styleManager = Toolkit::StyleManager::Get();
if(styleManager)
{
- bool temp;
- Property::Map config = Toolkit::DevelStyleManager::GetConfigurations(styleManager);
- if(config["clearFocusOnEscape"].Get(temp))
- {
- mShouldClearFocusOnEscape = temp;
- }
+ const Property::Map& config = Toolkit::DevelStyleManager::GetConfigurations(styleManager);
+ const auto clearFocusOnEscapeValue = config.Find("clearFocusOnEscape", Property::Type::BOOLEAN);
+
+ // Default is true. If config don't have "clearFocusOnEscape" property, make it true.
+ mShouldClearFocusOnEscape = (!clearFocusOnEscapeValue || clearFocusOnEscapeValue->Get<bool>());
}
}
std::unique_ptr<InputFilter> mInputFilter; ///< Avoid allocating this when the user does not specify input filter mode.
Vector2 mTextFitContentSize; ///< Size of Text fit content
- bool mRecalculateNaturalSize : 1; ///< Whether the natural size needs to be recalculated.
- bool mMarkupProcessorEnabled : 1; ///< Whether the mark-up procesor is enabled.
- bool mClipboardHideEnabled : 1; ///< Whether the ClipboardHide function work or not
- bool mIsAutoScrollEnabled : 1; ///< Whether auto text scrolling is enabled.
- bool mUpdateTextDirection : 1; ///< Whether the text direction needs to be updated.
- CharacterDirection mIsTextDirectionRTL : 1; ///< Whether the text direction is right to left or not
+ bool mRecalculateNaturalSize : 1; ///< Whether the natural size needs to be recalculated.
+ bool mMarkupProcessorEnabled : 1; ///< Whether the mark-up procesor is enabled.
+ bool mClipboardHideEnabled : 1; ///< Whether the ClipboardHide function work or not
+ bool mIsAutoScrollEnabled : 1; ///< Whether auto text scrolling is enabled.
+ bool mIsAutoScrollMaxTextureExceeded : 1; ///< Whether auto text scrolling is exceed max texture size.
+ bool mUpdateTextDirection : 1; ///< Whether the text direction needs to be updated.
+ CharacterDirection mIsTextDirectionRTL : 1; ///< Whether the text direction is right to left or not
bool mUnderlineSetByString : 1; ///< Set when underline is set by string (legacy) instead of map
bool mShadowSetByString : 1; ///< Set when shadow is set by string (legacy) instead of map
SHAPE_TEXT |
GET_GLYPH_METRICS);
- const OperationsMask sizeOperations = static_cast<OperationsMask>(LAYOUT | ALIGN | REORDER);
+ const OperationsMask sizeOperations = static_cast<OperationsMask>(LAYOUT | ALIGN | REORDER);
// Set the update info to relayout the whole text.
TextUpdateInfo& textUpdateInfo = impl.mTextUpdateInfo;
{
impl.UpdateModel(onlyOnceOperations);
+ if(impl.mIsAutoScrollEnabled)
+ {
+ // Layout the text for the new width.
+ operationsPending = static_cast<OperationsMask>(operationsPending | requestedOperationsMask);
+ }
+
DoRelayout(impl,
requestedControllerSize,
static_cast<OperationsMask>(onlyOnceOperations | requestedOperationsMask),
}
// Update the visual model.
- bool isAutoScrollEnabled = impl.mIsAutoScrollEnabled;
+ bool isAutoScrollEnabled = impl.mIsAutoScrollEnabled;
+ bool isAutoScrollMaxTextureExceeded = impl.mIsAutoScrollMaxTextureExceeded;
+
Size newLayoutSize;
viewUpdated = impl.mLayoutEngine.LayoutText(layoutParameters,
newLayoutSize,
elideTextEnabled,
isAutoScrollEnabled,
+ isAutoScrollMaxTextureExceeded,
ellipsisPosition);
impl.mIsAutoScrollEnabled = isAutoScrollEnabled;
void Controller::Relayouter::CalculateVerticalOffset(Controller::Impl& impl, const Size& controlSize)
{
- ModelPtr& model = impl.mModel;
- VisualModelPtr& visualModel = model->mVisualModel;
- Size layoutSize = model->mVisualModel->GetLayoutSize();
- Size oldLayoutSize = layoutSize;
- float offsetY = 0.f;
- bool needRecalc = false;
- float defaultFontLineHeight = impl.GetDefaultFontLineHeight();
+ ModelPtr& model = impl.mModel;
+ VisualModelPtr& visualModel = model->mVisualModel;
+ Size layoutSize = model->mVisualModel->GetLayoutSize();
+ Size oldLayoutSize = layoutSize;
+ float offsetY = 0.f;
+ bool needRecalc = false;
+ float defaultFontLineHeight = impl.GetDefaultFontLineHeight();
if(fabsf(layoutSize.height) < Math::MACHINE_EPSILON_1000)
{
mImpl->SetAutoScrollEnabled(enable);
}
+void Controller::SetAutoScrollMaxTextureExceeded(bool exceed)
+{
+ mImpl->mIsAutoScrollMaxTextureExceeded = exceed;
+}
+
bool Controller::IsAutoScrollEnabled() const
{
DALI_LOG_INFO(gLogFilter, Debug::Verbose, "Controller::IsAutoScrollEnabled[%s]\n", mImpl->mIsAutoScrollEnabled ? "true" : "false");
void SetAutoScrollEnabled(bool enable);
/**
+ * @brief Whether the auto scrolling texture exceed max texture.
+ *
+ * By default is false.
+ *
+ * @param[in] exceed Whether the auto scrolling texture exceed max texture.
+ */
+ void SetAutoScrollMaxTextureExceeded(bool exceed);
+
+ /**
* @brief Retrieves whether auto text scrolling is enabled.
*
* By default is disabled.
glyphInfo = ellipsisGlyph;
// Change the 'x' and 'y' position of the ellipsis glyph.
-
if(position.x > firstPenX)
{
- position.x = firstPenX + removedGlypsWidth - ellipsisGlyphWidth;
+ if(isTailMode)
+ {
+ // To handle case of the mixed languages (LTR then RTL) with
+ // EllipsisPosition::END and the LayoutDirection::RIGHT_TO_LEFT
+ float nextXPositions = ellipsisLine->width;
+ if(indexOfEllipsis + 1u < numberOfGlyphs)
+ {
+ Vector2& positionOfNextGlyph = *(glyphPositions + indexOfEllipsis + 1u);
+ nextXPositions = positionOfNextGlyph.x;
+ }
+
+ if(position.x > nextXPositions) // RTL language
+ {
+ if((indexOfEllipsis > 0u) && ((position.x - nextXPositions) > removedGlypsWidth))
+ {
+ // To handle mixed directions
+ // Re-calculates the first penX which will be used if rtl text is elided.
+ firstPenX = position.x - glyphToRemove.xBearing;
+ if(firstPenX < -ellipsisGlyph.xBearing)
+ {
+ // Avoids to exceed the bounding box when rtl text is elided.
+ firstPenX = -ellipsisGlyph.xBearing;
+ }
+ //Reset the width of removed glyphs
+ removedGlypsWidth = std::min(calculatedAdvance, (glyphToRemove.xBearing + glyphToRemove.width)) - ellipsisGlyph.xBearing;
+
+ --indexOfEllipsis;
+ continue;
+ }
+ else
+ {
+ // To handle the case of RTL language with EllipsisPosition::END
+ position.x = firstPenX + removedGlypsWidth - ellipsisGlyphWidth;
+ }
+ }
+ }
+ else
+ {
+ // To handle the case of LTR language with EllipsisPosition::START
+ position.x = firstPenX + removedGlypsWidth - ellipsisGlyphWidth;
+ }
+ }
+ else
+ {
+ if(!isTailMode)
+ {
+ // To handle case of the mixed languages (RTL then LTR) with
+ // EllipsisPosition::START and the LayoutDirection::RIGHT_TO_LEFT
+ float nextXPositions = ellipsisLine->width;
+ if(indexOfEllipsis + 1u < numberOfGlyphs)
+ {
+ Vector2& positionOfNextGlyph = *(glyphPositions + indexOfEllipsis + 1u);
+ nextXPositions = positionOfNextGlyph.x;
+ }
+
+ if(position.x < nextXPositions) // LTR language
+ {
+ position.x = firstPenX + removedGlypsWidth - ellipsisGlyphWidth;
+
+ if((position.x + ellipsisGlyphWidth + ellipsisGlyph.xBearing) > nextXPositions)
+ {
+ position.x -= (position.x + ellipsisGlyphWidth + ellipsisGlyph.xBearing) - nextXPositions;
+ }
+ }
+ }
}
position.x += ellipsisGlyph.xBearing;
// EXTERNAL INCLUDES
#include <dali/devel-api/adaptor-framework/image-loading.h>
#include <dali/integration-api/debug.h>
+#include <dali/public-api/rendering/decorated-visual-renderer.h>
#include <memory>
// INTERNAL INCLUDES
{
namespace
{
-const int CUSTOM_PROPERTY_COUNT(10); // ltr, wrap, pixel area, crop to mask, mask texture ratio + border/corner
+const int CUSTOM_PROPERTY_COUNT(5); // ltr, wrap, pixel area, crop to mask, mask texture ratio
// stop behavior
DALI_ENUM_TO_STRING_TABLE_BEGIN(STOP_BEHAVIOR)
if(mAnimatedImageLoading)
{
- mImageCache = new RollingAnimatedImageCache(textureManager, mAnimatedImageLoading, mMaskingData, *this, mCacheSize, mBatchSize, IsSynchronousLoadingRequired(),mFactoryCache.GetPreMultiplyOnLoad());
+ mImageCache = new RollingAnimatedImageCache(textureManager, mAnimatedImageLoading, mMaskingData, *this, mCacheSize, mBatchSize, IsSynchronousLoadingRequired(), mFactoryCache.GetPreMultiplyOnLoad());
}
else if(mImageUrls)
{
Geometry geometry = mFactoryCache.GetGeometry(VisualFactoryCache::QUAD_GEOMETRY);
- mImpl->mRenderer = VisualRenderer::New(geometry, shader);
+ mImpl->mRenderer = DecoratedVisualRenderer::New(geometry, shader);
mImpl->mRenderer.ReserveCustomProperties(CUSTOM_PROPERTY_COUNT);
// Register transform properties
{
if(mMaskingData && !mMaskingData->mPreappliedMasking)
{
- bool maskLoadFailed = true;
- TextureSet textures = mImpl->mRenderer.GetTextures();
+ bool maskLoadFailed = true;
+ TextureSet textures = mImpl->mRenderer.GetTextures();
if(textures && textures.GetTextureCount() >= TEXTURE_COUNT_FOR_GPU_ALPHA_MASK)
{
maskLoadFailed = false;
Debug::Filter* gAnimImgLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_ANIMATED_IMAGE");
#define LOG_CACHE \
+ if(gAnimImgLogFilter->IsEnabledFor(Debug::Concise)) \
{ \
std::ostringstream oss; \
oss << "Size:" << mQueue.Count() << " [ "; \
mLoadState = TextureManager::LoadState::LOADING;
auto preMultiplyOnLoading = mPreMultiplyOnLoad ? TextureManager::MultiplyOnLoad::MULTIPLY_ON_LOAD
- : TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
+ : TextureManager::MultiplyOnLoad::LOAD_WITHOUT_MULTIPLY;
TextureManager::TextureId loadTextureId = TextureManager::INVALID_TEXTURE_ID;
TextureSet textureSet = mTextureManager.LoadAnimatedImageTexture(mImageUrl,
Debug::Filter* gAnimImgLogFilter = Debug::Filter::New(Debug::NoLogging, false, "LOG_ANIMATED_IMAGE");
#define LOG_CACHE \
+ if(gAnimImgLogFilter->IsEnabledFor(Debug::Concise)) \
{ \
std::ostringstream oss; \
oss << "Size:" << mQueue.Count() << " [ "; \
#include <dali/devel-api/common/stage.h>
#include <dali/devel-api/rendering/renderer-devel.h>
#include <dali/integration-api/debug.h>
+#include <dali/public-api/rendering/decorated-visual-renderer.h>
// INTERNAL INCLUDES
#include <dali-toolkit/devel-api/visuals/animated-vector-image-visual-signals-devel.h>
{
namespace
{
-const int CUSTOM_PROPERTY_COUNT(6); // 5 transform properties + pixel area,
+const int CUSTOM_PROPERTY_COUNT(1); // pixel area,
const Dali::Vector4 FULL_TEXTURE_RECT(0.f, 0.f, 1.f, 1.f);
Geometry geometry = mFactoryCache.GetGeometry(VisualFactoryCache::QUAD_GEOMETRY);
- mImpl->mRenderer = VisualRenderer::New(geometry, shader);
+ mImpl->mRenderer = DecoratedVisualRenderer::New(geometry, shader);
mImpl->mRenderer.ReserveCustomProperties(CUSTOM_PROPERTY_COUNT);
TextureSet textureSet = TextureSet::New();
// EXTERNAL INCLUDES
#include <dali/devel-api/rendering/renderer-devel.h>
#include <dali/integration-api/debug.h>
+#include <dali/public-api/rendering/decorated-visual-renderer.h>
//INTERNAL INCLUDES
#include <dali-toolkit/devel-api/visuals/color-visual-properties-devel.h>
{
namespace
{
-const int CUSTOM_PROPERTY_COUNT(6); // Blur Radius + border/corner
+const int CUSTOM_PROPERTY_COUNT(0);
VisualFactoryCache::ShaderType SHADER_TYPE_TABLE[6] =
{
ColorVisual::ColorVisual(VisualFactoryCache& factoryCache)
: Visual::Base(factoryCache, Visual::FittingMode::FILL, Toolkit::Visual::COLOR),
mBlurRadius(0.0f),
- mBlurRadiusIndex(Property::INVALID_INDEX),
mAlwaysUsingBlurRadius(false)
{
}
DALI_LOG_ERROR("ColorVisual:DoSetProperties:: BLUR_RADIUS property has incorrect type: %d\n", blurRadiusValue->GetType());
}
- if(mBlurRadiusIndex != Property::INVALID_INDEX)
- {
- mImpl->mRenderer.SetProperty(mBlurRadiusIndex, mBlurRadius);
- }
- else if(DALI_UNLIKELY(mImpl->mRenderer && (!EqualsZero(mBlurRadius) || mAlwaysUsingBlurRadius)))
+ if(DALI_UNLIKELY(mImpl->mRenderer))
{
// Unusual case. SetProperty called after OnInitialize().
// Assume that DoAction call UPDATE_PROPERTY.
- // We must regist properies into renderer, and update shader.
-
- // BlurRadius added by this action. Regist property to renderer.
- mBlurRadiusIndex = mImpl->mRenderer.RegisterUniqueProperty(DevelColorVisual::Property::BLUR_RADIUS, BLUR_RADIUS_NAME, mBlurRadius);
- mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
+ DownCast<DecoratedVisualRenderer>(mImpl->mRenderer).RegisterBlurRadiusUniform();
+ mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BLUR_RADIUS, mBlurRadius);
- // Change the shader must not be occured many times. we always have to use blur feature.
- mAlwaysUsingBlurRadius = true;
-
- // Change shader
- UpdateShader();
+ // Check whether we must update shader.
+ if(!mAlwaysUsingBlurRadius && IsBlurRequired())
+ {
+ // Change the shader must not be occured many times. we always have to use blur feature.
+ mAlwaysUsingBlurRadius = true;
+
+ mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
+ // Change shader
+ if(!mImpl->mCustomShader)
+ {
+ UpdateShader();
+ }
+ }
}
}
}
map.Insert(Toolkit::Visual::Property::TYPE, Toolkit::Visual::COLOR);
map.Insert(Toolkit::ColorVisual::Property::MIX_COLOR, mImpl->mMixColor);
- if(mImpl->mRenderer && mBlurRadiusIndex != Property::INVALID_INDEX)
+ if(mImpl->mRenderer)
{
// Update values from Renderer
- float blurRadius = mImpl->mRenderer.GetProperty<float>(mBlurRadiusIndex);
+ float blurRadius = mImpl->mRenderer.GetProperty<float>(DecoratedVisualRenderer::Property::BLUR_RADIUS);
map.Insert(Toolkit::DevelColorVisual::Property::BLUR_RADIUS, blurRadius);
}
else
Shader shader = GenerateShader();
- mImpl->mRenderer = VisualRenderer::New(geometry, shader);
+ mImpl->mRenderer = DecoratedVisualRenderer::New(geometry, shader);
mImpl->mRenderer.ReserveCustomProperties(CUSTOM_PROPERTY_COUNT);
mImpl->mRenderer.SetProperty(VisualRenderer::Property::VISUAL_MIX_COLOR, Vector3(mImpl->mMixColor));
- if(!EqualsZero(mBlurRadius))
+ if(mAlwaysUsingBlurRadius || !EqualsZero(mBlurRadius))
{
- mBlurRadiusIndex = mImpl->mRenderer.RegisterUniqueProperty(DevelColorVisual::Property::BLUR_RADIUS, BLUR_RADIUS_NAME, mBlurRadius);
+ DownCast<DecoratedVisualRenderer>(mImpl->mRenderer).RegisterBlurRadiusUniform();
+ mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BLUR_RADIUS, mBlurRadius);
mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
}
bool roundedCorner = IsRoundedCornerRequired();
bool borderline = IsBorderlineRequired();
- bool blur = !EqualsZero(mBlurRadius) || mAlwaysUsingBlurRadius;
+ bool blur = IsBlurRequired();
int shaderTypeFlag = ColorVisualRequireFlag::DEFAULT;
if(roundedCorner)
std::string fragmentShaderPrefixList;
if(roundedCorner)
{
- vertexShaderPrefixList += "#define IS_REQUIRED_ROUNDED_CORNER 1\n";
- fragmentShaderPrefixList += "#define IS_REQUIRED_ROUNDED_CORNER 1\n";
+ vertexShaderPrefixList += "#define IS_REQUIRED_ROUNDED_CORNER\n";
+ fragmentShaderPrefixList += "#define IS_REQUIRED_ROUNDED_CORNER\n";
}
if(blur)
{
- vertexShaderPrefixList += "#define IS_REQUIRED_BLUR 1\n";
- fragmentShaderPrefixList += "#define IS_REQUIRED_BLUR 1\n";
+ vertexShaderPrefixList += "#define IS_REQUIRED_BLUR\n";
+ fragmentShaderPrefixList += "#define IS_REQUIRED_BLUR\n";
}
if(borderline)
{
- vertexShaderPrefixList += "#define IS_REQUIRED_BORDERLINE 1\n";
- fragmentShaderPrefixList += "#define IS_REQUIRED_BORDERLINE 1\n";
+ vertexShaderPrefixList += "#define IS_REQUIRED_BORDERLINE\n";
+ fragmentShaderPrefixList += "#define IS_REQUIRED_BORDERLINE\n";
}
shader = Shader::New(Dali::Shader::GetVertexShaderPrefix() + vertexShaderPrefixList + SHADER_COLOR_VISUAL_SHADER_VERT.data(),
Dali::Shader::GetFragmentShaderPrefix() + fragmentShaderPrefixList + SHADER_COLOR_VISUAL_SHADER_FRAG.data());
if((key.type == Property::Key::INDEX && key.indexKey == DevelColorVisual::Property::BLUR_RADIUS) || (key.type == Property::Key::STRING && key.stringKey == BLUR_RADIUS_NAME))
{
- mBlurRadiusIndex = mImpl->mRenderer.RegisterProperty(DevelColorVisual::Property::BLUR_RADIUS, BLUR_RADIUS_NAME, mBlurRadius);
+ const bool updateShader = !mImpl->mCustomShader && !IsBlurRequired();
// Blur is animated now. we always have to use blur feature.
mAlwaysUsingBlurRadius = true;
- mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
-
- // Change shader
- UpdateShader();
+ if(updateShader)
+ {
+ // Update each values to renderer
+ DownCast<DecoratedVisualRenderer>(mImpl->mRenderer).RegisterBlurRadiusUniform();
+ mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BLUR_RADIUS, mBlurRadius);
- return Dali::Property(mImpl->mRenderer, mBlurRadiusIndex);
+ // Change shader
+ UpdateShader();
+ }
+ mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
+ return Dali::Property(mImpl->mRenderer, DecoratedVisualRenderer::Property::BLUR_RADIUS);
}
Handle handle;
return Dali::Property(handle, Property::INVALID_INDEX);
}
+bool ColorVisual::IsBlurRequired() const
+{
+ float blurRadius = mBlurRadius;
+ if(mImpl->mRenderer)
+ {
+ // Update values from Renderer
+ blurRadius = mImpl->mRenderer.GetProperty<float>(DecoratedVisualRenderer::Property::BLUR_RADIUS);
+ }
+ return mAlwaysUsingBlurRadius || !EqualsZero(blurRadius);
+}
+
} // namespace Internal
} // namespace Toolkit
*/
Dali::Property OnGetPropertyObject(Dali::Property::Key key) override;
+protected:
+ /**
+ * @brief Query whether the visual requires to be blur.
+ *
+ * @return Returns true if the blur is required, false otherwise.
+ */
+ bool IsBlurRequired() const;
+
private:
// Undefined
ColorVisual(const ColorVisual& colorRenderer);
ColorVisual& operator=(const ColorVisual& colorRenderer);
private:
- float mBlurRadius; ///< The blur radius
- Property::Index mBlurRadiusIndex; ///< The blur radius property index
- bool mAlwaysUsingBlurRadius : 1; ///< Whether we need the blur radius in shader always.
+ float mBlurRadius; ///< The blur radius
+ bool mAlwaysUsingBlurRadius : 1; ///< Whether we need the blur radius in shader always.
};
} // namespace Internal
#include <dali/integration-api/debug.h>
#include <dali/public-api/common/dali-vector.h>
#include <dali/public-api/object/property-array.h>
+#include <dali/public-api/rendering/decorated-visual-renderer.h>
#include <typeinfo>
// INTERNAL INCLUDES
{
namespace
{
-const int CUSTOM_PROPERTY_COUNT(6); // alignment + corner/border
+const int CUSTOM_PROPERTY_COUNT(1); // alignment
DALI_ENUM_TO_STRING_TABLE_BEGIN(UNITS)
DALI_ENUM_TO_STRING_WITH_SCOPE(Toolkit::GradientVisual::Units, OBJECT_BOUNDING_BOX)
sampler.SetWrapMode(wrap, wrap);
textureSet.SetSampler(0u, sampler);
- mImpl->mRenderer = VisualRenderer::New(geometry, shader);
+ mImpl->mRenderer = DecoratedVisualRenderer::New(geometry, shader);
mImpl->mRenderer.ReserveCustomProperties(CUSTOM_PROPERTY_COUNT);
mImpl->mRenderer.SetTextures(textureSet);
if(roundedCorner)
{
- vertexShaderPrefixList += "#define IS_REQUIRED_ROUNDED_CORNER 1\n";
- fragmentShaderPrefixList += "#define IS_REQUIRED_ROUNDED_CORNER 1\n";
+ vertexShaderPrefixList += "#define IS_REQUIRED_ROUNDED_CORNER\n";
+ fragmentShaderPrefixList += "#define IS_REQUIRED_ROUNDED_CORNER\n";
}
if(borderline)
{
- vertexShaderPrefixList += "#define IS_REQUIRED_BORDERLINE 1\n";
- fragmentShaderPrefixList += "#define IS_REQUIRED_BORDERLINE 1\n";
+ vertexShaderPrefixList += "#define IS_REQUIRED_BORDERLINE\n";
+ fragmentShaderPrefixList += "#define IS_REQUIRED_BORDERLINE\n";
}
if(radialGradient)
{
- fragmentShaderPrefixList += "#define RADIAL 1\n";
+ fragmentShaderPrefixList += "#define RADIAL\n";
}
if(userspaceUnit)
{
- vertexShaderPrefixList += "#define USER_SPACE 1\n";
+ vertexShaderPrefixList += "#define USER_SPACE\n";
}
shader = Shader::New(Dali::Shader::GetVertexShaderPrefix() + vertexShaderPrefixList + SHADER_GRADIENT_VISUAL_SHADER_VERT.data(),
/*
- * Copyright (c) 2021 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2022 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.
ALPHA_MASKING = 1 << 2,
};
-static constexpr auto SHADER_TYPE_COUNT = 8u;
+static constexpr auto SHADER_TYPE_COUNT = 8u;
VisualFactoryCache::ShaderType SHADER_TYPE_TABLE[SHADER_TYPE_COUNT] =
-{
- VisualFactoryCache::IMAGE_SHADER,
- VisualFactoryCache::IMAGE_SHADER_ROUNDED_CORNER,
- VisualFactoryCache::IMAGE_SHADER_BORDERLINE,
- VisualFactoryCache::IMAGE_SHADER_ROUNDED_BORDERLINE,
- VisualFactoryCache::IMAGE_SHADER_MASKING,
- VisualFactoryCache::IMAGE_SHADER_ROUNDED_CORNER_MASKING,
- VisualFactoryCache::IMAGE_SHADER_BORDERLINE_MASKING,
- VisualFactoryCache::IMAGE_SHADER_ROUNDED_BORDERLINE_MASKING
-};
+ {
+ VisualFactoryCache::IMAGE_SHADER,
+ VisualFactoryCache::IMAGE_SHADER_ROUNDED_CORNER,
+ VisualFactoryCache::IMAGE_SHADER_BORDERLINE,
+ VisualFactoryCache::IMAGE_SHADER_ROUNDED_BORDERLINE,
+ VisualFactoryCache::IMAGE_SHADER_MASKING,
+ VisualFactoryCache::IMAGE_SHADER_ROUNDED_CORNER_MASKING,
+ VisualFactoryCache::IMAGE_SHADER_BORDERLINE_MASKING,
+ VisualFactoryCache::IMAGE_SHADER_ROUNDED_BORDERLINE_MASKING};
} // unnamed namespace
Shader ImageVisualShaderFactory::GetShader(VisualFactoryCache& factoryCache, const ImageVisualShaderFeature::FeatureBuilder& featureBuilder)
{
- Shader shader;
+ Shader shader;
VisualFactoryCache::ShaderType shaderType = VisualFactoryCache::IMAGE_SHADER;
const auto& atlasing = featureBuilder.mTextureAtlas;
const auto& borderline = featureBuilder.mBorderline;
const auto& alphaMaskingOnRendering = featureBuilder.mAlphaMaskingOnRendering;
const auto& changeFragmentShader = (featureBuilder.mTexture && DevelTexture::IsNative(featureBuilder.mTexture))
- ? ImageVisualShaderFeature::ChangeFragmentShader::NEED_CHANGE
- : ImageVisualShaderFeature::ChangeFragmentShader::DONT_CHANGE;
+ ? ImageVisualShaderFeature::ChangeFragmentShader::NEED_CHANGE
+ : ImageVisualShaderFeature::ChangeFragmentShader::DONT_CHANGE;
if(atlasing == ImageVisualShaderFeature::TextureAtlas::ENABLED)
{
{
if(defaultTextureWrapping == ImageVisualShaderFeature::DefaultTextureWrapMode::APPLY)
{
- fragmentShaderPrefixList += "#define ATLAS_DEFAULT_WARP 1\n";
+ fragmentShaderPrefixList += "#define ATLAS_DEFAULT_WARP\n";
}
else
{
- fragmentShaderPrefixList += "#define ATLAS_CUSTOM_WARP 1\n";
+ fragmentShaderPrefixList += "#define ATLAS_CUSTOM_WARP\n";
}
}
else
{
if(roundedCorner == ImageVisualShaderFeature::RoundedCorner::ENABLED)
{
- vertexShaderPrefixList += "#define IS_REQUIRED_ROUNDED_CORNER 1\n";
- fragmentShaderPrefixList += "#define IS_REQUIRED_ROUNDED_CORNER 1\n";
+ vertexShaderPrefixList += "#define IS_REQUIRED_ROUNDED_CORNER\n";
+ fragmentShaderPrefixList += "#define IS_REQUIRED_ROUNDED_CORNER\n";
}
if(borderline == ImageVisualShaderFeature::Borderline::ENABLED)
{
- vertexShaderPrefixList += "#define IS_REQUIRED_BORDERLINE 1\n";
- fragmentShaderPrefixList += "#define IS_REQUIRED_BORDERLINE 1\n";
+ vertexShaderPrefixList += "#define IS_REQUIRED_BORDERLINE\n";
+ fragmentShaderPrefixList += "#define IS_REQUIRED_BORDERLINE\n";
}
if(alphaMaskingOnRendering == ImageVisualShaderFeature::AlphaMaskingOnRendering::ENABLED)
{
- vertexShaderPrefixList += "#define IS_REQUIRED_ALPHA_MASKING 1\n";
- fragmentShaderPrefixList += "#define IS_REQUIRED_ALPHA_MASKING 1\n";
+ vertexShaderPrefixList += "#define IS_REQUIRED_ALPHA_MASKING\n";
+ fragmentShaderPrefixList += "#define IS_REQUIRED_ALPHA_MASKING\n";
}
}
- std::string vertexShader = std::string(Dali::Shader::GetVertexShaderPrefix() + vertexShaderPrefixList + SHADER_IMAGE_VISUAL_SHADER_VERT.data());
+ std::string vertexShader = std::string(Dali::Shader::GetVertexShaderPrefix() + vertexShaderPrefixList + SHADER_IMAGE_VISUAL_SHADER_VERT.data());
std::string fragmentShader = std::string(Dali::Shader::GetFragmentShaderPrefix() + fragmentShaderPrefixList + SHADER_IMAGE_VISUAL_SHADER_FRAG.data());
if(changeFragmentShader == ImageVisualShaderFeature::ChangeFragmentShader::NEED_CHANGE)
#include <dali/devel-api/scripting/scripting.h>
#include <dali/integration-api/debug.h>
#include <dali/public-api/actors/layer.h>
+#include <dali/public-api/rendering/decorated-visual-renderer.h>
#include <cstring> // for strlen()
// INTERNAL HEADERS
{
namespace
{
-const int CUSTOM_PROPERTY_COUNT(12); // ltr, wrap, pixel area, atlas, pixalign, crop to mask, mask texture ratio + border/corner
+const int CUSTOM_PROPERTY_COUNT(7); // ltr, wrap, pixel area, atlas, pixalign, crop to mask, mask texture ratio
// fitting modes
DALI_ENUM_TO_STRING_TABLE_BEGIN(FITTING_MODE)
Shader shader = GenerateShader();
// Create the renderer
- mImpl->mRenderer = VisualRenderer::New(geometry, shader);
+ mImpl->mRenderer = DecoratedVisualRenderer::New(geometry, shader);
mImpl->mRenderer.ReserveCustomProperties(CUSTOM_PROPERTY_COUNT);
//Register transform properties
if(useStandardShader)
{
- bool requiredAlphaMaskingOnRendering = (mMaskingData && !mMaskingData->mMaskImageLoadingFailed) ? !mMaskingData->mPreappliedMasking : false;
+ bool requiredAlphaMaskingOnRendering = (mMaskingData && !mMaskingData->mMaskImageLoadingFailed) ? !mMaskingData->mPreappliedMasking : false;
// Create and cache the standard shader
shader = mImageVisualShaderFactory.GetShader(
mFactoryCache,
{
if(mMaskingData && !mMaskingData->mPreappliedMasking)
{
- bool maskLoadFailed = true;
- TextureSet textures = mImpl->mRenderer.GetTextures();
+ bool maskLoadFailed = true;
+ TextureSet textures = mImpl->mRenderer.GetTextures();
if(textures && textures.GetTextureCount() >= TEXTURE_COUNT_FOR_GPU_ALPHA_MASK)
{
if(mMaskingData->mCropToMask)
// EXTERNAL INCLUDES
#include <dali/devel-api/common/stage.h>
#include <dali/integration-api/debug.h>
+#include <dali/public-api/rendering/decorated-visual-renderer.h>
namespace Dali
{
{
namespace
{
-const int CUSTOM_PROPERTY_COUNT(6); // atlas + corner/border
+const int CUSTOM_PROPERTY_COUNT(1); // atlas
// property name
const Dali::Vector4 FULL_TEXTURE_RECT(0.f, 0.f, 1.f, 1.f);
{
Shader shader = GenerateShader();
Geometry geometry = mFactoryCache.GetGeometry(VisualFactoryCache::QUAD_GEOMETRY);
- mImpl->mRenderer = VisualRenderer::New(geometry, shader);
+ mImpl->mRenderer = DecoratedVisualRenderer::New(geometry, shader);
mImpl->mRenderer.ReserveCustomProperties(CUSTOM_PROPERTY_COUNT);
Vector2 dpi = Stage::GetCurrent().GetDpi();
mCornerRadius(Vector4::ZERO),
mCornerRadiusPolicy(1.0f),
mDepthIndex(0.0f),
- mBorderlineWidthIndex(Property::INVALID_INDEX),
- mBorderlineColorIndex(Property::INVALID_INDEX),
- mBorderlineOffsetIndex(Property::INVALID_INDEX),
- mCornerRadiusIndex(Property::INVALID_INDEX),
mFittingMode(fittingMode),
mFlags(0),
mResourceStatus(Toolkit::Visual::ResourceStatus::PREPARING),
Vector4 mCornerRadius;
float mCornerRadiusPolicy;
int mDepthIndex;
- Property::Index mBorderlineWidthIndex;
- Property::Index mBorderlineColorIndex;
- Property::Index mBorderlineOffsetIndex;
- Property::Index mCornerRadiusIndex;
FittingMode mFittingMode; ///< How the contents should fit the view
int mFlags;
Toolkit::Visual::ResourceStatus mResourceStatus;
#include <dali/devel-api/rendering/renderer-devel.h>
#include <dali/devel-api/scripting/enum-helper.h>
#include <dali/integration-api/debug.h>
+#include <dali/public-api/rendering/decorated-visual-renderer.h>
#include <dali/public-api/rendering/visual-renderer.h>
//INTERNAL HEARDER
if(mImpl->mRenderer)
{
RegisterMixColor();
+ RegisterDecoration();
- if(IsRoundedCornerRequired())
- {
- mImpl->mCornerRadiusIndex = mImpl->mRenderer.RegisterUniqueProperty(DevelVisual::Property::CORNER_RADIUS, CORNER_RADIUS, mImpl->mCornerRadius);
- mImpl->mRenderer.RegisterUniqueProperty(CORNER_RADIUS_POLICY, mImpl->mCornerRadiusPolicy);
-
- mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
- }
if(IsBorderlineRequired())
{
- mImpl->mBorderlineWidthIndex = mImpl->mRenderer.RegisterUniqueProperty(DevelVisual::Property::BORDERLINE_WIDTH, BORDERLINE_WIDTH, mImpl->mBorderlineWidth);
- mImpl->mBorderlineColorIndex = mImpl->mRenderer.RegisterUniqueProperty(DevelVisual::Property::BORDERLINE_COLOR, BORDERLINE_COLOR, mImpl->mBorderlineColor);
- mImpl->mBorderlineOffsetIndex = mImpl->mRenderer.RegisterUniqueProperty(DevelVisual::Property::BORDERLINE_OFFSET, BORDERLINE_OFFSET, mImpl->mBorderlineOffset);
-
mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON_WITHOUT_CULL);
}
+ else if(IsRoundedCornerRequired())
+ {
+ mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
+ }
}
}
mImpl->mBorderlineWidth = width;
}
- if(mImpl->mBorderlineWidthIndex != Property::INVALID_INDEX)
- {
- mImpl->mRenderer.SetProperty(mImpl->mBorderlineWidthIndex, mImpl->mBorderlineWidth);
- }
- else if(DALI_UNLIKELY(mImpl->mRenderer && IsBorderlineRequired()))
+ if(DALI_UNLIKELY(mImpl->mRenderer))
{
// Unusual case. SetProperty called after OnInitialize().
// Assume that DoAction call UPDATE_PROPERTY.
- // We must regist properies into renderer, and update shader.
+ DownCast<DecoratedVisualRenderer>(mImpl->mRenderer).RegisterBorderlineUniform();
+ mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BORDERLINE_WIDTH, mImpl->mBorderlineWidth);
- // Borderline added by this action. Register property to renderer.
- mImpl->mBorderlineWidthIndex = mImpl->mRenderer.RegisterUniqueProperty(DevelVisual::Property::BORDERLINE_WIDTH, BORDERLINE_WIDTH, mImpl->mBorderlineWidth);
- mImpl->mBorderlineColorIndex = mImpl->mRenderer.RegisterUniqueProperty(DevelVisual::Property::BORDERLINE_COLOR, BORDERLINE_COLOR, mImpl->mBorderlineColor);
- mImpl->mBorderlineOffsetIndex = mImpl->mRenderer.RegisterUniqueProperty(DevelVisual::Property::BORDERLINE_OFFSET, BORDERLINE_OFFSET, mImpl->mBorderlineOffset);
-
- // Make Blend mode ON_WITHOUT_CULL for transparent mix color.
- mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON_WITHOUT_CULL);
+ // Check whether we must update shader.
+ if(!mImpl->mAlwaysUsingBorderline && IsBorderlineRequired())
+ {
+ // Make Blend mode ON_WITHOUT_CULL for transparent mix color.
+ mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON_WITHOUT_CULL);
- // Change the shader must not be occured many times. we always have to use borderline feature.
- mImpl->mAlwaysUsingBorderline = true;
+ // Change the shader must not be occured many times. we always have to use borderline feature.
+ mImpl->mAlwaysUsingBorderline = true;
- // Change shader
- needUpdateShader = true;
+ // Change shader
+ if(!mImpl->mCustomShader)
+ {
+ needUpdateShader = true;
+ }
+ }
}
break;
}
mImpl->mBorderlineColor = color;
}
- if(mImpl->mBorderlineColorIndex != Property::INVALID_INDEX)
+ if(DALI_UNLIKELY(mImpl->mRenderer))
{
- mImpl->mRenderer.SetProperty(mImpl->mBorderlineColorIndex, mImpl->mBorderlineColor);
+ // Unusual case. SetProperty called after OnInitialize().
+ // Assume that DoAction call UPDATE_PROPERTY.
+ mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BORDERLINE_COLOR, mImpl->mBorderlineColor);
}
break;
}
mImpl->mBorderlineOffset = offset;
}
- if(mImpl->mBorderlineOffsetIndex != Property::INVALID_INDEX)
+ if(DALI_UNLIKELY(mImpl->mRenderer))
{
- mImpl->mRenderer.SetProperty(mImpl->mBorderlineOffsetIndex, mImpl->mBorderlineOffset);
+ // Unusual case. SetProperty called after OnInitialize().
+ // Assume that DoAction call UPDATE_PROPERTY.
+ mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BORDERLINE_OFFSET, mImpl->mBorderlineOffset);
}
break;
}
}
}
- if(mImpl->mCornerRadiusIndex != Property::INVALID_INDEX)
- {
- mImpl->mRenderer.SetProperty(mImpl->mCornerRadiusIndex, mImpl->mCornerRadius);
- }
- else if(DALI_UNLIKELY(mImpl->mRenderer && IsRoundedCornerRequired()))
+ if(DALI_UNLIKELY(mImpl->mRenderer))
{
// Unusual case. SetProperty called after OnInitialize().
// Assume that DoAction call UPDATE_PROPERTY.
- // We must regist properies into renderer, and update shader.
+ DownCast<DecoratedVisualRenderer>(mImpl->mRenderer).RegisterCornerRadiusUniform();
+ mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::CORNER_RADIUS, mImpl->mCornerRadius);
- // CornerRadius added by this action. Regist property to renderer.
- mImpl->mCornerRadiusIndex = mImpl->mRenderer.RegisterUniqueProperty(DevelVisual::Property::CORNER_RADIUS, CORNER_RADIUS, mImpl->mCornerRadius);
- mImpl->mRenderer.RegisterUniqueProperty(CORNER_RADIUS_POLICY, mImpl->mCornerRadiusPolicy);
+ // Check whether we must update shader.
+ if(!mImpl->mAlwaysUsingCornerRadius && IsRoundedCornerRequired())
+ {
+ // Change the shader must not be occured many times. we always have to use corner radius feature.
+ mImpl->mAlwaysUsingCornerRadius = true;
- // Change the shader must not be occured many times. we always have to use corner radius feature.
- mImpl->mAlwaysUsingCornerRadius = true;
+ if(!IsBorderlineRequired())
+ {
+ // If IsBorderlineRequired is true, BLEND_MODE is already BlendMode::ON_WITHOUT_CULL. So we don't overwrite it.
+ mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
+ }
- if(!IsBorderlineRequired())
- {
- // If IsBorderlineRequired is true, BLEND_MODE is already BlendMode::ON_WITHOUT_CULL. So we don't overwrite it.
- mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
+ // Change shader
+ if(!mImpl->mCustomShader)
+ {
+ needUpdateShader = true;
+ }
}
-
- // Change shader
- needUpdateShader = true;
}
+
break;
}
case Toolkit::DevelVisual::Property::CORNER_RADIUS_POLICY:
case Toolkit::Visual::Transform::Policy::ABSOLUTE:
{
mImpl->mCornerRadiusPolicy = policy;
- if(DALI_UNLIKELY(mImpl->mRenderer && mImpl->mCornerRadiusIndex != Property::INVALID_INDEX))
+ if(DALI_UNLIKELY(mImpl->mRenderer))
{
// Unusual case. SetProperty called after OnInitialize().
// Assume that DoAction call UPDATE_PROPERTY.
- // We must update properies result into renderer
- // Note : mImpl->mCornerRadiusIndex is not INVALID_INDEX.
- // So CornerRadiusPolicy property is already registed.
- mImpl->mRenderer.SetProperty(mImpl->mRenderer.GetPropertyIndex(CORNER_RADIUS_POLICY), mImpl->mCornerRadiusPolicy);
+ mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::CORNER_RADIUS_POLICY, mImpl->mCornerRadiusPolicy);
}
break;
}
mImpl->mTransform.mOffset = mImpl->mRenderer.GetProperty<Vector2>(VisualRenderer::Property::TRANSFORM_OFFSET);
mImpl->mTransform.mSize = mImpl->mRenderer.GetProperty<Vector2>(VisualRenderer::Property::TRANSFORM_SIZE);
- if(mImpl->mCornerRadiusIndex != Property::INVALID_INDEX)
- {
- mImpl->mCornerRadius = mImpl->mRenderer.GetProperty<Vector4>(mImpl->mCornerRadiusIndex);
- }
- if(mImpl->mBorderlineWidthIndex != Property::INVALID_INDEX)
+ if(IsTypeAvailableForCornerRadius(mImpl->mType))
{
- mImpl->mBorderlineWidth = mImpl->mRenderer.GetProperty<float>(mImpl->mBorderlineWidthIndex);
+ mImpl->mCornerRadius = mImpl->mRenderer.GetProperty<Vector4>(DecoratedVisualRenderer::Property::CORNER_RADIUS);
}
- if(mImpl->mBorderlineColorIndex != Property::INVALID_INDEX)
+ if(IsTypeAvailableForBorderline(mImpl->mType))
{
- mImpl->mBorderlineColor = mImpl->mRenderer.GetProperty<Vector4>(mImpl->mBorderlineColorIndex);
- }
- if(mImpl->mBorderlineOffsetIndex != Property::INVALID_INDEX)
- {
- mImpl->mBorderlineOffset = mImpl->mRenderer.GetProperty<float>(mImpl->mBorderlineOffsetIndex);
+ mImpl->mBorderlineWidth = mImpl->mRenderer.GetProperty<float>(DecoratedVisualRenderer::Property::BORDERLINE_WIDTH);
+ mImpl->mBorderlineColor = mImpl->mRenderer.GetProperty<Vector4>(DecoratedVisualRenderer::Property::BORDERLINE_COLOR);
+ mImpl->mBorderlineOffset = mImpl->mRenderer.GetProperty<float>(DecoratedVisualRenderer::Property::BORDERLINE_OFFSET);
}
}
// If VisualType doesn't support rounded corner, always return false.
if(IsTypeAvailableForCornerRadius(mImpl->mType))
{
- if(mImpl->mRenderer && mImpl->mCornerRadiusIndex != Property::INVALID_INDEX)
+ if(mImpl->mRenderer)
{
// Update values from Renderer
- mImpl->mCornerRadius = mImpl->mRenderer.GetProperty<Vector4>(mImpl->mCornerRadiusIndex);
+ Property::Value value = mImpl->mRenderer.GetProperty(DecoratedVisualRenderer::Property::CORNER_RADIUS);
+ value.Get(mImpl->mCornerRadius);
}
- return !(mImpl->mCornerRadius == Vector4::ZERO) || mImpl->mAlwaysUsingCornerRadius;
+ return mImpl->mAlwaysUsingCornerRadius || !(mImpl->mCornerRadius == Vector4::ZERO);
}
return false;
}
// If VisualType doesn't support borderline, always return false.
if(IsTypeAvailableForBorderline(mImpl->mType))
{
- if(mImpl->mRenderer && mImpl->mBorderlineWidthIndex != Property::INVALID_INDEX)
+ if(mImpl->mRenderer)
{
// Update values from Renderer
- mImpl->mBorderlineWidth = mImpl->mRenderer.GetProperty<float>(mImpl->mBorderlineWidthIndex);
+ Property::Value value = mImpl->mRenderer.GetProperty(DecoratedVisualRenderer::Property::BORDERLINE_WIDTH);
+ value.Get(mImpl->mBorderlineWidth);
}
- return !EqualsZero(mImpl->mBorderlineWidth) || mImpl->mAlwaysUsingBorderline;
+ return mImpl->mAlwaysUsingBorderline || !EqualsZero(mImpl->mBorderlineWidth);
}
return false;
}
}
}
+void Visual::Base::RegisterDecoration()
+{
+ if(mImpl->mRenderer)
+ {
+ if(IsTypeAvailableForCornerRadius(mImpl->mType))
+ {
+ if(mImpl->mAlwaysUsingCornerRadius || !(mImpl->mCornerRadius == Vector4::ZERO))
+ {
+ DownCast<DecoratedVisualRenderer>(mImpl->mRenderer).RegisterCornerRadiusUniform();
+ mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::CORNER_RADIUS, mImpl->mCornerRadius);
+ mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::CORNER_RADIUS_POLICY, mImpl->mCornerRadiusPolicy);
+ }
+ }
+ if(IsTypeAvailableForBorderline(mImpl->mType))
+ {
+ if(mImpl->mAlwaysUsingBorderline || !EqualsZero(mImpl->mBorderlineWidth))
+ {
+ DownCast<DecoratedVisualRenderer>(mImpl->mRenderer).RegisterBorderlineUniform();
+ mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BORDERLINE_WIDTH, mImpl->mBorderlineWidth);
+ mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BORDERLINE_COLOR, mImpl->mBorderlineColor);
+ mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BORDERLINE_OFFSET, mImpl->mBorderlineOffset);
+ }
+ }
+ }
+}
+
void Visual::Base::SetMixColor(const Vector4& color)
{
mImpl->mMixColor = color;
{
return VisualRenderer::Property::VISUAL_PRE_MULTIPLIED_ALPHA;
}
+ case Dali::Toolkit::DevelVisual::Property::CORNER_RADIUS:
+ {
+ return DecoratedVisualRenderer::Property::CORNER_RADIUS;
+ }
+ case Dali::Toolkit::DevelVisual::Property::BORDERLINE_WIDTH:
+ {
+ return DecoratedVisualRenderer::Property::BORDERLINE_WIDTH;
+ }
+ case Dali::Toolkit::DevelVisual::Property::BORDERLINE_COLOR:
+ {
+ return DecoratedVisualRenderer::Property::BORDERLINE_COLOR;
+ }
+ case Dali::Toolkit::DevelVisual::Property::BORDERLINE_OFFSET:
+ {
+ return DecoratedVisualRenderer::Property::BORDERLINE_OFFSET;
+ }
}
Property::Index index = mImpl->mRenderer.GetPropertyIndex(key);
Internal::TransitionData::Animator& animator)
{
#if defined(DEBUG_ENABLED)
+ if(gVisualBaseLogFilter->IsEnabledFor(Debug::General))
{
std::ostringstream oss;
oss << "Visual::Base::AnimateProperty(Visual:" << mImpl->mName << " Property:" << animator.propertyKey << " Target: " << animator.targetValue << std::endl;
return Dali::Property(handle, Property::INVALID_INDEX);
}
- // Default animatable properties from VisualRenderer
switch(GetIntKey(key))
{
+ // Default animatable properties from VisualRenderer
case Toolkit::Visual::Property::MIX_COLOR:
{
return Dali::Property(mImpl->mRenderer, VisualRenderer::Property::VISUAL_MIX_COLOR);
{
return Dali::Property(mImpl->mRenderer, VisualRenderer::Property::TRANSFORM_SIZE);
}
- default:
- {
- if(key.type == Property::Key::INDEX &&
- ((mImpl->mType == Toolkit::Visual::COLOR && key.indexKey == ColorVisual::Property::MIX_COLOR) ||
- (mImpl->mType == Toolkit::Visual::PRIMITIVE && key.indexKey == PrimitiveVisual::Property::MIX_COLOR)))
- {
- return Dali::Property(mImpl->mRenderer, VisualRenderer::Property::VISUAL_MIX_COLOR);
- }
- }
- }
- // Other cases
- Property::Index index = GetPropertyIndex(key);
- if(index == Property::INVALID_INDEX)
- {
- if(IsTypeAvailableForBorderline(mImpl->mType) &&
- ((key.type == Property::Key::INDEX && key.indexKey == DevelVisual::Property::BORDERLINE_WIDTH) || (key.type == Property::Key::STRING && key.stringKey == BORDERLINE_WIDTH) ||
- (key.type == Property::Key::INDEX && key.indexKey == DevelVisual::Property::BORDERLINE_COLOR) || (key.type == Property::Key::STRING && key.stringKey == BORDERLINE_COLOR) ||
- (key.type == Property::Key::INDEX && key.indexKey == DevelVisual::Property::BORDERLINE_OFFSET) || (key.type == Property::Key::STRING && key.stringKey == BORDERLINE_OFFSET)))
+ // Default animatable properties from DecoratedVisualRenderer
+ case Toolkit::DevelVisual::Property::CORNER_RADIUS:
{
- mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON_WITHOUT_CULL);
-
- // Register borderline properties
- mImpl->mBorderlineWidthIndex = mImpl->mRenderer.RegisterUniqueProperty(DevelVisual::Property::BORDERLINE_WIDTH, BORDERLINE_WIDTH, mImpl->mBorderlineWidth);
- mImpl->mBorderlineColorIndex = mImpl->mRenderer.RegisterUniqueProperty(DevelVisual::Property::BORDERLINE_COLOR, BORDERLINE_COLOR, mImpl->mBorderlineColor);
- mImpl->mBorderlineOffsetIndex = mImpl->mRenderer.RegisterUniqueProperty(DevelVisual::Property::BORDERLINE_OFFSET, BORDERLINE_OFFSET, mImpl->mBorderlineOffset);
+ if(IsTypeAvailableForCornerRadius(mImpl->mType))
+ {
+ const bool updateShader = !mImpl->mCustomShader && !IsRoundedCornerRequired();
- // Borderline is animated now. we always have to use borderline feature.
- mImpl->mAlwaysUsingBorderline = true;
+ // CornerRadius is animated now. we always have to use corner radius feature.
+ mImpl->mAlwaysUsingCornerRadius = true;
- index = mImpl->mRenderer.GetPropertyIndex(key);
+ if(updateShader)
+ {
+ // Update each values to renderer
+ DownCast<DecoratedVisualRenderer>(mImpl->mRenderer).RegisterCornerRadiusUniform();
+ mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::CORNER_RADIUS, mImpl->mCornerRadius);
+ mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::CORNER_RADIUS_POLICY, mImpl->mCornerRadiusPolicy);
- // Change shader
- UpdateShader();
+ // Change shader
+ UpdateShader();
+ }
+ if(!IsBorderlineRequired())
+ {
+ // If IsBorderlineRequired is true, BLEND_MODE is already BlendMode::ON_WITHOUT_CULL. So we don't overwrite it.
+ mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
+ }
+ return Dali::Property(mImpl->mRenderer, DecoratedVisualRenderer::Property::CORNER_RADIUS);
+ }
+ break;
}
- else if(IsTypeAvailableForCornerRadius(mImpl->mType) && ((key.type == Property::Key::INDEX && key.indexKey == DevelVisual::Property::CORNER_RADIUS) || (key.type == Property::Key::STRING && key.stringKey == CORNER_RADIUS)))
+ case Toolkit::DevelVisual::Property::BORDERLINE_WIDTH:
+ case Toolkit::DevelVisual::Property::BORDERLINE_COLOR:
+ case Toolkit::DevelVisual::Property::BORDERLINE_OFFSET:
{
- // Register CORNER_RADIUS property
- mImpl->mCornerRadiusIndex = mImpl->mRenderer.RegisterUniqueProperty(DevelVisual::Property::CORNER_RADIUS, CORNER_RADIUS, mImpl->mCornerRadius);
- mImpl->mRenderer.RegisterUniqueProperty(CORNER_RADIUS_POLICY, mImpl->mCornerRadiusPolicy);
+ if(IsTypeAvailableForBorderline(mImpl->mType))
+ {
+ const bool updateShader = !mImpl->mCustomShader && !IsBorderlineRequired();
- // CornerRadius is animated now. we always have to use corner radius feature.
- mImpl->mAlwaysUsingCornerRadius = true;
+ // Borderline is animated now. we always have to use borderline feature.
+ mImpl->mAlwaysUsingBorderline = true;
- if(!IsBorderlineRequired())
- {
- // If IsBorderlineRequired is true, BLEND_MODE is already BlendMode::ON_WITHOUT_CULL. So we don't overwrite it.
- mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON);
- }
+ if(updateShader)
+ {
+ // Update each values to renderer
+ DownCast<DecoratedVisualRenderer>(mImpl->mRenderer).RegisterBorderlineUniform();
+ mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BORDERLINE_WIDTH, mImpl->mBorderlineWidth);
+ mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BORDERLINE_COLOR, mImpl->mBorderlineColor);
+ mImpl->mRenderer.SetProperty(DecoratedVisualRenderer::Property::BORDERLINE_OFFSET, mImpl->mBorderlineOffset);
- index = mImpl->mCornerRadiusIndex;
+ // Change shader
+ UpdateShader();
+ }
+ mImpl->mRenderer.SetProperty(Renderer::Property::BLEND_MODE, BlendMode::ON_WITHOUT_CULL);
- // Change shader
- UpdateShader();
- }
- else
- {
- // We can't find the property in the base class.
- // Request to child class
- return OnGetPropertyObject(key);
- }
- }
- else
- {
- if(index == mImpl->mBorderlineWidthIndex ||
- index == mImpl->mBorderlineColorIndex ||
- index == mImpl->mBorderlineOffsetIndex)
- {
- // Borderline is animated now. we always have to use borderline feature.
- mImpl->mAlwaysUsingBorderline = true;
+ return Dali::Property(mImpl->mRenderer, GetPropertyIndex(key));
+ }
+ break;
}
- if(index == mImpl->mCornerRadiusIndex)
+ // Special case for MIX_COLOR
+ default:
{
- // CornerRadius is animated now. we always have to use corner radius feature.
- mImpl->mAlwaysUsingCornerRadius = true;
+ if(key.type == Property::Key::INDEX &&
+ ((mImpl->mType == Toolkit::Visual::COLOR && key.indexKey == ColorVisual::Property::MIX_COLOR) ||
+ (mImpl->mType == Toolkit::Visual::PRIMITIVE && key.indexKey == PrimitiveVisual::Property::MIX_COLOR)))
+ {
+ return Dali::Property(mImpl->mRenderer, VisualRenderer::Property::VISUAL_MIX_COLOR);
+ }
}
}
- return Dali::Property(mImpl->mRenderer, index);
+ // We can't find the property in the base class.
+ // Request to child class
+ return OnGetPropertyObject(key);
}
} // namespace Internal
void RegisterMixColor();
/**
+ * Register the uniform on the DecoratedVisualRenderer and store the property index if necessary.
+ */
+ void RegisterDecoration();
+
+ /**
* Find the matching property on the renderer or shader. If it's a shader
* property, register it on the renderer in order to animate it for this
* visual independently.
if(styleManager)
{
- customBrokenImageUrlList = Toolkit::DevelStyleManager::GetBrokenImageUrlList(styleManager);
- Property::Map config = Toolkit::DevelStyleManager::GetConfigurations(styleManager);
- config["brokenImageUrl"].Get(brokenImageUrl);
+ customBrokenImageUrlList = Toolkit::DevelStyleManager::GetBrokenImageUrlList(styleManager);
+ const Property::Map& config = Toolkit::DevelStyleManager::GetConfigurations(styleManager);
+ const auto brokenImageUrlValue = config.Find("brokenImageUrl", Property::Type::STRING);
+ if(brokenImageUrlValue)
+ {
+ brokenImageUrlValue->Get(brokenImageUrl);
+ }
}
// Add default image
{
const unsigned int TOOLKIT_MAJOR_VERSION = 2;
const unsigned int TOOLKIT_MINOR_VERSION = 1;
-const unsigned int TOOLKIT_MICRO_VERSION = 25;
+const unsigned int TOOLKIT_MICRO_VERSION = 26;
const char* const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
Name: dali2-toolkit
Summary: Dali 3D engine Toolkit
-Version: 2.1.25
+Version: 2.1.26
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-3-Clause and MIT