summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/platform/graphics/android/VideoLayerAndroid.cpp
diff options
context:
space:
mode:
authorTeng-Hui Zhu <ztenghui@google.com>2011-05-31 15:24:42 -0700
committerTeng-Hui Zhu <ztenghui@google.com>2011-06-01 13:41:19 -0700
commit0bc8a6f1de48da432733e2bd21c5c793b7a0393d (patch)
tree418a64a17bcfcfd3934e0a15896b19f1a0605989 /Source/WebCore/platform/graphics/android/VideoLayerAndroid.cpp
parenta2f591386876bb23c1e69ad0bf7b0db72bf2865a (diff)
downloadexternal_webkit-0bc8a6f1de48da432733e2bd21c5c793b7a0393d.zip
external_webkit-0bc8a6f1de48da432733e2bd21c5c793b7a0393d.tar.gz
external_webkit-0bc8a6f1de48da432733e2bd21c5c793b7a0393d.tar.bz2
Support the screen shot while the video is paused.
Basically, the GL textures generated for the surface texture will be used for showing the screenshot. Surface texture will be recycled every time a new video starts. But GL textures will be recycled either when running out of memory bound, or when the mediaplayer is deleted. 1. Add the VideoLayerManager as a static instance to manage the info of textures allocated for the screenshot. The basic info will be added into the manager while the video is played and prepared. During the draw time, the matirx info will be updated, too. 2. When there are too many screenshots are created, then we will discard the oldest one and just show the grey static rectangle to replace the screenshot. The corresponding framework change is 112501. Change-Id: Ifea60c96532500f9c93062cc97f7c4ef978046b0
Diffstat (limited to 'Source/WebCore/platform/graphics/android/VideoLayerAndroid.cpp')
-rw-r--r--Source/WebCore/platform/graphics/android/VideoLayerAndroid.cpp37
1 files changed, 24 insertions, 13 deletions
diff --git a/Source/WebCore/platform/graphics/android/VideoLayerAndroid.cpp b/Source/WebCore/platform/graphics/android/VideoLayerAndroid.cpp
index 32e518d..aee5ae0 100644
--- a/Source/WebCore/platform/graphics/android/VideoLayerAndroid.cpp
+++ b/Source/WebCore/platform/graphics/android/VideoLayerAndroid.cpp
@@ -75,9 +75,7 @@ void VideoLayerAndroid::init()
{
// m_surfaceTexture is only useful on UI thread, no need to copy.
// And it will be set at setBaseLayer timeframe
-
m_playerState = INITIALIZED;
- m_textureId = 0;
}
// We can use this function to set the Layer to point to surface texture.
@@ -85,9 +83,8 @@ void VideoLayerAndroid::setSurfaceTexture(sp<SurfaceTexture> texture,
int textureName, PlayerState playerState)
{
m_surfaceTexture = texture;
- m_textureId = textureName;
-
m_playerState = playerState;
+ TilesManager::instance()->videoLayerManager()->registerTexture(uniqueId(), textureName);
}
GLuint VideoLayerAndroid::createSpinnerInnerTexture()
@@ -199,18 +196,32 @@ bool VideoLayerAndroid::drawGL(GLWebViewState* glWebViewState, SkMatrix& matrix)
// Show the real video.
m_surfaceTexture->updateTexImage();
m_surfaceTexture->getTransformMatrix(surfaceMatrix);
+ GLuint textureId =
+ TilesManager::instance()->videoLayerManager()->getTextureId(uniqueId());
TilesManager::instance()->shader()->drawVideoLayerQuad(drawTransform(),
surfaceMatrix,
- rect, m_textureId);
+ rect, textureId);
+ TilesManager::instance()->videoLayerManager()->updateMatrix(uniqueId(),
+ surfaceMatrix);
} else {
- // Show the poster
- TilesManager::instance()->shader()->drawLayerQuad(drawTransform(), rect,
- m_backgroundTextureId,
- 0.5, true);
-
- TilesManager::instance()->shader()->drawLayerQuad(drawTransform(), innerRect,
- m_posterTextureId,
- 1, true);
+ GLuint textureId =
+ TilesManager::instance()->videoLayerManager()->getTextureId(uniqueId());
+ GLfloat* matrix =
+ TilesManager::instance()->videoLayerManager()->getMatrix(uniqueId());
+ if (textureId && matrix) {
+ // Show the screen shot for each video.
+ TilesManager::instance()->shader()->drawVideoLayerQuad(drawTransform(),
+ matrix,
+ rect, textureId);
+ } else {
+ // Show the static poster b/c there is no screen shot available.
+ TilesManager::instance()->shader()->drawLayerQuad(drawTransform(), rect,
+ m_backgroundTextureId,
+ 0.5, true);
+ TilesManager::instance()->shader()->drawLayerQuad(drawTransform(), innerRect,
+ m_posterTextureId,
+ 1, true);
+ }
}
return drawChildrenGL(glWebViewState, matrix);