diff options
| author | Stuart Scott <stuartscott@google.com> | 2013-08-23 10:54:47 -0700 |
|---|---|---|
| committer | Stuart Scott <stuartscott@google.com> | 2013-08-23 13:18:40 -0700 |
| commit | 9ca0017d2a6651ce9b795082b249f66e476aaf44 (patch) | |
| tree | 06006541f2416d7bc38ff79c7fe0e7f4231026da /emulator/opengl/host/libs/libOpenglRender/WindowSurface.cpp | |
| parent | a2af11851c77884bc9b35f48f6b08a4773f02b64 (diff) | |
| download | sdk-9ca0017d2a6651ce9b795082b249f66e476aaf44.zip sdk-9ca0017d2a6651ce9b795082b249f66e476aaf44.tar.gz sdk-9ca0017d2a6651ce9b795082b249f66e476aaf44.tar.bz2 | |
Catch NULL context and bubbling error up.
bug: 10456411
Fix for internal bug
Change-Id: I85181d358f1844b25cc85fbaf5f64842d5ed6f22
Diffstat (limited to 'emulator/opengl/host/libs/libOpenglRender/WindowSurface.cpp')
| -rw-r--r-- | emulator/opengl/host/libs/libOpenglRender/WindowSurface.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/emulator/opengl/host/libs/libOpenglRender/WindowSurface.cpp b/emulator/opengl/host/libs/libOpenglRender/WindowSurface.cpp index 3674120..9c32ff8 100644 --- a/emulator/opengl/host/libs/libOpenglRender/WindowSurface.cpp +++ b/emulator/opengl/host/libs/libOpenglRender/WindowSurface.cpp @@ -81,11 +81,12 @@ WindowSurface *WindowSurface::create(int p_config, int p_width, int p_height) // previous attached color buffer is updated, if copy or blit should be done // in order to update it - it is being done here. // -void WindowSurface::flushColorBuffer() +bool WindowSurface::flushColorBuffer() { if (m_attachedColorBuffer.Ptr() != NULL) { - blitToColorBuffer(); + return blitToColorBuffer(); } + return true; } // @@ -140,14 +141,15 @@ void WindowSurface::bind(RenderContextPtr p_ctx, SurfaceBindType p_bindType) } -void WindowSurface::blitToColorBuffer() +bool WindowSurface::blitToColorBuffer() { - if (!m_width && !m_height) return; + if (!m_width && !m_height) return false; if (m_attachedColorBuffer->getWidth() != m_width || m_attachedColorBuffer->getHeight() != m_height) { // XXX: should never happen - how this needs to be handled? - return; + fprintf(stderr, "Dimensions do not match\n"); + return false; } // @@ -157,9 +159,14 @@ void WindowSurface::blitToColorBuffer() EGLSurface prevReadSurf = s_egl.eglGetCurrentSurface(EGL_READ); EGLSurface prevDrawSurf = s_egl.eglGetCurrentSurface(EGL_DRAW); FrameBuffer *fb = FrameBuffer::getFB(); + if (!m_drawContext.Ptr()) { + fprintf(stderr, "Draw context is NULL\n"); + return false; + } if (!s_egl.eglMakeCurrent(fb->getDisplay(), m_eglSurface, m_eglSurface, m_drawContext->getEGLContext())) { - return; + fprintf(stderr, "Error making draw context current\n"); + return false; } m_attachedColorBuffer->blitFromCurrentReadBuffer(); @@ -167,12 +174,12 @@ void WindowSurface::blitToColorBuffer() // restore current context/surface s_egl.eglMakeCurrent(fb->getDisplay(), prevDrawSurf, prevReadSurf, prevContext); - + return true; } bool WindowSurface::resizePbuffer(unsigned int p_width, unsigned int p_height) { - if (m_eglSurface && + if (m_eglSurface && m_pbufWidth == p_width && m_pbufHeight == p_height) { // no need to resize |
