Changeset 864
- Timestamp:
- 06/04/07 06:18:32 (2 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/jahwidgets/src/qt3/widgets/opengl_store.cpp
r771 r864 98 98 void resizeGL( int w, int h ) 99 99 { 100 prop_width_.set( w );101 prop_height_.set( h );102 100 glViewport( 0, 0, w, h ); 103 101 } … … 159 157 int orig_phy_h = media_->phy_h( ); 160 158 159 prop_width_.set( orig_phy_w ); 160 prop_height_.set( orig_phy_h ); 161 161 162 // Size the media 162 163 int phy_w, phy_h, req_w, req_h; … … 179 180 180 181 // Check for edge cases and abort if possible 181 if ( off_x + req_w < 0 || off_y + req_h < 0 || off_x > width( ) || off_y >height( ) )182 if ( off_x + req_w < 0 || off_y + req_h < 0 || off_x > owner_->width( ) || off_y > owner_->height( ) ) 182 183 return; 183 184 … … 355 356 glPushMatrix( ); 356 357 glLoadIdentity( ); 357 gluOrtho2D( 0.0f, width( ), 0.0f,height( ) );358 gluOrtho2D( 0.0f, owner_->width( ), 0.0f, owner_->height( ) ); 358 359 359 360 glMatrixMode( GL_MODELVIEW ); … … 361 362 glLoadIdentity( ); 362 363 363 glTranslatef( off_x, height( ) - off_y - req_h, 0.0f );364 glTranslatef( off_x, owner_->height( ) - off_y - req_h, 0.0f ); 364 365 365 366 glTranslatef( req_w * media_->rotate_x( ), req_h * media_->rotate_y( ), 0.0f ); … … 443 444 444 445 // Display the image at the correct aspect ratio and scaled to fill as much as possible 445 glWindowPos2f( off_x, height( ) - off_y - req_h );446 glWindowPos2f( off_x, owner_->height( ) - off_y - req_h ); 446 447 glPixelZoom( ( ( float )req_w / phy_w ), ( ( float )req_h / phy_h ) ); 447 448 glDrawPixels( phy_w, phy_h, glformat.second, type, new_im->data( ) ); … … 450 451 glPushMatrix( ); 451 452 glLoadIdentity( ); 452 gluOrtho2D( 0.0f, width( ), 0.0f,height( ) );453 gluOrtho2D( 0.0f, owner_->width( ), 0.0f, owner_->height( ) ); 453 454 454 455 glMatrixMode( GL_MODELVIEW ); … … 456 457 glLoadIdentity( ); 457 458 458 glTranslatef( off_x, height( ) - off_y - req_h, 0.0f );459 glTranslatef( off_x, owner_->height( ) - off_y - req_h, 0.0f ); 459 460 460 461 glTranslatef( req_w * media_->rotate_x( ), req_h * media_->rotate_y( ), 0.0f ); … … 486 487 487 488 // This is the absolute WxH we have 488 int abs_w = width();489 int abs_h = height();489 int abs_w = owner_->width(); 490 int abs_h = owner_->height(); 490 491 491 492 // Should get the ar from the frame or the previous value … … 568 569 void media_geometry( MediaPtr media, int req_w, int req_h ) 569 570 { 570 float off_x = ( media->x( ) * width( ) ) + ( (width( ) * media->w( ) ) - req_w ) * media->align_h( ) / 2;571 float off_y = ( media->y( ) * height( ) ) + ( (height( ) * media->h( ) ) - req_h ) * media->align_v( ) / 2;571 float off_x = ( media->x( ) * owner_->width( ) ) + ( ( owner_->width( ) * media->w( ) ) - req_w ) * media->align_h( ) / 2; 572 float off_y = ( media->y( ) * owner_->height( ) ) + ( ( owner_->height( ) * media->h( ) ) - req_h ) * media->align_v( ) / 2; 572 573 media->set_geometry( int( off_x ), int( off_y ), req_w, req_h ); 573 574 } … … 693 694 QSize opengl_store::minimumSizeHint() const 694 695 { 696 return QSize( 200, 100 ); 697 } 698 699 QSize opengl_store::sizeHint() const 700 { 695 701 return QSize( impl_->width(), impl_->height() ); 696 702 } 697 703 698 QSize opengl_store::sizeHint() const699 {700 return minimumSizeHint();701 }702 703 704 void opengl_store::initializeGL( ) 704 705 {
