summaryrefslogtreecommitdiff
path: root/core/multimedia/opieplayer/videowidget.cpp
Unidiff
Diffstat (limited to 'core/multimedia/opieplayer/videowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/multimedia/opieplayer/videowidget.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp
index d002c42..164458b 100644
--- a/core/multimedia/opieplayer/videowidget.cpp
+++ b/core/multimedia/opieplayer/videowidget.cpp
@@ -520,100 +520,102 @@ bool VideoWidget::playVideo() {
520 { 520 {
521#endif 521#endif
522 QPainter p(this); 522 QPainter p(this);
523 523
524 w = 320; 524 w = 320;
525 h = 240; 525 h = 240;
526 526
527 if ( mediaPlayerState->scaled() ) 527 if ( mediaPlayerState->scaled() )
528 { 528 {
529 // maintain aspect ratio 529 // maintain aspect ratio
530 if ( w * sh > sw * h ) 530 if ( w * sh > sw * h )
531 w = sw * h / sh; 531 w = sw * h / sh;
532 else 532 else
533 h = sh * w / sw; 533 h = sh * w / sw;
534 } 534 }
535 else 535 else
536 { 536 {
537 w = sw; 537 w = sw;
538 h = sh; 538 h = sh;
539 } 539 }
540 540
541 int bytes = ( dd == 16 ) ? 2 : 4; 541 int bytes = ( dd == 16 ) ? 2 : 4;
542 QImage tempFrame( w, h, bytes << 3 ); 542 QImage tempFrame( w, h, bytes << 3 );
543 result = mediaPlayerState->curDecoder()->videoReadScaledFrame( tempFrame.jumpTable(), 543 result = mediaPlayerState->curDecoder()->videoReadScaledFrame( tempFrame.jumpTable(),
544 0, 0, sw, sh, w, h, format, 0) == 0; 544 0, 0, sw, sh, w, h, format, 0) == 0;
545 545
546 if ( result && mediaPlayerState->fullscreen() ) 546 if ( result && mediaPlayerState->fullscreen() )
547 { 547 {
548 548
549 int rw = h, rh = w; 549 int rw = h, rh = w;
550 QImage rotatedFrame( rw, rh, bytes << 3 ); 550 QImage rotatedFrame( rw, rh, bytes << 3 );
551 551
552 ushort* in = (ushort*)tempFrame.bits(); 552 ushort* in = (ushort*)tempFrame.bits();
553 ushort* out = (ushort*)rotatedFrame.bits(); 553 ushort* out = (ushort*)rotatedFrame.bits();
554 int spl = rotatedFrame.bytesPerLine() / bytes; 554 int spl = rotatedFrame.bytesPerLine() / bytes;
555 555
556 for (int x=0; x<h; x++) 556 for (int x=0; x<h; x++)
557 { 557 {
558 if ( bytes == 2 ) 558 if ( bytes == 2 )
559 { 559 {
560 ushort* lout = out++ + (w - 1)*spl; 560 ushort* lout = out++ + (w - 1)*spl;
561 for (int y=0; y<w; y++) { 561 for (int y=0; y<w; y++) {
562 *lout=*in++; 562 *lout=*in++;
563 lout-=spl; 563 lout-=spl;
564 } 564 }
565 } 565 }
566 else 566 else
567 { 567 {
568 ulong* lout = ((ulong *)out)++ + (w - 1)*spl; 568 ulong* _out = (ulong *)out;
569 ulong* lout = _out++ + (w - 1)*spl;
569 for (int y=0; y<w; y++) 570 for (int y=0; y<w; y++)
570 { 571 {
571 *lout=*((ulong*)in)++; 572 ulong *_in = (ulong*)in;
573 *lout=*_in++;
572 lout-=spl; 574 lout-=spl;
573 } 575 }
574 } 576 }
575 } 577 }
576 578
577 p.drawImage( (240 - rw) / 2, (320 - rh) / 2, rotatedFrame, 0, 0, rw, rh ); 579 p.drawImage( (240 - rw) / 2, (320 - rh) / 2, rotatedFrame, 0, 0, rw, rh );
578 } 580 }
579#ifdef USE_DIRECT_PAINTER 581#ifdef USE_DIRECT_PAINTER
580 } 582 }
581#endif 583#endif
582 } 584 }
583 else 585 else
584 { 586 {
585 587
586 w = 220; 588 w = 220;
587 h = 160; 589 h = 160;
588 590
589 // maintain aspect ratio 591 // maintain aspect ratio
590 if ( w * sh > sw * h ) 592 if ( w * sh > sw * h )
591 w = sw * h / sh; 593 w = sw * h / sh;
592 else 594 else
593 h = sh * w / sw; 595 h = sh * w / sw;
594 596
595 result = mediaPlayerState->curDecoder()->videoReadScaledFrame( currentFrame->jumpTable(), 0, 0, sw, sh, w, h, format, 0) == 0; 597 result = mediaPlayerState->curDecoder()->videoReadScaledFrame( currentFrame->jumpTable(), 0, 0, sw, sh, w, h, format, 0) == 0;
596 598
597 QPainter p( this ); 599 QPainter p( this );
598 int deskW = qApp->desktop()->width(); 600 int deskW = qApp->desktop()->width();
599 // Image changed size, therefore need to blank the possibly unpainted regions first 601 // Image changed size, therefore need to blank the possibly unpainted regions first
600 if ( scaledWidth != w || scaledHeight != h ) 602 if ( scaledWidth != w || scaledHeight != h )
601 { 603 {
602 p.setBrush( QBrush( Qt::black ) ); 604 p.setBrush( QBrush( Qt::black ) );
603 p.drawRect( ( deskW -scaledWidth)/2, 20, scaledWidth, 160 ); 605 p.drawRect( ( deskW -scaledWidth)/2, 20, scaledWidth, 160 );
604 } 606 }
605 607
606 scaledWidth = w; 608 scaledWidth = w;
607 scaledHeight = h; 609 scaledHeight = h;
608 610
609 if ( result ) 611 if ( result )
610 { 612 {
611 p.drawImage( (deskW - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight ); 613 p.drawImage( (deskW - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight );
612 } 614 }
613 615
614 } 616 }
615 617
616 return result; 618 return result;
617} 619}
618 620
619 621