diff options
author | Nicolas Roard <nicolas@android.com> | 2010-12-08 11:37:30 -0800 |
---|---|---|
committer | Nicolas Roard <nicolas@android.com> | 2010-12-16 13:12:03 -0800 |
commit | 211482b53e73a386e2aabb0d3acb92e0e7ea22d4 (patch) | |
tree | 22d211edc86483739ac9af68fd25d1d90470d26d /WebCore/platform/graphics/android/BaseLayerAndroid.cpp | |
parent | 6fc858d42732739e4a3b628b4953a8a279e8dc3d (diff) | |
download | external_webkit-211482b53e73a386e2aabb0d3acb92e0e7ea22d4.zip external_webkit-211482b53e73a386e2aabb0d3acb92e0e7ea22d4.tar.gz external_webkit-211482b53e73a386e2aabb0d3acb92e0e7ea22d4.tar.bz2 |
Layers implementation in GL.
- add textures management code for layers in TilesManager
- add the layers drawing GL code
- modify BaseLayerAndroid::drawGL() to paint the layers
- modify TexturesGenerator to process layers painting requests
Note: some further refactoring (when getting rid of SkLayer as a base
class) will let us remove some redudant function, e.g.
setAnchorPoint/setAnchorPointZ (bug:3292285)
Change-Id: I3cc88575f331104d45c89e84ba27f3af755aa845
Diffstat (limited to 'WebCore/platform/graphics/android/BaseLayerAndroid.cpp')
-rw-r--r-- | WebCore/platform/graphics/android/BaseLayerAndroid.cpp | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/WebCore/platform/graphics/android/BaseLayerAndroid.cpp b/WebCore/platform/graphics/android/BaseLayerAndroid.cpp index 996b272..040f63e 100644 --- a/WebCore/platform/graphics/android/BaseLayerAndroid.cpp +++ b/WebCore/platform/graphics/android/BaseLayerAndroid.cpp @@ -75,6 +75,9 @@ BaseLayerAndroid::BaseLayerAndroid() BaseLayerAndroid::~BaseLayerAndroid() { +#if USE(ACCELERATED_COMPOSITING) + TilesManager::instance()->removeOperationsForBaseLayer(this); +#endif m_content.clear(); #ifdef DEBUG_COUNT gBaseLayerAndroidCount--; @@ -256,6 +259,33 @@ bool BaseLayerAndroid::drawGL(IntRect& viewRect, SkRect& visibleRect, ret = drawBasePictureInGL(visibleRect, scale); + if (countChildren() >= 1) { + LayerAndroid* compositedRoot = static_cast<LayerAndroid*>(getChild(0)); + TransformationMatrix ident; + compositedRoot->updateFixedLayersPositions(visibleRect); + compositedRoot->updateGLPositions(ident, 1); + SkMatrix matrix; + matrix.setTranslate(left, top); + + // At this point, the previous LayerAndroid* root has been destroyed, + // which will have removed the layers as owners of the textures. + // Let's now do a pass to reserve the textures for the current tree; + // it will only reserve existing textures, not create them on demand. +#ifdef DEBUG + TilesManager::instance()->printLayersTextures("reserve"); +#endif + compositedRoot->reserveGLTextures(); + // Now that we marked the textures being used, we delete the unnecessary + // ones to make space... + TilesManager::instance()->cleanupLayersTextures(); + // Finally do another pass to create new textures if needed + compositedRoot->createGLTextures(); + + if (compositedRoot->drawGL(matrix)) + ret = true; + } + glDisable(GL_SCISSOR_TEST); + glBindBuffer(GL_ARRAY_BUFFER, 0); m_previousVisible = visibleRect; |