From: noam.rosenthal@nokia.com Date: Tue, 21 Feb 2012 01:20:20 +0000 (+0000) Subject: [Qt][WK2] Clipping is broken X-Git-Tag: 070512121124~12365 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=ea0420a44673ed497c9bfe477c5c299c4a2cc8df;p=profile%2Fivi%2Fwebkit-efl.git [Qt][WK2] Clipping is broken https://bugs.webkit.org/show_bug.cgi?id=78677 It's not necessary to add a full-viewport rect to the scissor clip stack. It creates a situation where if there's a clip in the page, we return to the viewport clip instead of applying the WebView's clip we got from the scenegraph. Also, it's unnecessary to clip before we paint the layer's content, we should only clip afterwards, before painting the children. Reviewed by Kenneth Rohde Christiansen. No new functionality. * platform/graphics/opengl/TextureMapperGL.cpp: (WebCore::BitmapTextureGL::size): (WebCore::scissorClip): (WebCore): (WebCore::TextureMapperGL::beginScissorClip): (WebCore::TextureMapperGL::endScissorClip): * platform/graphics/texmap/TextureMapperLayer.cpp: (WebCore::TextureMapperLayer::paintSelfAndChildren): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108274 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog index 100f4ba..a351f94 100644 --- a/Source/WebCore/ChangeLog +++ b/Source/WebCore/ChangeLog @@ -1,5 +1,31 @@ 2012-02-20 No'am Rosenthal + [Qt][WK2] Clipping is broken + https://bugs.webkit.org/show_bug.cgi?id=78677 + + It's not necessary to add a full-viewport rect to the scissor clip stack. + It creates a situation where if there's a clip in the page, we return to + the viewport clip instead of applying the WebView's clip we got from the + scenegraph. + + Also, it's unnecessary to clip before we paint the layer's content, we should + only clip afterwards, before painting the children. + + Reviewed by Kenneth Rohde Christiansen. + + No new functionality. + + * platform/graphics/opengl/TextureMapperGL.cpp: + (WebCore::BitmapTextureGL::size): + (WebCore::scissorClip): + (WebCore): + (WebCore::TextureMapperGL::beginScissorClip): + (WebCore::TextureMapperGL::endScissorClip): + * platform/graphics/texmap/TextureMapperLayer.cpp: + (WebCore::TextureMapperLayer::paintSelfAndChildren): + +2012-02-20 No'am Rosenthal + [Texmap] Layers and tiles appear to have missing pixels in their right/bottom borders https://bugs.webkit.org/show_bug.cgi?id=78961 diff --git a/Source/WebCore/platform/graphics/opengl/TextureMapperGL.cpp b/Source/WebCore/platform/graphics/opengl/TextureMapperGL.cpp index 390e4a8..c034618 100644 --- a/Source/WebCore/platform/graphics/opengl/TextureMapperGL.cpp +++ b/Source/WebCore/platform/graphics/opengl/TextureMapperGL.cpp @@ -809,7 +809,6 @@ void TextureMapperGL::bindSurface(BitmapTexture *surfacePointer) GL_CMD(glStencilFunc(data().sharedGLData().stencilIndex > 1 ? GL_EQUAL : GL_ALWAYS, data().sharedGLData().stencilIndex - 1, data().sharedGLData().stencilIndex - 1)) GL_CMD(glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP)) GL_CMD(glViewport(0, 0, viewportSize.width(), viewportSize.height())) - data().sharedGLData().clipStack.append(IntRect(data().viewport[0], data().viewport[1], data().viewport[2], data().viewport[3])); return; } @@ -835,8 +834,15 @@ bool TextureMapperGL::beginScissorClip(const TransformationMatrix& modelViewMatr } // Intersect with previous clip. - if (!data().sharedGLData().clipStack.isEmpty()) - rect.intersect(data().sharedGLData().clipStack.last()); + for (int i = data().sharedGLData().clipStack.size() - 1; i >= 0; --i) { + const IntRect& prevRect = data().sharedGLData().clipStack[i]; + if (prevRect.isEmpty()) + continue; + + // We only need the last valid clip. + rect.intersect(prevRect); + break; + } scissorClip(rect); data().sharedGLData().clipStack.append(rect); @@ -861,6 +867,7 @@ void TextureMapperGL::beginClip(const TransformationMatrix& modelViewMatrix, con { if (beginScissorClip(modelViewMatrix, targetRect)) return; + data().initStencil(); TextureMapperGLData::SharedGLData::ShaderProgramIndex program = TextureMapperGLData::SharedGLData::ClipProgram; const TextureMapperGLData::SharedGLData::ProgramInfo& programInfo = data().sharedGLData().programs[program]; diff --git a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp index 5f3862b..8dd4eb8 100644 --- a/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp +++ b/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp @@ -175,16 +175,19 @@ void TextureMapperLayer::sortByZOrder(Vector& array, int f void TextureMapperLayer::paintSelfAndChildren(const TextureMapperPaintOptions& options) { - bool hasClip = m_state.masksToBounds && !m_children.isEmpty(); - if (hasClip) - options.textureMapper->beginClip(TransformationMatrix(options.transform).multiply(m_transform.combined()), FloatRect(0, 0, m_size.width(), m_size.height())); - paintSelf(options); - for (size_t i = 0; i < m_children.size(); ++i) + if (m_children.isEmpty()) + return; + + bool shouldClip = m_state.masksToBounds || m_state.maskLayer; + if (shouldClip) + options.textureMapper->beginClip(TransformationMatrix(options.transform).multiply(m_transform.combined()), FloatRect(0, 0, m_size.width(), m_size.height())); + + for (int i = 0; i < m_children.size(); ++i) m_children[i]->paintRecursive(options); - if (hasClip) + if (shouldClip) options.textureMapper->endClip(); }