From: Adeel Kazmi Date: Wed, 17 Jun 2020 18:39:34 +0000 (+0100) Subject: Remove ResourceImage Usage X-Git-Tag: dali_1.9.17~1^2~1 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git;a=commitdiff_plain;h=6261b85db16d8e9f842c9dc152046747eec67eaa Remove ResourceImage Usage Change-Id: If2410a4d27fd388af26920335764f264a4c6cc75 --- diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-DebugRendering.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-DebugRendering.cpp index fb8287a..90b5a65 100644 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-DebugRendering.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-DebugRendering.cpp @@ -238,7 +238,7 @@ int UtcDaliDebugRenderingGetVisual2(void) map[ ImageVisual::Property::URL ] = TEST_IMAGE_FILE_NAME; Visual::Base imageVisual = factory.CreateVisual( map ); DALI_TEST_CHECK( imageVisual ); - TestDebugVisual( imageVisual, Visual::IMAGE, Vector2::ZERO); + TestDebugVisual( imageVisual, Visual::IMAGE, Vector2(64.0f, 64.0f /* Broken Image Size */ )); // Test that n patch visual is replaced with debug visual Visual::Base nPatchVisual = factory.CreateVisual( TEST_NPATCH_FILE_NAME, ImageDimensions() ); diff --git a/automated-tests/src/dali-toolkit-internal/utc-Dali-ItemView-internal.cpp b/automated-tests/src/dali-toolkit-internal/utc-Dali-ItemView-internal.cpp old mode 100755 new mode 100644 index 3ca8d0a..5663d79 --- a/automated-tests/src/dali-toolkit-internal/utc-Dali-ItemView-internal.cpp +++ b/automated-tests/src/dali-toolkit-internal/utc-Dali-ItemView-internal.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -75,10 +75,7 @@ public: // From ItemFactory virtual Actor NewItem(unsigned int itemId) { // Create a renderable actor for this item - Image image = ResourceImage::New( TEST_IMAGE_FILE_NAME ); - Actor actor = CreateRenderableActor(image); - - return actor; + return ImageView::New( TEST_IMAGE_FILE_NAME ); } }; diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ItemLayout.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ItemLayout.cpp old mode 100755 new mode 100644 index 4098d72..8dcb505 --- a/automated-tests/src/dali-toolkit/utc-Dali-ItemLayout.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ItemLayout.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -73,10 +73,7 @@ public: // From ItemFactory virtual Actor NewItem(unsigned int itemId) { // Create a renderable actor for this item - Image image = ResourceImage::New( TEST_IMAGE_FILE_NAME ); - Actor actor = CreateRenderableActor(image); - - return actor; + return ImageView::New( TEST_IMAGE_FILE_NAME ); } }; diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ItemView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ItemView.cpp old mode 100755 new mode 100644 index f5e6da8..8b011b8 --- a/automated-tests/src/dali-toolkit/utc-Dali-ItemView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ItemView.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -135,10 +135,7 @@ public: // From ItemFactory virtual Actor NewItem(unsigned int itemId) { // Create a renderable actor for this item - Image image = ResourceImage::New( TEST_IMAGE_FILE_NAME ); - Actor actor = CreateRenderableActor(image); - - return actor; + return ImageView::New( TEST_IMAGE_FILE_NAME ); } }; diff --git a/automated-tests/src/dali-toolkit/utc-Dali-TextSelectionPopup.cpp b/automated-tests/src/dali-toolkit/utc-Dali-TextSelectionPopup.cpp index 4b8aca5..b09f171 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-TextSelectionPopup.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-TextSelectionPopup.cpp @@ -230,3 +230,25 @@ int UtcDaliToolkitTextSelectionToolBarScrollView(void) END_TEST; } + + +int UtcDaliToolkitTextSelectionPopupIconProperties(void) +{ + ToolkitTestApplication application; + TextSelectionPopup popup = TextSelectionPopup::New(nullptr); + popup.SetProperty(TextSelectionPopup::Property::POPUP_CLIPBOARD_BUTTON_ICON_IMAGE, "POPUP_CLIPBOARD_BUTTON_ICON_IMAGE"); + popup.SetProperty(TextSelectionPopup::Property::POPUP_CUT_BUTTON_ICON_IMAGE, "POPUP_CUT_BUTTON_ICON_IMAGE"); + popup.SetProperty(TextSelectionPopup::Property::POPUP_COPY_BUTTON_ICON_IMAGE, "POPUP_COPY_BUTTON_ICON_IMAGE"); + popup.SetProperty(TextSelectionPopup::Property::POPUP_PASTE_BUTTON_ICON_IMAGE, "POPUP_PASTE_BUTTON_ICON_IMAGE"); + popup.SetProperty(TextSelectionPopup::Property::POPUP_SELECT_BUTTON_ICON_IMAGE, "POPUP_SELECT_BUTTON_ICON_IMAGE"); + popup.SetProperty(TextSelectionPopup::Property::POPUP_SELECT_ALL_BUTTON_ICON_IMAGE, "POPUP_SELECT_ALL_BUTTON_ICON_IMAGE"); + + DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::POPUP_CLIPBOARD_BUTTON_ICON_IMAGE).Get(), "POPUP_CLIPBOARD_BUTTON_ICON_IMAGE", TEST_LOCATION); + DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::POPUP_CUT_BUTTON_ICON_IMAGE).Get(), "POPUP_CUT_BUTTON_ICON_IMAGE", TEST_LOCATION); + DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::POPUP_COPY_BUTTON_ICON_IMAGE).Get(), "POPUP_COPY_BUTTON_ICON_IMAGE", TEST_LOCATION); + DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::POPUP_PASTE_BUTTON_ICON_IMAGE).Get(), "POPUP_PASTE_BUTTON_ICON_IMAGE", TEST_LOCATION); + DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::POPUP_SELECT_BUTTON_ICON_IMAGE).Get(), "POPUP_SELECT_BUTTON_ICON_IMAGE", TEST_LOCATION); + DALI_TEST_EQUALS( popup.GetProperty(TextSelectionPopup::Property::POPUP_SELECT_ALL_BUTTON_ICON_IMAGE).Get(), "POPUP_SELECT_ALL_BUTTON_ICON_IMAGE", TEST_LOCATION); + + END_TEST; +} diff --git a/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.cpp b/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.cpp index c947286..6b4433d 100644 --- a/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.cpp +++ b/dali-toolkit/internal/accessibility-manager/accessibility-manager-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -25,7 +25,6 @@ #include #include #include -#include #include // INTERNAL INCLUDES diff --git a/dali-toolkit/internal/controls/buttons/button-impl.cpp b/dali-toolkit/internal/controls/buttons/button-impl.cpp index d355c17..0305e8a3 100644 --- a/dali-toolkit/internal/controls/buttons/button-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/button-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include diff --git a/dali-toolkit/internal/controls/buttons/check-box-button-impl.cpp b/dali-toolkit/internal/controls/buttons/check-box-button-impl.cpp index 9554ccb..00a99bf 100644 --- a/dali-toolkit/internal/controls/buttons/check-box-button-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/check-box-button-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -21,7 +21,6 @@ // EXTERNAL INCLUDES #include #include -#include //INTERNAL INCLUDES #include diff --git a/dali-toolkit/internal/controls/buttons/push-button-impl.cpp b/dali-toolkit/internal/controls/buttons/push-button-impl.cpp index 612d010..394f127 100644 --- a/dali-toolkit/internal/controls/buttons/push-button-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/push-button-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -21,7 +21,6 @@ // EXTERNAL INCLUDES #include #include -#include #include #include diff --git a/dali-toolkit/internal/controls/buttons/radio-button-impl.cpp b/dali-toolkit/internal/controls/buttons/radio-button-impl.cpp index bbd151a..5389a22 100644 --- a/dali-toolkit/internal/controls/buttons/radio-button-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/radio-button-impl.cpp @@ -22,7 +22,6 @@ // EXTERNAL INCLUDES #include #include -#include #if defined(DEBUG_ENABLED) extern Debug::Filter* gLogButtonFilter; diff --git a/dali-toolkit/internal/controls/buttons/toggle-button-impl.cpp b/dali-toolkit/internal/controls/buttons/toggle-button-impl.cpp index dca592a..e6c0ab7 100755 --- a/dali-toolkit/internal/controls/buttons/toggle-button-impl.cpp +++ b/dali-toolkit/internal/controls/buttons/toggle-button-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -21,7 +21,6 @@ // EXTERNAL INCLUDES #include #include -#include #include #include #include diff --git a/dali-toolkit/internal/controls/image-view/image-view-impl.cpp b/dali-toolkit/internal/controls/image-view/image-view-impl.cpp index 69c126c..e4dc770 100755 --- a/dali-toolkit/internal/controls/image-view/image-view-impl.cpp +++ b/dali-toolkit/internal/controls/image-view/image-view-impl.cpp @@ -19,7 +19,6 @@ #include "image-view-impl.h" // EXTERNAL INCLUDES -#include #include #include #include diff --git a/dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp b/dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp index 04fa8da..cc2a2f6 100644 --- a/dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp +++ b/dali-toolkit/internal/controls/magnifier/magnifier-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include diff --git a/dali-toolkit/internal/controls/model3d-view/model3d-view-impl.cpp b/dali-toolkit/internal/controls/model3d-view/model3d-view-impl.cpp index 3830f62..467783c 100644 --- a/dali-toolkit/internal/controls/model3d-view/model3d-view-impl.cpp +++ b/dali-toolkit/internal/controls/model3d-view/model3d-view-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -25,7 +25,6 @@ #include #include #include -#include #include #include diff --git a/dali-toolkit/internal/controls/popup/confirmation-popup-impl.cpp b/dali-toolkit/internal/controls/popup/confirmation-popup-impl.cpp index 43758cb..1092c13 100644 --- a/dali-toolkit/internal/controls/popup/confirmation-popup-impl.cpp +++ b/dali-toolkit/internal/controls/popup/confirmation-popup-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -19,7 +19,6 @@ #include "confirmation-popup-impl.h" // EXTERNAL INCLUDES -#include #include #include #include diff --git a/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp b/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp index 8a2d5be..711f323 100755 --- a/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp +++ b/dali-toolkit/internal/controls/scroll-bar/scroll-bar-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -22,7 +22,6 @@ #include // for strcmp #include #include -#include #include #include #include diff --git a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp index 48c8ff1..f9fe425 100644 --- a/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-editor-impl.cpp @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include diff --git a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp index 745a5a5..f4af0d0 100644 --- a/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-field-impl.cpp @@ -23,7 +23,6 @@ #include #include #include -#include #include #include #include diff --git a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp index 2f0c692..f35dd4b 100644 --- a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp +++ b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include @@ -177,38 +176,32 @@ void TextSelectionPopup::SetProperty( BaseObject* object, Property::Index index, } case Toolkit::TextSelectionPopup::Property::POPUP_CLIPBOARD_BUTTON_ICON_IMAGE: { - ResourceImage image = ResourceImage::New( value.Get< std::string >() ); - impl.SetButtonImage( Toolkit::TextSelectionPopup::CLIPBOARD, image ); + impl.SetButtonImage( Toolkit::TextSelectionPopup::CLIPBOARD, value.Get< std::string >() ); break; } case Toolkit::TextSelectionPopup::Property::POPUP_CUT_BUTTON_ICON_IMAGE: { - ResourceImage image = ResourceImage::New( value.Get< std::string >() ); - impl.SetButtonImage( Toolkit::TextSelectionPopup::CUT, image ); + impl.SetButtonImage( Toolkit::TextSelectionPopup::CUT, value.Get< std::string >() ); break; } case Toolkit::TextSelectionPopup::Property::POPUP_COPY_BUTTON_ICON_IMAGE: { - ResourceImage image = ResourceImage::New( value.Get< std::string >() ); - impl.SetButtonImage( Toolkit::TextSelectionPopup::COPY, image ); + impl.SetButtonImage( Toolkit::TextSelectionPopup::COPY, value.Get< std::string >() ); break; } case Toolkit::TextSelectionPopup::Property::POPUP_PASTE_BUTTON_ICON_IMAGE: { - ResourceImage image = ResourceImage::New( value.Get< std::string >() ); - impl.SetButtonImage( Toolkit::TextSelectionPopup::PASTE, image ); + impl.SetButtonImage( Toolkit::TextSelectionPopup::PASTE, value.Get< std::string >() ); break; } case Toolkit::TextSelectionPopup::Property::POPUP_SELECT_BUTTON_ICON_IMAGE: { - ResourceImage image = ResourceImage::New( value.Get< std::string >() ); - impl.SetButtonImage( Toolkit::TextSelectionPopup::SELECT, image ); + impl.SetButtonImage( Toolkit::TextSelectionPopup::SELECT, value.Get< std::string >() ); break; } case Toolkit::TextSelectionPopup::Property::POPUP_SELECT_ALL_BUTTON_ICON_IMAGE: { - ResourceImage image = ResourceImage::New( value.Get< std::string >() ); - impl.SetButtonImage( Toolkit::TextSelectionPopup::SELECT_ALL, image ); + impl.SetButtonImage( Toolkit::TextSelectionPopup::SELECT_ALL, value.Get< std::string >() ); break; } case Toolkit::TextSelectionPopup::Property::POPUP_DIVIDER_COLOR: @@ -285,56 +278,32 @@ Property::Value TextSelectionPopup::GetProperty( BaseObject* object, Property::I } case Toolkit::TextSelectionPopup::Property::POPUP_CLIPBOARD_BUTTON_ICON_IMAGE: { - ResourceImage image = ResourceImage::DownCast( impl.GetButtonImage( Toolkit::TextSelectionPopup::CLIPBOARD ) ); - if( image ) - { - value = image.GetUrl(); - } + value = impl.GetButtonImage( Toolkit::TextSelectionPopup::CLIPBOARD ); break; } case Toolkit::TextSelectionPopup::Property::POPUP_CUT_BUTTON_ICON_IMAGE: { - ResourceImage image = ResourceImage::DownCast( impl.GetButtonImage( Toolkit::TextSelectionPopup::CUT ) ); - if( image ) - { - value = image.GetUrl(); - } + value = impl.GetButtonImage( Toolkit::TextSelectionPopup::CUT ); break; } case Toolkit::TextSelectionPopup::Property::POPUP_COPY_BUTTON_ICON_IMAGE: { - ResourceImage image = ResourceImage::DownCast( impl.GetButtonImage( Toolkit::TextSelectionPopup::COPY ) ); - if( image ) - { - value = image.GetUrl(); - } + value = impl.GetButtonImage( Toolkit::TextSelectionPopup::COPY ); break; } case Toolkit::TextSelectionPopup::Property::POPUP_PASTE_BUTTON_ICON_IMAGE: { - ResourceImage image = ResourceImage::DownCast( impl.GetButtonImage( Toolkit::TextSelectionPopup::PASTE ) ); - if( image ) - { - value = image.GetUrl(); - } + value = impl.GetButtonImage( Toolkit::TextSelectionPopup::PASTE ); break; } case Toolkit::TextSelectionPopup::Property::POPUP_SELECT_BUTTON_ICON_IMAGE: { - ResourceImage image = ResourceImage::DownCast( impl.GetButtonImage( Toolkit::TextSelectionPopup::SELECT ) ); - if( image ) - { - value = image.GetUrl(); - } + value = impl.GetButtonImage( Toolkit::TextSelectionPopup::SELECT ); break; } case Toolkit::TextSelectionPopup::Property::POPUP_SELECT_ALL_BUTTON_ICON_IMAGE: { - ResourceImage image = ResourceImage::DownCast( impl.GetButtonImage( Toolkit::TextSelectionPopup::SELECT_ALL ) ); - if( image ) - { - value = image.GetUrl(); - } + value = impl.GetButtonImage( Toolkit::TextSelectionPopup::SELECT_ALL ); break; } case Toolkit::TextSelectionPopup::Property::POPUP_PRESSED_IMAGE: @@ -557,89 +526,89 @@ Size TextSelectionPopup::GetDimensionToCustomise( const PopupCustomisations& set return Size::ZERO; } -void TextSelectionPopup::SetButtonImage( Toolkit::TextSelectionPopup::Buttons button, Dali::Image image ) +void TextSelectionPopup::SetButtonImage( Toolkit::TextSelectionPopup::Buttons button, const std::string& image ) { switch ( button ) { - break; - case Toolkit::TextSelectionPopup::CLIPBOARD: - { - mClipboardIconImage = image; - } - break; - case Toolkit::TextSelectionPopup::CUT : - { - mCutIconImage = image; - } - break; - case Toolkit::TextSelectionPopup::COPY : - { - mCopyIconImage = image; - } - break; - case Toolkit::TextSelectionPopup::PASTE : - { - mPasteIconImage = image; - } - break; - case Toolkit::TextSelectionPopup::SELECT : - { - mSelectIconImage = image; - } - break; - case Toolkit::TextSelectionPopup::SELECT_ALL : - { - mSelectAllIconImage = image; - } - break; - default : - { - DALI_ASSERT_DEBUG( "TextSelectionPopup SetPopupImage Unknown Button" ); - } + case Toolkit::TextSelectionPopup::CLIPBOARD: + { + mClipboardIconImage = image; + break; + } + case Toolkit::TextSelectionPopup::CUT : + { + mCutIconImage = image; + break; + } + case Toolkit::TextSelectionPopup::COPY : + { + mCopyIconImage = image; + break; + } + case Toolkit::TextSelectionPopup::PASTE : + { + mPasteIconImage = image; + break; + } + case Toolkit::TextSelectionPopup::SELECT : + { + mSelectIconImage = image; + break; + } + case Toolkit::TextSelectionPopup::SELECT_ALL : + { + mSelectAllIconImage = image; + break; + } + default : + { + DALI_ASSERT_DEBUG( "TextSelectionPopup SetPopupImage Unknown Button" ); + } } // switch } -Dali::Image TextSelectionPopup::GetButtonImage( Toolkit::TextSelectionPopup::Buttons button ) +std::string TextSelectionPopup::GetButtonImage( Toolkit::TextSelectionPopup::Buttons button ) { + std::string buttonImageUrl; switch ( button ) { - case Toolkit::TextSelectionPopup::CLIPBOARD : - { - return mClipboardIconImage; - } - break; - case Toolkit::TextSelectionPopup::CUT : - { - return mCutIconImage; - } - break; - case Toolkit::TextSelectionPopup::COPY : - { - return mCopyIconImage; - } - break; - case Toolkit::TextSelectionPopup::PASTE : - { - return mPasteIconImage; - } - break; - case Toolkit::TextSelectionPopup::SELECT : - { - return mSelectIconImage; - } - break; - case Toolkit::TextSelectionPopup::SELECT_ALL : - { - return mSelectAllIconImage; - } - break; - default : - { - DALI_ASSERT_DEBUG( "TextSelectionPopup GetPopupImage Unknown Button" ); - } + case Toolkit::TextSelectionPopup::CLIPBOARD : + { + buttonImageUrl = mClipboardIconImage; + break; + } + case Toolkit::TextSelectionPopup::CUT : + { + buttonImageUrl = mCutIconImage; + break; + } + case Toolkit::TextSelectionPopup::COPY : + { + buttonImageUrl = mCopyIconImage; + break; + } + case Toolkit::TextSelectionPopup::PASTE : + { + buttonImageUrl = mPasteIconImage; + break; + } + case Toolkit::TextSelectionPopup::SELECT : + { + buttonImageUrl = mSelectIconImage; + break; + } + case Toolkit::TextSelectionPopup::SELECT_ALL : + { + buttonImageUrl = mSelectAllIconImage; + break; + } + default : + { + DALI_ASSERT_DEBUG( "TextSelectionPopup GetPopupImage Unknown Button" ); + } } // switch - return Dali::Image(); + return buttonImageUrl; } void TextSelectionPopup::SetPressedImage( const std::string& filename ) @@ -658,12 +627,12 @@ std::string TextSelectionPopup::GetPressedImage() const mOrderListOfButtons.reserve( 8u ); // Create button for each possible option using Option priority - mOrderListOfButtons.push_back( ButtonRequirement( Toolkit::TextSelectionPopup::CUT, mCutOptionPriority, OPTION_CUT, POPUP_CUT_STRING , mCutIconImage, 0 != ( mEnabledButtons & Toolkit::TextSelectionPopup::CUT) ) ); - mOrderListOfButtons.push_back( ButtonRequirement( Toolkit::TextSelectionPopup::COPY, mCopyOptionPriority, OPTION_COPY, POPUP_COPY_STRING, mCopyIconImage, 0 != ( mEnabledButtons & Toolkit::TextSelectionPopup::COPY) ) ); - mOrderListOfButtons.push_back( ButtonRequirement( Toolkit::TextSelectionPopup::PASTE, mPasteOptionPriority, OPTION_PASTE, POPUP_PASTE_STRING, mPasteIconImage, 0 != ( mEnabledButtons & Toolkit::TextSelectionPopup::PASTE) ) ); - mOrderListOfButtons.push_back( ButtonRequirement( Toolkit::TextSelectionPopup::SELECT, mSelectOptionPriority, OPTION_SELECT_WORD, POPUP_SELECT_STRING, mSelectIconImage, 0 != ( mEnabledButtons & Toolkit::TextSelectionPopup::SELECT) ) ); - mOrderListOfButtons.push_back( ButtonRequirement( Toolkit::TextSelectionPopup::SELECT_ALL, mSelectAllOptionPriority, OPTION_SELECT_ALL, POPUP_SELECT_ALL_STRING, mSelectAllIconImage, 0 != ( mEnabledButtons & Toolkit::TextSelectionPopup::SELECT_ALL) ) ); - mOrderListOfButtons.push_back( ButtonRequirement( Toolkit::TextSelectionPopup::CLIPBOARD, mClipboardOptionPriority, OPTION_CLIPBOARD, POPUP_CLIPBOARD_STRING, mClipboardIconImage, 0 != ( mEnabledButtons & Toolkit::TextSelectionPopup::CLIPBOARD) ) ); + mOrderListOfButtons.push_back( ButtonRequirement( Toolkit::TextSelectionPopup::CUT, mCutOptionPriority, OPTION_CUT, POPUP_CUT_STRING , 0 != ( mEnabledButtons & Toolkit::TextSelectionPopup::CUT) ) ); + mOrderListOfButtons.push_back( ButtonRequirement( Toolkit::TextSelectionPopup::COPY, mCopyOptionPriority, OPTION_COPY, POPUP_COPY_STRING, 0 != ( mEnabledButtons & Toolkit::TextSelectionPopup::COPY) ) ); + mOrderListOfButtons.push_back( ButtonRequirement( Toolkit::TextSelectionPopup::PASTE, mPasteOptionPriority, OPTION_PASTE, POPUP_PASTE_STRING, 0 != ( mEnabledButtons & Toolkit::TextSelectionPopup::PASTE) ) ); + mOrderListOfButtons.push_back( ButtonRequirement( Toolkit::TextSelectionPopup::SELECT, mSelectOptionPriority, OPTION_SELECT_WORD, POPUP_SELECT_STRING, 0 != ( mEnabledButtons & Toolkit::TextSelectionPopup::SELECT) ) ); + mOrderListOfButtons.push_back( ButtonRequirement( Toolkit::TextSelectionPopup::SELECT_ALL, mSelectAllOptionPriority, OPTION_SELECT_ALL, POPUP_SELECT_ALL_STRING, 0 != ( mEnabledButtons & Toolkit::TextSelectionPopup::SELECT_ALL) ) ); + mOrderListOfButtons.push_back( ButtonRequirement( Toolkit::TextSelectionPopup::CLIPBOARD, mClipboardOptionPriority, OPTION_CLIPBOARD, POPUP_CLIPBOARD_STRING, 0 != ( mEnabledButtons & Toolkit::TextSelectionPopup::CLIPBOARD) ) ); // Sort the buttons according their priorities. std::sort( mOrderListOfButtons.begin(), mOrderListOfButtons.end(), TextSelectionPopup::ButtonPriorityCompare() ); diff --git a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h index a79a925..9cd7ab7 100644 --- a/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h +++ b/dali-toolkit/internal/controls/text-controls/text-selection-popup-impl.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_INTERNAL_TEXT_SELECTION_POPUP_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -18,6 +18,11 @@ * */ +// EXTERNAL INCLUDES +#include +#include +#include + // INTERNAL INCLUDES #include #include @@ -26,10 +31,6 @@ #include #include -// EXTERNAL INCLUDES -#include -#include - namespace Dali { @@ -58,7 +59,6 @@ public: priority( 0u ), name(), caption(), - icon(), enabled( false ) {} @@ -66,13 +66,11 @@ public: std::size_t buttonPriority, const std::string& buttonName, const std::string& buttonCaption, - Dali::Image& buttonIcon, bool buttonEnabled ) : id( buttonId ), priority( buttonPriority ), name( buttonName ), caption( buttonCaption ), - icon( buttonIcon ), enabled( buttonEnabled ) {} @@ -80,7 +78,6 @@ public: std::size_t priority; std::string name; std::string caption; - Dali::Image icon; bool enabled; }; @@ -211,7 +208,7 @@ private: // Implementation * @param[in] button The button the image should be used for from the Buttons Enum. * @param[in] image The image to use. */ - void SetButtonImage( Toolkit::TextSelectionPopup::Buttons button, Dali::Image image ); + void SetButtonImage( Toolkit::TextSelectionPopup::Buttons button, const std::string& image ); /** * @brief Retrieves the image of the given button used by the popup @@ -219,7 +216,7 @@ private: // Implementation * @param[in] button The button to get the image from * @return The image used for that button. */ - Dali::Image GetButtonImage( Toolkit::TextSelectionPopup::Buttons button ); + std::string GetButtonImage( Toolkit::TextSelectionPopup::Buttons button ); /** * @brief Sets the image for the pressed state of a popup option. @@ -273,13 +270,13 @@ private: // Data Dali::Toolkit::TableView mTableOfButtons; // Actor which holds all the buttons, sensitivity can be set on buttons via this actor - // Images to be used by the Popup buttons - Image mCutIconImage; - Image mCopyIconImage; - Image mPasteIconImage; - Image mClipboardIconImage; - Image mSelectIconImage; - Image mSelectAllIconImage; + // Images paths to be used by the Popup buttons + std::string mCutIconImage; + std::string mCopyIconImage; + std::string mPasteIconImage; + std::string mClipboardIconImage; + std::string mSelectIconImage; + std::string mSelectAllIconImage; Size mPopupMaxSize; // Maximum size of the Popup Size mOptionMaxSize; // Maximum size of an Option button diff --git a/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp b/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp index 0695af9..e4eb16b 100644 --- a/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp +++ b/dali-toolkit/internal/focus-manager/keyboard-focus-manager-impl.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 Samsung Electronics Co., Ltd. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -31,7 +31,6 @@ #include #include #include -#include #include #include #include diff --git a/dali-toolkit/internal/text/decorator/text-decorator.cpp b/dali-toolkit/internal/text/decorator/text-decorator.cpp index 5eafd84..a495768 100644 --- a/dali-toolkit/internal/text/decorator/text-decorator.cpp +++ b/dali-toolkit/internal/text/decorator/text-decorator.cpp @@ -25,7 +25,6 @@ #include #include #include -#include #include #include #include diff --git a/dali-toolkit/internal/visuals/image/image-visual.cpp b/dali-toolkit/internal/visuals/image/image-visual.cpp index 16038b4..7e196fa 100644 --- a/dali-toolkit/internal/visuals/image/image-visual.cpp +++ b/dali-toolkit/internal/visuals/image/image-visual.cpp @@ -498,7 +498,7 @@ void ImageVisual::GetNaturalSize( Vector2& naturalSize ) } else { - Image brokenImage = mFactoryCache.GetBrokenVisualImage(); + Texture brokenImage = mFactoryCache.GetBrokenVisualImage(); naturalSize.x = brokenImage.GetWidth(); naturalSize.y = brokenImage.GetWidth(); @@ -806,24 +806,20 @@ void ImageVisual::UploadComplete( bool loadingSuccess, int32_t textureId, Textur mPlacementActor.Reset(); } - if( loadingSuccess ) + if( !loadingSuccess ) { - Sampler sampler = Sampler::New(); - sampler.SetWrapMode( mWrapModeU, mWrapModeV ); - textureSet.SetSampler( 0u, sampler ); - mImpl->mRenderer.SetTextures(textureSet); - } - else - { - Image brokenImage = mFactoryCache.GetBrokenVisualImage(); + Texture brokenImage = mFactoryCache.GetBrokenVisualImage(); textureSet = TextureSet::New(); + textureSet.SetTexture(0u, brokenImage); mImpl->mRenderer.SetTextures( textureSet ); - TextureSetImage( textureSet, 0u, brokenImage ); - Sampler sampler = Sampler::New(); - sampler.SetWrapMode( mWrapModeU, mWrapModeV ); - textureSet.SetSampler( 0u, sampler ); } + + Sampler sampler = Sampler::New(); + sampler.SetWrapMode( mWrapModeU, mWrapModeV ); + textureSet.SetSampler( 0u, sampler ); + mImpl->mRenderer.SetTextures(textureSet); + } // Storing TextureSet needed when renderer staged. diff --git a/dali-toolkit/internal/visuals/image/image-visual.h b/dali-toolkit/internal/visuals/image/image-visual.h index 46e7bd9..4868a32 100644 --- a/dali-toolkit/internal/visuals/image/image-visual.h +++ b/dali-toolkit/internal/visuals/image/image-visual.h @@ -22,9 +22,7 @@ #include #include -#include #include -#include #include // INTERNAL INCLUDES diff --git a/dali-toolkit/internal/visuals/npatch/npatch-visual.cpp b/dali-toolkit/internal/visuals/npatch/npatch-visual.cpp old mode 100755 new mode 100644 index 0c89731..020f20a --- a/dali-toolkit/internal/visuals/npatch/npatch-visual.cpp +++ b/dali-toolkit/internal/visuals/npatch/npatch-visual.cpp @@ -619,8 +619,8 @@ void NPatchVisual::ApplyTextureAndUniforms() DALI_LOG_ERROR("The N patch image '%s' is not a valid N patch image\n", mImageUrl.GetUrl().c_str() ); textureSet = TextureSet::New(); - Image croppedImage = mFactoryCache.GetBrokenVisualImage(); - TextureSetImage( textureSet, 0u, croppedImage ); + Texture croppedImage = mFactoryCache.GetBrokenVisualImage(); + textureSet.SetTexture( 0u, croppedImage ); mImpl->mRenderer.RegisterProperty( "uFixed[0]", Vector2::ZERO ); mImpl->mRenderer.RegisterProperty( "uFixed[1]", Vector2::ZERO ); mImpl->mRenderer.RegisterProperty( "uFixed[2]", Vector2::ZERO ); diff --git a/dali-toolkit/internal/visuals/npatch/npatch-visual.h b/dali-toolkit/internal/visuals/npatch/npatch-visual.h index 4a82cfb..827e9cb 100644 --- a/dali-toolkit/internal/visuals/npatch/npatch-visual.h +++ b/dali-toolkit/internal/visuals/npatch/npatch-visual.h @@ -20,7 +20,6 @@ // EXTERNAL INCLUDES #include -#include #include #include #include diff --git a/dali-toolkit/internal/visuals/visual-factory-cache.cpp b/dali-toolkit/internal/visuals/visual-factory-cache.cpp index 854a43a..2db3a57 100644 --- a/dali-toolkit/internal/visuals/visual-factory-cache.cpp +++ b/dali-toolkit/internal/visuals/visual-factory-cache.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -19,7 +19,7 @@ // EXTERNAL INCLUDES #include -#include +#include // INTERNAL INCLUDES #include @@ -217,9 +217,21 @@ Geometry VisualFactoryCache::CreateGridGeometry( Uint16Pair gridSize ) return geometry; } -Image VisualFactoryCache::GetBrokenVisualImage() +Texture VisualFactoryCache::GetBrokenVisualImage() { - return ResourceImage::New( mBrokenImageUrl ); + if(!mBrokenImageTexture && mBrokenImageUrl.size()) + { + PixelData data; + Devel::PixelBuffer pixelBuffer = LoadImageFromFile( mBrokenImageUrl ); + if( pixelBuffer ) + { + data = Devel::PixelBuffer::Convert(pixelBuffer); // takes ownership of buffer + mBrokenImageTexture = Texture::New( Dali::TextureType::TEXTURE_2D, data.GetPixelFormat(), + data.GetWidth(), data.GetHeight() ); + mBrokenImageTexture.Upload( data ); + } + } + return mBrokenImageTexture; } void VisualFactoryCache::SetPreMultiplyOnLoad( bool preMultiply ) diff --git a/dali-toolkit/internal/visuals/visual-factory-cache.h b/dali-toolkit/internal/visuals/visual-factory-cache.h index f1822c1..18d4abc 100644 --- a/dali-toolkit/internal/visuals/visual-factory-cache.h +++ b/dali-toolkit/internal/visuals/visual-factory-cache.h @@ -32,7 +32,7 @@ namespace Dali { -class Image; +class Texture; namespace Toolkit { @@ -168,10 +168,10 @@ public: static Geometry CreateGridGeometry( Uint16Pair gridSize ); /** - * @brief Returns an image to be used when a visual has failed to correctly render - * @return The broken image handle. + * @brief Returns a new Texture to use when a visual has failed to correctly render + * @return The broken image texture. */ - Image GetBrokenVisualImage(); + Texture GetBrokenVisualImage(); /** * @copydoc Toolkit::VisualFactory::SetPreMultiplyOnLoad() @@ -246,6 +246,7 @@ private: ImageAtlasManagerPtr mAtlasManager; TextureManager mTextureManager; NPatchLoader mNPatchLoader; + Texture mBrokenImageTexture; SvgRasterizeThread* mSvgRasterizeThread; std::unique_ptr< VectorAnimationThread > mVectorAnimationThread; std::string mBrokenImageUrl; diff --git a/dali-toolkit/internal/visuals/visual-factory-impl.cpp b/dali-toolkit/internal/visuals/visual-factory-impl.cpp index 3966018..2531a84 100644 --- a/dali-toolkit/internal/visuals/visual-factory-impl.cpp +++ b/dali-toolkit/internal/visuals/visual-factory-impl.cpp @@ -19,7 +19,6 @@ // EXTERNAL INCLUDES #include -#include #include #include #include diff --git a/dali-toolkit/public-api/controls/buttons/button.cpp b/dali-toolkit/public-api/controls/buttons/button.cpp index 70377b3..2855636 100644 --- a/dali-toolkit/public-api/controls/buttons/button.cpp +++ b/dali-toolkit/public-api/controls/buttons/button.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -21,7 +21,6 @@ // EXTERNAL INCLUDES #include #include -#include // INTERNAL INCLUDES #include diff --git a/dali-toolkit/public-api/controls/buttons/push-button.cpp b/dali-toolkit/public-api/controls/buttons/push-button.cpp index 6a70aaf..e8ae5a1 100644 --- a/dali-toolkit/public-api/controls/buttons/push-button.cpp +++ b/dali-toolkit/public-api/controls/buttons/push-button.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -21,7 +21,6 @@ // EXTERNAL INCLUDES #include -#include // INTERNAL INCLUDES #include diff --git a/dali-toolkit/public-api/controls/control.h b/dali-toolkit/public-api/controls/control.h index ed68e15..1413bac 100644 --- a/dali-toolkit/public-api/controls/control.h +++ b/dali-toolkit/public-api/controls/control.h @@ -2,7 +2,7 @@ #define DALI_TOOLKIT_CONTROL_H /* - * Copyright (c) 2019 Samsung Electronics Co., Ltd. + * Copyright (c) 2020 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. @@ -26,7 +26,6 @@ #include #include #include -#include // INTERNAL INCLUDES #include diff --git a/dali-toolkit/public-api/controls/image-view/image-view.cpp b/dali-toolkit/public-api/controls/image-view/image-view.cpp index 78e7f39..f06b667 100644 --- a/dali-toolkit/public-api/controls/image-view/image-view.cpp +++ b/dali-toolkit/public-api/controls/image-view/image-view.cpp @@ -20,7 +20,6 @@ // EXTERNAL INCLUDES #include -#include #include // INTERNAL INCLUDES