author | llornkcor <llornkcor> | 2002-02-25 01:35:47 (UTC) |
---|---|---|
committer | llornkcor <llornkcor> | 2002-02-25 01:35:47 (UTC) |
commit | f180c1a5e8fc889ff1fb390d5cc94cdbc5085046 (patch) (unidiff) | |
tree | 5e9ea6f1313f4c33d57fb266523c1cfbe0826756 /core/multimedia/opieplayer/videowidget.cpp | |
parent | c0446b55fc32b7fdea9f58db06e40da703f5e8ff (diff) | |
download | opie-f180c1a5e8fc889ff1fb390d5cc94cdbc5085046.zip opie-f180c1a5e8fc889ff1fb390d5cc94cdbc5085046.tar.gz opie-f180c1a5e8fc889ff1fb390d5cc94cdbc5085046.tar.bz2 |
fucked up- no workie.. back out
Diffstat (limited to 'core/multimedia/opieplayer/videowidget.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/multimedia/opieplayer/videowidget.cpp | 363 |
1 files changed, 182 insertions, 181 deletions
diff --git a/core/multimedia/opieplayer/videowidget.cpp b/core/multimedia/opieplayer/videowidget.cpp index 1f128a4..12ae4fd 100644 --- a/core/multimedia/opieplayer/videowidget.cpp +++ b/core/multimedia/opieplayer/videowidget.cpp | |||
@@ -1,6 +1,6 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
@@ -18,6 +18,7 @@ | |||
18 | ** | 18 | ** |
19 | **********************************************************************/ | 19 | **********************************************************************/ |
20 | |||
20 | #include <qpe/resource.h> | 21 | #include <qpe/resource.h> |
21 | #include "mediaplayerplugininterface.h" | 22 | #include <qpe/mediaplayerplugininterface.h> |
22 | #include <qwidget.h> | 23 | #include <qwidget.h> |
23 | #include <qpainter.h> | 24 | #include <qpainter.h> |
@@ -67,5 +68,5 @@ static const int numButtons = (sizeof(videoButtons)/sizeof(MediaButton)); | |||
67 | VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : | 68 | VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : |
68 | QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { | 69 | QWidget( parent, name, f ), scaledWidth( 0 ), scaledHeight( 0 ) { |
69 | setCaption( tr("OpiePlayer") ); | 70 | setCaption( tr("MediaPlayer") ); |
70 | setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) ); | 71 | setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) ); |
71 | pixmaps[0] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButton0a" ) ); | 72 | pixmaps[0] = new QPixmap( Resource::loadPixmap( "mpegplayer/mediaButton0a" ) ); |
@@ -81,6 +82,6 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : | |||
81 | slider->setGeometry( QRect( 7, 250, 220, 20 ) ); | 82 | slider->setGeometry( QRect( 7, 250, 220, 20 ) ); |
82 | 83 | ||
83 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); | 84 | connect( slider, SIGNAL( sliderPressed() ), this, SLOT( sliderPressed() ) ); |
84 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); | 85 | connect( slider, SIGNAL( sliderReleased() ), this, SLOT( sliderReleased() ) ); |
85 | 86 | ||
86 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); | 87 | connect( mediaPlayerState, SIGNAL( lengthChanged(long) ), this, SLOT( setLength(long) ) ); |
@@ -102,5 +103,5 @@ VideoWidget::VideoWidget(QWidget* parent, const char* name, WFlags f) : | |||
102 | VideoWidget::~VideoWidget() { | 103 | VideoWidget::~VideoWidget() { |
103 | for ( int i = 0; i < 3; i++ ) | 104 | for ( int i = 0; i < 3; i++ ) |
104 | delete pixmaps[i]; | 105 | delete pixmaps[i]; |
105 | delete currentFrame; | 106 | delete currentFrame; |
106 | } | 107 | } |
@@ -118,5 +119,5 @@ void VideoWidget::sliderReleased() { | |||
118 | videoSliderBeingMoved = FALSE; | 119 | videoSliderBeingMoved = FALSE; |
119 | if ( slider->width() == 0 ) | 120 | if ( slider->width() == 0 ) |
120 | return; | 121 | return; |
121 | long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); | 122 | long val = long((double)slider->value() * mediaPlayerState->length() / slider->width()); |
122 | mediaPlayerState->setPosition( val ); | 123 | mediaPlayerState->setPosition( val ); |
@@ -136,10 +137,10 @@ void VideoWidget::setLength( long max ) { | |||
136 | void VideoWidget::setView( char view ) { | 137 | void VideoWidget::setView( char view ) { |
137 | if ( view == 'v' ) { | 138 | if ( view == 'v' ) { |
138 | makeVisible(); | 139 | makeVisible(); |
139 | } else { | 140 | } else { |
140 | // Effectively blank the view next time we show it so it looks nicer | 141 | // Effectively blank the view next time we show it so it looks nicer |
141 | scaledWidth = 0; | 142 | scaledWidth = 0; |
142 | scaledHeight = 0; | 143 | scaledHeight = 0; |
143 | hide(); | 144 | hide(); |
144 | } | 145 | } |
145 | } | 146 | } |
@@ -149,12 +150,12 @@ void VideoWidget::updateSlider( long i, long max ) { | |||
149 | // Will flicker too much if we don't do this | 150 | // Will flicker too much if we don't do this |
150 | if ( max == 0 ) | 151 | if ( max == 0 ) |
151 | return; | 152 | return; |
152 | int width = slider->width(); | 153 | int width = slider->width(); |
153 | int val = int((double)i * width / max); | 154 | int val = int((double)i * width / max); |
154 | if ( !mediaPlayerState->fullscreen() && !videoSliderBeingMoved ) { | 155 | if ( !mediaPlayerState->fullscreen() && !videoSliderBeingMoved ) { |
155 | if ( slider->value() != val ) | 156 | if ( slider->value() != val ) |
156 | slider->setValue( val ); | 157 | slider->setValue( val ); |
157 | if ( slider->maxValue() != width ) | 158 | if ( slider->maxValue() != width ) |
158 | slider->setMaxValue( width ); | 159 | slider->setMaxValue( width ); |
159 | } | 160 | } |
160 | } | 161 | } |
@@ -163,5 +164,5 @@ void VideoWidget::updateSlider( long i, long max ) { | |||
163 | void VideoWidget::setToggleButton( int i, bool down ) { | 164 | void VideoWidget::setToggleButton( int i, bool down ) { |
164 | if ( down != videoButtons[i].isDown ) | 165 | if ( down != videoButtons[i].isDown ) |
165 | toggleButton( i ); | 166 | toggleButton( i ); |
166 | } | 167 | } |
167 | 168 | ||
@@ -185,34 +186,34 @@ void VideoWidget::paintButton( QPainter *p, int i ) { | |||
185 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { | 186 | void VideoWidget::mouseMoveEvent( QMouseEvent *event ) { |
186 | for ( int i = 0; i < numButtons; i++ ) { | 187 | for ( int i = 0; i < numButtons; i++ ) { |
187 | int x = videoButtons[i].xPos; | 188 | int x = videoButtons[i].xPos; |
188 | int y = videoButtons[i].yPos; | 189 | int y = videoButtons[i].yPos; |
189 | if ( event->state() == QMouseEvent::LeftButton ) { | 190 | if ( event->state() == QMouseEvent::LeftButton ) { |
190 | // The test to see if the mouse click is inside the circular button or not | 191 | // The test to see if the mouse click is inside the circular button or not |
191 | // (compared with the radius squared to avoid a square-root of our distance) | 192 | // (compared with the radius squared to avoid a square-root of our distance) |
192 | int radius = 16; | 193 | int radius = 16; |
193 | QPoint center = QPoint( x + radius, y + radius ); | 194 | QPoint center = QPoint( x + radius, y + radius ); |
194 | QPoint dXY = center - event->pos(); | 195 | QPoint dXY = center - event->pos(); |
195 | int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y(); | 196 | int dist = dXY.x() * dXY.x() + dXY.y() * dXY.y(); |
196 | bool isOnButton = dist <= (radius * radius); | 197 | bool isOnButton = dist <= (radius * radius); |
197 | if ( isOnButton != videoButtons[i].isHeld ) { | 198 | if ( isOnButton != videoButtons[i].isHeld ) { |
198 | videoButtons[i].isHeld = isOnButton; | 199 | videoButtons[i].isHeld = isOnButton; |
199 | toggleButton(i); | 200 | toggleButton(i); |
200 | } | 201 | } |
201 | } else { | 202 | } else { |
202 | if ( videoButtons[i].isHeld ) { | 203 | if ( videoButtons[i].isHeld ) { |
203 | videoButtons[i].isHeld = FALSE; | 204 | videoButtons[i].isHeld = FALSE; |
204 | if ( !videoButtons[i].isToggle ) | 205 | if ( !videoButtons[i].isToggle ) |
205 | setToggleButton( i, FALSE ); | 206 | setToggleButton( i, FALSE ); |
206 | switch (i) { | 207 | switch (i) { |
207 | case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return; | 208 | case VideoPlay: mediaPlayerState->setPlaying(videoButtons[i].isDown); return; |
208 | case VideoStop: mediaPlayerState->setPlaying(FALSE); return; | 209 | case VideoStop: mediaPlayerState->setPlaying(FALSE); return; |
209 | case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; | 210 | case VideoPause: mediaPlayerState->setPaused(videoButtons[i].isDown); return; |
210 | case VideoNext: mediaPlayerState->setNext(); return; | 211 | case VideoNext: mediaPlayerState->setNext(); return; |
211 | case VideoPrevious: mediaPlayerState->setPrev(); return; | 212 | case VideoPrevious: mediaPlayerState->setPrev(); return; |
212 | case VideoPlayList: mediaPlayerState->setList(); return; | 213 | case VideoPlayList: mediaPlayerState->setList(); return; |
213 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; | 214 | case VideoFullscreen: mediaPlayerState->setFullscreen( TRUE ); makeVisible(); return; |
214 | } | 215 | } |
215 | } | 216 | } |
216 | } | 217 | } |
217 | } | 218 | } |
218 | } | 219 | } |
@@ -226,8 +227,8 @@ void VideoWidget::mousePressEvent( QMouseEvent *event ) { | |||
226 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { | 227 | void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { |
227 | if ( mediaPlayerState->fullscreen() ) { | 228 | if ( mediaPlayerState->fullscreen() ) { |
228 | mediaPlayerState->setFullscreen( FALSE ); | 229 | mediaPlayerState->setFullscreen( FALSE ); |
229 | makeVisible(); | 230 | makeVisible(); |
230 | } else { | 231 | } else { |
231 | mouseMoveEvent( event ); | 232 | mouseMoveEvent( event ); |
232 | } | 233 | } |
233 | } | 234 | } |
@@ -236,13 +237,13 @@ void VideoWidget::mouseReleaseEvent( QMouseEvent *event ) { | |||
236 | void VideoWidget::makeVisible() { | 237 | void VideoWidget::makeVisible() { |
237 | if ( mediaPlayerState->fullscreen() ) { | 238 | if ( mediaPlayerState->fullscreen() ) { |
238 | setBackgroundMode( QWidget::NoBackground ); | 239 | setBackgroundMode( QWidget::NoBackground ); |
239 | showFullScreen(); | 240 | showFullScreen(); |
240 | resize( qApp->desktop()->size() ); | 241 | resize( qApp->desktop()->size() ); |
241 | slider->hide(); | 242 | slider->hide(); |
242 | } else { | 243 | } else { |
243 | setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) ); | 244 | setBackgroundPixmap( Resource::loadPixmap( "mpegplayer/metalFinish" ) ); |
244 | showNormal(); | 245 | showNormal(); |
245 | showMaximized(); | 246 | showMaximized(); |
246 | slider->show(); | 247 | slider->show(); |
247 | } | 248 | } |
248 | } | 249 | } |
@@ -253,27 +254,27 @@ void VideoWidget::paintEvent( QPaintEvent * ) { | |||
253 | 254 | ||
254 | if ( mediaPlayerState->fullscreen() ) { | 255 | if ( mediaPlayerState->fullscreen() ) { |
255 | // Clear the background | 256 | // Clear the background |
256 | p.setBrush( QBrush( Qt::black ) ); | 257 | p.setBrush( QBrush( Qt::black ) ); |
257 | p.drawRect( rect() ); | 258 | p.drawRect( rect() ); |
258 | 259 | ||
259 | // Draw the current frame | 260 | // Draw the current frame |
260 | //p.drawImage( ); // If using directpainter we won't have a copy except whats on the screen | 261 | //p.drawImage( ); // If using directpainter we won't have a copy except whats on the screen |
261 | } else { | 262 | } else { |
262 | // draw border | 263 | // draw border |
263 | qDrawShadePanel( &p, 4, 15, 230, 170, colorGroup(), TRUE, 5, NULL ); | 264 | qDrawShadePanel( &p, 4, 15, 230, 170, colorGroup(), TRUE, 5, NULL ); |
264 | 265 | ||
265 | // Clear the movie screen first | 266 | // Clear the movie screen first |
266 | p.setBrush( QBrush( Qt::black ) ); | 267 | p.setBrush( QBrush( Qt::black ) ); |
267 | p.drawRect( 9, 20, 220, 160 ); | 268 | p.drawRect( 9, 20, 220, 160 ); |
268 | 269 | ||
269 | // draw current frame (centrally positioned from scaling to maintain aspect ratio) | 270 | // draw current frame (centrally positioned from scaling to maintain aspect ratio) |
270 | p.drawImage( 9 + (220 - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight ); | 271 | p.drawImage( 9 + (220 - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight ); |
271 | 272 | ||
272 | // draw the buttons | 273 | // draw the buttons |
273 | for ( int i = 0; i < numButtons; i++ ) | 274 | for ( int i = 0; i < numButtons; i++ ) |
274 | paintButton( &p, i ); | 275 | paintButton( &p, i ); |
275 | 276 | ||
276 | // draw the slider | 277 | // draw the slider |
277 | slider->repaint( TRUE ); | 278 | slider->repaint( TRUE ); |
278 | } | 279 | } |
279 | } | 280 | } |
@@ -300,119 +301,119 @@ bool VideoWidget::playVideo() { | |||
300 | if ( mediaPlayerState->fullscreen() ) { | 301 | if ( mediaPlayerState->fullscreen() ) { |
301 | #ifdef USE_DIRECT_PAINTER | 302 | #ifdef USE_DIRECT_PAINTER |
302 | QDirectPainter p(this); | 303 | QDirectPainter p(this); |
303 | 304 | ||
304 | if ( ( qt_screen->transformOrientation() == 3 ) && | 305 | if ( ( qt_screen->transformOrientation() == 3 ) && |
305 | ( ( dd == 16 ) || ( dd == 32 ) ) && ( p.numRects() == 1 ) ) { | 306 | ( ( dd == 16 ) || ( dd == 32 ) ) && ( p.numRects() == 1 ) ) { |
306 | 307 | ||
307 | w = 320; | 308 | w = 320; |
308 | h = 240; | 309 | h = 240; |
309 | 310 | ||
310 | if ( mediaPlayerState->scaled() ) { | 311 | if ( mediaPlayerState->scaled() ) { |
311 | // maintain aspect ratio | 312 | // maintain aspect ratio |
312 | if ( w * sh > sw * h ) | 313 | if ( w * sh > sw * h ) |
313 | w = sw * h / sh; | 314 | w = sw * h / sh; |
314 | else | 315 | else |
315 | h = sh * w / sw; | 316 | h = sh * w / sw; |
316 | } else { | 317 | } else { |
317 | w = sw; | 318 | w = sw; |
318 | h = sh; | 319 | h = sh; |
319 | } | 320 | } |
320 | 321 | ||
321 | w--; // we can't allow libmpeg to overwrite. | 322 | w--; // we can't allow libmpeg to overwrite. |
322 | QPoint roff = qt_screen->mapToDevice( p.offset(), QSize( qt_screen->width(), qt_screen->height() ) ); | 323 | QPoint roff = qt_screen->mapToDevice( p.offset(), QSize( qt_screen->width(), qt_screen->height() ) ); |
323 | 324 | ||
324 | int ox = roff.x() - height() + 2 + (height() - w) / 2; | 325 | int ox = roff.x() - height() + 2 + (height() - w) / 2; |
325 | int oy = roff.y() + (width() - h) / 2; | 326 | int oy = roff.y() + (width() - h) / 2; |
326 | int sx = 0, sy = 0; | 327 | int sx = 0, sy = 0; |
327 | 328 | ||
328 | uchar* fp = p.frameBuffer() + p.lineStep() * oy; | 329 | uchar* fp = p.frameBuffer() + p.lineStep() * oy; |
329 | fp += dd * ox / 8; | 330 | fp += dd * ox / 8; |
330 | uchar **jt = new uchar*[h]; | 331 | uchar **jt = new uchar*[h]; |
331 | for ( int i = h; i; i-- ) { | 332 | for ( int i = h; i; i-- ) { |
332 | jt[h - i] = fp; | 333 | jt[h - i] = fp; |
333 | fp += p.lineStep(); | 334 | fp += p.lineStep(); |
334 | } | 335 | } |
335 | 336 | ||
336 | result = mediaPlayerState->curDecoder()->videoReadScaledFrame( jt, sx, sy, sw, sh, w, h, format, 0) == 0; | 337 | result = mediaPlayerState->curDecoder()->videoReadScaledFrame( jt, sx, sy, sw, sh, w, h, format, 0) == 0; |
337 | 338 | ||
338 | delete [] jt; | 339 | delete [] jt; |
339 | } else { | 340 | } else { |
340 | #endif | 341 | #endif |
341 | QPainter p(this); | 342 | QPainter p(this); |
342 | 343 | ||
343 | w = 320; | 344 | w = 320; |
344 | h = 240; | 345 | h = 240; |
345 | 346 | ||
346 | if ( mediaPlayerState->scaled() ) { | 347 | if ( mediaPlayerState->scaled() ) { |
347 | // maintain aspect ratio | 348 | // maintain aspect ratio |
348 | if ( w * sh > sw * h ) | 349 | if ( w * sh > sw * h ) |
349 | w = sw * h / sh; | 350 | w = sw * h / sh; |
350 | else | 351 | else |
351 | h = sh * w / sw; | 352 | h = sh * w / sw; |
352 | } else { | 353 | } else { |
353 | w = sw; | 354 | w = sw; |
354 | h = sh; | 355 | h = sh; |
355 | } | 356 | } |
356 | 357 | ||
357 | int bytes = ( dd == 16 ) ? 2 : 4; | 358 | int bytes = ( dd == 16 ) ? 2 : 4; |
358 | QImage tempFrame( w, h, bytes << 3 ); | 359 | QImage tempFrame( w, h, bytes << 3 ); |
359 | result = mediaPlayerState->curDecoder()->videoReadScaledFrame( tempFrame.jumpTable(), | 360 | result = mediaPlayerState->curDecoder()->videoReadScaledFrame( tempFrame.jumpTable(), |
360 | 0, 0, sw, sh, w, h, format, 0) == 0; | 361 | 0, 0, sw, sh, w, h, format, 0) == 0; |
361 | if ( result && mediaPlayerState->fullscreen() ) { | 362 | if ( result && mediaPlayerState->fullscreen() ) { |
362 | 363 | ||
363 | int rw = h, rh = w; | 364 | int rw = h, rh = w; |
364 | QImage rotatedFrame( rw, rh, bytes << 3 ); | 365 | QImage rotatedFrame( rw, rh, bytes << 3 ); |
365 | 366 | ||
366 | ushort* in = (ushort*)tempFrame.bits(); | 367 | ushort* in = (ushort*)tempFrame.bits(); |
367 | ushort* out = (ushort*)rotatedFrame.bits(); | 368 | ushort* out = (ushort*)rotatedFrame.bits(); |
368 | int spl = rotatedFrame.bytesPerLine() / bytes; | 369 | int spl = rotatedFrame.bytesPerLine() / bytes; |
369 | for (int x=0; x<h; x++) { | 370 | for (int x=0; x<h; x++) { |
370 | if ( bytes == 2 ) { | 371 | if ( bytes == 2 ) { |
371 | ushort* lout = out++ + (w - 1)*spl; | 372 | ushort* lout = out++ + (w - 1)*spl; |
372 | for (int y=0; y<w; y++) { | 373 | for (int y=0; y<w; y++) { |
373 | *lout=*in++; | 374 | *lout=*in++; |
374 | lout-=spl; | 375 | lout-=spl; |
375 | } | 376 | } |
376 | } else { | 377 | } else { |
377 | ulong* lout = ((ulong *)out)++ + (w - 1)*spl; | 378 | ulong* lout = ((ulong *)out)++ + (w - 1)*spl; |
378 | for (int y=0; y<w; y++) { | 379 | for (int y=0; y<w; y++) { |
379 | *lout=*((ulong*)in)++; | 380 | *lout=*((ulong*)in)++; |
380 | lout-=spl; | 381 | lout-=spl; |
381 | } | 382 | } |
382 | } | 383 | } |
383 | } | 384 | } |
384 | 385 | ||
385 | p.drawImage( (240 - rw) / 2, (320 - rh) / 2, rotatedFrame, 0, 0, rw, rh ); | 386 | p.drawImage( (240 - rw) / 2, (320 - rh) / 2, rotatedFrame, 0, 0, rw, rh ); |
386 | } | 387 | } |
387 | #ifdef USE_DIRECT_PAINTER | 388 | #ifdef USE_DIRECT_PAINTER |
388 | } | 389 | } |
389 | #endif | 390 | #endif |
390 | } else { | 391 | } else { |
391 | 392 | ||
392 | w = 220; | 393 | w = 220; |
393 | h = 160; | 394 | h = 160; |
394 | 395 | ||
395 | // maintain aspect ratio | 396 | // maintain aspect ratio |
396 | if ( w * sh > sw * h ) | 397 | if ( w * sh > sw * h ) |
397 | w = sw * h / sh; | 398 | w = sw * h / sh; |
398 | else | 399 | else |
399 | h = sh * w / sw; | 400 | h = sh * w / sw; |
400 | 401 | ||
401 | result = mediaPlayerState->curDecoder()->videoReadScaledFrame( currentFrame->jumpTable(), 0, 0, sw, sh, w, h, format, 0) == 0; | 402 | result = mediaPlayerState->curDecoder()->videoReadScaledFrame( currentFrame->jumpTable(), 0, 0, sw, sh, w, h, format, 0) == 0; |
402 | 403 | ||
403 | QPainter p( this ); | 404 | QPainter p( this ); |
404 | 405 | ||
405 | // Image changed size, therefore need to blank the possibly unpainted regions first | 406 | // Image changed size, therefore need to blank the possibly unpainted regions first |
406 | if ( scaledWidth != w || scaledHeight != h ) { | 407 | if ( scaledWidth != w || scaledHeight != h ) { |
407 | p.setBrush( QBrush( Qt::black ) ); | 408 | p.setBrush( QBrush( Qt::black ) ); |
408 | p.drawRect( 9, 20, 220, 160 ); | 409 | p.drawRect( 9, 20, 220, 160 ); |
409 | } | 410 | } |
410 | 411 | ||
411 | scaledWidth = w; | 412 | scaledWidth = w; |
412 | scaledHeight = h; | 413 | scaledHeight = h; |
413 | 414 | ||
414 | if ( result ) { | 415 | if ( result ) { |
415 | p.drawImage( 9 + (220 - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight ); | 416 | p.drawImage( 9 + (220 - scaledWidth) / 2, 20 + (160 - scaledHeight) / 2, *currentFrame, 0, 0, scaledWidth, scaledHeight ); |
416 | } | 417 | } |
417 | 418 | ||
418 | } | 419 | } |