diff options
author | Nicolas Roard <nicolasroard@google.com> | 2011-04-28 11:45:55 -0700 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-04-28 11:45:55 -0700 |
commit | e8c7a7791b9238a5b89df8c6c1455684328291f3 (patch) | |
tree | c8b54a8770b038af42945e0e213104077086cb22 /WebCore | |
parent | d628e7ba947e4b46f80e7b8fcdf904d29b9a225f (diff) | |
parent | e5a6c868b4e82b9c4d7a536d1ab977149346e156 (diff) | |
download | external_webkit-e8c7a7791b9238a5b89df8c6c1455684328291f3.zip external_webkit-e8c7a7791b9238a5b89df8c6c1455684328291f3.tar.gz external_webkit-e8c7a7791b9238a5b89df8c6c1455684328291f3.tar.bz2 |
am e5a6c868: am 0702955d: am 2d60bef7: Fix clipping issues with layers
* commit 'e5a6c868b4e82b9c4d7a536d1ab977149346e156':
Fix clipping issues with layers
Diffstat (limited to 'WebCore')
-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; |