Delete dead code.

Change-Id: I5b87fac4e2140a903221a1f68b16fa6a96e5effc
diff --git a/tools/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.cpp b/tools/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.cpp
index 950abab..87e7a24 100644
--- a/tools/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.cpp
+++ b/tools/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.cpp
@@ -131,17 +131,6 @@
     fb->unbind_locked();
 }
 
-void ColorBuffer::update(GLenum p_format, GLenum p_type, void *pixels)
-{
-    FrameBuffer *fb = FrameBuffer::getFB();
-    if (!fb->bind_locked()) return;
-    s_gl.glBindTexture(GL_TEXTURE_2D, m_tex);
-    s_gl.glPixelStorei(GL_UNPACK_ALIGNMENT, 1);
-    s_gl.glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0,
-                         m_width, m_height, p_format, p_type, pixels);
-    fb->unbind_locked();
-}
-
 void ColorBuffer::subUpdate(int x, int y, int width, int height, GLenum p_format, GLenum p_type, void *pixels)
 {
     FrameBuffer *fb = FrameBuffer::getFB();
@@ -153,52 +142,6 @@
     fb->unbind_locked();
 }
 
-bool ColorBuffer::blitFromPbuffer(EGLSurface p_pbufSurface)
-{
-    FrameBuffer *fb = FrameBuffer::getFB();
-    if (!fb->bind_locked()) return false;
-
-    //
-    // bind FBO object which has this colorbuffer as render target
-    //
-    if (!bind_fbo()) {
-        fb->unbind_locked();
-        return false;
-    }
-
-    //
-    // bind the pbuffer to a temporary texture object
-    //
-    GLuint tempTex;
-    s_gl.glGenTextures(1, &tempTex);
-    s_gl.glBindTexture(GL_TEXTURE_2D, tempTex);
-    if (!s_egl.eglBindTexImage(fb->getDisplay(), p_pbufSurface, EGL_BACK_BUFFER)) {
-        printf("eglBindTexImage failed 0x%x\n", s_egl.eglGetError());
-        s_gl.glDeleteTextures(1, &tempTex);
-        fb->unbind_locked();
-        return false;
-    }
-
-    s_gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
-    s_gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
-    s_gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
-    s_gl.glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
-    s_gl.glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE);
-    s_gl.glEnable(GL_TEXTURE_2D);
-
-    drawTexQuad();
-
-    //
-    // unbind FBO, release the pbuffer and delete the temp texture object
-    //
-    s_gl.glBindFramebufferOES(GL_FRAMEBUFFER_OES, 0);
-    s_egl.eglReleaseTexImage(fb->getDisplay(), p_pbufSurface, EGL_BACK_BUFFER);
-    s_gl.glDeleteTextures(1, &tempTex);
-
-    fb->unbind_locked();
-    return true;
-}
-
 bool ColorBuffer::blitFromCurrentReadBuffer()
 {
     RenderThreadInfo *tInfo = getRenderThreadInfo();
diff --git a/tools/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.h b/tools/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.h
index 5e01dcc..16d1ee9 100644
--- a/tools/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.h
+++ b/tools/emulator/opengl/host/libs/libOpenglRender/ColorBuffer.h
@@ -32,9 +32,7 @@
     GLuint getWidth() const { return m_width; }
     GLuint getHeight() const { return m_height; }
 
-    void update(GLenum p_format, GLenum p_type, void *pixels);
     void subUpdate(int x, int y, int width, int height, GLenum p_format, GLenum p_type, void *pixels);
-    bool blitFromPbuffer(EGLSurface p_pbufSurface);
     bool post();
     bool bindToTexture();
     bool bindToRenderbuffer();
diff --git a/tools/emulator/opengl/host/libs/libOpenglRender/WindowSurface.cpp b/tools/emulator/opengl/host/libs/libOpenglRender/WindowSurface.cpp
index b8d1bd2..3674120 100644
--- a/tools/emulator/opengl/host/libs/libOpenglRender/WindowSurface.cpp
+++ b/tools/emulator/opengl/host/libs/libOpenglRender/WindowSurface.cpp
@@ -84,8 +84,6 @@
 void WindowSurface::flushColorBuffer()
 {
     if (m_attachedColorBuffer.Ptr() != NULL) {
-
-        //copyToColorBuffer();
         blitToColorBuffer();
     }
 }
@@ -142,84 +140,6 @@
 
 }
 
