summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics
diff options
context:
space:
mode:
authorNicolas Roard <nicolasroard@google.com>2011-10-05 11:35:24 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-10-05 11:35:24 -0700
commit4357667d698f572b676929bfcb26b7cbff80a212 (patch)
tree1e86f17acaa8faf0d5fbdc924be43d3d14ff720f /Source/WebCore/platform/graphics
parent9a05db771f2264b0ae687d0adf51a075183f9498 (diff)
parent3adbe453816c9282bfe1d212e813661ce2590955 (diff)
downloadexternal_webkit-4357667d698f572b676929bfcb26b7cbff80a212.zip
external_webkit-4357667d698f572b676929bfcb26b7cbff80a212.tar.gz
external_webkit-4357667d698f572b676929bfcb26b7cbff80a212.tar.bz2
Merge "Streamline the layers update codepath. Directly update the layers transform and position. This makes updates faster and less dependent on other webkit work."
Diffstat (limited to 'Source/WebCore/platform/graphics')
-rw-r--r--Source/WebCore/platform/graphics/android/Layer.h1
-rw-r--r--Source/WebCore/platform/graphics/android/LayerAndroid.cpp35
-rw-r--r--Source/WebCore/platform/graphics/android/LayerAndroid.h6
3 files changed, 41 insertions, 1 deletions
diff --git a/Source/WebCore/platform/graphics/android/Layer.h b/Source/WebCore/platform/graphics/android/Layer.h
index 24302ce..c8bb81d 100644
--- a/Source/WebCore/platform/graphics/android/Layer.h
+++ b/Source/WebCore/platform/graphics/android/Layer.h
@@ -136,7 +136,6 @@ protected:
bool m_hasOverflowChildren;
-private:
bool isAncestor(const Layer*) const;
Layer* fParent;
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();
diff --git a/Source/WebCore/platform/graphics/android/LayerAndroid.h b/Source/WebCore/platform/graphics/android/LayerAndroid.h
index 90f4e86..cd52937 100644
--- a/Source/WebCore/platform/graphics/android/LayerAndroid.h
+++ b/Source/WebCore/platform/graphics/android/LayerAndroid.h
@@ -276,6 +276,12 @@ public:
void assignTextureTo(LayerAndroid* newTree);
void createTexture();
+ // Update layers using another tree. Only works for basic properties
+ // such as the position, the transform. Return true if anything more
+ // complex is needed.
+ bool updateWithTree(LayerAndroid*);
+ bool updateWithLayer(LayerAndroid*);
+
SkBitmapRef* imageRef() { return m_imageRef; }
ImageTexture* imageTexture() { return m_imageTexture; }
int type() { return m_type; }