From 76f7148df2d21c7862101226f9a21e4489e891f8 Mon Sep 17 00:00:00 2001 From: sunghyun kim Date: Thu, 16 May 2024 11:58:44 +0900 Subject: [PATCH] [NUI] Calculate desired size internally The desired size of the image view will be calculated internally. Therefore, the NUI is no longer calculated the desired size for fitting mode. related patches: https://review.tizen.org/gerrit/#/c/platform/core/uifw/dali-adaptor/+/307711/ https://review.tizen.org/gerrit/#/c/platform/core/uifw/dali-toolkit/+/307712/ --- .../src/public/BaseComponents/ImageView.cs | 37 ---------------------- 1 file changed, 37 deletions(-) diff --git a/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs b/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs index 3d9188a..dc18df2 100755 --- a/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs +++ b/src/Tizen.NUI/src/public/BaseComponents/ImageView.cs @@ -2216,43 +2216,6 @@ namespace Tizen.NUI.BaseComponents backgroundExtraDataUpdatedFlag &= ~BackgroundExtraDataUpdatedFlag.ContentsCornerRadius; backgroundExtraDataUpdatedFlag &= ~BackgroundExtraDataUpdatedFlag.ContentsBorderline; - // Do Fitting Buffer when desired dimension is set - // TODO : Couldn't we do this job in dali-engine side. - if (_desired_width != -1 && _desired_height != -1) - { - if (!string.IsNullOrEmpty(_resourceUrl)) - { - Size2D imageSize = ImageLoader.GetOriginalImageSize(_resourceUrl, true); - if (imageSize.Height > 0 && imageSize.Width > 0 && _desired_width > 0 && _desired_height > 0) - { - int adjustedDesiredWidth, adjustedDesiredHeight; - float aspectOfDesiredSize = (float)_desired_height / (float)_desired_width; - float aspectOfImageSize = (float)imageSize.Height / (float)imageSize.Width; - if (aspectOfImageSize > aspectOfDesiredSize) - { - adjustedDesiredWidth = _desired_width; - adjustedDesiredHeight = imageSize.Height * _desired_width / imageSize.Width; - } - else - { - adjustedDesiredWidth = imageSize.Width * _desired_height / imageSize.Height; - adjustedDesiredHeight = _desired_height; - } - - PropertyValue returnWidth = new PropertyValue(adjustedDesiredWidth); - cachedImagePropertyMap[ImageVisualProperty.DesiredWidth] = returnWidth; - returnWidth?.Dispose(); - PropertyValue returnHeight = new PropertyValue(adjustedDesiredHeight); - cachedImagePropertyMap[ImageVisualProperty.DesiredHeight] = returnHeight; - returnHeight?.Dispose(); - PropertyValue scaleToFit = new PropertyValue((int)FittingModeType.ScaleToFill); - cachedImagePropertyMap[ImageVisualProperty.FittingMode] = scaleToFit; - scaleToFit?.Dispose(); - } - imageSize?.Dispose(); - } - } - UpdateImageMap(); } -- 2.7.4