From: Dae young ,Ryu Date: Wed, 21 Aug 2013 08:12:02 +0000 (+0300) Subject: modify for NativeWindow class X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=61a448410af662008c9be7e3bf1175c456c6d8e3;p=framework%2Fosp%2Fuifw.git modify for NativeWindow class Change-Id: Ida8967d4915d186daaac7be6e84570468a11677c Signed-off-by: Dae young ,Ryu --- diff --git a/src/graphics/FGrp_Canvas.cpp b/src/graphics/FGrp_Canvas.cpp index 5fc8455..d517d76 100644 --- a/src/graphics/FGrp_Canvas.cpp +++ b/src/graphics/FGrp_Canvas.cpp @@ -219,14 +219,6 @@ _ConvertRGB888ToRGB565(unsigned char red, unsigned char green, unsigned char blu return (ColorType(red >> 3) << 11) | (ColorType(green >> 2) << 5) | ColorType(blue >> 3); } -#ifdef VE_X_GL -void* -_GetWindowSourceObject(Handle handle) -{ - return null; -} -#endif - #ifdef VE_EFL Evas_Object* _GetWindowSourceObject(Handle handle) @@ -236,6 +228,14 @@ _GetWindowSourceObject(Handle handle) return (pSourceObject) ? pSourceObject : (Evas_Object*) handle; } +#else + +void* +_GetWindowSourceObject(Handle handle) +{ + return null; +} + #endif diff --git a/src/ui/animations/FUiAnim_GlContext.cpp b/src/ui/animations/FUiAnim_GlContext.cpp index 646685b..1b32673 100644 --- a/src/ui/animations/FUiAnim_GlContext.cpp +++ b/src/ui/animations/FUiAnim_GlContext.cpp @@ -31,7 +31,9 @@ #include "FUiAnim_DisplayManager.h" #include "FUiAnim_VisualElementSurfaceManager.h" -#ifndef BUILD_UI_CORE +#include "FUiAnim_ShaderImpl.h" +#include "FUiAnim_ShaderProgramImpl.h" + #ifndef VE_SIMULATOR #include @@ -56,7 +58,6 @@ extern "C" } #endif #endif -#endif using namespace Tizen::Graphics; using namespace Tizen::Ui::Animations; @@ -95,7 +96,7 @@ _GlContext::_GlContext(Handle nativeDisplay) , __useBlend(false) , __useStencil(false) , __useDepthTest(false) - , __texId(0) + , __textureId(0) { SysAssertf(nativeDisplay, "Invalid display"); @@ -128,8 +129,6 @@ _GlContext::_GlContext(Handle nativeDisplay) _GlContext::~_GlContext(void) { -#ifndef BUILD_UI_CORE - #ifndef VE_USE_GL_MULTI_CONTEXT if (__nativeDummyPixmap) { @@ -169,7 +168,6 @@ _GlContext::~_GlContext(void) __display = EGL_NO_DISPLAY; #endif } -#endif PRINT("_GlContext:~_GlContext() \n"); } @@ -201,32 +199,6 @@ _GlContext::ReleaseInstance(void) } #endif -void -_GlContext::UseShaderProgram(_GlShaderProgram* pShaderProgram) -{ - if (__pCurrentShader == pShaderProgram) - return; - - if (__pCurrentShader) - { - __pCurrentShader->OnProgramDereferenced(); - __pCurrentShader = null; - } - - // TODO: Reference Counting !!! - if (pShaderProgram) - { - __pCurrentShader = pShaderProgram; - __pCurrentShader->OnProgramReferenced(); - - glUseProgram(__pCurrentShader->GetProgram()); - } - else - { - glUseProgram(0); - } -} - #ifdef VE_USE_GL_MULTI_CONTEXT bool _GlContext::MakeCurrent(void) @@ -310,7 +282,6 @@ _GlContext::DestroySurface(Handle surface) bool _GlContext::CreateDefaultSurface(void) { -#ifndef BUILD_UI_CORE if (__dummySurface != EGL_NO_SURFACE) { return true; @@ -340,7 +311,6 @@ _GlContext::CreateDefaultSurface(void) } return true; -#endif } #endif @@ -492,17 +462,6 @@ _GlContext::InitGL(void) glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); } -GLuint -_GlContext::GenTexture(void) const -{ - GLuint textureId = 0; - - glGenTextures(1, &textureId); - SysAssertf(textureId, "failed to glGenTexture."); - - return textureId; -} - bool _GlContext::CreateTexture(TextureInfo* pTextureInfo) { @@ -513,7 +472,7 @@ _GlContext::CreateTexture(TextureInfo* pTextureInfo) glBindTexture(GL_TEXTURE_2D, textureId); - __texId = textureId; + __textureId = textureId; glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); @@ -529,19 +488,43 @@ _GlContext::CreateTexture(TextureInfo* pTextureInfo) else #endif { - if (IsSupportedBGRA()) + GLenum format, type; + + switch ( pTextureInfo->bitsPerPixel ) { + case 8: + format = GL_ALPHA; + type = GL_UNSIGNED_BYTE; + break; + + case 16: + format = GL_RGB; + type = GL_UNSIGNED_SHORT_5_6_5; + break; + + case 32: + if (IsSupportedBGRA()) + { #if defined(_OSP_EMUL_) - glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA, pTextureInfo->width, pTextureInfo->height, 0, GL_BGRA, GL_UNSIGNED_BYTE, pTextureInfo->pPixels); + format = GL_BGRA; #else - glTexImage2D(GL_TEXTURE_2D, 0, GL_BGRA_EXT, pTextureInfo->width, pTextureInfo->height, 0, GL_BGRA_EXT, GL_UNSIGNED_BYTE, pTextureInfo->pPixels); + format = GL_BGRA_EXT; #endif + } + else + { + format = GL_RGBA; + } + type = GL_UNSIGNED_BYTE; + break; + + default: + format = GL_RGB; + type = GL_UNSIGNED_BYTE; + break; } - else - { - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, pTextureInfo->width, pTextureInfo->height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pTextureInfo->pPixels); - } - //TODO: exception handling + + glTexImage2D(GL_TEXTURE_2D, 0, format, pTextureInfo->width, pTextureInfo->height, 0, format, type, pTextureInfo->pPixels); } pTextureInfo->textureId = textureId; @@ -551,10 +534,33 @@ _GlContext::CreateTexture(TextureInfo* pTextureInfo) return true; } +//TODO: why?? pSurfaceInfo +void +_GlContext::UploadTexture(GlVisualElementSurfaceInfo* pSurfaceInfo) +{ +// if (pSurfaceInfo->type == SURFACE_TYPE_STATIC && pSurfaceInfo->updated) // TODO: enable + if (pSurfaceInfo->type == SURFACE_TYPE_STATIC) + { + if (IsSupportedBGRA()) + { +#if defined(_OSP_EMUL_) + glTexSubImage2D(GL_TEXTURE_2D, 0, pSurfaceInfo->x, pSurfaceInfo->y, pSurfaceInfo->width, pSurfaceInfo->height, GL_BGRA, GL_UNSIGNED_BYTE, pSurfaceInfo->pPixels); +#else + glTexSubImage2D(GL_TEXTURE_2D, 0, pSurfaceInfo->x, pSurfaceInfo->y, pSurfaceInfo->width, pSurfaceInfo->height, GL_BGRA_EXT, GL_UNSIGNED_BYTE, pSurfaceInfo->pPixels); +#endif + } + else + { + glTexSubImage2D(GL_TEXTURE_2D, 0, pSurfaceInfo->x, pSurfaceInfo->y, pSurfaceInfo->width, pSurfaceInfo->height, GL_RGBA, GL_UNSIGNED_BYTE, pSurfaceInfo->pPixels); + } + + pSurfaceInfo->updated = false; + } +} + void _GlContext::DeleteTexture(TextureInfo *pTextureInfo) { -#ifndef BUILD_UI_CORE glDeleteTextures(1, &pTextureInfo->textureId); // TODO: remove hashmap @@ -597,36 +603,11 @@ _GlContext::DeleteTexture(TextureInfo *pTextureInfo) delete pPixmapInfo; } #endif -#endif -} - -void -_GlContext::UploadTexture(GlVisualElementSurfaceInfo* pSurfaceInfo) -{ -// if (pSurfaceInfo->type == SURFACE_TYPE_STATIC && pSurfaceInfo->updated) // TODO: enable - if (pSurfaceInfo->type == SURFACE_TYPE_STATIC) - { - if (IsSupportedBGRA()) - { -#if defined(_OSP_EMUL_) - glTexSubImage2D(GL_TEXTURE_2D, 0, pSurfaceInfo->x, pSurfaceInfo->y, pSurfaceInfo->width, pSurfaceInfo->height, GL_BGRA, GL_UNSIGNED_BYTE, pSurfaceInfo->pPixels); -#else - glTexSubImage2D(GL_TEXTURE_2D, 0, pSurfaceInfo->x, pSurfaceInfo->y, pSurfaceInfo->width, pSurfaceInfo->height, GL_BGRA_EXT, GL_UNSIGNED_BYTE, pSurfaceInfo->pPixels); -#endif - } - else - { - glTexSubImage2D(GL_TEXTURE_2D, 0, pSurfaceInfo->x, pSurfaceInfo->y, pSurfaceInfo->width, pSurfaceInfo->height, GL_RGBA, GL_UNSIGNED_BYTE, pSurfaceInfo->pPixels); - } - - pSurfaceInfo->updated = false; - } } _GlContext::_PixmapInfo* _GlContext::CreateNativePixmap(BufferInfo& bufferInfo) { -#ifndef BUILD_UI_CORE #ifndef VE_SIMULATOR _PixmapInfo* pPixmapInfo = null; @@ -767,7 +748,6 @@ CATCH_01: SysLog(NID_UI_ANIM, "CreateNativePixmap failed!!"); #endif #endif -#endif return null; } @@ -826,55 +806,239 @@ _GlContext::CreateDynamicTexture(GLuint textureId, TextureInfo* pTextureInfo) } void -_GlContext::LoadTexture(void* pBits, GLenum target, int w, int h, int bpp) +_GlContext::UseShaderProgram(_GlShaderProgram* pShaderProgram) { - int level = 0; - GLenum texParamTarget = GL_TEXTURE_2D; - - switch ( target ) - { - case GL_TEXTURE_CUBE_MAP_POSITIVE_X: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_X: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Y: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Y: - case GL_TEXTURE_CUBE_MAP_POSITIVE_Z: - case GL_TEXTURE_CUBE_MAP_NEGATIVE_Z: - texParamTarget = GL_TEXTURE_CUBE_MAP; - break; + if (__pCurrentShader == pShaderProgram) + { + return; + } + + if (__pCurrentShader) + { + __pCurrentShader->OnProgramDereferenced(); + __pCurrentShader = null; + } + + // TODO: Reference Counting !!! + if (pShaderProgram) + { + __pCurrentShader = pShaderProgram; + __pCurrentShader->OnProgramReferenced(); + + glUseProgram(__pCurrentShader->GetProgram()); + } + else + { + glUseProgram(0); + } +} + +void +_GlContext::UseShaderProgram(ShaderProgram* pShaderProgram) +{ +// if (__pCurrentShader == pShaderProgram) +// { +// return; +// } + + if (__pCurrentShader) + { + __pCurrentShader->OnProgramDereferenced(); + __pCurrentShader = null; + } + + // TODO: Reference Counting !!! + if (pShaderProgram) + { +// __pCurrentShader = pShaderProgram; +// __pCurrentShader->OnProgramReferenced(); + + unsigned int program = _ShaderProgramImpl::GetInstance(*pShaderProgram)->__program; + AppLog("\n jinstar -- use program %d", program); + glUseProgram(program); + } + else + { + glUseProgram(0); + } +} +GLuint +_GlContext::BuildShader(GLuint type, const char* pShaderSource) +{ + switch(type) + { + case Shader::SHADER_VERTEX: + type = GL_VERTEX_SHADER; + break; + case Shader::SHADER_FRAGMENT: + type = GL_FRAGMENT_SHADER; + break; default: - texParamTarget = target; + break; +// return 0; }; - glTexParameteri(texParamTarget, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - glTexParameteri(texParamTarget, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - glTexParameteri(texParamTarget, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameteri(texParamTarget, GL_TEXTURE_WRAP_T, GL_REPEAT); + if (type != GL_VERTEX_SHADER && type != GL_FRAGMENT_SHADER) + return 0; - if (pBits) +#ifndef VE_USE_GL_MULTI_CONTEXT + CHECK_GL_CONTEXT(); +#endif + + GLuint shaderId = glCreateShader(type); + if (shaderId == 0) { - GLenum format, type; + return 0; + } + + GLint status; - switch ( bpp ) + glShaderSource(shaderId, 1, &pShaderSource, NULL); + glCompileShader(shaderId); + glGetShaderiv(shaderId, GL_COMPILE_STATUS, &status); + if (!status) + { + GLint infoLen = 0; + glGetShaderiv(shaderId, GL_INFO_LOG_LENGTH, &infoLen); + if (infoLen > 1) { - case 16: - format = GL_RGB; - type = GL_UNSIGNED_SHORT_5_6_5; - break; + char* infoLog = (char*)malloc(sizeof(char) * infoLen); + glGetShaderInfoLog(shaderId, infoLen, NULL, infoLog); + SysLog(NID_UI_ANIM, "Failed to compile shader - %s", infoLog); + free(infoLog); + } - case 32: - format = GL_RGBA; - type = GL_UNSIGNED_BYTE; - break; + glDeleteShader(shaderId); + return 0; + } - default: - format = GL_RGB; - type = GL_UNSIGNED_BYTE; - break; + //for log + switch(type) + { + case GL_VERTEX_SHADER: + AppLog("\n jinstar -- BuildShader vertex %d", shaderId); + break; + case GL_FRAGMENT_SHADER: + AppLog("\n jinstar -- BuildShader fragment %d", shaderId); + break; + } + + return shaderId; +} + +bool +_GlContext::DeleteShader(GLuint shaderId) +{ +#ifndef VE_USE_GL_MULTI_CONTEXT + CHECK_GL_CONTEXT(); +#endif + + AppLog("\n jinstar -- Delete Shader %d", shaderId); + + glDeleteShader(shaderId); + + return true; +} + +GLuint +_GlContext::BuildShaderProgram(GLuint vertexShader, GLuint fragmentShader) +{ +#ifndef VE_USE_GL_MULTI_CONTEXT + CHECK_GL_CONTEXT(); +#endif + + if (vertexShader <= 0 || fragmentShader <= 0) + { + return 0; + } + + GLuint programId = glCreateProgram(); + + glAttachShader(programId, vertexShader); + glAttachShader(programId, fragmentShader); + + GLint linked; + glLinkProgram(programId); + glGetProgramiv(programId, GL_LINK_STATUS, &linked); + if (!linked) + { + GLint infoLen = 0; + glGetProgramiv(programId, GL_INFO_LOG_LENGTH, &infoLen); + if (infoLen >1) + { + char* infoLog = (char*)malloc(sizeof(char) * infoLen); + glGetShaderInfoLog(programId, infoLen, NULL, infoLog); + SysLog(NID_UI_ANIM, "Failed to link shader program- %s", infoLog); + free(infoLog); } - glTexImage2D(target, level, format, w, h, 0, format, type, pBits); + glDeleteProgram(programId); + return 0; } + + AppLog("\n jinstar -- Build Program %d", programId); + + return programId; +} + +bool +_GlContext::DeleteShaderProgram(GLuint programId) +{ +#ifndef VE_USE_GL_MULTI_CONTEXT + CHECK_GL_CONTEXT(); +#endif + + AppLog("\n jinstar -- Delete Program %d", programId); + + glDeleteProgram(programId); + + return true; +} + +int +_GlContext::GetAttribLocation(int program, const char* name) +{ + int location = glGetAttribLocation(program, name); + + AppLog("\n jinstar -- GetAttribLocation %d %s %d [error:%d]", program, name, location, glGetError()); + + return location; +// return glGetAttribLocation(program, name); } +int +_GlContext::GetUniformLocation(int program, const char* name) +{ + int location = glGetUniformLocation(program, name); + + AppLog("\n jinstar -- GetUniformLocation %d %s %d [error:%d]", program, name, location, glGetError()); + + return location; +// return glGetUniformLocation(program, name); +} + + +void +_GlContext::EnableVertexAttribArray(GLuint program, int index) +{ + glUseProgram(program); + + glEnableVertexAttribArray(index); + + AppLog("\n jinstar -- EnableVertexAttribArray %d %d [error:%d]", program, index, glGetError()); + //TODO: Need to return glGetError() +} + +void +_GlContext::DisableVertexAttribArray(GLuint program, int index) +{ + glUseProgram(program); + + glDisableVertexAttribArray(index); + + AppLog("\n jinstar -- EnableVertexAttribArray %d %d [error:%d]", program, index, glGetError()); +} + + }}} // Tizen::Ui::Animations diff --git a/src/ui/animations/FUiAnim_GlLayer.cpp b/src/ui/animations/FUiAnim_GlLayer.cpp index ace4139..c482aa0 100644 --- a/src/ui/animations/FUiAnim_GlLayer.cpp +++ b/src/ui/animations/FUiAnim_GlLayer.cpp @@ -61,7 +61,8 @@ namespace Tizen { namespace Ui { namespace Animations _GlLayer::_GlLayer(void) - : __showState(false) + : __isWindowOwner(true) + , __showState(false) , __opacity(1.0f) , __pRootVisualElement(null) , __pWindow(null) @@ -78,7 +79,7 @@ _GlLayer::~_GlLayer(void) { _GlRenderManager::GetInstance()->FinalizeGLLayer(this); - if (__pWindow) + if (__pWindow && __isWindowOwner) { _NativeWindow::DestroyNativeWindow(__pWindow); __pWindow = null; @@ -86,20 +87,35 @@ _GlLayer::~_GlLayer(void) } - result -_GlLayer::OnConstructed(void) +_GlLayer::ConstructForNativeWindow(const _NativeWindow& window) { SysAssertf(__pWindow == null, "Already constructed! Calling Construct() twice or more on a same instance is not allowed for this class."); + __isWindowOwner = false; + __pWindow = const_cast<_NativeWindow*>(&window); + + return Construct(); +} + + +result +_GlLayer::OnConstructed(void) +{ __bounds.SetBounds(0, 0, DEF_WIDTH, DEF_HEIGHT); - __pWindow = _NativeWindow::CreateNativeWindow(null, __bounds, null); + if(__isWindowOwner) + { + __pWindow = _NativeWindow::CreateNativeWindow(null, __bounds, null, 0); + } if (!_GlRenderManager::GetInstance()->InitializeGLLayer(this)) { - _NativeWindow::DestroyNativeWindow(__pWindow); - __pWindow = null; + if(__isWindowOwner) + { + _NativeWindow::DestroyNativeWindow(__pWindow); + __pWindow = null; + } return E_INVALID_STATE; // CHECKME: } @@ -140,7 +156,7 @@ _GlLayer::SetBounds(const FloatRectangle& bounds) __bounds = bounds; - if(__pWindow) + if(__pWindow && __isWindowOwner) { return __pWindow->SetBounds(bounds); } @@ -158,7 +174,7 @@ result _GlLayer::SetShowState(bool show) { __showState = true; - if(__pWindow) + if(__pWindow && __isWindowOwner) { return __pWindow->SetShowState(show); } @@ -176,7 +192,7 @@ void _GlLayer::SetOpacity(float opacity) { __opacity = opacity; - if(__pWindow) + if(__pWindow && __isWindowOwner) { __pWindow->SetOpacity(opacity); } @@ -192,7 +208,7 @@ _GlLayer::GetOpacity(void) bool _GlLayer::IsMapped(void) const { - if(__pWindow) + if(__pWindow && __isWindowOwner) { return __pWindow->IsMapped(); } diff --git a/src/ui/animations/FUiAnim_GlLayer.h b/src/ui/animations/FUiAnim_GlLayer.h index 6734d0c..6ac4cec 100644 --- a/src/ui/animations/FUiAnim_GlLayer.h +++ b/src/ui/animations/FUiAnim_GlLayer.h @@ -35,7 +35,6 @@ namespace Tizen { namespace Ui { namespace Animations { - #if defined(_OSP_EMUL_) #define VE_USE_GL_MULTI_CONTEXT #endif @@ -66,6 +65,8 @@ public: void SetReconfigureNeeded(bool need) { __reconfigureNeeded = need; } bool IsMapped(void) const; + result ConstructForNativeWindow(const Tizen::Ui::Animations::_NativeWindow& window); + _RootVisualElement* GetRootVisualElement(void) const { return __pRootVisualElement; @@ -105,6 +106,7 @@ public: private: Tizen::Graphics::FloatRectangle __bounds; + bool __isWindowOwner; bool __showState; float __opacity; _RootVisualElement* __pRootVisualElement; diff --git a/src/ui/animations/FUiAnim_MeshImportSample.cpp b/src/ui/animations/FUiAnim_MeshImportSample.cpp index e8d0e01..871ebdc 100644 --- a/src/ui/animations/FUiAnim_MeshImportSample.cpp +++ b/src/ui/animations/FUiAnim_MeshImportSample.cpp @@ -72,7 +72,7 @@ Geo::AddFrame(Mesh* pMesh) if(pMesh) { // not yet apply - pMesh->AdjustBoundingBox(); + pMesh->AdjustBoundingBox(); __meshList.Add(pMesh); } } diff --git a/src/ui/animations/FUiAnim_NativeLayer.cpp b/src/ui/animations/FUiAnim_NativeLayer.cpp index dfa804a..703ece2 100644 --- a/src/ui/animations/FUiAnim_NativeLayer.cpp +++ b/src/ui/animations/FUiAnim_NativeLayer.cpp @@ -96,7 +96,6 @@ _NativeLayer::CreateInstanceN(void) return pLayer; #endif - } result diff --git a/src/ui/animations/FUiAnim_NativeWindow.h b/src/ui/animations/FUiAnim_NativeWindow.h index 4fbfc60..59f899c 100644 --- a/src/ui/animations/FUiAnim_NativeWindow.h +++ b/src/ui/animations/FUiAnim_NativeWindow.h @@ -40,7 +40,7 @@ namespace Tizen { namespace Ui { namespace Animations { class _NativeWindow { public: - static _NativeWindow* CreateNativeWindow(const _NativeWindow* pParent, const Tizen::Graphics::FloatRectangle& bounds, const Tizen::Base::String* pExtension); + static _NativeWindow* CreateNativeWindow(const _NativeWindow* pParent, const Tizen::Graphics::FloatRectangle& bounds, const Tizen::Base::String* pExtension, Handle handle); static result DestroyNativeWindow(_NativeWindow* pWindow); // for Native Window System APIs diff --git a/src/ui/animations/platform/FUiAnim_NativeWindow.cpp b/src/ui/animations/platform/FUiAnim_NativeWindow.cpp index 797097e..e2d8389 100644 --- a/src/ui/animations/platform/FUiAnim_NativeWindow.cpp +++ b/src/ui/animations/platform/FUiAnim_NativeWindow.cpp @@ -3,24 +3,18 @@ #include "FBaseString.h" #include "FUiAnim_NativeWindow.h" +#if defined(VE_X_GL) #define X11_NATIVE -//#define WAYLAND_NATIVE -//#define WIN32_NATIVE - -#ifdef BUILD_UI_CORE -#undef X11_NATIVE -#endif - -#if defined(X11_NATIVE) #include "FUiAnim_X11Window.h" - +#elif defined(VE_WIN32_GL) +#define WIN32_NATIVE +#include "FUiAnim_Win32Window.h" #elif defined(WAYLAND_NATIVE) - -#elif defined(WIN32_NATIVE) - +#define WAYLAND_NATIVE #endif + using namespace Tizen::Base; using namespace Tizen::Graphics; using namespace Tizen::Ui; @@ -28,34 +22,48 @@ using namespace Tizen::Ui; namespace Tizen { namespace Ui { namespace Animations { + // static method _NativeWindow* -_NativeWindow::CreateNativeWindow(const _NativeWindow* pParent, const FloatRectangle& bounds, const String* pExtension) +_NativeWindow::CreateNativeWindow(const _NativeWindow* pParent, const FloatRectangle& bounds, const String* pExtension, Handle handle) { + _NativeWindow* pWindow = null; + +#if defined(X11_NATIVE) + // native is X11 if(pExtension) { //ToDo:Implementation return null; } - _NativeWindow* pWindow = null; - -#if defined(X11_NATIVE) - // native is X11 - - pWindow = new (std::nothrow) _X11Window; - pWindow->SetBounds(bounds); - pWindow->Construct(); + else + { + pWindow = new (std::nothrow) _X11Window; + pWindow->SetBounds(bounds); + pWindow->Construct(); + } #elif defined(WAYLAND_NATIVE) #elif defined(WIN32_NATIVE) - + if(pExtension) + { + if(pExtension->CompareTo(String(L"plugin")) == 0) + { +// _Win32Window + pWindow = new (std::nothrow) _Win32Window(handle); + } + else + { + pWindow = new (std::nothrow) _Win32Window; + pWindow->SetBounds(bounds); + pWindow->Construct(); + } + } #endif - return pWindow; - } result diff --git a/src/ui/animations/platform/FUiAnim_Win32Window.cpp b/src/ui/animations/platform/FUiAnim_Win32Window.cpp new file mode 100644 index 0000000..e24a6ee --- /dev/null +++ b/src/ui/animations/platform/FUiAnim_Win32Window.cpp @@ -0,0 +1,67 @@ + +#include +#include "FUiAnim_GlLayer.h" +#include "FUiAnim_DisplayManager.h" +#include "FUiAnim_GlRenderManager.h" +#include "FUiAnim_Win32Window.h" + +namespace Tizen { namespace Ui { namespace Animations { + +_Win32Window::_Win32Window() +{ + +} + +_Win32Window::_Win32Window(Handle windowHandle) +{ + RECT rect; + __window = windowHandle; + ::GetWindowRect(__window, &rect); + __bounds.x = rect.x; + __bounds.y = rect.y; + __bounds.width = rect.width; + __bounds.height = rect.height; + + + __showState = (bool) ::IsVisibleWindow(__window); + __opacity = 1.0f; + __isMapped = true; +} + +_Win32Window::~_Win32Window() +{ + +} + +Handle +_Win32Window::OnConstructing() +{ + +} + +void +_Win32Window::OnDestructing() +{ + +} + +void +_Win32Window::OnBoundsChanging(const Tizen::Graphics::FloatRectangle& newBounds) +{ + +} + +void +_Win32Window::OnShowStateChanging(bool newShowState) +{ + +} + +void +_Win32Window::OnOpacityChanging(float newOpacity) +{ + +} + + +}}} //namespace Tizen { namespace Ui { namespace Animations { diff --git a/src/ui/animations/platform/FUiAnim_Win32Window.h b/src/ui/animations/platform/FUiAnim_Win32Window.h new file mode 100644 index 0000000..9eadb23 --- /dev/null +++ b/src/ui/animations/platform/FUiAnim_Win32Window.h @@ -0,0 +1,52 @@ +// +// Open Service Platform +// Copyright (c) 2013 Samsung Electronics Co., Ltd. +// +// Licensed under the Flora License, Version 1.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://floralicense.org/license/ +// +// 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. +// + +/** + * @file FUiAnim_Win32Window.h + * @brief This is the header file for the _Win32Window class. + * + * This header file contains the declarations of the _X11Window class. @n + */ + +#ifndef _FUI_ANIM_WIN32_WINDOW_H_ +#define _FUI_ANIM_WIN32_WINDOW_H_ + +#include "FUiAnim_NativeWindow.h" + + +namespace Tizen { namespace Ui { namespace Animations { + +class _GlLayer; + +class _Win32Window : public _NativeWindow +{ +public: + _Win32Window(); + _Win32Window(Handle windowHandle); + virtual ~_Win32Window(); + +protected: + virtual Handle OnConstructing(); + virtual void OnDestructing(); + virtual void OnBoundsChanging(const Tizen::Graphics::FloatRectangle& newBounds); + virtual void OnShowStateChanging(bool newShowState); + virtual void OnOpacityChanging(float newOpacity); +}; + +}}} //namespace Tizen { namespace Ui { namespace Animations { + +#endif // _FUI_ANIM_WIN32_WINDOW_H_