summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
diff options
context:
space:
mode:
authorNicolas Roard <nicolasroard@google.com>2012-05-11 18:13:15 -0700
committerNicolas Roard <nicolasroard@google.com>2012-05-11 18:34:42 -0700
commitcedc69e9625169d4d585fcd019af2ea5597f0ed1 (patch)
tree3e75e84586ee86b9455ed86d12fff5728e2e11a5 /Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
parent78d0003d44a4fa393275929d92c8e4929e70c7fa (diff)
downloadexternal_webkit-cedc69e9625169d4d585fcd019af2ea5597f0ed1.zip
external_webkit-cedc69e9625169d4d585fcd019af2ea5597f0ed1.tar.gz
external_webkit-cedc69e9625169d4d585fcd019af2ea5597f0ed1.tar.bz2
Implements mask layers and replica layers
bug:6221600 Change-Id: I974eb846200d43bd3635ed1787a5753f87a547dd
Diffstat (limited to 'Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp')
-rw-r--r--Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp41
1 files changed, 38 insertions, 3 deletions
diff --git a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
index 06bb767..68f452a 100644
--- a/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/GraphicsLayerAndroid.cpp
@@ -199,6 +199,22 @@ bool GraphicsLayerAndroid::replaceChild(GraphicsLayer* oldChild, GraphicsLayer*
return ret;
}
+void GraphicsLayerAndroid::setReplicatedLayer(GraphicsLayer* layer)
+{
+ GraphicsLayer::setReplicatedLayer(layer);
+ if (m_replicatedLayer) {
+ GraphicsLayerAndroid* graphicsLayer = static_cast<GraphicsLayerAndroid*>(m_replicatedLayer);
+ if (graphicsLayer->m_contentLayer)
+ graphicsLayer->m_contentLayer->setReplicatedLayer(m_contentLayer);
+ if (maskLayer()) {
+ GraphicsLayerAndroid* maskLayer = static_cast<GraphicsLayerAndroid*>(GraphicsLayer::maskLayer());
+ m_contentLayer->setMaskLayer(maskLayer->m_contentLayer);
+ }
+ m_contentLayer->setReplicatedLayerPosition(replicatedLayerPosition());
+ askForSync();
+ }
+}
+
void GraphicsLayerAndroid::removeFromParent()
{
ALOGV("(%x) removeFromParent()", this);
@@ -745,6 +761,16 @@ bool GraphicsLayerAndroid::repaint()
m_foregroundClipLayer->setPosition(layerBounds.x(), layerBounds.y());
m_foregroundClipLayer->setSize(layerBounds.width(), layerBounds.height());
} else {
+
+ // If we are replicated, paint the mask
+ if (isReplicated()) {
+ GraphicsLayerAndroid* replicatedLayer = static_cast<GraphicsLayerAndroid*>(replicaLayer());
+ if (replicatedLayer->maskLayer()) {
+ GraphicsLayerAndroid* mask = static_cast<GraphicsLayerAndroid*>(replicatedLayer->maskLayer());
+ mask->paintContext(mask->m_contentLayer, layerBounds, false);
+ }
+ }
+
// If there is no contents clip, we can draw everything into one
// picture.
bool painting = paintContext(m_contentLayer, layerBounds);
@@ -806,7 +832,8 @@ SkPicture* GraphicsLayerAndroid::paintPicture(const IntRect& rect)
}
bool GraphicsLayerAndroid::paintContext(LayerAndroid* layer,
- const IntRect& rect)
+ const IntRect& rect,
+ bool checkOptimisations)
{
if (!layer)
return false;
@@ -817,7 +844,10 @@ bool GraphicsLayerAndroid::paintContext(LayerAndroid* layer,
picture->endRecording();
PictureLayerContent* layerContent = new PictureLayerContent(picture);
- layerContent->checkForOptimisations();
+ if (checkOptimisations)
+ layerContent->checkForOptimisations();
+ else
+ layerContent->setCheckForOptimisations(false);
layer->setContent(layerContent);
SkSafeUnref(layerContent);
SkSafeUnref(picture);
@@ -1079,10 +1109,15 @@ void GraphicsLayerAndroid::askForSync()
void GraphicsLayerAndroid::syncChildren()
{
- if (m_needsSyncChildren && !m_contentLayer->isFixedBackground()) {
+ if (m_needsSyncChildren || isReplicated()) {
m_contentLayer->removeChildren();
LayerAndroid* layer = m_contentLayer;
+ if (isReplicated()) {
+ GraphicsLayerAndroid* replicatedLayer = static_cast<GraphicsLayerAndroid*>(replicaLayer());
+ m_contentLayer->addChild(replicatedLayer->m_contentLayer);
+ }
+
if (m_contentLayer->isFixedBackground()) {
m_contentLayer->addChild(m_foregroundClipLayer);
m_contentLayer->addChild(m_foregroundLayer);