[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.22-985-g3c00f00
eric at webkit.org
eric at webkit.org
Wed Mar 17 17:56:53 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 275d931abf86c7e0296e35aa07855497ec1799d7
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Tue Feb 23 09:47:16 2010 +0000
2010-02-23 Noam Rosenthal <noam.rosenthal at nokia.com>
Reviewed by Ariya Hidayat.
[Qt] Connect video with accelerated compositing
https://bugs.webkit.org/show_bug.cgi?id=35276
MediaControlPrivate and GraphicsLayer are patched together via
a shared PlatformLayer (QGraphicsItem). This patch makes sure that the
QGraphicsVideoItem from MediaControl becomes part of the scene
associsated with GraphicsLayer
Test: http://double.co.nz/video_test/test1.html with AC turned on
* platform/graphics/qt/GraphicsLayerQt.cpp:
(WebCore::GraphicsLayerQtImpl::): mediaLayer member
(WebCore::GraphicsLayerQtImpl::opaqueArea): video is opaque
(WebCore::GraphicsLayerQtImpl::paint): don't paint video
(WebCore::GraphicsLayerQtImpl::flushChanges): flush mediaLayer
(WebCore::GraphicsLayerQt::setContentsToMedia): notify
* platform/graphics/qt/GraphicsLayerQt.h: reimp setContentsToMedia
* platform/graphics/qt/MediaPlayerPrivateQt.cpp:
(WebCore::MediaPlayerPrivate::MediaPlayerPrivate): m_compositing
(WebCore::MediaPlayerPrivate::paint): don't paint if compositing
(WebCore::MediaPlayerPrivate::acceleratedRenderingStateChanged):
reimp from MediaPlayerPrivateInterface to support AC
(WebCore::MediaPlayerPrivate::platformLayer): ditto
* platform/graphics/qt/MediaPlayerPrivateQt.h:
(WebCore::MediaPlayerPrivate::supportsAcceleratedRendering): ditto
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55132 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 4fd7777..81dcd68 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,33 @@
+2010-02-23 Noam Rosenthal <noam.rosenthal at nokia.com>
+
+ Reviewed by Ariya Hidayat.
+
+ [Qt] Connect video with accelerated compositing
+ https://bugs.webkit.org/show_bug.cgi?id=35276
+
+ MediaControlPrivate and GraphicsLayer are patched together via
+ a shared PlatformLayer (QGraphicsItem). This patch makes sure that the
+ QGraphicsVideoItem from MediaControl becomes part of the scene
+ associsated with GraphicsLayer
+
+ Test: http://double.co.nz/video_test/test1.html with AC turned on
+
+ * platform/graphics/qt/GraphicsLayerQt.cpp:
+ (WebCore::GraphicsLayerQtImpl::): mediaLayer member
+ (WebCore::GraphicsLayerQtImpl::opaqueArea): video is opaque
+ (WebCore::GraphicsLayerQtImpl::paint): don't paint video
+ (WebCore::GraphicsLayerQtImpl::flushChanges): flush mediaLayer
+ (WebCore::GraphicsLayerQt::setContentsToMedia): notify
+ * platform/graphics/qt/GraphicsLayerQt.h: reimp setContentsToMedia
+ * platform/graphics/qt/MediaPlayerPrivateQt.cpp:
+ (WebCore::MediaPlayerPrivate::MediaPlayerPrivate): m_compositing
+ (WebCore::MediaPlayerPrivate::paint): don't paint if compositing
+ (WebCore::MediaPlayerPrivate::acceleratedRenderingStateChanged):
+ reimp from MediaPlayerPrivateInterface to support AC
+ (WebCore::MediaPlayerPrivate::platformLayer): ditto
+ * platform/graphics/qt/MediaPlayerPrivateQt.h:
+ (WebCore::MediaPlayerPrivate::supportsAcceleratedRendering): ditto
+
2010-02-23 Stephan Aßmus <superstippi at gmx.de>
Reviewed by Eric Seidel.
diff --git a/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp b/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp
index 0fd0f1a..3b8b4e7 100644
--- a/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp
+++ b/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp
@@ -125,7 +125,7 @@ public:
};
// the compositor lets us special-case images and colors, so we try to do so
- enum StaticContentType { HTMLContentType, PixmapContentType, ColorContentType};
+ enum StaticContentType { HTMLContentType, PixmapContentType, ColorContentType, MediaContentType};
GraphicsLayerQtImpl(GraphicsLayerQt* newLayer);
virtual ~GraphicsLayerQtImpl();
@@ -179,6 +179,7 @@ public:
bool updateAll;
QColor contentsBackgroundColor;
QColor backgroundColor;
+ QWeakPointer<QGraphicsObject> mediaLayer;
StaticContentType contentType;
float opacity;
ContentData()
@@ -353,6 +354,7 @@ QPainterPath GraphicsLayerQtImpl::opaqueArea() const
else {
if (m_state.contentsOpaque
|| (m_currentContent.contentType == ColorContentType && m_currentContent.contentsBackgroundColor.alpha() == 0xff)
+ || (m_currentContent.contentType == MediaContentType)
|| (m_currentContent.contentType == PixmapContentType && !m_currentContent.pixmap.hasAlpha())) {
painterPath.addRect(m_state.contentsRect);
@@ -385,6 +387,9 @@ void GraphicsLayerQtImpl::paint(QPainter* painter, const QStyleOptionGraphicsIte
case ColorContentType:
painter->fillRect(m_state.contentsRect, m_currentContent.contentsBackgroundColor);
break;
+ case MediaContentType:
+ // we don't need to paint anything: we have a QGraphicsItem from the media element
+ break;
}
}
@@ -433,7 +438,7 @@ void GraphicsLayerQtImpl::flushChanges(bool recursive, bool forceUpdateTransform
w->setParentItem(this);
for (QSet<QGraphicsItem*>::const_iterator it = childrenToRemove.begin(); it != childrenToRemove.end(); ++it)
- if (QGraphicsItem* w = *it)
+ if (GraphicsLayerQtImpl* w = qobject_cast<GraphicsLayerQtImpl*>((*it)->toGraphicsObject()))
w->setParentItem(0);
// children are ordered by z-value, let graphics-view know.
@@ -465,7 +470,6 @@ void GraphicsLayerQtImpl::flushChanges(bool recursive, bool forceUpdateTransform
m_size = QSizeF(m_layer->size().width(), m_layer->size().height());
}
}
-
// FIXME: this is a hack, due to a probable QGraphicsScene bug when rapidly modifying the perspective
// but without this line we get graphic artifacts
if ((m_changeMask & ChildrenTransformChange) && m_state.childrenTransform != m_layer->childrenTransform())
@@ -484,6 +488,10 @@ void GraphicsLayerQtImpl::flushChanges(bool recursive, bool forceUpdateTransform
setFlag(ItemHasNoContents, false);
break;
+ case MediaContentType:
+ setFlag(ItemHasNoContents, true);
+ m_pendingContent.mediaLayer.data()->setParentItem(this);
+ break;
case ColorContentType:
// no point in caching a solid-color rectangle
@@ -569,6 +577,7 @@ void GraphicsLayerQtImpl::flushChanges(bool recursive, bool forceUpdateTransform
m_state.childrenTransform = m_layer->childrenTransform();
m_currentContent.pixmap = m_pendingContent.pixmap;
m_currentContent.contentType = m_pendingContent.contentType;
+ m_currentContent.mediaLayer = m_pendingContent.mediaLayer;
m_currentContent.backgroundColor = m_pendingContent.backgroundColor;
m_currentContent.regionToUpdate |= m_pendingContent.regionToUpdate;
m_currentContent.contentsBackgroundColor = m_pendingContent.contentsBackgroundColor;
@@ -845,6 +854,15 @@ void GraphicsLayerQt::setContentsBackgroundColor(const Color& color)
GraphicsLayer::setContentsBackgroundColor(color);
}
+void GraphicsLayerQt::setContentsToMedia(PlatformLayer* media)
+{
+ m_impl->notifyChange(GraphicsLayerQtImpl::ContentChange);
+ m_impl->m_pendingContent.contentType = GraphicsLayerQtImpl::MediaContentType;
+ m_impl->m_pendingContent.mediaLayer = media->toGraphicsObject();
+ GraphicsLayer::setContentsToMedia(media);
+}
+
+
// reimp from GraphicsLayer.h
void GraphicsLayerQt::setGeometryOrientation(CompositingCoordinatesOrientation orientation)
{
diff --git a/WebCore/platform/graphics/qt/GraphicsLayerQt.h b/WebCore/platform/graphics/qt/GraphicsLayerQt.h
index 3a53bd9..4132d7d 100644
--- a/WebCore/platform/graphics/qt/GraphicsLayerQt.h
+++ b/WebCore/platform/graphics/qt/GraphicsLayerQt.h
@@ -70,6 +70,7 @@ public:
virtual void suspendAnimations(double time);
virtual void resumeAnimations();
virtual void setContentsToImage(Image*);
+ virtual void setContentsToMedia(PlatformLayer*);
virtual void setContentsBackgroundColor(const Color&);
virtual void setGeometryOrientation(CompositingCoordinatesOrientation orientation);
virtual void setContentsOrientation(CompositingCoordinatesOrientation orientation);
diff --git a/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp b/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp
index e178144..6a7b4a2 100644
--- a/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp
+++ b/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp
@@ -86,6 +86,7 @@ MediaPlayerPrivate::MediaPlayerPrivate(MediaPlayer* player)
, m_readyState(MediaPlayer::HaveNothing)
, m_isVisible(false)
, m_isSeeking(false)
+ , m_composited(false)
, m_queuedSeek(-1)
{
m_videoItem->setMediaObject(m_mediaPlayer);
@@ -516,6 +517,10 @@ IntSize MediaPlayerPrivate::naturalSize() const
void MediaPlayerPrivate::paint(GraphicsContext* context, const IntRect& rect)
{
+#if USE(ACCELERATED_COMPOSITING)
+ if (m_composited)
+ return;
+#endif
if (context->paintingDisabled())
return;
@@ -534,6 +539,26 @@ void MediaPlayerPrivate::repaint()
m_player->repaint();
}
+#if USE(ACCELERATED_COMPOSITING)
+void MediaPlayerPrivate::acceleratedRenderingStateChanged()
+{
+ bool composited = m_player->mediaPlayerClient()->mediaPlayerRenderingCanBeAccelerated(m_player);
+ if (composited == m_composited)
+ return;
+
+ m_composited = composited;
+ if (composited)
+ m_videoScene->removeItem(m_videoItem);
+ else
+ m_videoScene->addItem(m_videoItem);
+}
+
+PlatformLayer* MediaPlayerPrivate::platformLayer() const
+{
+ return m_composited ? m_videoItem : 0;
+}
+#endif
+
} // namespace WebCore
#include "moc_MediaPlayerPrivateQt.cpp"
diff --git a/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h b/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h
index 6234311..8f8229b 100644
--- a/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h
+++ b/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h
@@ -83,6 +83,15 @@ public:
bool supportsFullscreen() const { return false; }
+#if USE(ACCELERATED_COMPOSITING)
+ // whether accelerated rendering is supported by the media engine for the current media.
+ virtual bool supportsAcceleratedRendering() const { return true; }
+ // called when the rendering system flips the into or out of accelerated rendering mode.
+ virtual void acceleratedRenderingStateChanged();
+ // returns an object that can be directly composited via GraphicsLayerQt (essentially a QGraphicsItem*)
+ virtual PlatformLayer* platformLayer() const;
+#endif
+
private slots:
void mediaStatusChanged(QMediaPlayer::MediaStatus);
void handleError(QMediaPlayer::Error);
@@ -114,6 +123,7 @@ private:
IntSize m_currentSize;
bool m_isVisible;
bool m_isSeeking;
+ bool m_composited;
qint64 m_queuedSeek;
};
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list