| 26 | // ---- QPixmap API ------------------------------------------------------------ |
| 27 | |
| 28 | QPixmap scalePixmap(const QPixmap &pixmap, int width, int height, ScaleMethod method) |
| 29 | { |
| 30 | if ((pixmap.width() == width && pixmap.height() == height) || pixmap.isNull()) |
| 31 | return pixmap; |
| 32 | |
| 33 | switch (method) { |
| 34 | case ScaleMethod::Nearest: |
| 35 | return pixmap.scaled(width, height, Qt::IgnoreAspectRatio, Qt::FastTransformation); |
| 36 | case ScaleMethod::Bilinear: |
| 37 | return pixmap.scaled(width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); |
| 38 | case ScaleMethod::Lanczos: |
| 39 | return QPixmap::fromImage(scaleImageLancir(pixmap.toImage(), width, height)); |
| 40 | } |
| 41 | return pixmap; |
| 42 | } |
| 43 | |
| 44 | // ---- QImage API (avoids QPixmap round-trip in ContinuousPageWidget) --------- |
| 45 |
no test coverage detected