VideoLayerWebKitThread.cpp [plain text]
#include "config.h"
#if USE(ACCELERATED_COMPOSITING) && ENABLE(VIDEO)
#include "VideoLayerWebKitThread.h"
#include "FrameView.h"
#include "LayerCompositingThread.h"
#include "MediaPlayer.h"
#include <BlackBerryPlatformLog.h>
#define DEBUG_VIDEO_CLIPPING 0
namespace WebCore {
VideoLayerWebKitThread::VideoLayerWebKitThread(MediaPlayer* mediaPlayer)
: LayerWebKitThread(Layer, 0)
{
setMediaPlayer(mediaPlayer);
}
VideoLayerWebKitThread::~VideoLayerWebKitThread()
{
}
void VideoLayerWebKitThread::setMediaPlayer(MediaPlayer* mediaPlayer)
{
m_mediaPlayer = mediaPlayer;
setNeedsTexture(isDrawable() && (contents() || drawsContent() || this->mediaPlayer()));
if (!m_mediaPlayer) {
layerCompositingThread()->setMediaPlayer(0);
setHolePunchRect(IntRect());
}
setNeedsCommit();
}
void VideoLayerWebKitThread::setHolePunchRect(const IntRect& rect)
{
m_holePunchRect = rect;
#if DEBUG_VIDEO_CLIPPING
BlackBerry::Platform::log(BlackBerry::Platform::LogLevelInfo, "VideoLayerWebKitThread m_holePunchRect=(x=%d,y=%d,width=%d,height=%d).", m_holePunchRect.x(), m_holePunchRect.y(), m_holePunchRect.width(), m_holePunchRect.height());
#endif
setNeedsCommit();
}
void VideoLayerWebKitThread::setNeedsDisplay()
{
setNeedsCommit();
}
void VideoLayerWebKitThread::boundsChanged()
{
if (!mediaPlayer())
return;
setHolePunchRect(IntRect(IntPoint::zero(), m_bounds));
if (FrameView* frameView = mediaPlayer()->frameView())
m_holePunchClipRect = frameView->windowClipRect();
else
m_holePunchClipRect = holePunchRect();
#if DEBUG_VIDEO_CLIPPING
BlackBerry::Platform::log(BlackBerry::Platform::LogLevelInfo, "VideoLayerWebKitThread m_holePunchClipRect=(x=%d,y=%d,width=%d,height=%d).", m_holePunchClipRect.x(), m_holePunchClipRect.y(), m_holePunchClipRect.width(), m_holePunchClipRect.height());
#endif
}
void VideoLayerWebKitThread::updateTextureContentsIfNeeded()
{
}
}
#endif // USE(ACCELERATED_COMPOSITING) && ENABLE(VIDEO)