Changeset 69772 in webkit


Ignore:
Timestamp:
Oct 14, 2010 9:52:57 AM (13 years ago)
Author:
noam.rosenthal@nokia.com
Message:

2010-10-14 No'am Rosenthal <noam.rosenthal@nokia.com>

Reviewed by Kenneth Rohde Christiansen.

[Texmap] [Qt] Texture mapper initial implementation
https://bugs.webkit.org/show_bug.cgi?id=47070

This patch enables compilation of TextureMapper with Media. It has an initial non-working implementation of a video layer, to be integrated
once other parts of TextureMapper are fully working.

No new tests: this is new implementation that's not enabled yet.

  • platform/graphics/qt/MediaPlayerPrivateQt.cpp: (WebCore::TextureMapperVideoLayerQt::TextureMapperVideoLayerQt): (WebCore::TextureMapperVideoLayerQt::setPlatformLayerClient): (WebCore::TextureMapperVideoLayerQt::paint): (WebCore::TextureMapperVideoLayerQt::size): (WebCore::MediaPlayerPrivateQt::acceleratedRenderingStateChanged): (WebCore::MediaPlayerPrivateQt::platformLayer):
  • platform/graphics/qt/MediaPlayerPrivateQt.h: (WebCore::MediaPlayerPrivateQt::supportsAcceleratedRendering): (WebCore::MediaPlayerPrivateQt::acceleratedRenderingStateChanged): (WebCore::MediaPlayerPrivateQt::platformLayer):
Location:
trunk/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r69768 r69772  
     12010-10-14  No'am Rosenthal  <noam.rosenthal@nokia.com>
     2
     3        Reviewed by Kenneth Rohde Christiansen.
     4
     5        [Texmap] [Qt] Texture mapper initial implementation
     6        https://bugs.webkit.org/show_bug.cgi?id=47070
     7
     8        This patch enables compilation of TextureMapper with Media. It has an initial non-working implementation of a video layer, to be integrated
     9        once other parts of TextureMapper are fully working.
     10
     11        No new tests: this is new implementation that's not enabled yet.
     12
     13        * platform/graphics/qt/MediaPlayerPrivateQt.cpp:
     14        (WebCore::TextureMapperVideoLayerQt::TextureMapperVideoLayerQt):
     15        (WebCore::TextureMapperVideoLayerQt::setPlatformLayerClient):
     16        (WebCore::TextureMapperVideoLayerQt::paint):
     17        (WebCore::TextureMapperVideoLayerQt::size):
     18        (WebCore::MediaPlayerPrivateQt::acceleratedRenderingStateChanged):
     19        (WebCore::MediaPlayerPrivateQt::platformLayer):
     20        * platform/graphics/qt/MediaPlayerPrivateQt.h:
     21        (WebCore::MediaPlayerPrivateQt::supportsAcceleratedRendering):
     22        (WebCore::MediaPlayerPrivateQt::acceleratedRenderingStateChanged):
     23        (WebCore::MediaPlayerPrivateQt::platformLayer):
     24
    1252010-10-14  Alejandro G. Castro  <alex@igalia.com>
    226
  • trunk/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.cpp

    r69291 r69772  
    4444#include <QPoint>
    4545#include <QRect>
     46#include <QStyleOptionGraphicsItem>
    4647#include <QTime>
    4748#include <QTimer>
     
    5051#include <wtf/HashSet.h>
    5152#include <wtf/text/CString.h>
     53
     54#if USE(ACCELERATED_COMPOSITING)
     55#include "texmap/TextureMapperPlatformLayer.h"
     56#endif
    5257
    5358using namespace WTF;
     
    603608}
    604609
    605 #if USE(ACCELERATED_COMPOSITING)
     610#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER)
     611
     612class TextureMapperVideoLayerQt : public virtual TextureMapperVideoLayer {
     613public:
     614    TextureMapperVideoLayerQt(QGraphicsVideoItem* videoItem)
     615        : m_videoItem(videoItem)
     616    {
     617    }
     618
     619    virtual void setPlatformLayerClient(TextureMapperLayerClient* client)
     620    {
     621        m_client = client;
     622    }
     623
     624    virtual void paint(GraphicsContext* context)
     625    {
     626        if (!m_videoItem)
     627            return;
     628
     629        QStyleOptionGraphicsItem opt;
     630        opt.exposedRect = m_videoItem.data()->sceneBoundingRect();
     631        opt.rect = opt.exposedRect.toRect();
     632        m_videoItem.data()->paint(context->platformContext(), &opt);
     633    }
     634
     635    virtual IntSize size() const
     636    {
     637        return m_videoItem ? IntSize(m_videoItem.data()->size().width(), m_videoItem.data()->size().height()) : IntSize();
     638    }
     639
     640    QWeakPointer<QGraphicsVideoItem> m_videoItem;
     641    TextureMapperLayerClient* m_client;
     642};
     643
     644
    606645void MediaPlayerPrivateQt::acceleratedRenderingStateChanged()
    607646{
     
    613652    m_composited = composited;
    614653    if (composited)
    615         m_videoScene->removeItem(m_videoItem);
    616     else
    617         m_videoScene->addItem(m_videoItem);
     654        m_platformLayer = new TextureMapperVideoLayerQt(m_videoItem);
    618655}
    619656
    620657PlatformLayer* MediaPlayerPrivateQt::platformLayer() const
    621658{
    622     return m_composited ? m_videoItem : 0;
     659    return m_composited ? m_platformLayer.get() : 0;
    623660}
    624661#endif
  • trunk/WebCore/platform/graphics/qt/MediaPlayerPrivateQt.h

    r68777 r69772  
    3333
    3434namespace WebCore {
     35
     36class TextureMapperVideoLayer;
    3537
    3638class MediaPlayerPrivateQt : public QObject, public MediaPlayerPrivateInterface {
     
    9294
    9395#if USE(ACCELERATED_COMPOSITING)
     96#if USE(TEXTURE_MAPPER)
    9497    // whether accelerated rendering is supported by the media engine for the current media.
    9598    virtual bool supportsAcceleratedRendering() const { return true; }
     
    98101    // returns an object that can be directly composited via GraphicsLayerQt (essentially a QGraphicsItem*)
    99102    virtual PlatformLayer* platformLayer() const;
     103#else
     104    virtual bool supportsAcceleratedRendering() const { return false; }
     105    virtual void acceleratedRenderingStateChanged() { }
     106    virtual PlatformLayer* platformLayer() const { return 0; }
     107#endif
    100108#endif
    101109
     
    126134    QGraphicsVideoItem* m_videoItem;
    127135    QGraphicsScene* m_videoScene;
     136#if USE(ACCELERATED_COMPOSITING) && USE(TEXTURE_MAPPER)
     137    OwnPtr<TextureMapperVideoLayer> m_platformLayer;
     138#endif
    128139
    129140    mutable MediaPlayer::NetworkState m_networkState;
Note: See TracChangeset for help on using the changeset viewer.