MCPcopy Create free account
hub / github.com/NetHack/NetHack / setSize

Method setSize

win/Qt/qt_glyph.cpp:244–276  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242}
243
244void NetHackQtGlyphs::setSize(int w, int h)
245{
246 if (size == QSize(w, h))
247 return;
248 size = QSize(w, h);
249 if (!w || !h)
250 return; // Still not decided
251
252 if (size == pm1.size()) { // not zoomed
253 pm = pm1;
254 return;
255 }
256 if (size == pm2.size()) { // zoomed
257 pm = pm2;
258 return;
259 }
260
261 bool was1 = (size == pm1.size());
262 if (w == tilefile_tile_W && h == tilefile_tile_H) {
263 pm.convertFromImage(img);
264 } else {
265 QApplication::setOverrideCursor(Qt::WaitCursor);
266 QImage scaled = img.scaled(
267 w * img.width() / tilefile_tile_W,
268 h * img.height() / tilefile_tile_H,
269 Qt::IgnoreAspectRatio,
270 Qt::FastTransformation
271 );
272 pm.convertFromImage(scaled, Qt::ThresholdDither | Qt::PreferDither);
273 QApplication::restoreOverrideCursor();
274 }
275 (was1 ? pm2 : pm1) = pm;
276}
277
278} // namespace nethack_qt_

Callers 2

paintEventMethod · 0.45
resizeTilesMethod · 0.45

Calls 2

widthMethod · 0.45
heightMethod · 0.45

Tested by

no test coverage detected