summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/platform/graphics/chromium/VideoLayerChromium.cpp')
-rw-r--r--WebCore/platform/graphics/chromium/VideoLayerChromium.cpp28
1 files changed, 20 insertions, 8 deletions
diff --git a/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp b/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp
index 89b6ec1..7ff98b9 100644
--- a/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp
+++ b/WebCore/platform/graphics/chromium/VideoLayerChromium.cpp
@@ -48,23 +48,24 @@
namespace WebCore {
-PassRefPtr<VideoLayerChromium> VideoLayerChromium::create(GraphicsLayerChromium* owner)
+PassRefPtr<VideoLayerChromium> VideoLayerChromium::create(GraphicsLayerChromium* owner,
+ VideoFrameProvider* provider)
{
- return adoptRef(new VideoLayerChromium(owner));
+ return adoptRef(new VideoLayerChromium(owner, provider));
}
-VideoLayerChromium::VideoLayerChromium(GraphicsLayerChromium* owner)
- : LayerChromium(owner)
- , m_allocatedTextureId(0)
+VideoLayerChromium::VideoLayerChromium(GraphicsLayerChromium* owner, VideoFrameProvider* provider)
+ : ContentLayerChromium(owner)
#if PLATFORM(SKIA)
, m_canvas(0)
, m_skiaContext(0)
#endif
, m_graphicsContext(0)
+ , m_provider(provider)
{
}
-void VideoLayerChromium::updateTextureContents(unsigned textureId)
+void VideoLayerChromium::updateContents()
{
RenderLayerBacking* backing = static_cast<RenderLayerBacking*>(m_owner->client());
if (!backing || backing->paintingGoesToWindow())
@@ -109,9 +110,20 @@ void VideoLayerChromium::updateTextureContents(unsigned textureId)
// Bring the canvas into the coordinate system of the paint rect.
m_canvas->translate(static_cast<SkScalar>(-dirtyRect.x()), static_cast<SkScalar>(-dirtyRect.y()));
+ // FIXME: Remove this test when tiled layers are implemented.
+ m_skipsDraw = false;
+ if (!layerRenderer()->checkTextureSize(requiredTextureSize)) {
+ m_skipsDraw = true;
+ return;
+ }
+
+ unsigned textureId = m_contentsTexture;
+ if (!textureId)
+ textureId = layerRenderer()->createLayerTexture();
+
// If the texture id or size changed since last time, then we need to tell GL
// to re-allocate a texture.
- if (m_allocatedTextureId != textureId || requiredTextureSize != m_allocatedTextureSize)
+ if (m_contentsTexture != textureId || requiredTextureSize != m_allocatedTextureSize)
createTextureRect(requiredTextureSize, dirtyRect, textureId);
else
updateTextureRect(dirtyRect, textureId);
@@ -150,7 +162,7 @@ void VideoLayerChromium::createTextureRect(const IntSize& requiredTextureSize, c
ASSERT(bitmapSize == requiredTextureSize);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, requiredTextureSize.width(), requiredTextureSize.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
- m_allocatedTextureId = textureId;
+ m_contentsTexture = textureId;
m_allocatedTextureSize = requiredTextureSize;
updateCompleted();