diff options
author | Chris Craik <ccraik@google.com> | 2012-03-08 13:17:21 -0800 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-03-08 13:17:21 -0800 |
commit | ddacf299acbe17093f175cec8d86088ea3472793 (patch) | |
tree | bec13457fd6584fa2fe9b6a1175711f9ff9d30be | |
parent | ce76304e955cb279f6f237a84c0ba4fd40a2b2ba (diff) | |
parent | 180773f73e86ee60ebacb1a738650b9c319c0212 (diff) | |
download | external_webkit-ddacf299acbe17093f175cec8d86088ea3472793.zip external_webkit-ddacf299acbe17093f175cec8d86088ea3472793.tar.gz external_webkit-ddacf299acbe17093f175cec8d86088ea3472793.tar.bz2 |
Merge "partial multi-layer invalidates in layergroups"
-rw-r--r-- | Source/WebCore/platform/graphics/android/LayerGroup.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/Source/WebCore/platform/graphics/android/LayerGroup.cpp b/Source/WebCore/platform/graphics/android/LayerGroup.cpp index 6980f3e..5ec41f8 100644 --- a/Source/WebCore/platform/graphics/android/LayerGroup.cpp +++ b/Source/WebCore/platform/graphics/android/LayerGroup.cpp @@ -101,23 +101,27 @@ bool LayerGroup::tryUpdateLayerGroup(LayerGroup* oldLayerGroup) SkRegion* layerInval = getFirstLayer()->getInvalRegion(); m_dualTiledTexture->markAsDirty(*layerInval); } else { - bool inval = false; + SkRegion invalRegion; + bool fullInval = false; for (unsigned int i = 0; i < m_layers.size(); i++) { - if (m_layers[i]->uniqueId() != oldLayerGroup->m_layers[i]->uniqueId() - || !m_layers[i]->getInvalRegion()->isEmpty()) { - // layer list has changed, or one has been inval'd - inval = true; + if (m_layers[i]->uniqueId() != oldLayerGroup->m_layers[i]->uniqueId()) { + // layer list has changed, fully invalidate + // TODO: partially invalidate based on layer size/position + fullInval = true; + break; + } else if (!m_layers[i]->getInvalRegion()->isEmpty()) { + // merge layer inval - translate the layer's inval region into group coordinates + SkPoint pos = m_layers[i]->getPosition(); + m_layers[i]->getInvalRegion()->translate(pos.fX, pos.fY); + invalRegion.op(*(m_layers[i]->getInvalRegion()), SkRegion::kUnion_Op); break; } } - if (inval) { - // fully invalidate the layer - // TODO: partial multi-layer invalidations - SkRegion inval; - inval.setRect(-1e8, -1e8, 2e8, 2e8); - m_dualTiledTexture->markAsDirty(inval); - } + if (fullInval) + invalRegion.setRect(-1e8, -1e8, 2e8, 2e8); + + m_dualTiledTexture->markAsDirty(invalRegion); } return true; } |