summaryrefslogtreecommitdiffstats
path: root/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebKit/chromium/src/WebMediaPlayerClientImpl.cpp')
-rw-r--r--WebKit/chromium/src/WebMediaPlayerClientImpl.cpp29
1 files changed, 21 insertions, 8 deletions
diff --git a/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp b/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
index e19308a..65f0fde 100644
--- a/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
+++ b/WebKit/chromium/src/WebMediaPlayerClientImpl.cpp
@@ -99,8 +99,10 @@ WebMediaPlayerClientImpl::~WebMediaPlayerClientImpl()
{
// VideoLayerChromium may outlive this object so make sure all frames are
// released.
+#if USE(ACCELERATED_COMPOSITING)
if (m_videoLayer.get())
m_videoLayer->releaseCurrentFrame();
+#endif
}
void WebMediaPlayerClientImpl::networkStateChanged()
@@ -113,8 +115,10 @@ void WebMediaPlayerClientImpl::readyStateChanged()
{
ASSERT(m_mediaPlayer);
m_mediaPlayer->readyStateChanged();
+#if USE(ACCELERATED_COMPOSITING)
if (hasVideo() && supportsAcceleratedRendering() && !m_videoLayer.get())
m_videoLayer = VideoLayerChromium::create(0, this);
+#endif
}
void WebMediaPlayerClientImpl::volumeChanged(float newVolume)
@@ -185,8 +189,10 @@ void WebMediaPlayerClientImpl::load(const String& url)
// Video frame object is owned by WebMediaPlayer. Before destroying
// WebMediaPlayer all frames need to be released.
+#if USE(ACCELERATED_COMPOSITING)
if (m_videoLayer.get())
m_videoLayer->releaseCurrentFrame();
+#endif
m_webMediaPlayer.set(createWebMediaPlayer(this, frame));
if (m_webMediaPlayer.get())
@@ -396,7 +402,14 @@ void WebMediaPlayerClientImpl::paint(GraphicsContext* context, const IntRect& re
// check.
if (m_webMediaPlayer.get() && !context->paintingDisabled()) {
#if WEBKIT_USING_SKIA
- m_webMediaPlayer->paint(context->platformContext()->canvas(), rect);
+ PlatformGraphicsContext* platformContext = context->platformContext();
+ WebCanvas* canvas = platformContext->canvas();
+
+ canvas->saveLayerAlpha(0, platformContext->getNormalizedAlpha());
+
+ m_webMediaPlayer->paint(canvas, rect);
+
+ canvas->restore();
#elif WEBKIT_USING_CG
m_webMediaPlayer->paint(context->platformContext(), rect);
#else
@@ -418,13 +431,6 @@ bool WebMediaPlayerClientImpl::hasSingleSecurityOrigin() const
return false;
}
-#if USE(ACCELERATED_COMPOSITING)
-bool WebMediaPlayerClientImpl::supportsAcceleratedRendering() const
-{
- return m_supportsAcceleratedCompositing;
-}
-#endif
-
MediaPlayer::MovieLoadType WebMediaPlayerClientImpl::movieLoadType() const
{
if (m_webMediaPlayer.get())
@@ -433,6 +439,12 @@ MediaPlayer::MovieLoadType WebMediaPlayerClientImpl::movieLoadType() const
return MediaPlayer::Unknown;
}
+#if USE(ACCELERATED_COMPOSITING)
+bool WebMediaPlayerClientImpl::supportsAcceleratedRendering() const
+{
+ return m_supportsAcceleratedCompositing;
+}
+
VideoFrameChromium* WebMediaPlayerClientImpl::getCurrentFrame()
{
VideoFrameChromium* videoFrame = 0;
@@ -454,6 +466,7 @@ void WebMediaPlayerClientImpl::putCurrentFrame(VideoFrameChromium* videoFrame)
delete videoFrame;
}
}
+#endif
MediaPlayerPrivateInterface* WebMediaPlayerClientImpl::create(MediaPlayer* player)
{