=== modified file 'src/composite-canvas.cc'
--- src/composite-canvas.cc	2011-07-18 13:28:08 +0000
+++ src/composite-canvas.cc	2011-08-03 14:34:10 +0000
@@ -448,7 +448,7 @@
     {
         CompositeWindow *comp_win = *iter;
         if (comp_win->get_texture().is_valid())
-            comp_win->update_texture_from_pixmap(false);
+            comp_win->update_texture_from_pixmap();
     }
 }
 

=== modified file 'src/composite-window-eglimage.cc'
--- src/composite-window-eglimage.cc	2011-04-04 12:56:06 +0000
+++ src/composite-window-eglimage.cc	2011-08-03 14:34:10 +0000
@@ -37,34 +37,44 @@
 
 CompositeWindowEGLImage::~CompositeWindowEGLImage()
 {
-    if (egl_image_)
+    release_tfp();
+}
+
+void
+CompositeWindowEGLImage::release_tfp()
+{
+    if (egl_image_) {
         eglDestroyImageKHR_(egl_display_, egl_image_);
+        egl_image_ = 0;
+    }
 }
 
 void
-CompositeWindowEGLImage::update_texture_from_pixmap(bool recreate)
+CompositeWindowEGLImage::update_texture()
 {
+    CompositeWindowGL::update_texture();
+
     const EGLint egl_image_attribs[] = {
         EGL_IMAGE_PRESERVED_KHR, EGL_TRUE,
         EGL_NONE
     };
 
+    release_tfp();
+
+    egl_image_ = eglCreateImageKHR_(egl_display_, EGL_NO_CONTEXT,
+                                    EGL_NATIVE_PIXMAP_KHR,
+                                    reinterpret_cast<EGLClientBuffer>(pix_),
+                                    egl_image_attribs);
+
+    Log::debug("    => EGLImage <= %p\n", egl_image_);
+    Log::debug("    => eglError 0x%x\n", eglGetError());
+}
+
+void
+CompositeWindowEGLImage::update_texture_from_pixmap()
+{
     Profiler::ScopedSamples scoped_tfp(CompositeWindow::get_profiler_tfp_pair());
 
-    if (recreate) {
-        if (egl_image_) {
-            eglDestroyImageKHR_(egl_display_, egl_image_);
-            egl_image_ = 0;
-        }
-        egl_image_ = eglCreateImageKHR_(egl_display_, EGL_NO_CONTEXT,
-                                        EGL_NATIVE_PIXMAP_KHR,
-                                        reinterpret_cast<EGLClientBuffer>(pix_),
-                                        egl_image_attribs);
-
-        Log::debug("    => EGLImage <= %p\n", egl_image_);
-        Log::debug("    => eglError 0x%x\n", eglGetError());
-    }
-
     /* Update texture with new data */
     eglWaitNative(EGL_CORE_NATIVE_ENGINE);
 

=== modified file 'src/composite-window-eglimage.h'
--- src/composite-window-eglimage.h	2011-07-15 08:16:54 +0000
+++ src/composite-window-eglimage.h	2011-08-03 14:34:10 +0000
@@ -39,9 +39,11 @@
         egl_image_(0), egl_display_(egl_display) {}
     ~CompositeWindowEGLImage();
 
-    void update_texture_from_pixmap(bool recreate);
+    void update_texture();
+    void update_texture_from_pixmap();
 
 private:
+    void release_tfp();
     EGLImageKHR egl_image_;
     EGLDisplay egl_display_;
 };

=== modified file 'src/composite-window-gl.cc'
--- src/composite-window-gl.cc	2011-07-15 08:16:54 +0000
+++ src/composite-window-gl.cc	2011-08-03 14:34:10 +0000
@@ -30,11 +30,9 @@
         glDeleteTextures(1, &tex_);
 }
 
-bool
+void
 CompositeWindowGL::update_texture()
 {
-    bool ret = false;
-
     if (!tex_ && attr_.map_state != 0) {
         glGenTextures(1, &tex_);
 
@@ -45,14 +43,10 @@
         glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
 
         Log::debug("    => texture <= 0x%x\n", (unsigned) tex_);
-        ret = true;
     }
     else if (tex_ && attr_.map_state == 0) {
         Log::debug("    => Deleting texture 0x%x\n", (unsigned) tex_);
         glDeleteTextures(1, &tex_);
-        tex_ = 0;
     }
-
-    return ret;
 }
 

