Changeset 55132 in webkit
- Timestamp:
- Feb 23, 2010, 1:47:16 AM (16 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
platform/graphics/qt/GraphicsLayerQt.cpp (modified) (9 diffs)
-
platform/graphics/qt/GraphicsLayerQt.h (modified) (1 diff)
-
platform/graphics/qt/MediaPlayerPrivateQt.cpp (modified) (3 diffs)
-
platform/graphics/qt/MediaPlayerPrivateQt.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r55130 r55132 1 2010-02-23 Noam Rosenthal <noam.rosenthal@nokia.com> 2 3 Reviewed by Ariya Hidayat. 4 5 [Qt] Connect video with accelerated compositing 6 https://bugs.webkit.org/show_bug.cgi?id=35276 7 8 MediaControlPrivate and GraphicsLayer are patched together via 9 a shared PlatformLayer (QGraphicsItem). This patch makes sure that the 10 QGraphicsVideoItem from MediaControl becomes part of the scene 11 associsated with GraphicsLayer 12 13 Test: http://double.co.nz/video_test/test1.html with AC turned on 14 15 * platform/graphics/qt/GraphicsLayerQt.cpp: 16 (WebCore::GraphicsLayerQtImpl::): mediaLayer member 17 (WebCore::GraphicsLayerQtImpl::opaqueArea): video is opaque 18 (WebCore::GraphicsLayerQtImpl::paint): don't paint video 19 (WebCore::GraphicsLayerQtImpl::flushChanges): flush mediaLayer 20 (WebCore::GraphicsLayerQt::setContentsToMedia): notify 21 * platform/graphics/qt/GraphicsLayerQt.h: reimp setContentsToMedia 22 * platform/graphics/qt/MediaPlayerPrivateQt.cpp: 23 (WebCore::MediaPlayerPrivate::MediaPlayerPrivate): m_compositing 24 (WebCore::MediaPlayerPrivate::paint): don't paint if compositing 25 (WebCore::MediaPlayerPrivate::acceleratedRenderingStateChanged): 26 reimp from MediaPlayerPrivateInterface to support AC 27 (WebCore::MediaPlayerPrivate::platformLayer): ditto 28 * platform/graphics/qt/MediaPlayerPrivateQt.h: 29 (WebCore::MediaPlayerPrivate::supportsAcceleratedRendering): ditto 30 1 31 2010-02-23 Stephan Aßmus <superstippi@gmx.de> 2 32 -
trunk/WebCore/platform/graphics/qt/GraphicsLayerQt.cpp
r55028 r55132 126 126 127 127 // the compositor lets us special-case images and colors, so we try to do so 128 enum StaticContentType { HTMLContentType, PixmapContentType, ColorContentType };128 enum StaticContentType { HTMLContentType, PixmapContentType, ColorContentType, MediaContentType}; 129 129 130 130 GraphicsLayerQtImpl(GraphicsLayerQt* newLayer); … … 180 180 QColor contentsBackgroundColor; 181 181 QColor backgroundColor; 182 QWeakPointer<QGraphicsObject> mediaLayer; 182 183 StaticContentType contentType; 183 184 float opacity; … … 354 355 if (m_state.contentsOpaque 355 356 || (m_currentContent.contentType == ColorContentType && m_currentContent.contentsBackgroundColor.alpha() == 0xff) 357 || (m_currentContent.contentType == MediaContentType) 356 358 || (m_currentContent.contentType == PixmapContentType && !m_currentContent.pixmap.hasAlpha())) { 357 359 … … 386 388 painter->fillRect(m_state.contentsRect, m_currentContent.contentsBackgroundColor); 387 389 break; 390 case MediaContentType: 391 // we don't need to paint anything: we have a QGraphicsItem from the media element 392 break; 388 393 } 389 394 } … … 434 439 435 440 for (QSet<QGraphicsItem*>::const_iterator it = childrenToRemove.begin(); it != childrenToRemove.end(); ++it) 436 if ( QGraphicsItem* w = *it)441 if (GraphicsLayerQtImpl* w = qobject_cast<GraphicsLayerQtImpl*>((*it)->toGraphicsObject())) 437 442 w->setParentItem(0); 438 443 … … 466 471 } 467 472 } 468 469 473 // FIXME: this is a hack, due to a probable QGraphicsScene bug when rapidly modifying the perspective 470 474 // but without this line we get graphic artifacts … … 484 488 setFlag(ItemHasNoContents, false); 485 489 490 break; 491 case MediaContentType: 492 setFlag(ItemHasNoContents, true); 493 m_pendingContent.mediaLayer.data()->setParentItem(this); 486 494 break; 487 495 … … 570 578 m_currentContent.pixmap = m_pendingContent.pixmap; 571 579 m_currentContent.contentType = m_pendingContent.contentType; 580 m_currentContent.mediaLayer = m_pendingContent.mediaLayer; 572 581 m_currentContent.backgroundColor = m_pendingContent.backgroundColor; 573 582 m_currentContent.regionToUpdate |= m_pendingContent.regionToUpdate; … … 845 854 GraphicsLayer::setContentsBackgroundColor(color); 846 855 } 856 857 void GraphicsLayerQt::setContentsToMedia(PlatformLayer* media) 858 { 859 m_impl->notifyChange(GraphicsLayerQtImpl::ContentChange); 860 m_impl->m_pendingContent.contentType = GraphicsLayerQtImpl::MediaContentType; 861 m_impl->m_pendingContent.mediaLayer = media->toGraphicsObject(); 862 GraphicsLayer::setContentsToMedia(media); 863 } 864 847 865 848 866 // reimp from GraphicsLayer.h -
trunk/WebCore/platform/graphics/qt/GraphicsLayerQt.h
r53618 r55132 71 71 virtual void resumeAnimations(); 72 72 virtual void setContentsToImage(Image*); 73 virtual void setContentsToMedia(PlatformLayer*); 73 74 virtual void setContentsBackgroundColor(const Color&); 74 75 virtual void setGeometryOrientation(CompositingCoordinatesOrientation orientation); -
trunk/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp
r55079 r55132 87 87 , m_isVisible(false) 88 88 , m_isSeeking(false) 89 , m_composited(false) 89 90 , m_queuedSeek(-1) 90 91 { … … 517 518 void MediaPlayerPrivate::paint(GraphicsContext* context, const IntRect& rect) 518 519 { 520 #if USE(ACCELERATED_COMPOSITING) 521 if (m_composited) 522 return; 523 #endif 519 524 if (context->paintingDisabled()) 520 525 return; … … 535 540 } 536 541 542 #if USE(ACCELERATED_COMPOSITING) 543 void MediaPlayerPrivate::acceleratedRenderingStateChanged() 544 { 545 bool composited = m_player->mediaPlayerClient()->mediaPlayerRenderingCanBeAccelerated(m_player); 546 if (composited == m_composited) 547 return; 548 549 m_composited = composited; 550 if (composited) 551 m_videoScene->removeItem(m_videoItem); 552 else 553 m_videoScene->addItem(m_videoItem); 554 } 555 556 PlatformLayer* MediaPlayerPrivate::platformLayer() const 557 { 558 return m_composited ? m_videoItem : 0; 559 } 560 #endif 561 537 562 } // namespace WebCore 538 563 -
trunk/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h
r55079 r55132 84 84 bool supportsFullscreen() const { return false; } 85 85 86 #if USE(ACCELERATED_COMPOSITING) 87 // whether accelerated rendering is supported by the media engine for the current media. 88 virtual bool supportsAcceleratedRendering() const { return true; } 89 // called when the rendering system flips the into or out of accelerated rendering mode. 90 virtual void acceleratedRenderingStateChanged(); 91 // returns an object that can be directly composited via GraphicsLayerQt (essentially a QGraphicsItem*) 92 virtual PlatformLayer* platformLayer() const; 93 #endif 94 86 95 private slots: 87 96 void mediaStatusChanged(QMediaPlayer::MediaStatus); … … 115 124 bool m_isVisible; 116 125 bool m_isSeeking; 126 bool m_composited; 117 127 qint64 m_queuedSeek; 118 128 };
Note:
See TracChangeset
for help on using the changeset viewer.