diff options
author | Teng-Hui Zhu <ztenghui@google.com> | 2011-01-06 11:56:00 -0800 |
---|---|---|
committer | Teng-Hui Zhu <ztenghui@google.com> | 2011-01-07 10:11:51 -0800 |
commit | eb2b1cb78cf15cf3e33bc5752ab080ecfd2ec6b9 (patch) | |
tree | 3c25e33f5cb41c177077dc10fa340d00bbca9d8d /WebCore/platform/graphics/android/ShaderProgram.cpp | |
parent | 45a8f6360a851a7c7d75a7e2fa11cc71f778ce89 (diff) | |
download | external_webkit-eb2b1cb78cf15cf3e33bc5752ab080ecfd2ec6b9.zip external_webkit-eb2b1cb78cf15cf3e33bc5752ab080ecfd2ec6b9.tar.gz external_webkit-eb2b1cb78cf15cf3e33bc5752ab080ecfd2ec6b9.tar.bz2 |
Redo the clippingRect calculation
Although the intersetcion is done correctly, but the clippingRect
should take the parents' matrix into account.
To make the code cleaner, we convert all the rects into screen
coordinate for intersection.
bug:3304761
Change-Id: Ia3dc3e7b72f2e72eaab66ba8e017d89ab71dc468
Diffstat (limited to 'WebCore/platform/graphics/android/ShaderProgram.cpp')
-rw-r--r-- | WebCore/platform/graphics/android/ShaderProgram.cpp | 22 |
1 files changed, 14 insertions, 8 deletions
diff --git a/WebCore/platform/graphics/android/ShaderProgram.cpp b/WebCore/platform/graphics/android/ShaderProgram.cpp index 15f120d..6c18a61 100644 --- a/WebCore/platform/graphics/android/ShaderProgram.cpp +++ b/WebCore/platform/graphics/android/ShaderProgram.cpp @@ -206,23 +206,29 @@ void ShaderProgram::setViewRect(const IntRect& viewRect) m_clippingMatrix.multiply(scale); } -void ShaderProgram::clip(const TransformationMatrix& drawMatrix, - const FloatRect& rect) +// This function transform a clip rect extracted from the current layer +// into a clip rect in screen coordinates +FloatRect ShaderProgram::clipRectInScreenCoord(const TransformationMatrix& drawMatrix, + const IntSize& size) { - if (rect == m_clipRect) - return; - - FloatRect srect(0, 0, rect.width(), rect.height()); + FloatRect srect(0, 0, size.width(), size.height()); TransformationMatrix renderMatrix = drawMatrix; renderMatrix.multiply(m_clippingMatrix); - FloatRect clip = renderMatrix.mapRect(srect); + return renderMatrix.mapRect(srect); +} + +// clip is in screen coordinates +void ShaderProgram::clip(const FloatRect& clip) +{ + if (clip == m_clipRect) + return; // we should only call glScissor in this function, so that we can easily // track the current clipping rect. glScissor(m_viewRect.x() + clip.x(), m_viewRect.y() + clip.y(), clip.width(), clip.height()); - m_clipRect = rect; + m_clipRect = clip; } void ShaderProgram::drawLayerQuad(const TransformationMatrix& drawMatrix, |