diff options
author | Chris Craik <ccraik@google.com> | 2012-03-07 14:44:50 -0800 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2012-03-07 17:22:51 -0800 |
commit | 180773f73e86ee60ebacb1a738650b9c319c0212 (patch) | |
tree | 4f436b320af288c3862f319f84ac59a70aeaf984 /Source | |
parent | 47b8a953ab1b71113b605fd84489f63938bd7dd7 (diff) | |
download | external_webkit-180773f73e86ee60ebacb1a738650b9c319c0212.zip external_webkit-180773f73e86ee60ebacb1a738650b9c319c0212.tar.gz external_webkit-180773f73e86ee60ebacb1a738650b9c319c0212.tar.bz2 |
partial multi-layer invalidates in layergroups
Change-Id: Ic17235008ba96056cef353285e46eec86ee52597
Diffstat (limited to 'Source')
-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; } |