aboutsummaryrefslogtreecommitdiffstats
path: root/emulator
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2013-11-21 20:56:47 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2013-11-21 20:56:48 +0000
commitb31d3de8bdcbd8bbe975e3ad25451b7f3716882d (patch)
tree94effe031ddd85246b670ed76bf99486f9c8f994 /emulator
parentda9160e42970c409b1518586e2d80f8be36d4e59 (diff)
parent9ca0017d2a6651ce9b795082b249f66e476aaf44 (diff)
downloadsdk-b31d3de8bdcbd8bbe975e3ad25451b7f3716882d.zip
sdk-b31d3de8bdcbd8bbe975e3ad25451b7f3716882d.tar.gz
sdk-b31d3de8bdcbd8bbe975e3ad25451b7f3716882d.tar.bz2
Merge "Catch NULL context and bubbling error up."
Diffstat (limited to 'emulator')
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/FrameBuffer.cpp4
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/RenderControl.cpp4
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/WindowSurface.cpp23
-rw-r--r--emulator/opengl/host/libs/libOpenglRender/WindowSurface.h4
4 files changed, 21 insertions, 14 deletions
diff --git a/emulator/opengl/host/libs/libOpenglRender/FrameBuffer.cpp b/emulator/opengl/host/libs/libOpenglRender/FrameBuffer.cpp
index 042d38a..cfadf12 100644
--- a/emulator/opengl/host/libs/libOpenglRender/FrameBuffer.cpp
+++ b/emulator/opengl/host/libs/libOpenglRender/FrameBuffer.cpp
@@ -585,9 +585,7 @@ bool FrameBuffer::flushWindowSurfaceColorBuffer(HandleType p_surface)
return false;
}
- (*w).second->flushColorBuffer();
-
- return true;
+ return (*w).second->flushColorBuffer();
}
bool FrameBuffer::setWindowSurfaceColorBuffer(HandleType p_surface,
diff --git a/emulator/opengl/host/libs/libOpenglRender/RenderControl.cpp b/emulator/opengl/host/libs/libOpenglRender/RenderControl.cpp
index 960dec7..6a15138 100644
--- a/emulator/opengl/host/libs/libOpenglRender/RenderControl.cpp
+++ b/emulator/opengl/host/libs/libOpenglRender/RenderControl.cpp
@@ -239,7 +239,9 @@ static int rcFlushWindowColorBuffer(uint32_t windowSurface)
if (!fb) {
return -1;
}
- fb->flushWindowSurfaceColorBuffer(windowSurface);
+ if (!fb->flushWindowSurfaceColorBuffer(windowSurface)) {
+ return -1;
+ }
return 0;
}
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
diff --git a/emulator/opengl/host/libs/libOpenglRender/WindowSurface.h b/emulator/opengl/host/libs/libOpenglRender/WindowSurface.h
index 1b655c9..e9f1f7d 100644
--- a/emulator/opengl/host/libs/libOpenglRender/WindowSurface.h
+++ b/emulator/opengl/host/libs/libOpenglRender/WindowSurface.h
@@ -38,13 +38,13 @@ public:
EGLSurface getEGLSurface() const { return m_eglSurface; }
void setColorBuffer(ColorBufferPtr p_colorBuffer);
- void flushColorBuffer();
+ bool flushColorBuffer();
void bind(RenderContextPtr p_ctx, SurfaceBindType p_bindType);
private:
WindowSurface();
- void blitToColorBuffer(); // copy pbuffer content with texload and blit
+ bool blitToColorBuffer(); // copy pbuffer content with texload and blit
bool resizePbuffer(unsigned int p_width, unsigned int p_height);
private: