/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
bool zeroPadding = (padding == Extents());
- Vector2 naturalSize;
- mVisual.GetNaturalSize(naturalSize);
-
Dali::LayoutDirection::Type layoutDirection = static_cast<Dali::LayoutDirection::Type>(
Self().GetProperty(Dali::Actor::Property::LAYOUT_DIRECTION).Get<int>());
if(Dali::LayoutDirection::RIGHT_TO_LEFT == layoutDirection)
Vector2 finalSize = size - Vector2(padding.start + padding.end, padding.top + padding.bottom);
Vector2 finalOffset = Vector2(padding.start, padding.top);
- ApplyFittingMode(finalSize, naturalSize, finalOffset, zeroPadding, transformMap);
+ ApplyFittingMode(finalSize, finalOffset, zeroPadding, transformMap);
mVisual.SetTransformAndSize(transformMap, size);
}
}
-void ImageView::ApplyFittingMode(Vector2 finalSize, Vector2 naturalSize, Vector2 finalOffset, bool zeroPadding, Property::Map& transformMap)
+void ImageView::ApplyFittingMode(Vector2 finalSize, Vector2 finalOffset, bool zeroPadding, Property::Map& transformMap)
{
Visual::FittingMode fittingMode = Toolkit::GetImplementation(mVisual).GetFittingMode();
{
mImageVisualPaddingSetByTransform = true;
+ Vector2 naturalSize;
+ // NaturalSize will not be used for FILL fitting mode, which is default.
+ // Skip GetNaturalSize
+ if(fittingMode != Visual::FittingMode::FILL)
+ {
+ mVisual.GetNaturalSize(naturalSize);
+ }
+
// If FittingMode use FIT_WIDTH or FIT_HEIGTH, it need to change proper fittingMode
if(fittingMode == Visual::FittingMode::FIT_WIDTH)
{
#define DALI_TOOLKIT_INTERNAL_IMAGE_VIEW_H
/*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2023 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.
/**
* @brief Apply fittingMode
* param[in] finalSize The size for fittingMode
- * param[in] textureSize The size of texture
* param[in] offset The offset for fittingMode
* param[in] zeroPadding whether padding is zero
* param[in] transformMap The map for fitting image
*/
- void ApplyFittingMode(Vector2 finalSize, Vector2 textureSize, Vector2 offset, bool zeroPadding, Property::Map& transformMap);
+ void ApplyFittingMode(Vector2 finalSize, Vector2 offset, bool zeroPadding, Property::Map& transformMap);
private:
// Undefined