diff options
author | Nicolas Roard <nicolasroard@google.com> | 2011-10-04 18:01:40 -0700 |
---|---|---|
committer | Nicolas Roard <nicolasroard@google.com> | 2011-10-04 18:03:21 -0700 |
commit | 3adbe453816c9282bfe1d212e813661ce2590955 (patch) | |
tree | 3f2cb5fd1646f1f246629bfd0abf652ef2f3fc41 /Source/WebCore/platform/graphics/android/LayerAndroid.cpp | |
parent | 89829a24e4efac83486ad878de3438e272aeeddf (diff) | |
download | external_webkit-3adbe453816c9282bfe1d212e813661ce2590955.zip external_webkit-3adbe453816c9282bfe1d212e813661ce2590955.tar.gz external_webkit-3adbe453816c9282bfe1d212e813661ce2590955.tar.bz2 |
Streamline the layers update codepath.
Directly update the layers transform and position.
This makes updates faster and less dependent on other webkit work.
counterpart java CL: https://android-git.corp.google.com/g/#/c/139853/
bug:5218173
Change-Id: I03a76ab853e81f0f12177fb785707ffb8dace330
Diffstat (limited to 'Source/WebCore/platform/graphics/android/LayerAndroid.cpp')
-rw-r--r-- | Source/WebCore/platform/graphics/android/LayerAndroid.cpp | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Source/WebCore/platform/graphics/android/LayerAndroid.cpp b/Source/WebCore/platform/graphics/android/LayerAndroid.cpp index b086c79..4e00a4b 100644 --- a/Source/WebCore/platform/graphics/android/LayerAndroid.cpp +++ b/Source/WebCore/platform/graphics/android/LayerAndroid.cpp @@ -575,6 +575,7 @@ void LayerAndroid::updatePositions() void LayerAndroid::updateGLPositionsAndScale(const TransformationMatrix& parentMatrix, const FloatRect& clipping, float opacity, float scale) { + m_atomicSync.lock(); IntSize layerSize(getSize().width(), getSize().height()); FloatPoint anchorPoint(getAnchorPoint().fX, getAnchorPoint().fY); FloatPoint position(getPosition().fX, getPosition().fY); @@ -593,6 +594,7 @@ void LayerAndroid::updateGLPositionsAndScale(const TransformationMatrix& parentM -originY, -anchorPointZ()); + m_atomicSync.unlock(); setDrawTransform(localMatrix); if (m_drawTransform.isIdentityOrTranslation()) { // adjust the translation coordinates of the draw transform matrix so @@ -762,6 +764,39 @@ void LayerAndroid::assignTextureTo(LayerAndroid* newTree) } } +bool LayerAndroid::updateWithTree(LayerAndroid* newTree) +{ + bool needsRepaint = false; + int count = this->countChildren(); + for (int i = 0; i < count; i++) + needsRepaint |= this->getChild(i)->updateWithTree(newTree); + + if (newTree) { + LayerAndroid* newLayer = newTree->findById(uniqueId()); + needsRepaint |= updateWithLayer(newLayer); + } + return needsRepaint; +} + +bool LayerAndroid::updateWithLayer(LayerAndroid* layer) +{ + if (!layer) + return true; + + android::AutoMutex lock(m_atomicSync); + m_position = layer->m_position; + m_anchorPoint = layer->m_anchorPoint; + m_size = layer->m_size; + m_opacity = layer->m_opacity; + m_transform = layer->m_transform; + + if ((m_recordingPicture != layer->m_recordingPicture) + || (m_imageRef != layer->m_imageRef)) + return true; + + return false; +} + void LayerAndroid::createTexture() { int count = this->countChildren(); |