diff options
author | Nicolas Roard <nicolasroard@google.com> | 2011-04-27 18:44:46 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-04-27 18:44:46 -0700 |
commit | 0702955df30f6610313bdf9363bc22a7fd6d640a (patch) | |
tree | 58aadf31564fed16dd77e14ca0fed122f2c7ebfe | |
parent | c471914f1c3bb86fb8c2fae304d848e7675a9258 (diff) | |
parent | 2d60bef786645e5b9e2da0e8374d3f06a40d0638 (diff) | |
download | external_webkit-0702955df30f6610313bdf9363bc22a7fd6d640a.zip external_webkit-0702955df30f6610313bdf9363bc22a7fd6d640a.tar.gz external_webkit-0702955df30f6610313bdf9363bc22a7fd6d640a.tar.bz2 |
am 2d60bef7: Fix clipping issues with layers
* commit '2d60bef786645e5b9e2da0e8374d3f06a40d0638':
Fix clipping issues with layers
-rw-r--r-- | WebCore/platform/graphics/android/ShaderProgram.cpp | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/WebCore/platform/graphics/android/ShaderProgram.cpp b/WebCore/platform/graphics/android/ShaderProgram.cpp index 74328a1..9e0a4ab 100644 --- a/WebCore/platform/graphics/android/ShaderProgram.cpp +++ b/WebCore/platform/graphics/android/ShaderProgram.cpp @@ -260,22 +260,17 @@ void ShaderProgram::setViewRect(const IntRect& viewRect) TransformationMatrix translate; translate.translate(1.0, 1.0); - TransformationMatrix screenTranslate; - screenTranslate.translate(-viewRect.x(), -viewRect.y()); - TransformationMatrix scale; scale.scale3d(m_viewRect.width() * 0.5f, m_viewRect.height() * 0.5f, 1); m_documentToScreenMatrix = m_projectionMatrix; m_documentToScreenMatrix.multiply(translate); m_documentToScreenMatrix.multiply(scale); - m_documentToScreenMatrix.multiply(screenTranslate); m_documentToInvScreenMatrix = m_projectionMatrix; translate.scale3d(1, -1, 1); m_documentToInvScreenMatrix.multiply(translate); m_documentToInvScreenMatrix.multiply(scale); - m_documentToScreenMatrix.multiply(screenTranslate); } // This function transform a clip rect extracted from the current layer @@ -337,6 +332,9 @@ void ShaderProgram::clip(const FloatRect& clip) if (clip == m_clipRect) return; + if (clip.width() == 0 && clip.height() == 0) + return; + // we should only call glScissor in this function, so that we can easily // track the current clipping rect. @@ -347,6 +345,20 @@ void ShaderProgram::clip(const FloatRect& clip) if (!m_screenClip.isEmpty()) screenClip.intersect(m_screenClip); + screenClip.setY(screenClip.y() + m_viewRect.y()); + if (screenClip.x() < 0) { + int w = screenClip.width(); + w += screenClip.x(); + screenClip.setX(0); + screenClip.setWidth(w); + } + if (screenClip.y() < 0) { + int h = screenClip.height(); + h += screenClip.y(); + screenClip.setY(0); + screenClip.setHeight(h); + } + glScissor(screenClip.x(), screenClip.y(), screenClip.width(), screenClip.height()); m_clipRect = clip; |