utc-Dali-Matrix3.cpp
utc-Dali-MeshMaterial.cpp
utc-Dali-Mutex.cpp
- utc-Dali-NativeImage.cpp
utc-Dali-ObjectRegistry.cpp
utc-Dali-PanGesture.cpp
utc-Dali-PanGestureDetector.cpp
/*
- * 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.
DALI_TEST_EQUALS(image3.GetWidth(), testSize.x, TEST_LOCATION);
DALI_TEST_EQUALS(image3.GetHeight(), testSize.y, TEST_LOCATION);
- testSize = Vector2(32.0f, 64.0f);
- PrepareResourceImage( application, testSize.x, testSize.y, Pixel::RGBA8888 );
- TestNativeImagePointer nativeImage = TestNativeImage::New(testSize.x, testSize.y);
- Image image4 = NativeImage::New(*(nativeImage.Get()));
- DALI_TEST_EQUALS(image4.GetWidth(), testSize.x, TEST_LOCATION);
- DALI_TEST_EQUALS(image4.GetHeight(), testSize.y, TEST_LOCATION);
-
END_TEST;
}
+++ /dev/null
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-#include <iostream>
-#include <algorithm>
-#include <stdlib.h>
-#include <dali/public-api/dali-core.h>
-#include <dali-test-suite-utils.h>
-#include <test-native-image.h>
-#include <test-intrusive-ptr.h>
-
-using namespace Dali;
-
-void utc_dali_native_image_startup(void)
-{
- test_return_value = TET_UNDEF;
-}
-
-void utc_dali_native_image_cleanup(void)
-{
- test_return_value = TET_PASS;
-}
-
-IntrusivePtr<TestNativeImage> Creator()
-{
- return TestNativeImage::New(10,10);
-}
-
-int UtcDaliIntrusivePtrTestNativeImage(void)
-{
- UtcCoverageIntrusivePtr<TestNativeImage> pointer;
-
- pointer.Check(Creator);
-
- END_TEST;
-}
-
-int UtcDaliNativeImageNew(void)
-{
- TestApplication application;
-
- tet_infoline("UtcDaliNativeImageNew - NativeImage::New(NativeImageInterface&)");
-
- // invoke default handle constructor
- NativeImage image;
- TestNativeImagePointer nativeImage = TestNativeImage::New(16, 16);
-
- DALI_TEST_CHECK( !image );
-
- // initialise handle
- image = NativeImage::New(*(nativeImage.Get()));
-
- DALI_TEST_CHECK( image );
- END_TEST;
-}
-
-int UtcDaliNativeImageCopyConstructor(void)
-{
- TestApplication application;
-
- tet_infoline("UtcDaliNativeImageCopyConstructor - NativeImage::NativeImage( const NativeImage& )");
-
- NativeImage image1;
- DALI_TEST_CHECK( !image1 );
-
- TestNativeImagePointer nativeImage = TestNativeImage::New(16, 16);
- image1 = NativeImage::New(*(nativeImage.Get()));
- NativeImage image2( image1 );
-
- DALI_TEST_CHECK( image2 );
- DALI_TEST_EQUALS( image1, image2, TEST_LOCATION );
-
- END_TEST;
-}
-
-int UtcDaliNativeImageDownCast(void)
-{
- TestApplication application;
- tet_infoline("Testing Dali::Image::DownCast()");
-
- TestNativeImagePointer nativeImage = TestNativeImage::New(16, 16);
- NativeImage image = NativeImage::New(*(nativeImage.Get()));
-
- BaseHandle object(image);
-
- NativeImage image2 = NativeImage::DownCast(object);
- DALI_TEST_CHECK(image2);
-
- NativeImage image3 = DownCast< NativeImage >(object);
- DALI_TEST_CHECK(image3);
-
- BaseHandle unInitializedObject;
- NativeImage image4 = NativeImage::DownCast(unInitializedObject);
- DALI_TEST_CHECK(!image4);
-
- NativeImage image5 = DownCast< NativeImage >(unInitializedObject);
- DALI_TEST_CHECK(!image5);
-
- Image image6 = NativeImage::New(*(nativeImage.Get()));
- NativeImage image7 = NativeImage::DownCast(image6);
- DALI_TEST_CHECK(image7);
- END_TEST;
-}
-
-int UtcDaliNativeImageExtensionP(void)
-{
- TestApplication application;
- tet_infoline( "Testing Dali::NativeImage::GenerateGlTexture()" );
-
- TestNativeImagePointer testNativeImage = TestNativeImage::New( 16, 16 );
- DALI_TEST_CHECK( testNativeImage );
- DALI_TEST_CHECK( NULL != testNativeImage->GetExtension() );
-
- TestNativeImageNoExtPointer testNativeImage2 = TestNativeImageNoExt::New( 16, 16 );
- DALI_TEST_CHECK( testNativeImage2 );
- DALI_TEST_CHECK( NULL == testNativeImage2->GetExtension() );
-
- END_TEST;
-}
-
-int UtcDaliNativeImageGetCustomFragmentPreFixP(void)
-{
- TestApplication application;
- TestNativeImagePointer nativeImageInterface = TestNativeImage::New( 16, 16 );
- NativeImage nativeImage = NativeImage::New( *(nativeImageInterface.Get()) );
-
- const char* preFix = "#extension GL_OES_EGL_image_external:require\n";
- DALI_TEST_EQUALS( nativeImage.GetCustomFragmentPreFix(), preFix, TEST_LOCATION );
- END_TEST;
-}
-
-int UtcDaliNativeImageGetCustomSamplerTypenameP(void)
-{
- TestApplication application;
- TestNativeImagePointer nativeImageInterface = TestNativeImage::New( 16, 16 );
- NativeImage nativeImage = NativeImage::New( *(nativeImageInterface.Get()) );
-
- const char* samplerTypename = "samplerExternalOES";
- DALI_TEST_EQUALS( nativeImage.GetCustomSamplerTypename(), samplerTypename, TEST_LOCATION );
- END_TEST;
-}
-
-
-
-int UtcDaliNativeImageTestCreationFailure(void)
-{
- TestApplication application;
- TestNativeImagePointer nativeImageInterface = TestNativeImage::New( 16, 16 );
- NativeImage nativeImage = NativeImage::New( *(nativeImageInterface.Get()) );
-
- tet_printf("Test what happens when GlExtensionCreate is called, and returns false to indicate an error\n");
-
- nativeImageInterface->SetGlExtensionCreateResult( false );
-
- Actor actor = CreateRenderableActor( nativeImage );
- actor.SetProperty( Actor::Property::PARENT_ORIGIN, ParentOrigin::CENTER );
- Stage::GetCurrent().Add( actor );
-
- TestGlAbstraction& gl = application.GetGlAbstraction();
- TraceCallStack& textureTrace = gl.GetTextureTrace();
- textureTrace.Reset();
- textureTrace.Enable(true);
-
- TraceCallStack& drawTrace = gl.GetDrawTrace();
- drawTrace.Reset();
- drawTrace.Enable(true);
-
- application.SendNotification();
- application.Render();
-
- // Test that nothing was rendered
- //GlExtensionCreate() called twice, once at initialization and once when trying to bind the texture
- DALI_TEST_EQUALS( nativeImageInterface->mExtensionCreateCalls, 2, TEST_LOCATION );
- DALI_TEST_EQUALS( nativeImageInterface->mTargetTextureCalls, 0, TEST_LOCATION );
- DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), false, TEST_LOCATION );
- DALI_TEST_EQUALS( drawTrace.FindMethod("DrawElements") || drawTrace.FindMethod("DrawArrays"), false, TEST_LOCATION );
-
- textureTrace.Reset();
- drawTrace.Reset();
-
- nativeImageInterface->SetGlExtensionCreateResult( true );
- actor.SetProperty( Actor::Property::POSITION, Vector3( 0, 0, 1 ));
- application.SendNotification();
- application.Render();
-
- // This time around, the bind and draw should occur following the call to nativeImage->GlExtensionCreate.
- DALI_TEST_EQUALS( nativeImageInterface->mExtensionCreateCalls, 3, TEST_LOCATION );
- DALI_TEST_EQUALS( nativeImageInterface->mTargetTextureCalls, 1, TEST_LOCATION );
- DALI_TEST_EQUALS( textureTrace.FindMethod("BindTexture"), true, TEST_LOCATION );
- DALI_TEST_EQUALS( drawTrace.FindMethod("DrawElements") || drawTrace.FindMethod("DrawArrays"), true, TEST_LOCATION );
-
- END_TEST;
-}
+++ /dev/null
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali/internal/event/images/native-image-impl.h>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/common/dali-common.h>
-#include <dali/public-api/object/type-registry.h>
-#include <dali/integration-api/debug.h>
-#include <dali/internal/event/common/stage-impl.h>
-#include <dali/devel-api/images/native-image-interface-extension.h>
-
-using namespace Dali::Integration;
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-NativeImage::NativeImage( NativeImageInterface& resourceData )
-: Image()
-{
- NativeImageInterface::Extension* extension = resourceData.GetExtension();
- if( extension != NULL )
- {
- mCustomFragmentPreFix = extension->GetCustomFragmentPreFix();
- mCustomSamplerTypename = extension->GetCustomSamplerTypename();
- }
-}
-
-NativeImagePtr NativeImage::New( NativeImageInterface& resourceData )
-{
- NativeImagePtr image = new NativeImage( resourceData );
- image->Initialize();
-
- image->mWidth = resourceData.GetWidth();
- image->mHeight = resourceData.GetHeight();
-
- image->mTexture = Texture::New( resourceData );
- return image;
-}
-
-NativeImage::~NativeImage()
-{
-}
-
-const char* NativeImage::GetCustomFragmentPreFix()
-{
- if( mCustomFragmentPreFix.empty() )
- {
- return NULL;
- }
-
- return mCustomFragmentPreFix.c_str();
-}
-
-const char* NativeImage::GetCustomSamplerTypename()
-{
- if( mCustomSamplerTypename.empty() )
- {
- return NULL;
- }
-
- return mCustomSamplerTypename.c_str();
-}
-
-} // namespace Internal
-
-} // namespace Dali
+++ /dev/null
-#ifndef DALI_INTERNAL_NATIVE_IMAGE_H
-#define DALI_INTERNAL_NATIVE_IMAGE_H
-
-/*
- * Copyright (c) 2019 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// EXTERNAL INCLUDES
-#include <string>
-
-// INTERNAL INCLUDES
-#include <dali/public-api/images/native-image.h>
-#include <dali/internal/event/images/image-impl.h>
-
-namespace Dali
-{
-
-namespace Internal
-{
-
-class NativeImage;
-typedef IntrusivePtr<NativeImage> NativeImagePtr;
-
-/**
- * @copydoc Dali::NativeImage
- */
-class NativeImage : public Image
-{
-public:
-
- /**
- * Creates object by using native resources
- * the maximum size of the image is limited by GL_MAX_TEXTURE_SIZE
- * @param [in] nativeImageInterface An reference to the object of the interface implementation.
- * @return a pointer to a newly created object.
- */
- static NativeImagePtr New( NativeImageInterface& nativeImageInterface );
-
-protected:
-
- /**
- * Constructor
- */
- NativeImage( NativeImageInterface& nativeImageInterface );
-
- /**
- * A reference counted object may only be deleted by calling Unreference()
- */
- virtual ~NativeImage();
-
-public:
-
- /**
- * @copydoc Dali::NativeImageInterface::Extension::GetCustomFragmentPreFix()
- */
- const char* GetCustomFragmentPreFix();
-
- /**
- * @copydoc Dali::NativeImageInterface::Extension::GetCustomSamplerTypename()
- */
- const char* GetCustomSamplerTypename();
-
-private:
- std::string mCustomFragmentPreFix;
- std::string mCustomSamplerTypename;
-};
-
-} // namespace Internal
-
-/**
- * Helper methods for public API.
- */
-inline Internal::NativeImage& GetImplementation(Dali::NativeImage& image)
-{
- DALI_ASSERT_ALWAYS( image && "Image handle is empty" );
-
- BaseObject& handle = image.GetBaseObject();
-
- return static_cast<Internal::NativeImage&>(handle);
-}
-
-inline const Internal::NativeImage& GetImplementation(const Dali::NativeImage& image)
-{
- DALI_ASSERT_ALWAYS( image && "Image handle is empty" );
-
- const BaseObject& handle = image.GetBaseObject();
-
- return static_cast<const Internal::NativeImage&>(handle);
-}
-
-} // namespace Dali
-#endif // DALI_INTERNAL_NATIVE_IMAGE_H
${internal_src_dir}/event/images/image-impl.cpp
${internal_src_dir}/event/images/frame-buffer-image-impl.cpp
${internal_src_dir}/event/images/resource-image-impl.cpp
- ${internal_src_dir}/event/images/native-image-impl.cpp
${internal_src_dir}/event/images/pixel-data-impl.cpp
${internal_src_dir}/event/render-tasks/render-task-impl.cpp
${internal_src_dir}/event/render-tasks/render-task-list-impl.cpp
#include <dali/public-api/images/frame-buffer-image.h>
#include <dali/public-api/images/image.h>
-#include <dali/public-api/images/native-image.h>
#include <dali/public-api/images/native-image-interface.h>
#include <dali/public-api/images/resource-image.h>
#include <dali/public-api/images/pixel.h>
${public_api_src_dir}/images/pixel-data.cpp
${public_api_src_dir}/images/frame-buffer-image.cpp
${public_api_src_dir}/images/resource-image.cpp
- ${public_api_src_dir}/images/native-image.cpp
${public_api_src_dir}/math/compile-time-math.cpp
${public_api_src_dir}/math/degree.cpp
${public_api_src_dir}/math/matrix.cpp
${public_api_src_dir}/images/pixel.h
${public_api_src_dir}/images/pixel-data.h
${public_api_src_dir}/images/resource-image.h
- ${public_api_src_dir}/images/native-image.h
${public_api_src_dir}/images/native-image-interface.h
)
+++ /dev/null
-/*
- * Copyright (c) 2015 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// CLASS HEADER
-#include <dali/public-api/images/native-image.h>
-
-// INTERNAL INCLUDES
-#include <dali/internal/event/images/native-image-impl.h>
-
-namespace Dali
-{
-
-NativeImage::NativeImage()
-{
-}
-
-NativeImage::NativeImage(Internal::NativeImage* internal)
-: Image(internal)
-{
-}
-
-NativeImage::~NativeImage()
-{
-}
-
-NativeImage::NativeImage( const NativeImage& handle )
-: Image(handle)
-{
-}
-
-NativeImage& NativeImage::operator=( const NativeImage& rhs )
-{
- BaseHandle::operator=(rhs);
- return *this;
-}
-
-void NativeImage::CreateGlTexture()
-{
- //Nothing to do here. The texture is created immediately.
-}
-
-NativeImage NativeImage::New( NativeImageInterface& resourceData )
-{
- Internal::NativeImagePtr internal = Internal::NativeImage::New( resourceData );
- return NativeImage(internal.Get());
-}
-
-NativeImage NativeImage::DownCast( BaseHandle handle )
-{
- return NativeImage( dynamic_cast<Internal::NativeImage*>( handle.GetObjectPtr()) );
-}
-
-const char* NativeImage::GetCustomSamplerTypename()
-{
- return GetImplementation(*this).GetCustomSamplerTypename();
-}
-
-const char* NativeImage::GetCustomFragmentPreFix()
-{
- return GetImplementation(*this).GetCustomFragmentPreFix();
-}
-
-} // namespace Dali
+++ /dev/null
-#ifndef DALI_NATIVE_IMAGE_H
-#define DALI_NATIVE_IMAGE_H
-
-/*
- * Copyright (c) 2019 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.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- *
- */
-
-// INTERNAL INCLUDES
-#include <dali/public-api/images/image.h>
-#include <dali/public-api/images/native-image-interface.h>
-
-namespace Dali
-{
-/**
- * @addtogroup dali_core_images
- * @{
- */
-
-namespace Internal DALI_INTERNAL
-{
-class NativeImage;
-}
-
-/**
- * @DEPRECATED_1_2.41
- *
- * @brief NativeImage represents a platform specific image resource.
- *
- * Its data is provided by native resources, such as shared bitmap memory or pixmap.
- * @SINCE_1_0.0
- */
-class DALI_CORE_API NativeImage : public Image
-{
-public:
-
- /**
- * @DEPRECATED_1_2.41
- *
- * @brief Constructor with creates an uninitialized NativeImage object.
- *
- * Use NativeImage::New(...) to create an initialised object.
- * @SINCE_1_0.0
- */
- NativeImage() DALI_DEPRECATED_API;
-
- /**
- * @DEPRECATED_1_2.41
- *
- * @brief Destructor.
- *
- * This is non-virtual since derived Handle types must not contain data or virtual methods.
- * @SINCE_1_0.0
- */
- ~NativeImage() DALI_DEPRECATED_API;
-
- /**
- * @DEPRECATED_1_2.41
- *
- * @brief This copy constructor is required for (smart) pointer semantics.
- *
- * @SINCE_1_0.0
- * @param[in] handle A reference to the copied handle
- */
- NativeImage( const NativeImage& handle ) DALI_DEPRECATED_API;
-
- /**
- * @DEPRECATED_1_2.41
- *
- * @brief This assignment operator is required for (smart) pointer semantics.
- *
- * @SINCE_1_0.0
- * @param[in] rhs A reference to the copied handle
- * @return A reference to this
- */
- NativeImage& operator=( const NativeImage& rhs ) DALI_DEPRECATED_API;
-
- /**
- * @DEPRECATED_1_2.41
- *
- * @brief Triggers asynchronous creation of backing GL texture immediately.
- *
- * The normal policy is for a GL texture to created lazily when needed.
- * This function forces the allocation of a texture to happen at the earliest
- * opportunity.
- *
- * @SINCE_1_0.0
- * @note If the application loses its GL context, native images may lose their
- * GL textures. This function can be called again after context regain to force
- * the creation of the GL texture if still needed.
- */
- void CreateGlTexture() DALI_DEPRECATED_API;
-
- /**
- * @DEPRECATED_1_2.41
- *
- * @brief Creates a new NativeImage, which used native resources.
- *
- * The maximum size of the image is limited by GL_MAX_TEXTURE_SIZE
- * @SINCE_1_0.0
- * @param[in] nativeImageInterface An reference to the object of the interface implementation
- * @return A handle to a newly allocated object
- */
- static NativeImage New( NativeImageInterface& nativeImageInterface ) DALI_DEPRECATED_API;
-
- /**
- * @DEPRECATED_1_2.41
- *
- * @brief Downcasts a handle to NativeImage handle.
- *
- * If handle points to a NativeImage object, the downcast produces valid handle.
- * If not, the returned handle is left uninitialized.
- * @SINCE_1_0.0
- * @param[in] handle Handle to an object
- * @return handle to a NativeImage or an uninitialized handle
- */
- static NativeImage DownCast( BaseHandle handle ) DALI_DEPRECATED_API;
-
- /**
- * @DEPRECATED_1_2.41
- *
- * @brief Gets custom fragment prefix for rendering a native image.
- *
- * @return String for custom fragment prefix
- */
- const char* GetCustomFragmentPreFix() DALI_DEPRECATED_API;
-
- /**
- * @DEPRECATED_1_2.41
- *
- * @brief Gets custom sampler type name for rendering a native image.
- *
- * @return String for custom sampler type name
- */
- const char* GetCustomSamplerTypename() DALI_DEPRECATED_API;
-
-public: // Not intended for application developers
-
- explicit DALI_INTERNAL NativeImage( Internal::NativeImage* ) DALI_DEPRECATED_API;
-
-};
-
-/**
- * @}
- */
-} // namespace Dali
-
-#endif // DALI_NATIVE_IMAGE_H