diff options
author | Nicolas Roard <nicolasroard@google.com> | 2011-03-21 18:02:28 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2011-03-21 18:02:28 -0700 |
commit | 983c9f05fadaaceaa011dec0e5bcff2bd2b4199f (patch) | |
tree | 75bedb6d1eb2caf370c0d727fe5579254df28e88 /WebCore | |
parent | 47817e2ea523c5798c192ec9005238611b3910eb (diff) | |
parent | 316a020310e1b50a64a0f9832f77c8ed0c1126ef (diff) | |
download | external_webkit-983c9f05fadaaceaa011dec0e5bcff2bd2b4199f.zip external_webkit-983c9f05fadaaceaa011dec0e5bcff2bd2b4199f.tar.gz external_webkit-983c9f05fadaaceaa011dec0e5bcff2bd2b4199f.tar.bz2 |
Merge "Fix invals for CSS3D" into honeycomb-mr1
Diffstat (limited to 'WebCore')
-rw-r--r-- | WebCore/platform/graphics/android/LayerAndroid.cpp | 10 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/ShaderProgram.cpp | 27 | ||||
-rw-r--r-- | WebCore/platform/graphics/android/ShaderProgram.h | 2 |
3 files changed, 36 insertions, 3 deletions
diff --git a/WebCore/platform/graphics/android/LayerAndroid.cpp b/WebCore/platform/graphics/android/LayerAndroid.cpp index dba1ceb..009915e 100644 --- a/WebCore/platform/graphics/android/LayerAndroid.cpp +++ b/WebCore/platform/graphics/android/LayerAndroid.cpp @@ -252,8 +252,12 @@ bool LayerAndroid::evaluateAnimations(double time) void LayerAndroid::addDirtyArea(GLWebViewState* glWebViewState) { - IntRect rect(0, 0, getWidth(), getHeight()); - IntRect dirtyArea = drawTransform().mapRect(rect); + IntSize layerSize(getSize().width(), getSize().height()); + + FloatRect area = + TilesManager::instance()->shader()->projectedRect(drawTransform(), layerSize); + IntRect dirtyArea(area.x(), area.y(), area.width(), area.height()); + IntRect clip(m_clippingRect.x(), m_clippingRect.y(), m_clippingRect.width(), m_clippingRect.height()); dirtyArea.intersect(clip); glWebViewState->addDirtyArea(dirtyArea); @@ -945,7 +949,7 @@ bool LayerAndroid::drawGL(GLWebViewState* glWebViewState, SkMatrix& matrix) bool askPaint = drawChildrenGL(glWebViewState, matrix); m_atomicSync.lock(); askPaint |= m_dirty; - if (m_dirty || m_hasRunningAnimations) + if (m_dirty || m_hasRunningAnimations || drawTransform().hasPerspective()) addDirtyArea(glWebViewState); m_atomicSync.unlock(); return askPaint; diff --git a/WebCore/platform/graphics/android/ShaderProgram.cpp b/WebCore/platform/graphics/android/ShaderProgram.cpp index ba32d5d..0c96f24 100644 --- a/WebCore/platform/graphics/android/ShaderProgram.cpp +++ b/WebCore/platform/graphics/android/ShaderProgram.cpp @@ -300,6 +300,33 @@ IntRect ShaderProgram::clippedRectWithViewport(const IntRect& rect, int margin) return viewport; } +FloatRect ShaderProgram::projectedRect(const TransformationMatrix& drawMatrix, + IntSize& size) +{ + FloatRect srect(0, 0, size.width(), size.height()); + + TransformationMatrix translate; + translate.translate(1.0, 1.0); + TransformationMatrix scale; + scale.scale3d(m_viewport.width() * 0.5f, m_viewport.height() * 0.5f, 1); + TransformationMatrix translateViewport; + translateViewport.translate(-m_viewport.fLeft, -m_viewport.fTop); + + TransformationMatrix projectionMatrix = m_projectionMatrix; + projectionMatrix.scale3d(1, -1, 1); + projectionMatrix.multiply(translate); + projectionMatrix.multiply(scale); + projectionMatrix.multiply(translateViewport); + + TransformationMatrix renderMatrix = drawMatrix; + renderMatrix.multiply(projectionMatrix); + + FloatRect bounds = renderMatrix.mapRect(srect); + FloatRect ret(bounds.x(), bounds.y() - m_viewport.height(), + bounds.width(), bounds.height()); + return ret; +} + void ShaderProgram::drawLayerQuad(const TransformationMatrix& drawMatrix, SkRect& geometry, int textureId, float opacity, bool forceBlending) diff --git a/WebCore/platform/graphics/android/ShaderProgram.h b/WebCore/platform/graphics/android/ShaderProgram.h index 9419511..5ca0b0c 100644 --- a/WebCore/platform/graphics/android/ShaderProgram.h +++ b/WebCore/platform/graphics/android/ShaderProgram.h @@ -47,6 +47,8 @@ class ShaderProgram { void setViewRect(const IntRect& viewRect); FloatRect clipRectInScreenCoord(const TransformationMatrix& drawMatrix, const IntSize& size); + FloatRect projectedRect(const TransformationMatrix& drawMatrix, + IntSize& size); void clip(const FloatRect& rect); IntRect clippedRectWithViewport(const IntRect& rect, int margin = 0); |