/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
return CreateBufferImage(4, 4, Color::WHITE);
}
+void PrepareResourceImage( TestApplication& application, unsigned int imageWidth, unsigned int imageHeight, Pixel::Format pixelFormat )
+{
+ TestPlatformAbstraction& platform = application.GetPlatform();
+ platform.SetClosestImageSize(Vector2( imageWidth, imageHeight));
+
+ Integration::Bitmap* bitmap = Integration::Bitmap::New( Integration::Bitmap::BITMAP_2D_PACKED_PIXELS, ResourcePolicy::OWNED_RETAIN );
+ Integration::PixelBuffer* pixbuffer = bitmap->GetPackedPixelsProfile()->ReserveBuffer( pixelFormat, imageWidth, imageHeight, imageWidth, imageHeight );
+ unsigned int bytesPerPixel = GetBytesPerPixel( pixelFormat );
+ unsigned int initialColor = 0xFF;
+ memset( pixbuffer, initialColor, imageHeight*imageWidth*bytesPerPixel);
+
+ Integration::ResourcePointer resourcePtr(bitmap);
+ platform.SetSynchronouslyLoadedResource( resourcePtr );
+}
+
namespace Test
{
#define __DALI_TEST_SUITE_UTILS_H__
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
return false;
}
+ bool result = false;
switch(type)
{
case Property::BOOLEAN:
bool a, b;
q1.Get(a);
q2.Get(b);
- return a == b;
+ result = a == b;
break;
}
case Property::INTEGER:
int a, b;
q1.Get(a);
q2.Get(b);
- return a == b;
+ result = a == b;
break;
}
case Property::FLOAT:
float a, b;
q1.Get(a);
q2.Get(b);
- return CompareType<float>(a, b, epsilon);
+ result = CompareType<float>(a, b, epsilon);
break;
}
case Property::VECTOR2:
Vector2 a, b;
q1.Get(a);
q2.Get(b);
- return CompareType<Vector2>(a, b, epsilon);
+ result = CompareType<Vector2>(a, b, epsilon);
break;
}
case Property::VECTOR3:
Vector3 a, b;
q1.Get(a);
q2.Get(b);
- return CompareType<Vector3>(a, b, epsilon);
+ result = CompareType<Vector3>(a, b, epsilon);
break;
}
case Property::RECTANGLE:
Vector4 a, b;
q1.Get(a);
q2.Get(b);
- return CompareType<Vector4>(a, b, epsilon);
+ result = CompareType<Vector4>(a, b, epsilon);
break;
}
case Property::ROTATION:
Quaternion a, b;
q1.Get(a);
q2.Get(b);
- return CompareType<Quaternion>(a, b, epsilon);
+ result = CompareType<Quaternion>(a, b, epsilon);
+ break;
+ }
+ case Property::MATRIX:
+ case Property::MATRIX3:
+ case Property::STRING:
+ case Property::ARRAY:
+ case Property::MAP:
+ {
+ //TODO: Implement this?
+ DALI_ASSERT_ALWAYS( 0 && "Not implemented");
+ result = false;
+ break;
+ }
+ case Property::NONE:
+ {
+ result = false;
break;
}
- default:
- return false;
}
- return false;
+ return result;
}
BufferImage CreateBufferImage();
BufferImage CreateBufferImage(int width, int height, const Vector4& color);
+// Prepare a resource image to be loaded. Should be called before creating the ResourceImage
+void PrepareResourceImage( TestApplication& application, unsigned int imageWidth, unsigned int imageHeight, Pixel::Format pixelFormat );
+
// Test namespace to prevent pollution of Dali namespace, add Test helper functions here
namespace Test
{
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
#define __DALI_TEST_APPLICATION_H__
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
{
}
+
+TestNativeImageNoExtPointer TestNativeImageNoExt::New(int width, int height)
+{
+ return new TestNativeImageNoExt(width, height);
+}
+
+TestNativeImageNoExt::TestNativeImageNoExt(int width, int height)
+: mWidth(width), mHeight(height), mExtensionCreateCalls(0), mExtensionDestroyCalls(0), mTargetTextureCalls(0),createResult(true)
+{
+}
+
+TestNativeImageNoExt::~TestNativeImageNoExt()
+{
+}
+
} // namespace dali
#define __TEST_NATIVE_IMAGE_H__
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
*/
// INTERNAL INCLUDES
-
-// EXTERNAL INCLUDES
#include <dali/public-api/images/native-image-interface.h>
#include <dali/devel-api/images/native-image-interface-extension.h>
#include <dali/integration-api/gl-defines.h>
namespace Dali
{
class TestNativeImage;
+class TestNativeImageNoExt;
typedef IntrusivePtr<TestNativeImage> TestNativeImagePointer;
+typedef IntrusivePtr<TestNativeImageNoExt> TestNativeImageNoExtPointer;
class DALI_IMPORT_API TestNativeImageExtension: public Dali::NativeImageInterface::Extension
{
inline const char* GetCustomFragmentPreFix(){return "#extension GL_OES_EGL_image_external:require\n";}
inline const char* GetCustomSamplerTypename(){return "samplerExternalOES";}
- inline int GetEglImageTextureTarget(){return GL_TEXTURE_2D;}
+ inline int GetEglImageTextureTarget(){return GL_TEXTURE_EXTERNAL_OES;}
};
inline void SetGlExtensionCreateResult(bool result){ createResult = result;}
inline virtual bool GlExtensionCreate() { ++mExtensionCreateCalls; return createResult;};
inline virtual void GlExtensionDestroy() { ++mExtensionDestroyCalls; };
- inline virtual GLenum TargetTexture() { ++mTargetTextureCalls; return 1;};
+ inline virtual GLenum TargetTexture() { ++mTargetTextureCalls; return 0;};
inline virtual void PrepareTexture() {};
inline virtual unsigned int GetWidth() const {return mWidth;};
inline virtual unsigned int GetHeight() const {return mHeight;};
TestNativeImageExtension* mExtension;
};
+
+class DALI_IMPORT_API TestNativeImageNoExt : public Dali::NativeImageInterface
+{
+public:
+ static TestNativeImageNoExtPointer New(int width, int height);
+
+ inline void SetGlExtensionCreateResult(bool result){ createResult = result;}
+ inline virtual bool GlExtensionCreate() { ++mExtensionCreateCalls; return createResult;};
+ inline virtual void GlExtensionDestroy() { ++mExtensionDestroyCalls; };
+ inline virtual GLenum TargetTexture() { ++mTargetTextureCalls; return 1;};
+ inline virtual void PrepareTexture() {};
+ inline virtual unsigned int GetWidth() const {return mWidth;};
+ inline virtual unsigned int GetHeight() const {return mHeight;};
+ inline virtual bool RequiresBlending() const {return true;};
+
+private:
+ TestNativeImageNoExt(int width, int height);
+ virtual ~TestNativeImageNoExt();
+
+ int mWidth;
+ int mHeight;
+public:
+ int mExtensionCreateCalls;
+ int mExtensionDestroyCalls;
+ int mTargetTextureCalls;
+ bool createResult;
+};
+
} // Dali
#endif
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
TestPlatformAbstraction::~TestPlatformAbstraction()
{
+ DiscardRequest();
}
void TestPlatformAbstraction::Suspend()
Integration::BitmapPtr TestPlatformAbstraction::DecodeBuffer( const Integration::ResourceType& resourceType, uint8_t * buffer, size_t size )
{
mTrace.PushCall("DecodeBuffer", "");
- return Integration::BitmapPtr();
+ return mDecodedBitmap;
}
void TestPlatformAbstraction::CancelLoad(Integration::ResourceId id, Integration::ResourceTypeId typeId)
mResourceRequests.Clear();
mIsLoadingResult=false;
mSynchronouslyLoadedResource.Reset();
+ mDecodedBitmap.Reset();
}
bool TestPlatformAbstraction::WasCalled(TestFuncEnum func)
mLoadedResourcesQueue.clear();
mFailedLoadQueue.clear();
mSynchronouslyLoadedResource.Reset();
+ mDecodedBitmap.Reset();
}
void TestPlatformAbstraction::SetResourceLoaded(Integration::ResourceId loadedId,
Integration::ResourcePointer resource(bitmap);
bitmap->GetPackedPixelsProfile()->ReserveBuffer(Pixel::RGBA8888, 80, 80, 80, 80);
SetResourceLoaded( request->GetId(), request->GetType()->id, resource );
+ delete request;
}
mResourceRequests.Clear();
}
for( ResourceRequestContainer::Iterator iter = mResourceRequests.Begin(), endIter = mResourceRequests.End();
iter != endIter; ++iter )
{
+ Integration::ResourceRequest* request = *iter;
SetResourceLoadFailed( (*iter)->GetId(), failure);
+ delete request;
}
mResourceRequests.Clear();
}
void TestPlatformAbstraction::DiscardRequest()
{
+ for( ResourceRequestContainer::Iterator iter = mResourceRequests.Begin(), endIter = mResourceRequests.End();
+ iter != endIter; ++iter )
+ {
+ Integration::ResourceRequest* request = *iter;
+ delete request;
+ }
mResourceRequests.Clear();
}
mSynchronouslyLoadedResource = resource;
}
+void TestPlatformAbstraction::SetDecodedBitmap( Integration::BitmapPtr bitmap )
+{
+ mDecodedBitmap = bitmap;
+}
+
} // namespace Dali
#define __DALI_TEST_PLATFORM_ABSTRACTION_H__
/*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
*/
void SetSynchronouslyLoadedResource( Integration::ResourcePointer resource );
+ /**
+ * @brief Sets the bitmap returned by DecodeBuffer()
+ * @param[in] bitmap The decoded bitmap
+ */
+ void SetDecodedBitmap( Integration::BitmapPtr bitmap );
+
+private:
+
+ TestPlatformAbstraction( const TestPlatformAbstraction& ); ///< Undefined
+ TestPlatformAbstraction& operator=( const TestPlatformAbstraction& ); ///< Undefined
+
private:
struct LoadedResource
bool mSaveFileResult;
Integration::ResourcePointer mSynchronouslyLoadedResource;
+ Integration::BitmapPtr mDecodedBitmap;
};
} // Dali
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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.
/*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2017 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_CHECK( gl.GetTextureTrace().FindMethod("BindTexture") );
std::stringstream params;
- params << GL_TEXTURE_2D << ", " << 23;
+ params << GL_TEXTURE_EXTERNAL_OES << ", " << 23;
DALI_TEST_CHECK( gl.GetTextureTrace().FindMethodAndParams("BindTexture", params.str()) );
END_TEST;
DALI_TEST_CHECK( gl.GetTextureTrace().FindMethod("BindTexture") );
std::stringstream nextTextureParams;
- nextTextureParams << GL_TEXTURE_2D << ", " << 24;
+ nextTextureParams << GL_TEXTURE_EXTERNAL_OES << ", " << 24;
DALI_TEST_CHECK( gl.GetTextureTrace().FindMethodAndParams("BindTexture", nextTextureParams.str()) );
END_TEST;
DALI_TEST_CHECK( gl.GetTextureTrace().FindMethod("BindTexture") );
std::stringstream params;
- params << GL_TEXTURE_2D << ", " << 23;
+ params << GL_TEXTURE_EXTERNAL_OES << ", " << 23;
DALI_TEST_CHECK( gl.GetTextureTrace().FindMethodAndParams("BindTexture", params.str()) );
width = 200;
DALI_TEST_CHECK( gl.GetTextureTrace().FindMethod("BindTexture") );
std::stringstream params;
- params << GL_TEXTURE_2D << ", " << 23;
+ params << GL_TEXTURE_EXTERNAL_OES << ", " << 23;
DALI_TEST_CHECK( gl.GetTextureTrace().FindMethodAndParams("BindTexture", params.str()) );
END_TEST;
DALI_TEST_CHECK( gl.GetTextureTrace().FindMethod("BindTexture") );
std::stringstream nativeImageParams;
- nativeImageParams << GL_TEXTURE_2D << ", " << 24;
+ nativeImageParams << GL_TEXTURE_EXTERNAL_OES << ", " << 24;
DALI_TEST_CHECK( gl.GetTextureTrace().FindMethodAndParams("BindTexture", nativeImageParams.str()) );
*/
// EXTERNAL INCLUDES
-#include <dali/public-api/actors/layer.h>
+#include <dali/public-api/common/compile-time-assert.h>
+#include <dali/devel-api/actors/layer-devel.h>
namespace Dali
{
namespace DepthIndex
{
+// The negative value for background effect and background has been
+// chosen so that newer controls can have content without setting
+// depth index, and go in front of native controls with a background.
+// This backround negative value means that the highest possible value
+// is SIBLING_ORDER_MULTIPLIER-BACKGROUND_EFFECT-1. The divisor of
+// 100 ensures the range fits within the sibling order range, and has
+// enough gaps to allow Control Authors to use other intermediate depths.
+
enum Ranges
{
- BACKGROUND = -Dali::Layer::TREE_DEPTH_MULTIPLIER / 10,
- CONTENT = 0,
- TEXT = Dali::Layer::TREE_DEPTH_MULTIPLIER / 100,
- DECORATION = Dali::Layer::TREE_DEPTH_MULTIPLIER / 10
+ BACKGROUND_EFFECT = -2 * DevelLayer::SIBLING_ORDER_MULTIPLIER/100,
+ BACKGROUND = -1 * DevelLayer::SIBLING_ORDER_MULTIPLIER/100,
+ CONTENT = 0,
+ DECORATION = 1 * DevelLayer::SIBLING_ORDER_MULTIPLIER/100,
+ FOREGROUND_EFFECT = 2 * DevelLayer::SIBLING_ORDER_MULTIPLIER/100
};
+DALI_COMPILE_TIME_ASSERT( (unsigned int)DevelLayer::ACTOR_DEPTH_MULTIPLIER > (unsigned int)DevelLayer::SIBLING_ORDER_MULTIPLIER );
+DALI_COMPILE_TIME_ASSERT( BACKGROUND_EFFECT < BACKGROUND );
+DALI_COMPILE_TIME_ASSERT( BACKGROUND < CONTENT );
+DALI_COMPILE_TIME_ASSERT( CONTENT < DECORATION );
+DALI_COMPILE_TIME_ASSERT( DECORATION < FOREGROUND_EFFECT );
+
} // namespace DepthIndex
} // namespace Toolkit
{
renderableActor = mRenderer->Render( mController->GetView(),
mAlignmentOffset,
- DepthIndex::TEXT );
+ DepthIndex::CONTENT );
}
if( renderableActor != mRenderableActor )
{
renderableActor = mRenderer->Render( mController->GetView(),
mAlignmentOffset,
- DepthIndex::TEXT );
+ DepthIndex::CONTENT );
}
if( renderableActor != mRenderableActor )
{
renderableActor = mRenderer->Render( mController->GetView(),
alignmentOffset,
- DepthIndex::TEXT );
+ DepthIndex::CONTENT );
}
if( renderableActor != mRenderableActor )
// EXTERNAL INCLUDES
#include <dali/public-api/rendering/geometry.h>
#include <dali/public-api/rendering/renderer.h>
+#include <dali/public-api/images/frame-buffer-image.h>
#include <dali/devel-api/text-abstraction/font-client.h>
#include <dali/integration-api/debug.h>
BIDI_INFO |
SHAPE_TEXT |
GET_GLYPH_METRICS );
+
+ // Set the update info to relayout the whole text.
+ mImpl->mTextUpdateInfo.mParagraphCharacterIndex = 0u;
+ mImpl->mTextUpdateInfo.mRequestedNumberOfCharacters = mImpl->mModel->mLogicalModel->mText.Count();
+
// Make sure the model is up-to-date before layouting
mImpl->UpdateModel( onlyOnceOperations );
// Layout the text for the new width.
mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending | LAYOUT );
- // Set the update info to relayout the whole text.
- mImpl->mTextUpdateInfo.mParagraphCharacterIndex = 0u;
- mImpl->mTextUpdateInfo.mRequestedNumberOfCharacters = mImpl->mModel->mLogicalModel->mText.Count();
-
// Store the actual control's size to restore later.
const Size actualControlSize = mImpl->mModel->mVisualModel->mControlSize;
BIDI_INFO |
SHAPE_TEXT |
GET_GLYPH_METRICS );
+
+ // Set the update info to relayout the whole text.
+ mImpl->mTextUpdateInfo.mParagraphCharacterIndex = 0u;
+ mImpl->mTextUpdateInfo.mRequestedNumberOfCharacters = mImpl->mModel->mLogicalModel->mText.Count();
+
// Make sure the model is up-to-date before layouting
mImpl->UpdateModel( onlyOnceOperations );
// Layout the text for the new width.
mImpl->mOperationsPending = static_cast<OperationsMask>( mImpl->mOperationsPending | LAYOUT );
- // Set the update info to relayout the whole text.
- mImpl->mTextUpdateInfo.mParagraphCharacterIndex = 0u;
- mImpl->mTextUpdateInfo.mRequestedNumberOfCharacters = mImpl->mModel->mLogicalModel->mText.Count();
-
// Store the actual control's width.
const float actualControlWidth = mImpl->mModel->mVisualModel->mControlSize.width;
{
textChanged = BackspaceKeyEvent();
}
- else if( IsKey( keyEvent, Dali::DALI_KEY_POWER ) )
- {
- mImpl->ChangeState( EventData::INTERRUPTED ); // State is not INACTIVE as expect to return to edit mode.
- // Avoids calling the InsertText() method which can delete selected text
- }
- else if( IsKey( keyEvent, Dali::DALI_KEY_MENU ) ||
+ else if( IsKey( keyEvent, Dali::DALI_KEY_POWER ) ||
+ IsKey( keyEvent, Dali::DALI_KEY_MENU ) ||
IsKey( keyEvent, Dali::DALI_KEY_HOME ) )
{
+ // Power key/Menu/Home key behaviour does not allow edit mode to resume.
mImpl->ChangeState( EventData::INACTIVE );
- // Menu/Home key behaviour does not allow edit mode to resume like Power key
- // Avoids calling the InsertText() method which can delete selected text
+
+ // This branch avoids calling the InsertText() method of the 'else' branch which can delete selected text.
}
else if( Dali::DALI_KEY_SHIFT_LEFT == keyCode )
{
numberOfCharacters = currentText.Count() - cursorIndex;
}
- if( ( cursorIndex + numberOfCharacters ) <= mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters )
+ if( mImpl->mEventData->mPreEditFlag || // If the preedit flag is enabled, it means two (or more) of them came together i.e. when two keys have been pressed at the same time.
+ ( ( cursorIndex + numberOfCharacters ) <= mImpl->mTextUpdateInfo.mPreviousNumberOfCharacters ) )
{
// Mark the paragraphs to be updated.
mImpl->mTextUpdateInfo.mCharacterIndex = std::min( cursorIndex, mImpl->mTextUpdateInfo.mCharacterIndex );
vec2 visualOffset = mix( offset, offset/uSize.xy, offsetSizeMode.xy);\n
mediump vec2 scale = vec2( length( uModelMatrix[ 0 ].xyz ), length( uModelMatrix[ 1 ].xyz ) );\n
- mediump vec2 size = visualSize.xy * scale;\n
+ mediump vec2 size = visualSize.xy;\n
\n
mediump vec2 fixedFactor = vec2( uFixed[ int( ( aPosition.x + 1.0 ) * 0.5 ) ].x, uFixed[ int( ( aPosition.y + 1.0 ) * 0.5 ) ].y );\n
mediump vec2 stretch = floor( aPosition * 0.5 );\n
\n
mediump vec4 vertexPosition = vec4( fixedFactor + ( size - fixedTotal ) * stretch, 0.0, 1.0 );
vertexPosition.xy -= size * vec2( 0.5, 0.5 );\n
- vertexPosition.xy = vertexPosition.xy / scale + anchorPoint*size + (visualOffset + origin)*uSize.xy;\
+ vertexPosition.xy = vertexPosition.xy + anchorPoint*size + (visualOffset + origin)*uSize.xy;\
\n
vertexPosition = uMvpMatrix * vertexPosition;\n
\n
}
mImpl->mRenderer = Renderer::New( geometry, shader );
- mImpl->mRenderer.SetProperty( Dali::Renderer::Property::DEPTH_INDEX, Toolkit::DepthIndex::TEXT );
+ mImpl->mRenderer.SetProperty( Dali::Renderer::Property::DEPTH_INDEX, Toolkit::DepthIndex::CONTENT );
UpdateRenderer( true ); // Renderer needs textures and to be added to control
}
const unsigned int TOOLKIT_MAJOR_VERSION = 1;
const unsigned int TOOLKIT_MINOR_VERSION = 2;
-const unsigned int TOOLKIT_MICRO_VERSION = 25;
+const unsigned int TOOLKIT_MICRO_VERSION = 26;
const char * const TOOLKIT_BUILD_DATE = __DATE__ " " __TIME__;
#ifdef DEBUG_ENABLED
Name: dali-addon
Summary: DALi module for Node.JS
-Version: 1.2.25
+Version: 1.2.26
Release: 1
Group: Development/Libraries
License: Apache License, Version 2.0
Name: dali-toolkit
Summary: The OpenGLES Canvas Core Library Toolkit
-Version: 1.2.25
+Version: 1.2.26
Release: 1
Group: System/Libraries
License: Apache-2.0 and BSD-2-Clause and MIT