-void WindowSurface::copyToColorBuffer()
-{
-    if (!m_width && !m_height) return;
-
-    if (m_attachedColorBuffer->getWidth() != m_width ||
-        m_attachedColorBuffer->getHeight() != m_height) {
-        // XXX: should never happen - how this needs to be handled?
-        return;
-    }
-
-    void *data = m_xferBuffer.alloc(m_width * m_height * 4);
-    if (!data) {
-        fprintf(stderr,"WARNING: Failed to copy buffer data - OutOfMemory\n");
-        return;
-    }
-
-    //
-    // Make the surface current
-    //
-    EGLContext prevContext = s_egl.eglGetCurrentContext();
-    EGLSurface prevReadSurf = s_egl.eglGetCurrentSurface(EGL_READ);
-    EGLSurface prevDrawSurf = s_egl.eglGetCurrentSurface(EGL_DRAW);
-    FrameBuffer *fb = FrameBuffer::getFB();
-    if (!s_egl.eglMakeCurrent(fb->getDisplay(), m_eglSurface,
-                              m_eglSurface, m_drawContext->getEGLContext())) {
-        return;
-    }
-
-    if (m_drawContext->isGL2()) {
-#ifdef WITH_GLES2
-        s_gl2.glPixelStorei(GL_PACK_ALIGNMENT, 1);
-        s_gl2.glReadPixels(0, 0, m_width, m_height,
-                          GL_RGBA, GL_UNSIGNED_BYTE, data);
-#else
-        return; // should never happen, context cannot be GL2 in this case.
-#endif
-    }
-    else {
-        s_gl.glPixelStorei(GL_PACK_ALIGNMENT, 1);
-        s_gl.glReadPixels(0, 0, m_width, m_height,
-                          GL_RGBA, GL_UNSIGNED_BYTE, data);
-    }
-
-//
-// XXX: for some reason flipping the image is not required on
-//      Mac. Need to find the reason, currently unkbown.
-//
-#ifndef __APPLE__
-#define FLIP_BUFFER 1
-#endif
-
-#if FLIP_BUFFER
-    //We need to flip the pixels
-    int bpp = 4;
-    void *tmpBuf = m_xUpdateBuf.alloc(m_width * m_height * bpp);
-
-    int dst_line_len = m_width * bpp;
-    int src_line_len = m_width * bpp;
-    char *src = (char *)data;
-    char *dst = (char*)tmpBuf + (m_height-1)*dst_line_len;
-    for (uint32_t  y=0; y<m_height; y++) {
-        memcpy(dst, src, dst_line_len);
-        src += src_line_len;
-        dst -= dst_line_len;
-    }
-    // update the attached color buffer with the fliped readback pixels
-    m_attachedColorBuffer->update(GL_RGBA, GL_UNSIGNED_BYTE, tmpBuf);
-#else
-    // update the attached color buffer with the readback pixels
-    m_attachedColorBuffer->update(GL_RGBA, GL_UNSIGNED_BYTE, data);
-#endif
-
-    // restore current context/surface
-    s_egl.eglMakeCurrent(fb->getDisplay(), prevDrawSurf,
-                         prevReadSurf, prevContext);
-
-}
-
 void WindowSurface::blitToColorBuffer()
 {
     if (!m_width && !m_height) return;
diff --git a/tools/emulator/opengl/host/libs/libOpenglRender/WindowSurface.h b/tools/emulator/opengl/host/libs/libOpenglRender/WindowSurface.h
index 6c08954..1b655c9 100644
--- a/tools/emulator/opengl/host/libs/libOpenglRender/WindowSurface.h
+++ b/tools/emulator/opengl/host/libs/libOpenglRender/WindowSurface.h
@@ -44,7 +44,6 @@
 private:
     WindowSurface();
 
-    void copyToColorBuffer();  // copy pbuffer content with readback+download
     void blitToColorBuffer();  // copy pbuffer content with texload and blit
     bool resizePbuffer(unsigned int p_width, unsigned int p_height);