Bugfix : Improvement for handling, native X applications
authorMichael Schuldt <michael.schuldt@bmw-carit.de>
Wed, 29 Jun 2011 11:59:27 +0000 (13:59 +0200)
committerMichael Schuldt <michael.schuldt@bmw-carit.de>
Wed, 29 Jun 2011 11:59:27 +0000 (13:59 +0200)
CMakeLists.txt
LayerManagerCommands/src/CommitCommand.cpp
LayerManagerExamples/LayerManagerClientExample/src/LayermanagerClientTest.c
LayerManagerPlugins/Renderers/Graphic/include/TextureBinders/X11CopyGLES.h
LayerManagerPlugins/Renderers/Graphic/src/TextureBinders/X11CopyGLES.cpp
LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp

index cb94949..6c1c2d1 100644 (file)
@@ -78,7 +78,7 @@ add_subdirectory (LayerManagerUtils)
 add_subdirectory (LayerManagerCommands)
 add_subdirectory (LayerManagerService)
 add_subdirectory (LayerManagerExamples/LayerManagerClientExample)
-
+add_subdirectory (LayerManagerExamples/LayerManagerToolBox)
     
 if (WITH_DESKTOP)
     add_subdirectory (LayerManagerPlugins/Renderers/Platform/GLXRenderer)
@@ -97,3 +97,4 @@ if (WITH_GLX_EXAMPLE)
 endif(WITH_GLX_EXAMPLE)
 
 
+
index 913263f..6232a2e 100644 (file)
@@ -26,10 +26,10 @@ ExecutionResult CommitCommand::execute(ICommandExecutor* executor)
     bool success = true;
     bool redraw = false;
 
-    Scene& scene = *(executor->getScene());
+    Scene* scene = (executor->getScene());
 
-    CommandListIterator iter = scene.m_toBeCommittedList.begin();
-    CommandListIterator iterEnd = scene.m_toBeCommittedList.end();
+    CommandListIterator iter = scene->m_toBeCommittedList.begin();
+    CommandListIterator iterEnd = scene->m_toBeCommittedList.end();
 
     for (; iter != iterEnd; ++iter)
     {
@@ -51,7 +51,7 @@ ExecutionResult CommitCommand::execute(ICommandExecutor* executor)
             delete command;
         }
     }
-    scene.m_toBeCommittedList.clear();
+    scene->m_toBeCommittedList.clear();
 
     ExecutionResult returnValue = ExecutionFailed;
 
index aeb1f57..5ec4fd0 100644 (file)
@@ -106,6 +106,7 @@ ilmErrorTypes createLayers(t_ilm_int LayerWidth, t_ilm_int LayerHeight)
     }
 
     ilm_displaySetRenderOrder(0, &layer[0], 3);
+    ilm_commitChanges();
 
     return error;
 }
index f0016f0..816a015 100644 (file)
@@ -35,7 +35,7 @@ public:
                // pseudo require EGL to have been initialised
                // we dont really need the handle
        };
-       void swapPixmap(unsigned char* src,unsigned char* dest,unsigned int width,unsigned int height,bool swaprgb);
+       void swapPixmap(unsigned char* src,unsigned char* dest,unsigned int width,unsigned int height,bool swaprgb,bool includeAlpha);
        bool bindSurfaceTexture(Surface* surface);
     void createClientBuffer(Surface* surface);
     void destroyClientBuffer(Surface* surface);
index 01d68ff..d562aa3 100644 (file)
@@ -32,6 +32,7 @@ bool X11CopyGLES::bindSurfaceTexture(Surface* surface)
     GLenum sourceType = GL_RGBA;
        unsigned char* swapedData = NULL;
        bool swaprgb = false;
+    bool includeAlpha = false;
     if (surface != NULL ) 
     {
         nativeSurface = (XPlatformSurface*)surface->platform;
@@ -51,16 +52,28 @@ bool X11CopyGLES::bindSurfaceTexture(Surface* surface)
                    glBindTexture(GL_TEXTURE_2D, nativeSurface->texture);
                    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
                    glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-                   if ( xim->depth == 24 )
+                   if ( surface->getPixelFormat() == PIXELFORMAT_RGB888)
                    {
                            targetType = GL_RGB;
                            sourceType = GL_RGB;
-                           swaprgb = true;
+                           swaprgb = true;                
                            swapedData = new unsigned char[surface->OriginalSourceWidth*surface->OriginalSourceHeight*3];
-                   } else {
-                           swapedData = new unsigned char[surface->OriginalSourceWidth*surface->OriginalSourceHeight*4];
-                   }
-                   swapPixmap((unsigned char*)xim->data, swapedData, surface->OriginalSourceWidth, surface->OriginalSourceHeight,swaprgb);
+                   } 
+            else if ( surface->getPixelFormat() == PIXELFORMAT_RGBA8888)
+            {
+                if (xim->depth == 24) 
+                {
+                               includeAlpha = true;
+                }
+                swapedData = new unsigned char[surface->OriginalSourceWidth*surface->OriginalSourceHeight*4];
+                   } 
+            else 
+            {
+                LOG_ERROR("X11CopyGLES","Pixelformat currently not supported : " << surface->getPixelFormat());
+                   XDestroyImage(xim);
+                return false;
+            }
+                   swapPixmap((unsigned char*)xim->data, swapedData, surface->OriginalSourceWidth, surface->OriginalSourceHeight,swaprgb,includeAlpha);
                    glTexImage2D(GL_TEXTURE_2D, 0, sourceType, surface->OriginalSourceWidth, surface->OriginalSourceHeight, 0, targetType, GL_UNSIGNED_BYTE, swapedData);
                    XDestroyImage(xim);
                    delete[] swapedData;
@@ -69,7 +82,7 @@ bool X11CopyGLES::bindSurfaceTexture(Surface* surface)
     }
     return false;
 }
-void X11CopyGLES::swapPixmap(unsigned char* src,unsigned char* dest, unsigned int width,unsigned int height,bool swaprgb) 
+void X11CopyGLES::swapPixmap(unsigned char* src,unsigned char* dest, unsigned int width,unsigned int height,bool swaprgb,bool includeAlpha
 {
        unsigned int count = 0; 
        if (swaprgb == false)
@@ -79,10 +92,14 @@ void X11CopyGLES::swapPixmap(unsigned char* src,unsigned char* dest, unsigned in
                        dest[j*4]=src[j*4+2];
                        dest[j*4+1]=src[j*4+1];
                        dest[j*4+2]=src[j*4];
-                       dest[j*4+3]=src[j*4+3];
+            dest[j*4+3]=src[j*4+3];
+            if (includeAlpha) 
+            {    
+                       dest[j*4+3]=255;
+            } 
                }
        } else {
-               count = width*height;
+               count = width*height;        
                for (int j=0;j<count; j++) 
                {
                        dest[j*3]=src[j*3+2];
index d9928ce..ee5d698 100644 (file)
@@ -770,7 +770,7 @@ void* X11WindowSystem::EventLoop(void * ptr)
                        case UnmapNotify:
                                LOG_DEBUG("X11WindowSystem", "Unmap Event");
                                windowsys->UnMapWindow(event.xunmap.window);
-                               checkRedraw = true;
+                               checkRedraw = true;  
                                break;
                        case ReparentNotify:
                                LOG_DEBUG("X11WindowSystem", "Reparent Event");