src/multimedia/qgraphicsvideoitem_maemo5.cpp
changeset 5 603d3f8b6302
parent 0 876b1a06bc25
equal deleted inserted replaced
3:e4ebb16b39ea 5:603d3f8b6302
    59 
    59 
    60 #include "qxvideosurface_maemo5_p.h"
    60 #include "qxvideosurface_maemo5_p.h"
    61 
    61 
    62 
    62 
    63 QT_BEGIN_NAMESPACE
    63 QT_BEGIN_NAMESPACE
       
    64 
       
    65 //#define DEBUG_GFX_VIDEO_ITEM
    64 
    66 
    65 //update overlay geometry slightly later,
    67 //update overlay geometry slightly later,
    66 //to ensure color key is alredy replaced with static frame
    68 //to ensure color key is alredy replaced with static frame
    67 #define GEOMETRY_UPDATE_DELAY 20
    69 #define GEOMETRY_UPDATE_DELAY 20
    68 //this is necessary to prevent flickering, see maemo bug 8798
    70 //this is necessary to prevent flickering, see maemo bug 8798
   512 }
   514 }
   513 
   515 
   514 void QGraphicsVideoItem::paint(
   516 void QGraphicsVideoItem::paint(
   515         QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
   517         QPainter *painter, const QStyleOptionGraphicsItem *option, QWidget *widget)
   516 {
   518 {
       
   519 #ifdef DEBUG_GFX_VIDEO_ITEM
   517     qDebug() << "QGraphicsVideoItem::paint";
   520     qDebug() << "QGraphicsVideoItem::paint";
       
   521 #endif
       
   522 
   518     Q_UNUSED(option);
   523     Q_UNUSED(option);
   519     Q_D(QGraphicsVideoItem);
   524     Q_D(QGraphicsVideoItem);
   520 
   525 
   521     QGraphicsView *view = 0;
   526     QGraphicsView *view = 0;
   522     if (scene() && !scene()->views().isEmpty())
   527     if (scene() && !scene()->views().isEmpty())
   549         QRect currentSurfaceRect = d->surface->displayRect();
   554         QRect currentSurfaceRect = d->surface->displayRect();
   550 
   555 
   551         if (widget) {
   556         if (widget) {
   552             //workaround for xvideo issue with U/V planes swapped
   557             //workaround for xvideo issue with U/V planes swapped
   553             QPoint topLeft = widget->mapToGlobal(overlayRect.topLeft());
   558             QPoint topLeft = widget->mapToGlobal(overlayRect.topLeft());
   554             if ((topLeft.x() & 1) == 0)
   559             if ((topLeft.x() & 1) == 0 && topLeft.x() != 0)
   555                 overlayRect.moveLeft(overlayRect.left()-1);
   560                 overlayRect.moveLeft(overlayRect.left()-1);
   556         }
   561         }
   557 
   562 
   558         d->overlayRect = overlayRect;
   563         d->overlayRect = overlayRect;
   559 
   564 
   579                 d->surface->setDisplayRect( overlayRect );
   584                 d->surface->setDisplayRect( overlayRect );
   580 
   585 
   581             geometryChanged = true;
   586             geometryChanged = true;
   582             d->softwareRenderingTimer.start(SOFTWARE_RENDERING_DURATION, this);
   587             d->softwareRenderingTimer.start(SOFTWARE_RENDERING_DURATION, this);
   583 
   588 
   584             //qDebug() << "set video display rect:" << deviceRect;
   589 #ifdef DEBUG_GFX_VIDEO_ITEM
       
   590             qDebug() << "set video display rect:" << overlayRect;
       
   591 #endif
   585 
   592 
   586         }
   593         }
   587 
   594 
   588         colorKey = d->surface->colorKey();
   595         colorKey = d->surface->colorKey();
   589     }
   596     }