From: Eunki, Hong Date: Tue, 4 Oct 2022 09:27:28 +0000 (+0900) Subject: Revert "[Tizen](SVG) Support desired size" X-Git-Tag: accepted/tizen/7.0/unified/hotfix/20221116.105956~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d395ce821896f06bee774a90ac2c1a60ddc43935;hp=7b808962b9b0eb2b79d5a8fa4fce3dad8bb8992c;p=platform%2Fcore%2Fuifw%2Fdali-toolkit.git Revert "[Tizen](SVG) Support desired size" This reverts commit 7b808962b9b0eb2b79d5a8fa4fce3dad8bb8992c. --- diff --git a/automated-tests/src/dali-toolkit/utc-Dali-ImageView.cpp b/automated-tests/src/dali-toolkit/utc-Dali-ImageView.cpp index 085d4f1..1559ae7 100644 --- a/automated-tests/src/dali-toolkit/utc-Dali-ImageView.cpp +++ b/automated-tests/src/dali-toolkit/utc-Dali-ImageView.cpp @@ -3177,66 +3177,6 @@ int UtcDaliImageViewTVGLoading(void) END_TEST; } -int UtcDaliImageViewSvgDesiredSize01(void) -{ - ToolkitTestApplication application; - - TestGlAbstraction& gl = application.GetGlAbstraction(); - TraceCallStack& textureTrace = gl.GetTextureTrace(); - textureTrace.Enable(true); - - int desiredWidth = 100, desiredHeight = 150; - ImageView imageView = ImageView::New(TEST_SVG_FILE_NAME, ImageDimensions(desiredWidth, desiredHeight)); - - application.GetScene().Add(imageView); - - application.SendNotification(); - - // Wait for loading & rasterization - DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION); - - application.SendNotification(); - application.Render(16); - - { - std::stringstream out; - out << GL_TEXTURE_2D << ", " << 0u << ", " << desiredWidth << ", " << desiredHeight; - DALI_TEST_CHECK(textureTrace.FindMethodAndParams("TexImage2D", out.str().c_str())); - } - - END_TEST; -} - -int UtcDaliImageViewSvgDesiredSize02(void) -{ - ToolkitTestApplication application; - - TestGlAbstraction& gl = application.GetGlAbstraction(); - TraceCallStack& textureTrace = gl.GetTextureTrace(); - textureTrace.Enable(true); - - int desiredWidth = 150, desiredHeight = 100; - ImageView imageView = ImageView::New(); - imageView[ImageView::Property::IMAGE] = Property::Map().Add("url", TEST_SVG_FILE_NAME).Add("desiredWidth", desiredWidth).Add("desiredHeight", desiredHeight); - application.GetScene().Add(imageView); - - application.SendNotification(); - - // Wait for loading & rasterization - DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(2), true, TEST_LOCATION); - - application.SendNotification(); - application.Render(16); - - { - std::stringstream out; - out << GL_TEXTURE_2D << ", " << 0u << ", " << desiredWidth << ", " << desiredHeight; - DALI_TEST_CHECK(textureTrace.FindMethodAndParams("TexImage2D", out.str().c_str())); - } - - END_TEST; -} - int UtcDaliImageViewImageLoadFailure01(void) { ToolkitTestApplication application; diff --git a/dali-toolkit/internal/visuals/svg/svg-visual.cpp b/dali-toolkit/internal/visuals/svg/svg-visual.cpp index cd59107..a0ced87 100644 --- a/dali-toolkit/internal/visuals/svg/svg-visual.cpp +++ b/dali-toolkit/internal/visuals/svg/svg-visual.cpp @@ -48,20 +48,20 @@ const Dali::Vector4 FULL_TEXTURE_RECT(0.f, 0.f, 1.f, 1.f); SvgVisualPtr SvgVisual::New(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl, const Property::Map& properties) { - SvgVisualPtr svgVisual(new SvgVisual(factoryCache, shaderFactory, imageUrl, ImageDimensions{})); + SvgVisualPtr svgVisual(new SvgVisual(factoryCache, shaderFactory, imageUrl)); svgVisual->SetProperties(properties); svgVisual->Initialize(); return svgVisual; } -SvgVisualPtr SvgVisual::New(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl, ImageDimensions size) +SvgVisualPtr SvgVisual::New(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl) { - SvgVisualPtr svgVisual(new SvgVisual(factoryCache, shaderFactory, imageUrl, size)); + SvgVisualPtr svgVisual(new SvgVisual(factoryCache, shaderFactory, imageUrl)); svgVisual->Initialize(); return svgVisual; } -SvgVisual::SvgVisual(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl, ImageDimensions size) +SvgVisual::SvgVisual(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl) : Visual::Base(factoryCache, Visual::FittingMode::FILL, Toolkit::Visual::SVG), mImageVisualShaderFactory(shaderFactory), mAtlasRect(FULL_TEXTURE_RECT), @@ -71,7 +71,6 @@ SvgVisual::SvgVisual(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& mDefaultHeight(0), mPlacementActor(), mRasterizedSize(Vector2::ZERO), - mDesiredSize(size), mLoadFailed(false), mAttemptAtlasing(false) { @@ -123,14 +122,6 @@ void SvgVisual::DoSetProperties(const Property::Map& propertyMap) { DoSetProperty(Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING, keyValue.second); } - else if(keyValue.first == IMAGE_DESIRED_WIDTH) - { - DoSetProperty(Toolkit::ImageVisual::Property::DESIRED_WIDTH, keyValue.second); - } - else if(keyValue.first == IMAGE_DESIRED_HEIGHT) - { - DoSetProperty(Toolkit::ImageVisual::Property::DESIRED_HEIGHT, keyValue.second); - } } } @@ -163,24 +154,6 @@ void SvgVisual::DoSetProperty(Property::Index index, const Property::Value& valu } break; } - case Toolkit::ImageVisual::Property::DESIRED_WIDTH: - { - int32_t desiredWidth = 0; - if(value.Get(desiredWidth)) - { - mDesiredSize.SetWidth(desiredWidth); - } - break; - } - case Toolkit::ImageVisual::Property::DESIRED_HEIGHT: - { - int32_t desiredHeight = 0; - if(value.Get(desiredHeight)) - { - mDesiredSize.SetHeight(desiredHeight); - } - break; - } } } @@ -229,12 +202,7 @@ void SvgVisual::DoSetOffScene(Actor& actor) void SvgVisual::GetNaturalSize(Vector2& naturalSize) { - if(mDesiredSize.GetWidth() > 0 && mDesiredSize.GetHeight() > 0) - { - naturalSize.x = mDesiredSize.GetWidth(); - naturalSize.y = mDesiredSize.GetHeight(); - } - else if(mLoadFailed && mImpl->mRenderer) + if(mLoadFailed && mImpl->mRenderer) { // Load failed, use broken image size auto textureSet = mImpl->mRenderer.GetTextures(); @@ -266,8 +234,6 @@ void SvgVisual::DoCreatePropertyMap(Property::Map& map) const map.Insert(Toolkit::ImageVisual::Property::ATLASING, mAttemptAtlasing); } map.Insert(Toolkit::ImageVisual::Property::SYNCHRONOUS_LOADING, IsSynchronousLoadingRequired()); - map.Insert(Toolkit::ImageVisual::Property::DESIRED_WIDTH, mDesiredSize.GetWidth()); - map.Insert(Toolkit::ImageVisual::Property::DESIRED_HEIGHT, mDesiredSize.GetHeight()); } void SvgVisual::DoCreateInstancePropertyMap(Property::Map& map) const @@ -401,24 +367,14 @@ void SvgVisual::ApplyRasterizedImage(PixelData rasterizedPixelData, bool success void SvgVisual::OnSetTransform() { + Vector2 visualSize = mImpl->mTransform.GetVisualSize(mImpl->mControlSize); + if(IsOnScene() && !mLoadFailed) { - Vector2 size; - if(mDesiredSize.GetWidth() > 0 && mDesiredSize.GetHeight() > 0) - { - // Use desired size - size = Vector2(mDesiredSize.GetWidth(), mDesiredSize.GetHeight()); - } - else - { - // Use visual size - size = mImpl->mTransform.GetVisualSize(mImpl->mControlSize); - } - - if(size != mRasterizedSize || mDefaultWidth == 0 || mDefaultHeight == 0) + if(visualSize != mRasterizedSize || mDefaultWidth == 0 || mDefaultHeight == 0) { - mRasterizedSize = size; - AddRasterizationTask(size); + mRasterizedSize = visualSize; + AddRasterizationTask(visualSize); } } diff --git a/dali-toolkit/internal/visuals/svg/svg-visual.h b/dali-toolkit/internal/visuals/svg/svg-visual.h index 93decde..5c606f1 100644 --- a/dali-toolkit/internal/visuals/svg/svg-visual.h +++ b/dali-toolkit/internal/visuals/svg/svg-visual.h @@ -72,10 +72,9 @@ public: * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object * @param[in] shaderFactory The ImageVisualShaderFactory object * @param[in] imageUrl The URL to svg resource to use - * @param[in] size The width and height of the rasterized buffer. The visual size will be used if these are 0. * @return A smart-pointer to the newly allocated visual. */ - static SvgVisualPtr New(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl, ImageDimensions size = ImageDimensions()); + static SvgVisualPtr New(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl); public: // from Visual /** @@ -105,9 +104,8 @@ protected: * @param[in] factoryCache A pointer pointing to the VisualFactoryCache object * @param[in] shaderFactory The ImageVisualShaderFactory object * @param[in] imageUrl The URL to svg resource to use - * @param[in] size The width and height of the rasterized buffer. The visual size will be used if these are 0. */ - SvgVisual(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl, ImageDimensions size); + SvgVisual(VisualFactoryCache& factoryCache, ImageVisualShaderFactory& shaderFactory, const VisualUrl& imageUrl); /** * @brief A reference counted object may only be deleted by calling Unreference(). @@ -188,7 +186,6 @@ private: uint32_t mDefaultHeight; WeakHandle mPlacementActor; Vector2 mRasterizedSize; - Dali::ImageDimensions mDesiredSize{}; bool mLoadFailed; bool mAttemptAtlasing; ///< If true will attempt atlasing, otherwise create unique texture }; diff --git a/dali-toolkit/internal/visuals/visual-factory-impl.cpp b/dali-toolkit/internal/visuals/visual-factory-impl.cpp index 60fb25e..f5bed54 100644 --- a/dali-toolkit/internal/visuals/visual-factory-impl.cpp +++ b/dali-toolkit/internal/visuals/visual-factory-impl.cpp @@ -332,7 +332,7 @@ Toolkit::Visual::Base VisualFactory::CreateVisual(const std::string& url, ImageD case VisualUrl::TVG: case VisualUrl::SVG: { - visualPtr = SvgVisual::New(GetFactoryCache(), GetImageVisualShaderFactory(), visualUrl, size); + visualPtr = SvgVisual::New(GetFactoryCache(), GetImageVisualShaderFactory(), visualUrl); break; } case VisualUrl::GIF: