END_TEST;
}
+int UtcDaliImageVisualOrientationCorrectionCache(void)
+{
+ ToolkitTestApplication application;
+ tet_infoline("UtcDaliImageVisualOrientationCorrectionCache Check orientation correction value give effort to cache hit");
+
+ VisualFactory factory = VisualFactory::Get();
+ tet_infoline("Create visual with Orientation correction set OFF");
+ Property::Map propertyMap;
+ propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE);
+ propertyMap.Insert(ImageVisual::Property::URL, TEST_ROTATED_IMAGE);
+ propertyMap.Insert("orientationCorrection", false);
+ Visual::Base imageVisual1 = factory.CreateVisual(propertyMap);
+
+ tet_infoline("Create control for visual, need to loaded it");
+ DummyControl actor1 = DummyControl::New(true);
+ Impl::DummyControl& dummyImpl1 = static_cast<Impl::DummyControl&>(actor1.GetImplementation());
+ dummyImpl1.RegisterVisual(DummyControl::Property::TEST_VISUAL, imageVisual1);
+ application.GetScene().Add(actor1);
+
+ // Wait for image to load
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+
+ tet_infoline("Create visual with Orientation correction set ON ");
+ propertyMap.Clear();
+ propertyMap.Insert(Visual::Property::TYPE, Visual::IMAGE);
+ propertyMap.Insert(ImageVisual::Property::URL, TEST_ROTATED_IMAGE);
+ propertyMap.Insert(ImageVisual::Property::ORIENTATION_CORRECTION, true);
+ Visual::Base imageVisual2 = factory.CreateVisual(propertyMap);
+
+ tet_infoline("Create control for visual2, need to loaded it");
+ DummyControl actor2 = DummyControl::New(true);
+ Impl::DummyControl& dummyImpl2 = static_cast<Impl::DummyControl&>(actor2.GetImplementation());
+ dummyImpl2.RegisterVisual(DummyControl::Property::TEST_VISUAL, imageVisual2);
+ application.GetScene().Add(actor2);
+
+ // Wait for image to load. Check whether each correction and non-correction image have difference size.
+ DALI_TEST_EQUALS(Test::WaitForEventThreadTrigger(1), true, TEST_LOCATION);
+
+ Vector2 visual1NaturalSize;
+ imageVisual1.GetNaturalSize(visual1NaturalSize);
+ Vector2 visual2NaturalSize;
+ imageVisual2.GetNaturalSize(visual2NaturalSize);
+
+ DALI_TEST_NOT_EQUALS(visual1NaturalSize.width, visual1NaturalSize.height, 0.01f, TEST_LOCATION); // Width and Height must be different for this test.
+
+ tet_infoline("Confirm that visual has rotated");
+ DALI_TEST_EQUALS(visual1NaturalSize.width, visual2NaturalSize.height, TEST_LOCATION);
+ DALI_TEST_EQUALS(visual1NaturalSize.height, visual2NaturalSize.width, TEST_LOCATION);
+
+ END_TEST;
+}
+
int UtcDaliImageVisualCustomShader(void)
{
ToolkitTestApplication application;
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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 Dali::SamplingMode::Type samplingMode,
const TextureCacheManager::TextureId maskTextureId,
const bool cropToMask,
+ const bool orientationCorrection,
const uint32_t frameIndex)
{
std::vector<std::uint8_t> hashTarget;
*hashTargetPtr = (fittingMode << 3u) | (samplingMode);
}
+ // Append whether we will not correction orientation. We don't do additional job when it is true, the general cases.
+ if(!orientationCorrection)
+ {
+ auto textureIdIndex = hashTarget.size();
+ hashTarget.resize(hashTarget.size() + 1u);
+ std::uint8_t* hashTargetPtr = reinterpret_cast<std::uint8_t*>(&(hashTarget[textureIdIndex]));
+ *hashTargetPtr++ = 'F';
+ }
+
if(maskTextureId != INVALID_TEXTURE_ID)
{
auto textureIdIndex = hashTarget.size();
const TextureCacheManager::StorageType storageType,
const TextureCacheManager::TextureId maskTextureId,
const bool cropToMask,
+ const bool orientationCorrection,
const TextureCacheManager::MultiplyOnLoad preMultiplyOnLoad,
const bool isAnimatedImage,
const uint32_t frameIndex)
(isAnimatedImage == textureInfo.isAnimatedImageFormat) &&
(storageType == textureInfo.storageType) &&
(frameIndex == textureInfo.frameIndex) &&
+ (orientationCorrection == textureInfo.orientationCorrection) &&
((size.GetWidth() == 0 && size.GetHeight() == 0) ||
(fittingMode == textureInfo.fittingMode &&
samplingMode == textureInfo.samplingMode)))
#define DALI_TOOLKIT_TEXTURE_CACHE_MANAGER_H
/*
- * Copyright (c) 2023 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2024 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 Dali::SamplingMode::Type samplingMode,
const TextureCacheManager::TextureId maskTextureId,
const bool cropToMask,
+ const bool orientationCorrection,
const uint32_t frameIndex);
/**
const TextureCacheManager::StorageType storageType,
const TextureCacheManager::TextureId maskTextureId,
const bool cropToMask,
+ const bool orientationCorrection,
const TextureCacheManager::MultiplyOnLoad preMultiplyOnLoad,
const bool isAnimatedImage,
const uint32_t frameIndex);
if(storageType != TextureManager::StorageType::RETURN_PIXEL_BUFFER)
{
- textureHash = mTextureCacheManager.GenerateHash(url, desiredSize, fittingMode, samplingMode, maskTextureId, cropToMask, frameIndex);
+ textureHash = mTextureCacheManager.GenerateHash(url, desiredSize, fittingMode, samplingMode, maskTextureId, cropToMask, orientationCorrection, frameIndex);
// Look up the texture by hash. Note: The extra parameters are used in case of a hash collision.
- cacheIndex = mTextureCacheManager.FindCachedTexture(textureHash, url, desiredSize, fittingMode, samplingMode, storageType, maskTextureId, cropToMask, preMultiplyOnLoad, (animatedImageLoading) ? true : false, frameIndex);
+ cacheIndex = mTextureCacheManager.FindCachedTexture(textureHash, url, desiredSize, fittingMode, samplingMode, storageType, maskTextureId, cropToMask, orientationCorrection, preMultiplyOnLoad, (animatedImageLoading) ? true : false, frameIndex);
}
TextureManager::TextureId textureId = INVALID_TEXTURE_ID;