Introducing check to enable rendering dependent on the content state.
authorMichael Schuldt <michael.schuldt@bmw-carit.de>
Fri, 9 Dec 2011 12:59:59 +0000 (13:59 +0100)
committerMichael Schuldt <michael.schuldt@bmw-carit.de>
Fri, 9 Dec 2011 12:59:59 +0000 (13:59 +0100)
- Rendering is enables after a graphic context refresh was send.

LayerManagerPlugins/Renderers/Graphic/include/PlatformSurfaces/XPlatformSurface.h
LayerManagerPlugins/Renderers/Graphic/src/TextureBinders/X11CopyGLES.cpp
LayerManagerPlugins/Renderers/Graphic/src/TextureBinders/X11CopyGLX.cpp
LayerManagerPlugins/Renderers/Graphic/src/TextureBinders/X11EglImage.cpp
LayerManagerPlugins/Renderers/Graphic/src/TextureBinders/X11TextureFromPixmap.cpp
LayerManagerPlugins/Renderers/Graphic/src/WindowSystems/X11WindowSystem.cpp

index 2160ae4..d15a29d 100644 (file)
@@ -32,17 +32,33 @@ public:
     , isMapped(false)
     , pixmap(0)
     , texture(0)
+    , m_isReadyForRendering(false)
     {
     }
 
     ~XPlatformSurface()
     {
     }
+    
+    bool enableRendering()
+    {
+        m_isReadyForRendering = true;
+    }
 
+    bool disableRendering()
+    {
+        m_isReadyForRendering = false;
+    }
+
+    bool isReadyForRendering()
+    {
+        return m_isReadyForRendering;
+    }
     // TODO: private/protected
     bool isMapped;
     Pixmap pixmap;
     uint texture;
+    bool m_isReadyForRendering;    
 };
 
 #endif /* _XPLATFORMSURFACE_H_ */
index 28db1d5..3457670 100644 (file)
@@ -37,7 +37,7 @@ bool X11CopyGLES::bindSurfaceTexture(Surface* surface)
     {
         nativeSurface = (XPlatformSurface*)surface->platform;
     } 
-    if( nativeSurface != NULL && surface->getNativeContent() != 0 )
+    if( nativeSurface != NULL && surface->getNativeContent() != 0 && nativeSurface->isReadyForRendering())
     {
            pixmap = XCompositeNameWindowPixmap (dpy, surface->getNativeContent());
            if (!pixmap)
index e671291..9272996 100644 (file)
@@ -34,7 +34,7 @@ bool X11CopyGLX::bindSurfaceTexture(Surface* surface)
     {
         nativeSurface = (XPlatformSurface*)surface->platform;
     } 
-    if( nativeSurface != NULL && surface->getNativeContent() != 0 )
+    if( nativeSurface != NULL && surface->getNativeContent() != 0 && nativeSurface->isReadyForRendering())
     {
         pixmap = XCompositeNameWindowPixmap (dpy, surface->getNativeContent());
         if (!pixmap)
index de66298..7e08adc 100644 (file)
@@ -45,7 +45,7 @@ X11EglImage::X11EglImage(EGLDisplay eglDisplay, Display* x11display)
 bool X11EglImage::bindSurfaceTexture(Surface* surface)
 {
     EglXPlatformSurface* nativeSurface = (EglXPlatformSurface*)surface->platform;
-    if (nativeSurface)
+    if (nativeSurface && nativeSurface->isReadyForRendering())
     {
         glBindTexture(GL_TEXTURE_2D, nativeSurface->texture);
         if (nativeSurface->eglImage)
index 1e11eab..ccaa700 100644 (file)
@@ -58,7 +58,7 @@ bool X11TextureFromPixmap::bindSurfaceTexture(Surface* surface)
 bool X11TextureFromPixmap::unbindSurfaceTexture(Surface* surface)
 {
     GLXPlatformSurface* nativeSurface = (GLXPlatformSurface*)surface->platform;
-    if (nativeSurface)
+    if (nativeSurface && nativeSurface->isReadyForRendering())
     {
         glXReleaseTexImageEXT_func(dpy, nativeSurface->glxPixmap, GLX_FRONT_LEFT_EXT);
         return true;
index 37e7806..f77ee2b 100644 (file)
@@ -805,6 +805,13 @@ init_complete:
                     {
                         LOG_WARNING("X11WindowSystem", "Surface empty during damage notification");
                         break;
+                    } else {
+                        if (currentSurface->platform != NULL) 
+                        {
+                            /* Enable Rendering for Surface, after damage Notification was send successfully */
+                            /* This will ensure, that the content is not dirty */
+                            ((XPlatformSurface *)(currentSurface->platform))->enableRendering();
+                        }
                     }
                     currentSurface->damaged = true;
                     checkRedraw = true;