| 4338 | drawGlyph(painter,glyph,cellx*width(),celly*height()); |
| 4339 | } |
| 4340 | void NetHackQtGlyphs::setSize(int w, int h) |
| 4341 | { |
| 4342 | if ( size == QSize(w,h) ) |
| 4343 | return; |
| 4344 | |
| 4345 | bool was1 = size == pm1.size(); |
| 4346 | size = QSize(w,h); |
| 4347 | if (!w || !h) |
| 4348 | return; // Still not decided |
| 4349 | |
| 4350 | if ( size == pm1.size() ) { |
| 4351 | pm = pm1; |
| 4352 | return; |
| 4353 | } |
| 4354 | if ( size == pm2.size() ) { |
| 4355 | pm = pm2; |
| 4356 | return; |
| 4357 | } |
| 4358 | |
| 4359 | if (w==tilefile_tile_W && h==tilefile_tile_H) { |
| 4360 | pm.convertFromImage(img); |
| 4361 | } else { |
| 4362 | QApplication::setOverrideCursor( Qt::waitCursor ); |
| 4363 | QImage scaled = img.smoothScale( |
| 4364 | w*img.width()/tilefile_tile_W, |
| 4365 | h*img.height()/tilefile_tile_H |
| 4366 | ); |
| 4367 | pm.convertFromImage(scaled,Qt::ThresholdDither|Qt::PreferDither); |
| 4368 | QApplication::restoreOverrideCursor(); |
| 4369 | } |
| 4370 | (was1 ? pm2 : pm1) = pm; |
| 4371 | } |
| 4372 | |
| 4373 | |
| 4374 | ////////////////////////////////////////////////////////////// |
no test coverage detected