From 977ea75b39fc11aae8b24721438a082a14a8ad1f Mon Sep 17 00:00:00 2001 From: SeonhyungLee Date: Fri, 23 Aug 2013 13:49:58 +0300 Subject: [PATCH] Drawing a visual element with ui-core.so Change-Id: I49c338fa813ae1e85c9e9a8da69806cb2f4c6e88 --- src/ui-core/src/CMakeLists.txt | 6 +++++- src/ui-core/src/UcInterface.cpp | 17 ++++++++++++++--- src/ui-core/src/base/FBaseSysLog.cpp | 6 +++++- src/ui/animations/FUiAnim_GlLayer.h | 2 +- .../animations/FUiAnim_GlVisualElementSurfaceImpl.cpp | 9 ++++++++- src/ui/animations/platform/FUiAnim_GlContext.cpp | 3 ++- 6 files changed, 35 insertions(+), 8 deletions(-) diff --git a/src/ui-core/src/CMakeLists.txt b/src/ui-core/src/CMakeLists.txt index 0f148a5..00d931e 100755 --- a/src/ui-core/src/CMakeLists.txt +++ b/src/ui-core/src/CMakeLists.txt @@ -10,6 +10,7 @@ INCLUDE_DIRECTORIES( ${UIFW_DIRECTORY}/inc ${UIFW_DIRECTORY}/src/ui/inc ${UIFW_DIRECTORY}/src/ui/animations + ${UIFW_DIRECTORY}/src/ui/animations/platform ${RSA_DEV_DIRECTORY}/external/boost ) ELSEIF(_WIN32) @@ -23,6 +24,7 @@ INCLUDE_DIRECTORIES( ${UIFW_DIRECTORY}/inc ${UIFW_DIRECTORY}/src/ui/inc ${UIFW_DIRECTORY}/src/ui/animations + ${UIFW_DIRECTORY}/src/ui/animations/platform ${RSA_DEV_DIRECTORY}/external/boost ) ENDIF(LINUX) @@ -67,6 +69,8 @@ SET(${this_target}_SOURCE_FILES graphics/FGrpRectangle.cpp ${UIFW_DIRECTORY}/src/ui/animations/platform/FUiAnim_NativeWindow.cpp ${UIFW_DIRECTORY}/src/ui/animations/platform/FUiAnim_GlContext.cpp + ${UIFW_DIRECTORY}/src/ui/animations/platform/FUiAnim_Egl.cpp + ${UIFW_DIRECTORY}/src/ui/animations/platform/FUiAnim_Wgl.cpp ${UIFW_DIRECTORY}/src/ui/animations/FUiAnim_AnimationGroupNode.cpp ${UIFW_DIRECTORY}/src/ui/animations/FUiAnim_AnimationManager.cpp ${UIFW_DIRECTORY}/src/ui/animations/FUiAnimAnimationTransaction.cpp @@ -147,7 +151,7 @@ LIST(APPEND ${this_target}_SOURCE_FILES ${UIFW_DIRECTORY}/src/ui/animations/FUiAnim_Looper.cpp ) ELSEIF(_WIN32) -ADD_DEFINITIONS("-DVE_WIN32_GL -DBUILD_UI_CORE") +ADD_DEFINITIONS("-DVE_WIN32_GL -DBUILD_UI_CORE -D") LIST(APPEND ${this_target}_SOURCE_FILES ${UIFW_DIRECTORY}/src/ui/animations/platform/FUiAnim_Win32Window.cpp diff --git a/src/ui-core/src/UcInterface.cpp b/src/ui-core/src/UcInterface.cpp index cb5bf93..09020db 100644 --- a/src/ui-core/src/UcInterface.cpp +++ b/src/ui-core/src/UcInterface.cpp @@ -11,6 +11,8 @@ #include "FUiAnim_DisplayContextImpl.h" #include "FUiAnim_Looper.h" #include "FUiAnim_NativeWindow.h" +#include "FUiAnim_Win32Window.h" +#include "FUiAnim_GlLayer.h" using namespace Tizen::Graphics; using namespace Tizen::Ui::Animations; @@ -20,15 +22,24 @@ DisplayContext* pDisplayContext = null; void InitLibrary(int windowHandle, int width, int height) { -#ifdef LINUX - _DisplayManager::CreateInstance(); _AnimationManager::CreateInstance(); + _DisplayManager::CreateInstance(); +#ifdef LINUX pNativeLayer = _NativeLayer::CreateInstanceN(); pNativeLayer->SetShowState(true); + + pDisplayContext = _DisplayContextImpl::CreatePublicInstance(*pNativeLayer); #elif _WIN32 + _Win32Window* pWindow = new _Win32Window(windowHandle); + + _GlLayer* pLayer = new _GlLayer(); + pLayer->ConstructForNativeWindow(*pWindow); + pLayer->SetShowState(true); + + pDisplayContext = _DisplayContextImpl::CreatePublicInstance(*pLayer); #endif - pDisplayContext = _DisplayContextImpl::CreatePublicInstance(*pNativeLayer); + } void CreateVisualElement(int x, int y, int width, int height) diff --git a/src/ui-core/src/base/FBaseSysLog.cpp b/src/ui-core/src/base/FBaseSysLog.cpp index 8b985c7..abff952 100644 --- a/src/ui-core/src/base/FBaseSysLog.cpp +++ b/src/ui-core/src/base/FBaseSysLog.cpp @@ -1,10 +1,14 @@ #include +#include void SysLogInternal(unsigned long id, const char* pFunction, int lineNumber, const char* pFormat, ...){} void SysLogExceptionInternal(unsigned long id, result r, const char* pFunction, int lineNumber, const char* pFormat, ...){} void SysLogTagInternal(unsigned long id, const char* pTag, const char* pFunction, int lineNumber, const char* pFormat, ...){} void SysLogExceptionTagInternal(unsigned long id, const char* pTag, result r, const char* pFunction, int lineNumber, const char* pFormat, ...){} -void SysAssertInternal(const char* pFileName, int lineNumber, const char* pFunction){} +void SysAssertInternal(const char* pFileName, int lineNumber, const char* pFunction) +{ + assert(true); +} void SysAssertfInternal(const char* expr, const char* pFunction, int lineNumber, const char* pFormat, ...){} void SysPropagateInternal(const char* pFunction, int lineNumber, unsigned long nid, result r){} void SysTryReturnResultInternal(unsigned long id, result r, const char* pFunction, int lineNumber, const char* pFormat, ...){} diff --git a/src/ui/animations/FUiAnim_GlLayer.h b/src/ui/animations/FUiAnim_GlLayer.h index 16121ab..b77f277 100644 --- a/src/ui/animations/FUiAnim_GlLayer.h +++ b/src/ui/animations/FUiAnim_GlLayer.h @@ -34,7 +34,7 @@ namespace Tizen { namespace Ui { namespace Animations { -#if defined(_OSP_EMUL_) +#if defined(_OSP_EMUL_) || defined(BUILD_UI_CORE) #define VE_USE_GL_MULTI_CONTEXT #endif diff --git a/src/ui/animations/FUiAnim_GlVisualElementSurfaceImpl.cpp b/src/ui/animations/FUiAnim_GlVisualElementSurfaceImpl.cpp index 63c9ca5..4a544bc 100644 --- a/src/ui/animations/FUiAnim_GlVisualElementSurfaceImpl.cpp +++ b/src/ui/animations/FUiAnim_GlVisualElementSurfaceImpl.cpp @@ -60,8 +60,10 @@ _GlVisualElementSurfaceImpl::_GlVisualElementSurfaceImpl(const FloatDimension& s __pLayer = reinterpret_cast<_GlLayer*>(handle); SysAssertf(__pLayer, "Cannot create surface for null window"); +#ifndef BUILD_UI_CORE // WARNING: By default, we assume 32bit-packed stride (for Osp 2.0 compatibility and etc.) FloatDimension physSize = _CoordinateSystemUtils::Transform(size); +#endif (dynamic)? __surfaceInfo.type = SURFACE_TYPE_DYNAMIC : __surfaceInfo.type = SURFACE_TYPE_STATIC; @@ -69,12 +71,17 @@ _GlVisualElementSurfaceImpl::_GlVisualElementSurfaceImpl(const FloatDimension& s __surfaceInfo.bitsPerPixel = 32; __surfaceInfo.x = 0; __surfaceInfo.y = 0; +#ifndef BUILD_UI_CORE __surfaceInfo.width = physSize.width; __surfaceInfo.height = physSize.height; +#else + __surfaceInfo.width = size.width; + __surfaceInfo.height = size.height; +#endif __surfaceInfo.stride = __surfaceInfo.width * __surfaceInfo.bitsPerPixel / 8; __surfaceInfo.updated = false; - if (__surfaceInfo.type == SURFACE_TYPE_STATIC) + // if (__surfaceInfo.type == SURFACE_TYPE_STATIC) { __surfaceInfo.pPixels = (unsigned long*) new (std::nothrow) unsigned char[__surfaceInfo.stride * __surfaceInfo.height]; SysTryReturnVoidResult(NID_UI_ANIM, __surfaceInfo.pPixels, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY]"); diff --git a/src/ui/animations/platform/FUiAnim_GlContext.cpp b/src/ui/animations/platform/FUiAnim_GlContext.cpp index ad34044..0df85cb 100644 --- a/src/ui/animations/platform/FUiAnim_GlContext.cpp +++ b/src/ui/animations/platform/FUiAnim_GlContext.cpp @@ -488,7 +488,8 @@ _GlContext::InitGL(void) glDisable(GL_STENCIL_TEST); glDisable(GL_DEPTH_TEST); - glClearColor(0.0f, 0.0f, 0.0f, 0.0f); + glClearColor(1.0f, 0.0f, 0.0f, 1.0f); + glClear(GL_COLOR_BUFFER_BIT); glClearStencil(0); glActiveTexture(GL_TEXTURE0); -- 2.7.4