]> git.sesse.net Git - mlt/commitdiff
Cleanup & fix crash
authorj-b-m <jb@kdenlive.org>
Sat, 25 Jul 2009 22:58:01 +0000 (00:58 +0200)
committerMarco Gittler <g.marco@freenet.de>
Sun, 26 Jul 2009 19:19:09 +0000 (21:19 +0200)
modified:   kdenlivetitle_wrapper.cpp
modified:   kdenlivetitle_wrapper.h

src/modules/qimage/kdenlivetitle_wrapper.cpp
src/modules/qimage/kdenlivetitle_wrapper.h

index 5d230c1376d01b4122e7756ee9ab009431b025c1..fac8fde4951f1136758daad842a63926d2cf7c4e 100644 (file)
@@ -48,9 +48,6 @@ extern "C"
 
 Title::Title( const QString& filename ):m_filename( filename ), m_scene( NULL )
 {
-       //must be extracted from kdenlive title
-       /*m_start( QPolygonF( QRectF( 100, 100, 600, 600 ) ) );
-       m_end( QPolygonF( QRectF( 0, 0, 300, 300 ) ) );*/
 }
 
 Title::~Title()
@@ -74,7 +71,7 @@ void Title::drawKdenliveTitle( uint8_t * buffer, int width, int height, double p
                if ( ! QApplication::activeWindow() )
                        //if (!app)
                        app=new QApplication( argc,argv );
-               m_scene = new QGraphicsScene();
+               m_scene = new QGraphicsScene(app);
                loadDocument( m_filename, QString( templatexml ), QString( templatetext ) );
        }
        //must be extracted from kdenlive title
@@ -85,14 +82,12 @@ void Title::drawKdenliveTitle( uint8_t * buffer, int width, int height, double p
        p1.begin( img );
        p1.setRenderHints( QPainter::Antialiasing | QPainter::TextAntialiasing | QPainter::HighQualityAntialiasing );//|QPainter::SmoothPixmapTransform );
        
-       if (m_start.polygon().isEmpty() && m_end.polygon().isEmpty()) {
+       if (m_start.isNull() && m_end.isNull()) {
            m_scene->render( &p1,QRect( 0, 0, width, height ) );
        }
        else {
-           QRectF rstart=m_start.boundingRect();
-           QRectF rend=m_end.boundingRect();
-           QPointF topleft=rstart.topLeft()+( rend.topLeft()-rstart.topLeft() )*position;
-           QPointF bottomRight=rstart.bottomRight()+( rend.bottomRight()-rstart.bottomRight() )*position;
+           QPointF topleft=m_start.topLeft()+( m_end.topLeft()-m_start.topLeft() )*position;
+           QPointF bottomRight=m_start.bottomRight()+( m_end.bottomRight()-m_start.bottomRight() )*position;
            m_scene->render( &p1,QRect( 0,0,width,height ),QRectF( topleft,bottomRight ) );
        }
        p1.end();
@@ -263,12 +258,12 @@ int Title::loadFromXml( QDomDocument doc, const QString templateText )
                        else if ( items.item( i ).nodeName() == "startviewport" )
                        {
                                QString rect = items.item( i ).attributes().namedItem( "rect" ).nodeValue();
-                               m_start.setPolygon( stringToRect( rect ) );
+                               m_start = stringToRect( rect );
                        }
                        else if ( items.item( i ).nodeName() == "endviewport" )
                        {
                                QString rect = items.item( i ).attributes().namedItem( "rect" ).nodeValue();
-                               m_end.setPolygon( stringToRect( rect ) );
+                               m_end = stringToRect( rect );
                        }
                }
        }
index 03e3d401e048136558721e643802cd5526661d06..2453526c706376bf073e4e2a3956b56ccb8ac2cb 100644 (file)
@@ -41,7 +41,7 @@ private:
        int loadDocument( const QString& url, const QString templateXml, const QString templateText );
        int  loadFromXml( QDomDocument doc, const QString templateText );
        QGraphicsScene *m_scene;
-       QGraphicsPolygonItem m_start, m_end;
+       QRectF m_start, m_end;
        QString colorToString( const QColor& );
        QString rectFToString( const QRectF& );
        QRectF stringToRect( const QString & );