From c91121f64d67361c7480285765d5c1677bc9eb71 Mon Sep 17 00:00:00 2001 From: "noam.rosenthal@nokia.com" Date: Wed, 28 Sep 2011 09:45:13 +0000 Subject: [PATCH] [Texmap] Allow TextureMapperGL to work without a GraphicsContext https://bugs.webkit.org/show_bug.cgi?id=68980 Reviewed by Andreas Kling. Perform a null-check for m_context and initialize that variable. If a graphics-context doesn't exist, we don't need to reset it. No new functionality so no new tests. * platform/graphics/opengl/TextureMapperGL.cpp: (WebCore::TextureMapperGL::TextureMapperGL): (WebCore::TextureMapperGL::beginPainting): (WebCore::TextureMapperGL::endPainting): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@96211 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebCore/ChangeLog | 17 +++++++++++++++++ .../platform/graphics/opengl/TextureMapperGL.cpp | 13 +++++++++---- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 2d4c7c7..c16bfd1 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,3 +1,20 @@ +2011-09-28 No'am Rosenthal + + [Texmap] Allow TextureMapperGL to work without a GraphicsContext + https://bugs.webkit.org/show_bug.cgi?id=68980 + + Reviewed by Andreas Kling. + + Perform a null-check for m_context and initialize that variable. + If a graphics-context doesn't exist, we don't need to reset it. + + No new functionality so no new tests. + + * platform/graphics/opengl/TextureMapperGL.cpp: + (WebCore::TextureMapperGL::TextureMapperGL): + (WebCore::TextureMapperGL::beginPainting): + (WebCore::TextureMapperGL::endPainting): + 2011-09-28 Kentaro Hara Implement an ErrorEvent constructor for V8 diff --git a/Source/WebCore/platform/graphics/opengl/TextureMapperGL.cpp b/Source/WebCore/platform/graphics/opengl/TextureMapperGL.cpp index 9c143ef..78320a5 100644 --- a/Source/WebCore/platform/graphics/opengl/TextureMapperGL.cpp +++ b/Source/WebCore/platform/graphics/opengl/TextureMapperGL.cpp @@ -297,6 +297,7 @@ private: TextureMapperGL::TextureMapperGL() : m_data(new TextureMapperGLData) + , m_context(0) { } @@ -395,9 +396,11 @@ void TextureMapperGL::beginPainting() return; glGetIntegerv(GL_CURRENT_PROGRAM, &m_data->previousProgram); - QPainter* painter = m_context->platformContext(); - painter->save(); - painter->beginNativePainting(); + if (m_context) { + QPainter* painter = m_context->platformContext(); + painter->save(); + painter->beginNativePainting(); + } glClearStencil(0); glClear(GL_STENCIL_BUFFER_BIT); bindSurface(0); @@ -410,8 +413,10 @@ void TextureMapperGL::endPainting() #if PLATFORM(QT) glClearStencil(1); glClear(GL_STENCIL_BUFFER_BIT); - QPainter* painter = m_context->platformContext(); glUseProgram(m_data->previousProgram); + if (!m_context) + return; + QPainter* painter = m_context->platformContext(); painter->endNativePainting(); painter->restore(); #endif -- 2.7.4