=== modified file 'src/composite-window-gl.h'
--- src/composite-window-gl.h	2011-07-15 08:16:54 +0000
+++ src/composite-window-gl.h	2011-08-03 14:34:10 +0000
@@ -36,7 +36,7 @@
     virtual ~CompositeWindowGL();
 
     virtual Texture get_texture() { return CompositeWindow::Texture(tex_); }
-    virtual bool update_texture();
+    virtual void update_texture();
 
 protected:
     GLuint tex_;

=== modified file 'src/composite-window-glxpixmap.cc'
--- src/composite-window-glxpixmap.cc	2011-07-20 09:17:11 +0000
+++ src/composite-window-glxpixmap.cc	2011-08-03 14:34:10 +0000
@@ -52,24 +52,28 @@
 }
 
 void
-CompositeWindowGLXPixmap::update_texture_from_pixmap(bool recreate)
+CompositeWindowGLXPixmap::update_texture()
 {
+    CompositeWindowGL::update_texture();
+
     const int pixmap_attribs[] = {
         GLX_TEXTURE_TARGET_EXT, GLX_TEXTURE_2D_EXT,
         GLX_TEXTURE_FORMAT_EXT, GLX_TEXTURE_FORMAT_RGBA_EXT,
         None
     };
 
+    release_tfp();
+    glx_pixmap_ = glXCreatePixmap(xdpy_, glx_fbconfig_, pix_,
+                                  pixmap_attribs);
+
+    Log::debug("    => GLXPixmap <= %p\n", glx_pixmap_);
+}
+
+void
+CompositeWindowGLXPixmap::update_texture_from_pixmap()
+{
     Profiler::ScopedSamples scoped_tfp(CompositeWindow::get_profiler_tfp_pair());
 
-    if (recreate) {
-        release_tfp();
-        glx_pixmap_ = glXCreatePixmap(xdpy_, glx_fbconfig_, pix_,
-                                      pixmap_attribs);
-
-        Log::debug("    => GLXPixmap <= %p\n", glx_pixmap_);
-    }
-
     /* Update texture with new data */
     glXWaitX();
 

=== modified file 'src/composite-window-glxpixmap.h'
--- src/composite-window-glxpixmap.h	2011-07-20 08:23:33 +0000
+++ src/composite-window-glxpixmap.h	2011-08-03 14:34:10 +0000
@@ -37,7 +37,8 @@
         glx_fbconfig_ (glx_fbconfig), glx_pixmap_bound_(false) {}
     ~CompositeWindowGLXPixmap();
 
-    void update_texture_from_pixmap(bool recreate);
+    void update_texture();
+    void update_texture_from_pixmap();
 
 private:
     void release_tfp();

=== modified file 'src/composite-window-pixman.cc'
--- src/composite-window-pixman.cc	2011-07-19 16:01:23 +0000
+++ src/composite-window-pixman.cc	2011-08-03 14:34:10 +0000
@@ -188,31 +188,31 @@
 }
 
 void
-CompositeWindowPixman::update_texture_from_pixmap(bool recreate)
+CompositeWindowPixman::update_texture()
+{
+    release_resources();
+
+    if (use_shm_) {
+        if (!ensure_ximage_shm() || !ensure_pixman_image())
+            return;
+    }
+    else {
+        if (!ensure_ximage() || !ensure_pixman_image())
+            return;
+    }
+}
+
+void
+CompositeWindowPixman::update_texture_from_pixmap()
 {
     Profiler::ScopedSamples scoped_tfp(CompositeWindow::get_profiler_tfp_pair());
 
-    if (recreate)
-        release_resources();
-
     if (use_shm_) {
-        if (!ensure_ximage_shm() || !ensure_pixman_image())
-            return;
-
         XShmGetImage(xdpy_, pix_, ximage_, 0, 0, AllPlanes);
     }
     else {
-        if (!ensure_ximage() || !ensure_pixman_image())
-            return;
-
         XGetSubImage(xdpy_, pix_, 0, 0, width_, height_, AllPlanes, ZPixmap,
                      ximage_, 0, 0);
     }
 
 }
-
-bool
-CompositeWindowPixman::update_texture()
-{
-    return false;
-}

=== modified file 'src/composite-window-pixman.h'
--- src/composite-window-pixman.h	2011-07-18 16:26:56 +0000
+++ src/composite-window-pixman.h	2011-08-03 14:34:10 +0000
@@ -47,8 +47,8 @@
         return CompositeWindow::Texture(pixman_image_);
     }
 
-    bool update_texture();
-    void update_texture_from_pixmap(bool recreate);
+    void update_texture();
+    void update_texture_from_pixmap();
 
 private:
     bool have_xshm();

=== modified file 'src/composite-window-ximage.cc'
--- src/composite-window-ximage.cc	2011-04-04 12:56:06 +0000
+++ src/composite-window-ximage.cc	2011-08-03 14:34:10 +0000
@@ -36,23 +36,27 @@
 }
 
 void
-CompositeWindowXImage::update_texture_from_pixmap(bool recreate)
+CompositeWindowXImage::update_texture()
+{
+    CompositeWindowGL::update_texture();
+
+    glBindTexture(GL_TEXTURE_2D, tex_);
+    glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
+                 width_, height_, 0,
+                 GL_RGBA, GL_UNSIGNED_BYTE, NULL);
+}
+
+void
+CompositeWindowXImage::update_texture_from_pixmap()
 {
     Profiler::ScopedSamples scoped_tfp(CompositeWindow::get_profiler_tfp_pair());
 
-    glBindTexture(GL_TEXTURE_2D, tex_);
-
-    if (recreate) {
-        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA,
-                width_, height_, 0,
-                GL_RGBA, GL_UNSIGNED_BYTE, NULL);
-    }
-
     if (ximage_)
         XDestroyImage(ximage_);
 
     ximage_ = XGetImage(xdpy_, pix_, 0, 0, width_, height_, AllPlanes, ZPixmap);
     if (ximage_) {
+        glBindTexture(GL_TEXTURE_2D, tex_);
         /*
          * Note that the data we get from the pixmap is BGRA but the texture
          * expects RGBA, so what we are doing here is technically incorrect

=== modified file 'src/composite-window-ximage.h'
--- src/composite-window-ximage.h	2011-07-15 08:16:54 +0000
+++ src/composite-window-ximage.h	2011-08-03 14:34:10 +0000
@@ -35,7 +35,8 @@
         CompositeWindowGL(xdpy, win), ximage_(0) {}
     ~CompositeWindowXImage();
 
-    void update_texture_from_pixmap(bool recreate);
+    void update_texture();
+    void update_texture_from_pixmap();
 
 private:
     XImage *ximage_;

=== modified file 'src/composite-window.cc'
--- src/composite-window.cc	2011-07-15 08:16:54 +0000
+++ src/composite-window.cc	2011-08-03 14:34:10 +0000
@@ -96,10 +96,10 @@
     }
 
     /* Create or delete texture if needed */
-    update_tfp = update_texture() || update_tfp;
-
-    if (update_tfp)
-        update_texture_from_pixmap(true);
+    if (update_tfp) {
+        update_texture();
+        update_texture_from_pixmap();
+    }
 
     /*
      * We have to free the pixmap after calling update_texture_from_pixmap(),
@@ -123,5 +123,5 @@
     if (damage_)
         XDamageSubtract(xdpy_, damage_, None, None);
 
-    update_texture_from_pixmap(false);
+    update_texture_from_pixmap();
 }

=== modified file 'src/composite-window.h'
--- src/composite-window.h	2011-07-15 08:16:54 +0000
+++ src/composite-window.h	2011-08-03 14:34:10 +0000
@@ -49,8 +49,13 @@
     Window get_xwindow();
 
     virtual Texture get_texture() = 0;
-    virtual bool update_texture() = 0;
-    virtual void update_texture_from_pixmap(bool recreate) = 0;
+    /* 
+     * Update the texture itself (whatever that happens
+     * to be, eg GL texture + TFP, pixman image)
+     */
+    virtual void update_texture() = 0;
+    /* Update the texture contents from the pixmap */
+    virtual void update_texture_from_pixmap() = 0;
 
 protected:
     Display *xdpy_;

